diff options
| author | Adrian Prantl <aprantl@apple.com> | 2018-10-22 16:27:41 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2018-10-22 16:27:41 +0000 |
| commit | 169c23cb3dbd212834b3c4a56a517436f2eb7cd2 (patch) | |
| tree | fd0c5330d3b9fa2b9241a2ccd9fd14c0a3dfe75c /lib/CodeGen/CGExpr.cpp | |
| parent | ef01f7fbf3d553dea10333f00818ad7e0104509c (diff) | |
| download | clang-169c23cb3dbd212834b3c4a56a517436f2eb7cd2.tar.gz | |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 55fa455116..8a8f38678f 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/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; |
