Simplify isDerivedType() and other predicate interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80602 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-08-31 18:49:10 +00:00
parent 049e98d641
commit 6ceea33c5e
4 changed files with 75 additions and 58 deletions

View File

@@ -87,6 +87,13 @@ namespace llvm {
/// dump - print descriptor.
void dump() const;
bool isDerivedType() const;
bool isCompositeType() const;
bool isBasicType() const;
bool isVariable() const;
bool isSubprogram() const;
bool isGlobalVariable() const;
};
/// DISubrange - This is used to represent ranges, for array bounds.
@@ -185,19 +192,6 @@ namespace llvm {
DIType(MDNode *N, bool, bool) : DIDescriptor(N) {}
public:
/// isDerivedType - Return true if the specified tag is legal for
/// DIDerivedType.
static bool isDerivedType(unsigned TAG);
/// isCompositeType - Return true if the specified tag is legal for
/// DICompositeType.
static bool isCompositeType(unsigned TAG);
/// isBasicType - Return true if the specified tag is legal for
/// DIBasicType.
static bool isBasicType(unsigned TAG) {
return TAG == dwarf::DW_TAG_base_type;
}
/// Verify - Verify that a type descriptor is well formed.
bool Verify() const;
@@ -257,7 +251,7 @@ namespace llvm {
public:
explicit DIDerivedType(MDNode *N = 0)
: DIType(N, true, true) {
if (DbgNode && !isDerivedType(getTag()))
if (DbgNode && !isDerivedType())
DbgNode = 0;
}
@@ -282,7 +276,7 @@ namespace llvm {
public:
explicit DICompositeType(MDNode *N = 0)
: DIDerivedType(N, true, true) {
if (N && !isCompositeType(getTag()))
if (N && !isCompositeType())
DbgNode = 0;
}
@@ -302,18 +296,6 @@ namespace llvm {
explicit DIGlobal(MDNode *N, unsigned RequiredTag)
: DIDescriptor(N, RequiredTag) {}
/// isSubprogram - Return true if the specified tag is legal for
/// DISubprogram.
static bool isSubprogram(unsigned TAG) {
return TAG == dwarf::DW_TAG_subprogram;
}
/// isGlobalVariable - Return true if the specified tag is legal for
/// DIGlobalVariable.
static bool isGlobalVariable(unsigned TAG) {
return TAG == dwarf::DW_TAG_variable;
}
public:
virtual ~DIGlobal() {}
@@ -393,7 +375,7 @@ namespace llvm {
public:
explicit DIVariable(MDNode *N = 0)
: DIDescriptor(N) {
if (DbgNode && !isVariable(getTag()))
if (DbgNode && !isVariable())
DbgNode = 0;
}
@@ -405,8 +387,6 @@ namespace llvm {
unsigned getLineNumber() const { return getUnsignedField(4); }
DIType getType() const { return getFieldAs<DIType>(5); }
/// isVariable - Return true if the specified tag is legal for DIVariable.
static bool isVariable(unsigned Tag);
/// Verify - Verify that a variable descriptor is well formed.
bool Verify() const;