diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-17 01:01:15 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-17 01:01:15 +0000 |
commit | 808825cd08704d1cccef605f8cd3ef83c93eac78 (patch) | |
tree | 55bc5893cb2fb81c2741fdc64686318dae9f1b02 /lib/AST | |
parent | 21375a3cd51586ebbb311499f3533210bfab2fd4 (diff) |
Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/ASTContext.cpp | 8 | ||||
-rw-r--r-- | lib/AST/Type.cpp | 20 |
2 files changed, 5 insertions, 23 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index f30927c4ec..dcb18cb91d 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -447,7 +447,7 @@ unsigned ASTContext::getDeclAlignInBytes(const Decl *D) { if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) { QualType T = VD->getType(); - if (const ReferenceType* RT = T->getAsReferenceType()) { + if (const ReferenceType* RT = T->getAs<ReferenceType>()) { unsigned AS = RT->getPointeeType().getAddressSpace(); Align = Target.getPointerAlign(AS); } else if (!T->isIncompleteType() && !T->isFunctionType()) { @@ -779,7 +779,7 @@ void ASTRecordLayout::LayoutField(const FieldDecl *FD, unsigned FieldNo, FieldSize = 0; const ArrayType* ATy = Context.getAsArrayType(FD->getType()); FieldAlign = Context.getTypeAlign(ATy->getElementType()); - } else if (const ReferenceType *RT = FD->getType()->getAsReferenceType()) { + } else if (const ReferenceType *RT = FD->getType()->getAs<ReferenceType>()) { unsigned AS = RT->getPointeeType().getAddressSpace(); FieldSize = Context.Target.getPointerWidth(AS); FieldAlign = Context.Target.getPointerAlign(AS); @@ -3382,9 +3382,9 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { // enough that they should be handled separately. // FIXME: Merging of lvalue and rvalue references is incorrect. C++ *really* // shouldn't be going through here! - if (const ReferenceType *RT = LHS->getAsReferenceType()) + if (const ReferenceType *RT = LHS->getAs<ReferenceType>()) LHS = RT->getPointeeType(); - if (const ReferenceType *RT = RHS->getAsReferenceType()) + if (const ReferenceType *RT = RHS->getAs<ReferenceType>()) RHS = RT->getPointeeType(); QualType LHSCan = getCanonicalType(LHS), diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 13d0cb03e8..28c3a8f42a 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -305,24 +305,6 @@ QualType Type::getPointeeType() const { return QualType(); } -const ReferenceType *Type::getAsReferenceType() const { - // If this is directly a reference type, return it. - if (const ReferenceType *RTy = dyn_cast<ReferenceType>(this)) - return RTy; - - // If the canonical form of this type isn't the right kind, reject it. - if (!isa<ReferenceType>(CanonicalType)) { - // Look through type qualifiers - if (isa<ReferenceType>(CanonicalType.getUnqualifiedType())) - return CanonicalType.getUnqualifiedType()->getAsReferenceType(); - return 0; - } - - // If this is a typedef for a reference type, strip the typedef off without - // losing all typedef information. - return cast<ReferenceType>(getDesugaredType()); -} - const LValueReferenceType *Type::getAsLValueReferenceType() const { // If this is directly an lvalue reference type, return it. if (const LValueReferenceType *RTy = dyn_cast<LValueReferenceType>(this)) @@ -395,7 +377,7 @@ bool Type::isVariablyModifiedType() const { // correctly. 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()) return PT->getPointeeType()->isVariablyModifiedType(); |