summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-10-22 16:27:41 +0000
committerAdrian Prantl <aprantl@apple.com>2018-10-22 16:27:41 +0000
commit5f5b91049575285f8f3e9151b3dc1483d36d2bd6 (patch)
treebc1603ccd1ae4c975bd2f3259147c28d50016700 /clang/lib/CodeGen/CGExpr.cpp
parent687ec75d10bd860edb194d88d5438dcb1bc6eb92 (diff)
downloadbcm5719-llvm-5f5b91049575285f8f3e9151b3dc1483d36d2bd6.tar.gz
bcm5719-llvm-5f5b91049575285f8f3e9151b3dc1483d36d2bd6.zip
Ensure sanitizer check function calls have a !dbg location
Function calls without a !dbg location inside a function that has a DISubprogram make it impossible to construct inline information and are rejected by the verifier. This patch ensures that sanitizer check function calls have a !dbg location, by carrying forward the location of the preceding instruction or by inserting an artificial location if necessary. This fixes a crash when compiling the attached testcase with -Os. rdar://problem/45311226 Differential Revision: https://reviews.llvm.org/D53459 llvm-svn: 344915
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 55fa4551167..8a8f38678f6 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2867,6 +2867,9 @@ static void emitCheckHandlerCall(CodeGenFunction &CGF,
CheckRecoverableKind RecoverKind, bool IsFatal,
llvm::BasicBlock *ContBB) {
assert(IsFatal || RecoverKind != CheckRecoverableKind::Unrecoverable);
+ auto *DI = CGF.getDebugInfo();
+ SourceLocation Loc = DI ? DI->getLocation() : SourceLocation();
+ auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
bool NeedsAbortSuffix =
IsFatal && RecoverKind != CheckRecoverableKind::Unrecoverable;
bool MinimalRuntime = CGF.CGM.getCodeGenOpts().SanitizeMinimalRuntime;
OpenPOWER on IntegriCloud