llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Utkarsh Saxena (usx95)

<details>
<summary>Changes</summary>

Instead of directly pushing the `Destroy`, we should use `pushFullExprCleanup` 
which handles conditional branches.
This fixes a backend crash due to 89ba7e183e6e2c64370ed1b963e54c06352211db.

Tested:
```sh
CLANG_DIR=/usr/local/google/home/usx/build

$CLANG_DIR/bin/clang++ \
  -Itools/clang/tools/extra/clangd \
  -I/usr/local/google/home/usx/src/llvm/llvm-project/clang-tools-extra/clangd \
  
-I/usr/local/google/home/usx/src/llvm/llvm-project/clang-tools-extra/clangd/../include-cleaner/include
 \
  -Itools/clang/tools/extra/clangd/../clang-tidy \
  -I/usr/local/google/home/usx/src/llvm/llvm-project/clang/include \
  -Itools/clang/include \
  -Iinclude \
  -I/usr/local/google/home/usx/src/llvm/llvm-project/llvm/include \
  
-I/usr/local/google/home/usx/src/llvm/llvm-project/clang-tools-extra/pseudo/lib/../include
 \
  -isystem$CLANG_DIR/lib/clang/19/include \
  -o  
/usr/local/google/home/usx/build/bootstrap/tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ClangdLSPServer.cpp.o
 \
  -c  
/usr/local/google/home/usx/src/llvm/llvm-project/clang-tools-extra/clangd/ClangdLSPServer.cpp
```

---
Full diff: https://github.com/llvm/llvm-project/pull/88670.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGDecl.cpp (+5-2) 


``````````diff
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 8bdafa7c569b08..3f05ebb561da57 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -2216,8 +2216,11 @@ void CodeGenFunction::pushDestroyAndDeferDeactivation(
 void CodeGenFunction::pushDestroyAndDeferDeactivation(
     CleanupKind cleanupKind, Address addr, QualType type, Destroyer *destroyer,
     bool useEHCleanupForArray) {
-  pushCleanupAndDeferDeactivation<DestroyObject>(
-      cleanupKind, addr, type, destroyer, useEHCleanupForArray);
+  llvm::Instruction *DominatingIP =
+      Builder.CreateFlagLoad(llvm::Constant::getNullValue(Int8PtrTy));
+  pushDestroy(cleanupKind, addr, type, destroyer, useEHCleanupForArray);
+  DeferredDeactivationCleanupStack.push_back(
+      {EHStack.stable_begin(), DominatingIP});
 }
 
 void CodeGenFunction::pushStackRestore(CleanupKind Kind, Address SPMem) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/88670
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to