From 8526cc03a51347ab29737d1e5682aa6a7d095b9b Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 5 Jan 2009 22:35:52 +0000 Subject: Extract source location info from DebugInfo. Add methods to add source location info in a DIE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61761 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DebugInfo.h | 40 ++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index fae9a44..ea11b8d 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -48,10 +48,6 @@ namespace llvm { /// not, the debug info is corrupt and we ignore it. DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); - unsigned getVersion() const { - return getUnsignedField(0) & VersionMask; - } - std::string getStringField(unsigned Elt) const; unsigned getUnsignedField(unsigned Elt) const { return (unsigned)getUInt64Field(Elt); @@ -74,6 +70,10 @@ namespace llvm { GlobalVariable *getGV() const { return GV; } + unsigned getVersion() const { + return getUnsignedField(0) & VersionMask; + } + unsigned getTag() const { return getUnsignedField(0) & ~VersionMask; } @@ -147,7 +147,8 @@ namespace llvm { public: explicit DIType(GlobalVariable *GV); explicit DIType() {} - + virtual ~DIType() {} + DIDescriptor getContext() const { return getDescriptorField(1); } std::string getName() const { return getStringField(2); } DICompileUnit getCompileUnit() const{ return getFieldAs(3); } @@ -158,6 +159,16 @@ namespace llvm { // carry this is just plain insane. uint64_t getOffsetInBits() const { return getUInt64Field(7); } unsigned getFlags() const { return getUnsignedField(8); } + + virtual std::string getFilename() const { + assert (0 && "Invalid DIDescriptor"); + return ""; + } + + virtual std::string getDirectory() const { + assert (0 && "Invalid DIDescriptor"); + return ""; + } }; /// DIBasicType - A basic type, like 'int' or 'float'. @@ -166,7 +177,7 @@ namespace llvm { explicit DIBasicType(GlobalVariable *GV); unsigned getEncoding() const { return getUnsignedField(9); } - std::string getFileName() const { return getStringField(10); } + std::string getFilename() const { return getStringField(10); } std::string getDirectory() const { return getStringField(11); } }; @@ -180,7 +191,7 @@ namespace llvm { explicit DIDerivedType(GlobalVariable *GV); DIType getTypeDerivedFrom() const { return getFieldAs(9); } - std::string getFileName() const { return getStringField(10); } + std::string getFilename() const { return getStringField(10); } std::string getDirectory() const { return getStringField(11); } /// isDerivedType - Return true if the specified tag is legal for @@ -202,7 +213,7 @@ namespace llvm { explicit DICompositeType(GlobalVariable *GV); DIArray getTypeArray() const { return getFieldAs(10); } - std::string getFileName() const { return getStringField(11); } + std::string getFilename() const { return getStringField(11); } std::string getDirectory() const { return getStringField(12); } /// isCompositeType - Return true if the specified tag is legal for @@ -220,7 +231,8 @@ namespace llvm { explicit DIGlobal(GlobalVariable *GV, unsigned RequiredTag) : DIDescriptor(GV, RequiredTag) {} public: - + virtual ~DIGlobal() {} + DIDescriptor getContext() const { return getDescriptorField(2); } std::string getName() const { return getStringField(3); } std::string getDisplayName() const { return getStringField(4); } @@ -234,6 +246,16 @@ namespace llvm { /// compile unit, like 'static' in C. unsigned isLocalToUnit() const { return getUnsignedField(9); } unsigned isDefinition() const { return getUnsignedField(10); } + + virtual std::string getFilename() const { + assert (0 && "Invalid DIDescriptor"); + return ""; + } + + virtual std::string getDirectory() const { + assert (0 && "Invalid DIDescriptor"); + return ""; + } }; -- cgit v1.1