diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-02 17:35:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-02 17:35:06 +0000 |
commit | db5f1fa3d807f1777bd301a265905f03bd7a6354 (patch) | |
tree | ab473e67fbcad3971cef45304b267c4978e4ec33 /clang/lib/AST/ASTContext.cpp | |
parent | be3d44c3cbf2078672b7c594e67ecdb908fe5722 (diff) | |
download | bcm5719-llvm-db5f1fa3d807f1777bd301a265905f03bd7a6354.tar.gz bcm5719-llvm-db5f1fa3d807f1777bd301a265905f03bd7a6354.zip |
add a common base class "PointerLikeType" for PointerType and ReferenceType,
allowing them to be treated the same in some contexts. A suggestion for a
better name is welcome :)
llvm-svn: 49100
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ce2e58fa354..d716917b9ce 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -281,7 +281,7 @@ ASTContext::getTypeInfo(QualType T) { // of the referenced type." C++98 5.3.3p2: expr.sizeof. // FIXME: This is wrong for struct layout: a reference in a struct has // pointer size. - return getTypeInfo(cast<ReferenceType>(T)->getReferenceeType()); + return getTypeInfo(cast<ReferenceType>(T)->getPointeeType()); case Type::Complex: { // Complex types have the same alignment as their elements, but twice the @@ -1725,12 +1725,12 @@ bool ASTContext::referenceTypesAreCompatible(QualType lhs, QualType rhs) { QualType ltype = lhs; if (lhs->isReferenceType()) - ltype = cast<ReferenceType>(lhs.getCanonicalType())->getReferenceeType(); + ltype = cast<ReferenceType>(lhs.getCanonicalType())->getPointeeType(); QualType rtype = rhs; if (rhs->isReferenceType()) - rtype = cast<ReferenceType>(rhs.getCanonicalType())->getReferenceeType(); + rtype = cast<ReferenceType>(rhs.getCanonicalType())->getPointeeType(); return typesAreCompatible(ltype, rtype); } @@ -1817,9 +1817,9 @@ bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) { // designates the object or function denoted by the reference, and the // expression is an lvalue. if (ReferenceType *RT = dyn_cast<ReferenceType>(lcanon)) - lcanon = RT->getReferenceeType(); + lcanon = RT->getPointeeType(); if (ReferenceType *RT = dyn_cast<ReferenceType>(rcanon)) - rcanon = RT->getReferenceeType(); + rcanon = RT->getPointeeType(); Type::TypeClass LHSClass = lcanon->getTypeClass(); Type::TypeClass RHSClass = rcanon->getTypeClass(); |