[cfe-commits] r69389 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Devang Patel
dpatel at apple.com
Fri Apr 17 14:35:16 PDT 2009
Author: dpatel
Date: Fri Apr 17 16:35:15 2009
New Revision: 69389
URL: http://llvm.org/viewvc/llvm-project?rev=69389&view=rev
Log:
Use PresumedLoc to record line number in debug info entries.
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=69389&r1=69388&r2=69389&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Apr 17 16:35:15 2009
@@ -194,7 +194,8 @@
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t Line = SM.getInstantiationLineNumber(DefLoc);
+ PresumedLoc PLoc = SM.getPresumedLoc(DefLoc);
+ unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_typedef, Unit,
TyName, DefUnit, Line, 0, 0, 0, 0, Src);
@@ -246,8 +247,8 @@
std::string Name = Decl->getNameAsString();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
- unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
-
+ PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
+ unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
// Records and classes and unions can all be recursive. To handle them, we
// first generate a debug descriptor for the struct as a forward declaration.
@@ -284,7 +285,9 @@
// Get the location for the field.
SourceLocation FieldDefLoc = Field->getLocation();
llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
- unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc);
+ PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc);
+ unsigned FieldLine = PLoc.isInvalid() ? 0 : PLoc.getLine();
+
QualType FType = Field->getType();
uint64_t FieldSize = 0;
@@ -344,8 +347,9 @@
std::string Name = Decl->getNameAsString();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
- unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
-
+ PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
+ unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
+
// To handle recursive interface, we
// first generate a debug descriptor for the struct as a forward declaration.
@@ -392,7 +396,9 @@
// Get the location for the field.
SourceLocation FieldDefLoc = Field->getLocation();
llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
- unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc);
+ PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc);
+ unsigned FieldLine = PLoc.isInvalid() ? 0 : PLoc.getLine();
+
QualType FType = Field->getType();
uint64_t FieldSize = 0;
@@ -470,7 +476,9 @@
SourceLocation DefLoc = Decl->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
- unsigned Line = SM.getInstantiationLineNumber(DefLoc);
+ PresumedLoc PLoc = SM.getPresumedLoc(DefLoc);
+ unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
+
// Size and align of the type.
uint64_t Size = M->getContext().getTypeSize(Ty);
@@ -686,7 +694,8 @@
// Get location information.
SourceManager &SM = M->getContext().getSourceManager();
- unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
+ PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
+ unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
// Create the descriptor for the variable.
@@ -727,7 +736,8 @@
// Create global variable debug descriptor.
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
SourceManager &SM = M->getContext().getSourceManager();
- unsigned LineNo = SM.getInstantiationLineNumber(Decl->getLocation());
+ PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
+ unsigned LineNo = PLoc.isInvalid() ? 0 : PLoc.getLine();
std::string Name = Decl->getNameAsString();
@@ -756,7 +766,8 @@
// Create global variable debug descriptor.
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
SourceManager &SM = M->getContext().getSourceManager();
- unsigned LineNo = SM.getInstantiationLineNumber(Decl->getLocation());
+ PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
+ unsigned LineNo = PLoc.isInvalid() ? 0 : PLoc.getLine();
std::string Name = Decl->getNameAsString();
More information about the cfe-commits
mailing list