diff options
author | Chris Lattner <sabre@nondot.org> | 2009-05-05 05:16:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-05-05 05:16:17 +0000 |
commit | 448a2285218486b87a819ffa0488e3908ca50107 (patch) | |
tree | 2dc688cfcf93751a9f9f9dd93c6eb2176cd62083 /clang/lib | |
parent | f216fd96fe34a9b18cd1b071b3ac62c1b8cf66f2 (diff) | |
download | bcm5719-llvm-448a2285218486b87a819ffa0488e3908ca50107.tar.gz bcm5719-llvm-448a2285218486b87a819ffa0488e3908ca50107.zip |
fix some more cases where we'd emit a file with a line of 0 for implicit
types. In this case, it was objc_selector and objc_class. This fixes
rdar://6852754 - clang sometimes generates incorrect/unknown file/line info for DW_TAG__structure_type dies
llvm-svn: 70969
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a720cbc7a4f..67054f66b58 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -275,9 +275,13 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, // Get overall information about the record type for the debug info. std::string Name = Decl->getNameAsString(); - llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation()); PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation()); - unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine(); + llvm::DICompileUnit DefUnit; + unsigned Line = 0; + if (!PLoc.isInvalid()) { + DefUnit = getOrCreateCompileUnit(Decl->getLocation()); + Line = 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. @@ -317,10 +321,14 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, // Get the location for the field. SourceLocation FieldDefLoc = Field->getLocation(); - llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc); PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc); - unsigned FieldLine = PLoc.isInvalid() ? 0 : PLoc.getLine(); - + llvm::DICompileUnit FieldDefUnit; + unsigned FieldLine = 0; + + if (!PLoc.isInvalid()) { + FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc); + FieldLine = PLoc.getLine(); + } QualType FType = Field->getType(); uint64_t FieldSize = 0; |