summaryrefslogtreecommitdiffstats
path: root/clang/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
commit82bbfb58e3e301c3ff105d559393df5278929b36 (patch)
treeb1fca229722cdfa9a1e78c1dcf26e9e0d48e3ebe /clang/lib/CodeGen/CGDebugInfo.cpp
parenteee1669adbf5c4dad40a4d7e14407260e4e2f05d (diff)
downloadbcm5719-llvm-82bbfb58e3e301c3ff105d559393df5278929b36.tar.gz
bcm5719-llvm-82bbfb58e3e301c3ff105d559393df5278929b36.zip
Initialize Column.
llvm-svn: 103448
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 59b6b72ad52..cb6efe881c3 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud