From: Devang Patel Date: Thu, 28 Oct 2010 19:50:08 +0000 (+0000) Subject: Do not work too hard to find type's file info. There is a special field to record... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bc2bb9bbd0610bc43f08be6678431148898591aa;p=oota-llvm.git Do not work too hard to find type's file info. There is a special field to record file info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117588 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index ad824dd7fe4..41d8e14aaed 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -271,8 +271,14 @@ namespace llvm { bool isValid() const { return DbgNode && (isBasicType() || isDerivedType() || isCompositeType()); } - StringRef getFilename() const { return getCompileUnit().getFilename();} - StringRef getDirectory() const { return getCompileUnit().getDirectory();} + StringRef getDirectory() const { + DIFile F = getFieldAs(3); + return F.getDirectory(); + } + StringRef getFilename() const { + DIFile F = getFieldAs(3); + return F.getFilename(); + } /// replaceAllUsesWith - Replace all uses of debug info referenced by /// this descriptor. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b9c7d7a33ed..55c2e24eb92 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -568,8 +568,8 @@ void DwarfDebug::addSourceLine(DIE *Die, DIType Ty) { unsigned Line = Ty.getLineNumber(); if (Line == 0 || !Ty.getContext().Verify()) return; - unsigned FileID = GetOrCreateSourceID(Ty.getContext().getDirectory(), - Ty.getContext().getFilename()); + unsigned FileID = GetOrCreateSourceID(Ty.getDirectory(), + Ty.getFilename()); assert(FileID && "Invalid file id"); addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID); addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);