[cfe-commits] r103448 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Devang Patel
dpatel at apple.com
Mon May 10 16:48:38 PDT 2010
Author: dpatel
Date: Mon May 10 18:48:38 2010
New Revision: 103448
URL: http://llvm.org/viewvc/llvm-project?rev=103448&view=rev
Log:
Initialize Column.
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=103448&r1=103447&r2=103448&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon May 10 18:48:38 2010
@@ -1530,15 +1530,21 @@
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 @@
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,
More information about the cfe-commits
mailing list