summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-05 04:57:08 +0000
committerChris Lattner <sabre@nondot.org>2009-05-05 04:57:08 +0000
commit362d8ae32856b169d5fc5b863c05444ba2c2f996 (patch)
tree0fd50b956bd2332e726ecb856900c44b9573c9c6 /clang
parent929b644b0f156b2dc1e1f0855726f37bb370ec3b (diff)
downloadbcm5719-llvm-362d8ae32856b169d5fc5b863c05444ba2c2f996.tar.gz
bcm5719-llvm-362d8ae32856b169d5fc5b863c05444ba2c2f996.zip
Fix generated debug info for decls with no location (which include self/_cmd
in ObjC) to not emit file/line location information. Previously we would output a file with bogus line information. This fixes: rdar://6852814 - Clang generates incorrect file & line info for automatic/understood formal parameters for objc-programs llvm-svn: 70965
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c11e8ce0ad7..97153379709 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -734,17 +734,23 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
if (CO.OptimizationLevel)
return;
+ llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
+ llvm::DIType Ty = getOrCreateType(Decl->getType(), Unit);
+
// Get location information.
SourceManager &SM = M->getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
- unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
- llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
+ unsigned Line = 0;
+ if (!PLoc.isInvalid())
+ Line = PLoc.getLine();
+ else
+ Unit = llvm::DICompileUnit();
+
// Create the descriptor for the variable.
llvm::DIVariable D =
DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsString(),
- Unit, Line,
- getOrCreateType(Decl->getType(), Unit));
+ Unit, Line, Ty);
// Insert an llvm.dbg.declare into the current block.
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
}
OpenPOWER on IntegriCloud