1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Introduce DIScope.

llvm-svn: 80620
This commit is contained in:
Devang Patel 2009-08-31 20:44:45 +00:00
parent 444d9aee97
commit b31cfda0f8
2 changed files with 26 additions and 0 deletions

View File

@ -94,6 +94,7 @@ namespace llvm {
bool isVariable() const;
bool isSubprogram() const;
bool isGlobalVariable() const;
bool isScope() const;
};
/// DISubrange - This is used to represent ranges, for array bounds.
@ -118,6 +119,15 @@ namespace llvm {
}
};
/// DIScope - A base class for various scopes.
class DIScope : public DIDescriptor {
public:
explicit DIScope(MDNode *N = 0) : DIDescriptor (N) {
if (DbgNode && !isScope())
DbgNode = 0;
}
};
/// DICompileUnit - A wrapper for a compile unit.
class DICompileUnit : public DIDescriptor {
public:

View File

@ -210,6 +210,22 @@ bool DIDescriptor::isGlobalVariable() const {
return Tag == dwarf::DW_TAG_variable;
}
/// isScope - Return true if the specified tag is one of the scope
/// related tag.
bool DIDescriptor::isScope() const {
assert (!isNull() && "Invalid descriptor!");
unsigned Tag = getTag();
switch (Tag) {
case dwarf::DW_TAG_compile_unit:
case dwarf::DW_TAG_lexical_block:
case dwarf::DW_TAG_subprogram:
return true;
default:
break;
}
return false;
}
//===----------------------------------------------------------------------===//
// Simple Descriptor Constructors and other Methods