[llvm-branch-commits] [cfe-branch] r71300 - /cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp
Mike Stump
mrs at apple.com
Fri May 8 17:01:01 PDT 2009
Author: mrs
Date: Fri May 8 19:01:01 2009
New Revision: 71300
URL: http://llvm.org/viewvc/llvm-project?rev=71300&view=rev
Log:
Merge in 70965:
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/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp?rev=71300&r1=71299&r2=71300&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp Fri May 8 19:01:01 2009
@@ -742,17 +742,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 llvm-branch-commits
mailing list