aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2022-02-04 23:39:18 -0500
committerJames Y Knight <jyknight@google.com>2022-02-04 23:39:42 -0500
commitcaa1ebde70673ddb7124a0599ba846362a1f8b1e (patch)
tree49b0075da8b630d50bc74515eadd8f5ea5eae85a /clang/lib/CodeGen/CGCall.cpp
parentdee058c670593b999fec19c458dbbd882ad9de56 (diff)
downloadllvm-caa1ebde70673ddb7124a0599ba846362a1f8b1e.zip
llvm-caa1ebde70673ddb7124a0599ba846362a1f8b1e.tar.gz
llvm-caa1ebde70673ddb7124a0599ba846362a1f8b1e.tar.bz2
Don't assume that a new cleanup was added to InnermostEHScope.
After fa87fa97fb79, this was no longer guaranteed to be the cleanup just added by this code, if IsEHCleanup got disabled. Instead, use stable_begin(), which _is_ guaranteed to be the cleanup just added. This caused a crash when a object that is callee destroyed (e.g. with the MS ABI) was passed in a call from a noexcept function. Added a test to verify. Fixes: fa87fa97fb79
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index a37ff88..67a3f73 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4331,7 +4331,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
type);
// This unreachable is a temporary marker which will be removed later.
llvm::Instruction *IsActive = Builder.CreateUnreachable();
- args.addArgCleanupDeactivation(EHStack.getInnermostEHScope(), IsActive);
+ args.addArgCleanupDeactivation(EHStack.stable_begin(), IsActive);
}
return;
}