)]}'
{
  "commit": "0d98eb6e872811bdfd0545e46bdfd4251b493e2d",
  "tree": "e395309605673c6acd57b7c67df52020a99e585c",
  "parents": [
    "dc448dad35c896eab52dba9500ad599b69c420fa"
  ],
  "author": {
    "name": "Andy Kaylor",
    "email": "akaylor@nvidia.com",
    "time": "Mon Jun 01 11:39:23 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Jun 01 11:39:23 2026 -0700"
  },
  "message": "[CIR] Fix ordering of lifetime-extended cleanups (#200874)\n\nWe had a bug that was causing any lifetime-extended cleanups that\noccurred within a full-expression cleanup scope to be emitted\nprematurely when the expression also required deferred conditional\ncleanups. This was, in some cases, causing a dangling reference to\ntemporaries that had already been destructed. Luckily, it was also\ncausing us to not emit a return at the end of the function in one case,\nleading the verifier to draw attention to this problem.\n\nThis change introduces new functions in RunCleanupsScope to allow\n\"ordinary\" EH stack cleanups to be force-emitted separately from\nlifetime-extended cleanups. Classic codegen doesn\u0027t need this capability\nbecause it handles deferred conditional cleanups very differently than\nCIR due to its flat/branching approach.\n\nThe testing for this fix did uncover a significant issue wherein CIR is\ncalling destructors in the wrong order even after the fix in this PR.\nHowever, that\u0027s a pre-existing issue that will require changes beyond\nthe scope of this fix, so I\u0027ll handle it in a follow-up.\n\nAssisted-by: Cursor / claude-opus-4.7",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c8963f7ba473218d97a761421ffb99127f8843ae",
      "old_mode": 33188,
      "old_path": "clang/lib/CIR/CodeGen/CIRGenCleanup.cpp",
      "new_id": "60b92b32db519d86b9a7bef3d45fcc349d1e147c",
      "new_mode": 33188,
      "new_path": "clang/lib/CIR/CodeGen/CIRGenCleanup.cpp"
    },
    {
      "type": "modify",
      "old_id": "667d2292799fb7ce69211ea0df1f89d56b84198b",
      "old_mode": 33188,
      "old_path": "clang/lib/CIR/CodeGen/CIRGenFunction.h",
      "new_id": "3d369dc7e7294396ecf28527e9367a911886c949",
      "new_mode": 33188,
      "new_path": "clang/lib/CIR/CodeGen/CIRGenFunction.h"
    },
    {
      "type": "modify",
      "old_id": "7028b1990b873f16447bea54b3cb97bf763239ff",
      "old_mode": 33188,
      "old_path": "clang/test/CIR/CodeGen/cleanup-conditional.cpp",
      "new_id": "2bb1e1313e43ac2966d7ab70b021db7c851a5ad5",
      "new_mode": 33188,
      "new_path": "clang/test/CIR/CodeGen/cleanup-conditional.cpp"
    },
    {
      "type": "modify",
      "old_id": "5dad07717b808f5de8818749fe2897164c341215",
      "old_mode": 33188,
      "old_path": "clang/test/CIR/CodeGen/loop-cond-cleanup.cpp",
      "new_id": "31237845baf0d487d9bf4b0490a80fa44a21b455",
      "new_mode": 33188,
      "new_path": "clang/test/CIR/CodeGen/loop-cond-cleanup.cpp"
    }
  ]
}
