diff options
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 4de21d2b397..4e77f87cc65 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -72,13 +72,19 @@ ArtificialLocation::ArtificialLocation(CodeGenFunction &CGF, CGBuilderTy &B) : DI(CGF.getDebugInfo()), Builder(B) { if (DI) { SavedLoc = DI->getLocation(); + DI->CurLoc = SourceLocation(); + Builder.SetCurrentDebugLocation(llvm::DebugLoc()); + } +} + +void ArtificialLocation::Emit() { + if (DI) { // Sync the Builder. DI->EmitLocation(Builder, SavedLoc); DI->CurLoc = SourceLocation(); // Construct a location that has a valid scope, but no line info. - llvm::DIDescriptor Scope = DI->LexicalBlockStack.empty() ? - llvm::DIDescriptor(DI->TheCU) : - llvm::DIDescriptor(DI->LexicalBlockStack.back()); + assert(!DI->LexicalBlockStack.empty()); + llvm::DIDescriptor Scope(DI->LexicalBlockStack.back()); Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope)); } } |