aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Type.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-17 17:50:17 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-17 17:50:17 +0000
commit35366a67baa970c287c714c957cf78a4131cf60d (patch)
tree053ba730a50f0c434f8e6d6ca89d03d9cdcfc14d /lib/AST/Type.cpp
parent01bc160ffccc03e4c0583acf82bd7ab80494219a (diff)
Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r--lib/AST/Type.cpp42
1 files changed, 33 insertions, 9 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 6114dba148..2f66454aad 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -192,23 +192,23 @@ bool Type::isDerivedType() const {
}
bool Type::isClassType() const {
- if (const RecordType *RT = getAs<RecordType>())
+ if (const RecordType *RT = getAsRecordType())
return RT->getDecl()->isClass();
return false;
}
bool Type::isStructureType() const {
- if (const RecordType *RT = getAs<RecordType>())
+ if (const RecordType *RT = getAsRecordType())
return RT->getDecl()->isStruct();
return false;
}
bool Type::isVoidPointerType() const {
- if (const PointerType *PT = getAs<PointerType>())
+ if (const PointerType *PT = getAsPointerType())
return PT->getPointeeType()->isVoidType();
return false;
}
bool Type::isUnionType() const {
- if (const RecordType *RT = getAs<RecordType>())
+ if (const RecordType *RT = getAsRecordType())
return RT->getDecl()->isUnion();
return false;
}
@@ -296,11 +296,11 @@ const FunctionProtoType *Type::getAsFunctionProtoType() const {
}
QualType Type::getPointeeType() const {
- if (const PointerType *PT = getAs<PointerType>())
+ if (const PointerType *PT = getAsPointerType())
return PT->getPointeeType();
if (const ObjCObjectPointerType *OPT = getAsObjCObjectPointerType())
return OPT->getPointeeType();
- if (const BlockPointerType *BPT = getAs<BlockPointerType>())
+ if (const BlockPointerType *BPT = getAsBlockPointerType())
return BPT->getPointeeType();
return QualType();
}
@@ -321,11 +321,11 @@ bool Type::isVariablyModifiedType() const {
// Also, C++ references and member pointers can point to a variably modified
// type, where VLAs appear as an extension to C++, and should be treated
// correctly.
- if (const PointerType *PT = getAs<PointerType>())
+ if (const PointerType *PT = getAsPointerType())
return PT->getPointeeType()->isVariablyModifiedType();
- if (const ReferenceType *RT = getAs<ReferenceType>())
+ if (const ReferenceType *RT = getAsReferenceType())
return RT->getPointeeType()->isVariablyModifiedType();
- if (const MemberPointerType *PT = getAs<MemberPointerType>())
+ if (const MemberPointerType *PT = getAsMemberPointerType())
return PT->getPointeeType()->isVariablyModifiedType();
// A function can return a variably modified type
@@ -338,6 +338,30 @@ bool Type::isVariablyModifiedType() const {
return false;
}
+const PointerType *Type::getAsPointerType() const {
+ return getAs<PointerType>();
+}
+const BlockPointerType *Type::getAsBlockPointerType() const {
+ return getAs<BlockPointerType>();
+}
+const ReferenceType *Type::getAsReferenceType() const {
+ return getAs<ReferenceType>();
+}
+const LValueReferenceType *Type::getAsLValueReferenceType() const {
+ return getAs<LValueReferenceType>();
+}
+const RValueReferenceType *Type::getAsRValueReferenceType() const {
+ return getAs<RValueReferenceType>();
+}
+const MemberPointerType *Type::getAsMemberPointerType() const {
+ return getAs<MemberPointerType>();
+}
+const TagType *Type::getAsTagType() const {
+ return getAs<TagType>();
+}
+const RecordType *Type::getAsRecordType() const {
+ return getAs<RecordType>();
+}
const RecordType *Type::getAsStructureType() const {
// If this is directly a structure type, return it.
if (const RecordType *RT = dyn_cast<RecordType>(this)) {