From 71d94f805514f28730bf39143ee227648d521d09 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 19 Jul 2012 07:03:58 +0000 Subject: DebugInfo library: add support for fetching absolute paths to source files (instead of basenames) from DWARF. Use this behavior in llvm-dwarfdump tool. Reviewed by Benjamin Kramer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160496 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DebugInfo/DIContext.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'include/llvm/DebugInfo') diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h index 6377acb634..cfdeb46889 100644 --- a/include/llvm/DebugInfo/DIContext.h +++ b/include/llvm/DebugInfo/DIContext.h @@ -15,9 +15,9 @@ #ifndef LLVM_DEBUGINFO_DICONTEXT_H #define LLVM_DEBUGINFO_DICONTEXT_H +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" -#include namespace llvm { @@ -25,28 +25,29 @@ class raw_ostream; /// DILineInfo - a format-neutral container for source line information. class DILineInfo { - const char *FileName; - const char *FunctionName; + SmallString<16> FileName; + SmallString<16> FunctionName; uint32_t Line; uint32_t Column; public: DILineInfo() : FileName(""), FunctionName(""), Line(0), Column(0) {} - DILineInfo(const char *fileName, const char *functionName, + DILineInfo(const SmallString<16> &fileName, + const SmallString<16> &functionName, uint32_t line, uint32_t column) : FileName(fileName), FunctionName(functionName), Line(line), Column(column) {} - const char *getFileName() const { return FileName; } - const char *getFunctionName() const { return FunctionName; } + const char *getFileName() { return FileName.c_str(); } + const char *getFunctionName() { return FunctionName.c_str(); } uint32_t getLine() const { return Line; } uint32_t getColumn() const { return Column; } bool operator==(const DILineInfo &RHS) const { return Line == RHS.Line && Column == RHS.Column && - std::strcmp(FileName, RHS.FileName) == 0 && - std::strcmp(FunctionName, RHS.FunctionName) == 0; + FileName.equals(RHS.FileName) && + FunctionName.equals(RHS.FunctionName); } bool operator!=(const DILineInfo &RHS) const { return !(*this == RHS); @@ -60,7 +61,8 @@ class DILineInfoSpecifier { public: enum Specification { FileLineInfo = 1 << 0, - FunctionName = 1 << 1 + AbsoluteFilePath = 1 << 1, + FunctionName = 1 << 2 }; // Use file/line info by default. DILineInfoSpecifier(uint32_t flags = FileLineInfo) : Flags(flags) {} -- cgit v1.2.3