aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorusama hameed <u_hameed@apple.com>2023-01-20 11:24:05 -0800
committerusama hameed <u_hameed@apple.com>2023-01-24 15:31:07 -0800
commit5b6dbdecba0b033e6a64593062cf87cd6c8a66ee (patch)
tree4fc91abfff9831221d181919c71ac80a50a8bbd0 /clang/lib/CodeGen/CodeGenFunction.cpp
parent2a539ee17d8a6f0e4b99e1f8e8df593500b9154b (diff)
downloadllvm-5b6dbdecba0b033e6a64593062cf87cd6c8a66ee.zip
llvm-5b6dbdecba0b033e6a64593062cf87cd6c8a66ee.tar.gz
llvm-5b6dbdecba0b033e6a64593062cf87cd6c8a66ee.tar.bz2
[CodeGen] bugfix: ApplyDebugLocation goes out of scope before intended
rdar://103570533 Differential Revision: https://reviews.llvm.org/D142243
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 55464e1..8cbe2a5 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -361,17 +361,18 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
bool HasOnlyLifetimeMarkers =
HasCleanups && EHStack.containsOnlyLifetimeMarkers(PrologueCleanupDepth);
bool EmitRetDbgLoc = !HasCleanups || HasOnlyLifetimeMarkers;
+
+ std::optional<ApplyDebugLocation> OAL;
if (HasCleanups) {
// Make sure the line table doesn't jump back into the body for
// the ret after it's been at EndLoc.
- std::optional<ApplyDebugLocation> AL;
if (CGDebugInfo *DI = getDebugInfo()) {
if (OnlySimpleReturnStmts)
DI->EmitLocation(Builder, EndLoc);
else
// We may not have a valid end location. Try to apply it anyway, and
// fall back to an artificial location if needed.
- AL = ApplyDebugLocation::CreateDefaultArtificial(*this, EndLoc);
+ OAL = ApplyDebugLocation::CreateDefaultArtificial(*this, EndLoc);
}
PopCleanupBlocks(PrologueCleanupDepth);