[cfe-commits] r70965 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Chris Lattner
sabre at nondot.org
Mon May 4 21:57:08 PDT 2009
Author: lattner
Date: Mon May 4 23:57:08 2009
New Revision: 70965
URL: http://llvm.org/viewvc/llvm-project?rev=70965&view=rev
Log:
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
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=70965&r1=70964&r2=70965&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon May 4 23:57:08 2009
@@ -734,17 +734,23 @@
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());
}
More information about the cfe-commits
mailing list