aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-05 22:35:52 +0000
committerDevang Patel <dpatel@apple.com>2009-01-05 22:35:52 +0000
commit8526cc03a51347ab29737d1e5682aa6a7d095b9b (patch)
treebc51cb83da33265249dc68eca41af01e9aae177d /include
parent48d190f4d79a578749839b6132a84728c3a060c5 (diff)
downloadexternal_llvm-8526cc03a51347ab29737d1e5682aa6a7d095b9b.zip
external_llvm-8526cc03a51347ab29737d1e5682aa6a7d095b9b.tar.gz
external_llvm-8526cc03a51347ab29737d1e5682aa6a7d095b9b.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DebugInfo.h40
1 files changed, 31 insertions, 9 deletions
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<DICompileUnit>(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<DIType>(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<DIArray>(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 "";
+ }
};