aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-02-10 01:09:50 +0000
committerDevang Patel <dpatel@apple.com>2010-02-10 01:09:50 +0000
commitd263e7bb725c7d7600948c4ea8f38715998e598e (patch)
treed3bf069e20ea99ed10acfe9543e4feaca2736eae /lib/CodeGen/CGDebugInfo.cpp
parent6de8b62ae42818c0bd8878b0d1900e17c7c43e0e (diff)
Use current location as the location of compiler generated arguments, e.g. self, _cmd etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95743 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 6f84add037..7138bc0519 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -91,16 +91,15 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
// Get source file information.
const char *FileName = "<unknown>";
SourceManager &SM = CGM.getContext().getSourceManager();
- unsigned FID = 0;
if (Loc.isValid()) {
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
FileName = PLoc.getFilename();
- FID = PLoc.getIncludeLoc().getRawEncoding();
- }
+ unsigned FID = PLoc.getIncludeLoc().getRawEncoding();
- // See if this compile unit has been used before.
- llvm::DICompileUnit &Unit = CompileUnitCache[FID];
- if (!Unit.isNull()) return Unit;
+ // See if this compile unit has been used before for this valid location.
+ llvm::DICompileUnit &Unit = CompileUnitCache[FID];
+ if (!Unit.isNull()) return Unit;
+ }
// Get absolute path name.
llvm::sys::Path AbsFileName(FileName);
@@ -150,7 +149,7 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
RuntimeVers = LO.ObjCNonFragileABI ? 2 : 1;
// Create new compile unit.
- return Unit = DebugFactory.CreateCompileUnit(
+ return DebugFactory.CreateCompileUnit(
LangTag, AbsFileName.getLast(), AbsFileName.getDirname(), Producer, isMain,
LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
}
@@ -1515,9 +1514,12 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
PresumedLoc PLoc = SM.getPresumedLoc(VD->getLocation());
unsigned Line = 0;
unsigned Column = 0;
- if (!PLoc.isInvalid()) {
+ if (PLoc.isInvalid())
+ PLoc = SM.getPresumedLoc(CurLoc);
+ if (PLoc.isValid()) {
Line = PLoc.getLine();
Column = PLoc.getColumn();
+ Unit = getOrCreateCompileUnit(CurLoc);
} else {
Unit = llvm::DICompileUnit();
}