diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-29 21:53:49 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-29 21:53:49 +0000 |
commit | 6217b80b7a1379b74cced1c076338262c3c980b3 (patch) | |
tree | 771e3d3432ec70a00de34956f44a930a3012bc72 /lib/AST/Type.cpp | |
parent | f7a0cf426eddae76e1a71dd2295631a2cf0560af (diff) |
Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsRecordType() -> Type::getAs<RecordType>()
Type::getAsPointerType() -> Type::getAs<PointerType>()
Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsTagType() -> Type::getAs<TagType>()
And remove Type::getAsReferenceType(), etc.
This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index f937d15ffb..789bac3c7e 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -195,23 +195,23 @@ bool Type::isDerivedType() const { } bool Type::isClassType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isClass(); return false; } bool Type::isStructureType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isStruct(); return false; } bool Type::isVoidPointerType() const { - if (const PointerType *PT = getAsPointerType()) + if (const PointerType *PT = getAs<PointerType>()) return PT->getPointeeType()->isVoidType(); return false; } bool Type::isUnionType() const { - if (const RecordType *RT = getAsRecordType()) + if (const RecordType *RT = getAs<RecordType>()) return RT->getDecl()->isUnion(); return false; } @@ -299,11 +299,11 @@ const FunctionProtoType *Type::getAsFunctionProtoType() const { } QualType Type::getPointeeType() const { - if (const PointerType *PT = getAsPointerType()) + if (const PointerType *PT = getAs<PointerType>()) return PT->getPointeeType(); if (const ObjCObjectPointerType *OPT = getAsObjCObjectPointerType()) return OPT->getPointeeType(); - if (const BlockPointerType *BPT = getAsBlockPointerType()) + if (const BlockPointerType *BPT = getAs<BlockPointerType>()) return BPT->getPointeeType(); return QualType(); } @@ -324,11 +324,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 = getAsPointerType()) + if (const PointerType *PT = getAs<PointerType>()) return PT->getPointeeType()->isVariablyModifiedType(); - if (const ReferenceType *RT = getAsReferenceType()) + if (const ReferenceType *RT = getAs<ReferenceType>()) return RT->getPointeeType()->isVariablyModifiedType(); - if (const MemberPointerType *PT = getAsMemberPointerType()) + if (const MemberPointerType *PT = getAs<MemberPointerType>()) return PT->getPointeeType()->isVariablyModifiedType(); // A function can return a variably modified type @@ -341,30 +341,6 @@ 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)) { @@ -524,8 +500,8 @@ const TemplateTypeParmType *Type::getAsTemplateTypeParmType() const { } const CXXRecordDecl *Type::getCXXRecordDeclForPointerType() const { - if (const PointerType *PT = getAsPointerType()) - if (const RecordType *RT = PT->getPointeeType()->getAsRecordType()) + if (const PointerType *PT = getAs<PointerType>()) + if (const RecordType *RT = PT->getPointeeType()->getAs<RecordType>()) return dyn_cast<CXXRecordDecl>(RT->getDecl()); return 0; } |