aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r--lib/Analysis/DebugInfo.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index db5a0cbb21..6df1610517 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -189,6 +189,11 @@ bool DIDescriptor::isVariable() const {
}
}
+/// isType - Return true if the specified tag is legal for DIType.
+bool DIDescriptor::isType() const {
+ return isBasicType() || isCompositeType() || isDerivedType();
+}
+
/// isSubprogram - Return true if the specified tag is legal for
/// DISubprogram.
bool DIDescriptor::isSubprogram() const {
@@ -207,6 +212,11 @@ bool DIDescriptor::isGlobalVariable() const {
return Tag == dwarf::DW_TAG_variable;
}
+/// isGlobal - Return true if the specified tag is legal for DIGlobal.
+bool DIDescriptor::isGlobal() const {
+ return isGlobalVariable();
+}
+
/// isScope - Return true if the specified tag is one of the scope
/// related tag.
bool DIDescriptor::isScope() const {
@@ -240,6 +250,22 @@ bool DIDescriptor::isLexicalBlock() const {
return Tag == dwarf::DW_TAG_lexical_block;
}
+/// isSubrange - Return true if the specified tag is DW_TAG_subrange_type.
+bool DIDescriptor::isSubrange() const {
+ assert (!isNull() && "Invalid descriptor!");
+ unsigned Tag = getTag();
+
+ return Tag == dwarf::DW_TAG_subrange_type;
+}
+
+/// isEnumerator - Return true if the specified tag is DW_TAG_enumerator.
+bool DIDescriptor::isEnumerator() const {
+ assert (!isNull() && "Invalid descriptor!");
+ unsigned Tag = getTag();
+
+ return Tag == dwarf::DW_TAG_enumerator;
+}
+
//===----------------------------------------------------------------------===//
// Simple Descriptor Constructors and other Methods
//===----------------------------------------------------------------------===//
@@ -392,6 +418,30 @@ bool DISubprogram::describes(const Function *F) {
return false;
}
+const char *DIScope::getFilename() const {
+ if (isLexicalBlock())
+ return DILexicalBlock(DbgNode).getFilename();
+ else if (isSubprogram())
+ return DISubprogram(DbgNode).getFilename();
+ else if (isCompileUnit())
+ return DICompileUnit(DbgNode).getFilename();
+ else
+ assert (0 && "Invalid DIScope!");
+ return NULL;
+}
+
+const char *DIScope::getDirectory() const {
+ if (isLexicalBlock())
+ return DILexicalBlock(DbgNode).getDirectory();
+ else if (isSubprogram())
+ return DISubprogram(DbgNode).getDirectory();
+ else if (isCompileUnit())
+ return DICompileUnit(DbgNode).getDirectory();
+ else
+ assert (0 && "Invalid DIScope!");
+ return NULL;
+}
+
//===----------------------------------------------------------------------===//
// DIDescriptor: dump routines for all descriptors.
//===----------------------------------------------------------------------===//