)]}'
{
  "commit": "7cdfa800a29a7d02615688c5cdca11ec57e8eca2",
  "tree": "fb296f3377d9fa54e8396e2aeef539ace244141c",
  "parents": [
    "221b62cc240ea5f4369b4caca6c4e6442cda4368"
  ],
  "author": {
    "name": "jkorous-apple",
    "email": "32549412+jkorous-apple@users.noreply.github.com",
    "time": "Wed Feb 14 18:16:44 2024 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Wed Feb 14 18:23:04 2024 -0800"
  },
  "message": "[-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (#80504)\n\n[-Wunsafe-buffer-usage] Ignore safe array subscripts\nDon\u0027t emit warnings for array subscripts on constant size arrays where the index is constant and within bounds.\n\nExample:\nint arr[10];\narr[5] \u003d 0; //safe, no warning\n\nThis patch recognizes only array indices that are integer literals - it doesn\u0027t understand more complex expressions (arithmetic on constants, etc.).\n\n-Warray-bounds implemented in Sema::CheckArrayAccess() already solves a similar\n(opposite) problem, handles complex expressions and is battle-tested.\n\nAdding -Wunsafe-buffer-usage diagnostics to Sema is a non-starter as we need to emit\nboth the warnings and fixits and the performance impact of the fixit machine is\nunacceptable for Sema.\n\nCheckArrayAccess() as is doesn\u0027t distinguish between \"safe\" and \"unknown\" array\naccesses. It also mixes the analysis that decides if an index is out of bounds\nwith crafting the diagnostics.\n\nA refactor of CheckArrayAccess() might serve both the original purpose\nand help us avoid false-positive with -Wunsafe-buffer-usage on constant\nsize arrrays.\n\nGitOrigin-RevId: 9a1e6373ab3edc38486af504154db2d804e72d3d\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ca346444e047e5309156d31022aa25db8f21cfa9",
      "old_mode": 33188,
      "old_path": "lib/Analysis/UnsafeBufferUsage.cpp",
      "new_id": "a74c113e29f1cfd1fd53d3cadc783cd5201dc4c3",
      "new_mode": 33188,
      "new_path": "lib/Analysis/UnsafeBufferUsage.cpp"
    },
    {
      "type": "modify",
      "old_id": "90c11b1be95c25bea7b34da5c065d9e2ddafd093",
      "old_mode": 33188,
      "old_path": "test/SemaCXX/warn-unsafe-buffer-usage-array.cpp",
      "new_id": "8b2f103ec6670832059de3c7a1aa3077bd93c206",
      "new_mode": 33188,
      "new_path": "test/SemaCXX/warn-unsafe-buffer-usage-array.cpp"
    },
    {
      "type": "modify",
      "old_id": "f94072015ff87d400a433a6869526706a0724aa8",
      "old_mode": 33188,
      "old_path": "test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-access.cpp",
      "new_id": "b3c64f1b0d085e47862bbfd604d0103b0e3fa2e2",
      "new_mode": 33188,
      "new_path": "test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-access.cpp"
    },
    {
      "type": "modify",
      "old_id": "0459d6549fd86f550da73c923d1862c2c1f5305a",
      "old_mode": 33188,
      "old_path": "test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-arg-to-func-ptr-call.cpp",
      "new_id": "216813ce45bfd501b0f630fa795a0412b0397de0",
      "new_mode": 33188,
      "new_path": "test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-arg-to-func-ptr-call.cpp"
    },
    {
      "type": "modify",
      "old_id": "67cdf252d6a8b67797b239e0d29ff5a57708db01",
      "old_mode": 33188,
      "old_path": "test/SemaCXX/warn-unsafe-buffer-usage.cpp",
      "new_id": "642db0e9d3c632f2257ac3b184b5193240206546",
      "new_mode": 33188,
      "new_path": "test/SemaCXX/warn-unsafe-buffer-usage.cpp"
    }
  ]
}
