aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-05-10 23:48:38 +0000
committerDevang Patel <dpatel@apple.com>2010-05-10 23:48:38 +0000
commitf8e10a5d408b59946ce66edbaba251f0c6f16d60 (patch)
treec6146ba33dfe464ec517a2950a5305c767a1f4a2 /lib/CodeGen/CGDebugInfo.cpp
parent2f6c5506958dc3b84bef0671be6a2d979ab4c284 (diff)
Initialize Column.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 59b6b72ad5..cb6efe881c 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1530,15 +1530,21 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
Ty = getOrCreateType(VD->getType(), Unit);
// Get location information.
+ unsigned Line = 0;
+ unsigned Column = 0;
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(VD->getLocation());
- unsigned Line = 0;
- if (!PLoc.isInvalid())
+ if (PLoc.isInvalid())
+ // If variable location is invalid then try current location.
+ PLoc = SM.getPresumedLoc(CurLoc);
+ if (!PLoc.isInvalid()) {
Line = PLoc.getLine();
- else
- // If variable location is invalid, use current location to find
- // corresponding file info.
+ Column = PLoc.getColumn();
+ }
+ else {
+ // If current location is also invalid, then use main compile unit.
Unit = getOrCreateFile(CurLoc);
+ }
CharUnits offset = CGF->BlockDecls[VD];
llvm::SmallVector<llvm::Value *, 9> addr;
@@ -1570,7 +1576,7 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
llvm::MDNode *Scope = RegionStack.back();
- Call->setDebugLoc(llvm::DebugLoc::get(Line, PLoc.getColumn(), Scope));
+ Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,