[cfe-commits] r76193 - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/PathSensitive/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Frontend/ lib/Sema/
Ted Kremenek
kremenek at apple.com
Fri Jul 17 10:50:19 PDT 2009
Author: kremenek
Date: Fri Jul 17 12:50:17 2009
New Revision: 76193
URL: http://llvm.org/viewvc/llvm-project?rev=76193&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/DeclarationName.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/InheritViz.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Analysis/BasicStore.cpp
cfe/trunk/lib/Analysis/CFRefCount.cpp
cfe/trunk/lib/Analysis/CheckNSError.cpp
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/lib/Analysis/Store.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/RewriteBlocks.cpp
cfe/trunk/lib/Frontend/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInherit.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaNamedCast.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Fri Jul 17 12:50:17 2009
@@ -711,7 +711,7 @@
QualType getAllocatedType() const {
assert(getType()->isPointerType());
- return getType()->getAs<PointerType>()->getPointeeType();
+ return getType()->getAsPointerType()->getPointeeType();
}
FunctionDecl *getOperatorNew() const { return OperatorNew; }
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Jul 17 12:50:17 2009
@@ -431,6 +431,14 @@
const FunctionType *getAsFunctionType() const;
const FunctionNoProtoType *getAsFunctionNoProtoType() const;
const FunctionProtoType *getAsFunctionProtoType() const;
+ const PointerType *getAsPointerType() const;
+ const BlockPointerType *getAsBlockPointerType() const;
+ const ReferenceType *getAsReferenceType() const;
+ const LValueReferenceType *getAsLValueReferenceType() const;
+ const RValueReferenceType *getAsRValueReferenceType() const;
+ const MemberPointerType *getAsMemberPointerType() const;
+ const TagType *getAsTagType() const;
+ const RecordType *getAsRecordType() const;
const RecordType *getAsStructureType() const;
/// NOTE: getAs*ArrayType are methods on ASTContext.
const TypedefType *getAsTypedefType() const;
@@ -2099,7 +2107,7 @@
/// analysis, the expression designates the object or function
/// denoted by the reference, and the expression is an lvalue.
inline QualType QualType::getNonReferenceType() const {
- if (const ReferenceType *RefType = (*this)->getAs<ReferenceType>())
+ if (const ReferenceType *RefType = (*this)->getAsReferenceType())
return RefType->getPointeeType();
else
return *this;
@@ -2109,7 +2117,7 @@
return dyn_cast<TypedefType>(this);
}
inline const ObjCInterfaceType *Type::getAsPointerToObjCInterfaceType() const {
- if (const PointerType *PT = getAs<PointerType>())
+ if (const PointerType *PT = getAsPointerType())
return PT->getPointeeType()->getAsObjCInterfaceType();
return 0;
}
@@ -2138,7 +2146,7 @@
return isa<RValueReferenceType>(CanonicalType.getUnqualifiedType());
}
inline bool Type::isFunctionPointerType() const {
- if (const PointerType* T = getAs<PointerType>())
+ if (const PointerType* T = getAsPointerType())
return T->getPointeeType()->isFunctionType();
else
return false;
@@ -2147,7 +2155,7 @@
return isa<MemberPointerType>(CanonicalType.getUnqualifiedType());
}
inline bool Type::isMemberFunctionPointerType() const {
- if (const MemberPointerType* T = getAs<MemberPointerType>())
+ if (const MemberPointerType* T = getAsMemberPointerType())
return T->getPointeeType()->isFunctionType();
else
return false;
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Fri Jul 17 12:50:17 2009
@@ -357,7 +357,7 @@
}
QualType getValueType(ASTContext&) const {
- const PointerType* PTy = LValueType->getAs<PointerType>();
+ const PointerType* PTy = LValueType->getAsPointerType();
assert(PTy);
return PTy->getPointeeType();
}
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jul 17 12:50:17 2009
@@ -447,7 +447,7 @@
if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
QualType T = VD->getType();
- if (const ReferenceType* RT = T->getAs<ReferenceType>()) {
+ if (const ReferenceType* RT = T->getAsReferenceType()) {
unsigned AS = RT->getPointeeType().getAddressSpace();
Align = Target.getPointerAlign(AS);
} else if (!T->isIncompleteType() && !T->isFunctionType()) {
@@ -779,7 +779,7 @@
FieldSize = 0;
const ArrayType* ATy = Context.getAsArrayType(FD->getType());
FieldAlign = Context.getTypeAlign(ATy->getElementType());
- } else if (const ReferenceType *RT = FD->getType()->getAs<ReferenceType>()) {
+ } else if (const ReferenceType *RT = FD->getType()->getAsReferenceType()) {
unsigned AS = RT->getPointeeType().getAddressSpace();
FieldSize = Context.Target.getPointerWidth(AS);
FieldAlign = Context.Target.getPointerAlign(AS);
@@ -1092,7 +1092,7 @@
return T;
if (T->isPointerType()) {
- QualType Pointee = T->getAs<PointerType>()->getPointeeType();
+ QualType Pointee = T->getAsPointerType()->getPointeeType();
if (Pointee->isAnyPointerType()) {
QualType ResultType = getObjCGCQualType(Pointee, GCAttr);
return getPointerType(ResultType);
@@ -2462,7 +2462,7 @@
}
void ASTContext::setCFConstantStringType(QualType T) {
- const RecordType *Rec = T->getAs<RecordType>();
+ const RecordType *Rec = T->getAsRecordType();
assert(Rec && "Invalid CFConstantStringType");
CFConstantStringTypeDecl = Rec->getDecl();
}
@@ -2498,7 +2498,7 @@
}
void ASTContext::setObjCFastEnumerationStateType(QualType T) {
- const RecordType *Rec = T->getAs<RecordType>();
+ const RecordType *Rec = T->getAsRecordType();
assert(Rec && "Invalid ObjCFAstEnumerationStateType");
ObjCFastEnumerationStateTypeDecl = Rec->getDecl();
}
@@ -2779,7 +2779,7 @@
return;
}
- if (const PointerType *PT = T->getAs<PointerType>()) {
+ if (const PointerType *PT = T->getAsPointerType()) {
QualType PointeeTy = PT->getPointeeType();
bool isReadOnly = false;
// For historical/compatibility reasons, the read-only qualifier of the
@@ -2794,8 +2794,8 @@
}
else if (OutermostType) {
QualType P = PointeeTy;
- while (P->getAs<PointerType>())
- P = P->getAs<PointerType>()->getPointeeType();
+ while (P->getAsPointerType())
+ P = P->getAsPointerType()->getPointeeType();
if (P.isConstQualified()) {
isReadOnly = true;
S += 'r';
@@ -2866,7 +2866,7 @@
return;
}
- if (const RecordType *RTy = T->getAs<RecordType>()) {
+ if (const RecordType *RTy = T->getAsRecordType()) {
RecordDecl *RDecl = RTy->getDecl();
S += RDecl->isUnion() ? '(' : '{';
// Anonymous structures print as '?'
@@ -3035,7 +3035,7 @@
TypedefDecl *TD = TT->getDecl();
// typedef struct objc_selector *SEL;
- const PointerType *ptr = TD->getUnderlyingType()->getAs<PointerType>();
+ const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
if (!ptr)
return;
const RecordType *rec = ptr->getPointeeType()->getAsStructureType();
@@ -3159,7 +3159,7 @@
if (Ty->isObjCObjectPointerType())
GCAttrs = QualType::Strong;
else if (Ty->isPointerType())
- return getObjCGCAttrKind(Ty->getAs<PointerType>()->getPointeeType());
+ return getObjCGCAttrKind(Ty->getAsPointerType()->getPointeeType());
}
// Non-pointers have none gc'able attribute regardless of the attribute
// set on them.
@@ -3382,9 +3382,9 @@
// 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->getAs<ReferenceType>())
+ if (const ReferenceType *RT = LHS->getAsReferenceType())
LHS = RT->getPointeeType();
- if (const ReferenceType *RT = RHS->getAs<ReferenceType>())
+ if (const ReferenceType *RT = RHS->getAsReferenceType())
RHS = RT->getPointeeType();
QualType LHSCan = getCanonicalType(LHS),
@@ -3519,8 +3519,8 @@
case Type::Pointer:
{
// Merge two pointer types, while trying to preserve typedef info
- QualType LHSPointee = LHS->getAs<PointerType>()->getPointeeType();
- QualType RHSPointee = RHS->getAs<PointerType>()->getPointeeType();
+ QualType LHSPointee = LHS->getAsPointerType()->getPointeeType();
+ QualType RHSPointee = RHS->getAsPointerType()->getPointeeType();
QualType ResultType = mergeTypes(LHSPointee, RHSPointee);
if (ResultType.isNull()) return QualType();
if (getCanonicalType(LHSPointee) == getCanonicalType(ResultType))
@@ -3532,8 +3532,8 @@
case Type::BlockPointer:
{
// Merge two block pointer types, while trying to preserve typedef info
- QualType LHSPointee = LHS->getAs<BlockPointerType>()->getPointeeType();
- QualType RHSPointee = RHS->getAs<BlockPointerType>()->getPointeeType();
+ QualType LHSPointee = LHS->getAsBlockPointerType()->getPointeeType();
+ QualType RHSPointee = RHS->getAsBlockPointerType()->getPointeeType();
QualType ResultType = mergeTypes(LHSPointee, RHSPointee);
if (ResultType.isNull()) return QualType();
if (getCanonicalType(LHSPointee) == getCanonicalType(ResultType))
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Jul 17 12:50:17 2009
@@ -157,7 +157,7 @@
if (!isImplicit() || getDeclName())
return false;
- if (const RecordType *Record = getType()->getAs<RecordType>())
+ if (const RecordType *Record = getType()->getAsRecordType())
return Record->getDecl()->isAnonymousStructOrUnion();
return false;
@@ -704,24 +704,24 @@
}
void TagDecl::startDefinition() {
- TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>());
+ TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
TagT->decl.setPointer(this);
- TagT->getAs<TagType>()->decl.setInt(1);
+ TagT->getAsTagType()->decl.setInt(1);
}
void TagDecl::completeDefinition() {
assert((!TypeForDecl ||
- TypeForDecl->getAs<TagType>()->decl.getPointer() == this) &&
+ TypeForDecl->getAsTagType()->decl.getPointer() == this) &&
"Attempt to redefine a tag definition?");
IsDefinition = true;
- TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>());
+ TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
TagT->decl.setPointer(this);
TagT->decl.setInt(0);
}
TagDecl* TagDecl::getDefinition(ASTContext& C) const {
QualType T = C.getTypeDeclType(const_cast<TagDecl*>(this));
- TagDecl* D = cast<TagDecl>(T->getAs<TagType>()->getDecl());
+ TagDecl* D = cast<TagDecl>(T->getAsTagType()->getDecl());
return D->isDefinition() ? D : 0;
}
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri Jul 17 12:50:17 2009
@@ -473,7 +473,7 @@
if (DeclKind >= Decl::TagFirst && DeclKind <= Decl::TagLast) {
// If this is a tag type that has a definition or is currently
// being defined, that definition is our primary context.
- if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAs<TagType>())
+ if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAsTagType())
if (TagT->isBeingDefined() ||
(TagT->getDecl() && TagT->getDecl()->isDefinition()))
return TagT->getDecl();
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Jul 17 12:50:17 2009
@@ -81,7 +81,7 @@
if (BaseType->isDependentType())
continue;
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(BaseType->getAsRecordType()->getDecl());
if (Base->isVirtual())
hasDirectVirtualBase = true;
for (CXXRecordDecl::base_class_iterator VBase =
@@ -125,7 +125,7 @@
for (int i = 0; i < vbaseCount; i++) {
QualType QT = UniqueVbases[i]->getType();
CXXRecordDecl *VBaseClassDecl
- = cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(QT->getAsRecordType()->getDecl());
this->VBases[i] =
*new CXXBaseSpecifier(
VBaseClassDecl->getSourceRange(), true,
@@ -185,7 +185,7 @@
continue;
bool AcceptsConst = true;
QualType ArgType = FnType->getArgType(0);
- if (const LValueReferenceType *Ref = ArgType->getAs<LValueReferenceType>()) {
+ if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType()) {
ArgType = Ref->getPointeeType();
// Is it a non-const lvalue reference?
if (!ArgType.isConstQualified())
@@ -237,7 +237,7 @@
assert(FnType && "Overloaded operator has no proto function type.");
assert(FnType->getNumArgs() == 1 && !FnType->isVariadic());
QualType ArgType = FnType->getArgType(0);
- if (const LValueReferenceType *Ref = ArgType->getAs<LValueReferenceType>())
+ if (const LValueReferenceType *Ref = ArgType->getAsLValueReferenceType())
ArgType = Ref->getPointeeType();
ArgType = ArgType.getUnqualifiedType();
@@ -433,7 +433,7 @@
// Do we have a reference type? Rvalue references don't count.
const LValueReferenceType *ParamRefType =
- Param->getType()->getAs<LValueReferenceType>();
+ Param->getType()->getAsLValueReferenceType();
if (!ParamRefType)
return false;
@@ -503,7 +503,7 @@
while (const ArrayType *AT = C.getAsArrayType(FieldType))
FieldType = AT->getElementType();
- if (FieldType->getAs<RecordType>()) {
+ if (FieldType->getAsRecordType()) {
CXXBaseOrMemberInitializer *Member =
new CXXBaseOrMemberInitializer((*Field), 0, 0, SourceLocation());
AllToDestruct.push_back(Member);
@@ -535,12 +535,12 @@
for (CXXRecordDecl::base_class_iterator VBase =
ClassDecl->vbases_begin(),
E = ClassDecl->vbases_end(); VBase != E; ++VBase) {
- const Type * T = VBase->getType()->getAs<RecordType>();
+ const Type * T = VBase->getType()->getAsRecordType();
unsigned int i = 0;
for (i = 0; i < NumInitializers; i++) {
CXXBaseOrMemberInitializer *Member = Initializers[i];
if (Member->isBaseInitializer() &&
- Member->getBaseClass()->getAs<RecordType>() == T) {
+ Member->getBaseClass()->getAsRecordType() == T) {
AllToInit.push_back(Member);
break;
}
@@ -557,12 +557,12 @@
// Virtuals are in the virtual base list and already constructed.
if (Base->isVirtual())
continue;
- const Type * T = Base->getType()->getAs<RecordType>();
+ const Type * T = Base->getType()->getAsRecordType();
unsigned int i = 0;
for (i = 0; i < NumInitializers; i++) {
CXXBaseOrMemberInitializer *Member = Initializers[i];
if (Member->isBaseInitializer() &&
- Member->getBaseClass()->getAs<RecordType>() == T) {
+ Member->getBaseClass()->getAsRecordType() == T) {
AllToInit.push_back(Member);
break;
}
@@ -589,7 +589,7 @@
while (const ArrayType *AT = C.getAsArrayType(FieldType))
FieldType = AT->getElementType();
- if (FieldType->getAs<RecordType>()) {
+ if (FieldType->getAsRecordType()) {
CXXBaseOrMemberInitializer *Member =
new CXXBaseOrMemberInitializer((*Field), 0, 0, SourceLocation());
AllToInit.push_back(Member);
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Jul 17 12:50:17 2009
@@ -90,7 +90,7 @@
while (!BaseType->isSpecifierType()) {
if (isa<TypedefType>(BaseType))
break;
- else if (const PointerType* PTy = BaseType->getAs<PointerType>())
+ else if (const PointerType* PTy = BaseType->getAsPointerType())
BaseType = PTy->getPointeeType();
else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType))
BaseType = ATy->getElementType();
@@ -353,7 +353,7 @@
}
else // FIXME. skip dependent types for now.
if (const RecordType *RT =
- BMInitializer->getBaseClass()->getAs<RecordType>()) {
+ BMInitializer->getBaseClass()->getAsRecordType()) {
const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(RT->getDecl());
Out << BaseDecl->getNameAsString();
@@ -394,7 +394,7 @@
}
else // FIXME. skip dependent types for now.
if (const RecordType *RT =
- BMInitializer->getBaseClass()->getAs<RecordType>()) {
+ BMInitializer->getBaseClass()->getAsRecordType()) {
const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(RT->getDecl());
Proto += "~";
Modified: cfe/trunk/lib/AST/DeclarationName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Fri Jul 17 12:50:17 2009
@@ -135,7 +135,7 @@
case CXXConstructorName: {
QualType ClassType = getCXXNameType();
- if (const RecordType *ClassRec = ClassType->getAs<RecordType>())
+ if (const RecordType *ClassRec = ClassType->getAsRecordType())
return ClassRec->getDecl()->getNameAsString();
return ClassType.getAsString();
}
@@ -143,7 +143,7 @@
case CXXDestructorName: {
std::string Result = "~";
QualType Type = getCXXNameType();
- if (const RecordType *Rec = Type->getAs<RecordType>())
+ if (const RecordType *Rec = Type->getAsRecordType())
Result += Rec->getDecl()->getNameAsString();
else
Result += Type.getAsString();
@@ -170,7 +170,7 @@
case CXXConversionFunctionName: {
std::string Result = "operator ";
QualType Type = getCXXNameType();
- if (const RecordType *Rec = Type->getAs<RecordType>())
+ if (const RecordType *Rec = Type->getAsRecordType())
Result += Rec->getDecl()->getNameAsString();
else
Result += Type.getAsString();
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Jul 17 12:50:17 2009
@@ -287,9 +287,9 @@
QualType CallExpr::getCallReturnType() const {
QualType CalleeType = getCallee()->getType();
- if (const PointerType *FnTypePtr = CalleeType->getAs<PointerType>())
+ if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
CalleeType = FnTypePtr->getPointeeType();
- else if (const BlockPointerType *BPT = CalleeType->getAs<BlockPointerType>())
+ else if (const BlockPointerType *BPT = CalleeType->getAsBlockPointerType())
CalleeType = BPT->getPointeeType();
const FunctionType *FnType = CalleeType->getAsFunctionType();
@@ -438,7 +438,7 @@
/// getFunctionType - Return the underlying function type for this block.
///
const FunctionType *BlockExpr::getFunctionType() const {
- return getType()->getAs<BlockPointerType>()->
+ return getType()->getAsBlockPointerType()->
getPointeeType()->getAsFunctionType();
}
@@ -923,7 +923,7 @@
if (CT->isIncompleteType())
return MLV_IncompleteType;
- if (const RecordType *r = CT->getAs<RecordType>()) {
+ if (const RecordType *r = CT->getAsRecordType()) {
if (r->hasConstFields())
return MLV_ConstQualified;
}
@@ -999,7 +999,7 @@
QualType T = VD->getType();
// dereferencing to an object pointer is always a gc'able candidate
if (T->isPointerType() &&
- T->getAs<PointerType>()->getPointeeType()->isObjCObjectPointerType())
+ T->getAsPointerType()->getPointeeType()->isObjCObjectPointerType())
return true;
}
@@ -1427,7 +1427,7 @@
if (const ExplicitCastExpr *CE = dyn_cast<ExplicitCastExpr>(this)) {
if (!Ctx.getLangOptions().CPlusPlus) {
// Check that it is a cast to void*.
- if (const PointerType *PT = CE->getType()->getAs<PointerType>()) {
+ if (const PointerType *PT = CE->getType()->getAsPointerType()) {
QualType Pointee = PT->getPointeeType();
if (Pointee.getCVRQualifiers() == 0 &&
Pointee->isVoidType() && // to void*
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Fri Jul 17 12:50:17 2009
@@ -219,28 +219,28 @@
case UTT_IsPOD: return QueriedType->isPODType();
case UTT_IsClass: // Fallthrough
case UTT_IsUnion:
- if (const RecordType *Record = QueriedType->getAs<RecordType>()) {
+ if (const RecordType *Record = QueriedType->getAsRecordType()) {
bool Union = Record->getDecl()->isUnion();
return UTT == UTT_IsUnion ? Union : !Union;
}
return false;
case UTT_IsEnum: return QueriedType->isEnumeralType();
case UTT_IsPolymorphic:
- if (const RecordType *Record = QueriedType->getAs<RecordType>()) {
+ if (const RecordType *Record = QueriedType->getAsRecordType()) {
// Type traits are only parsed in C++, so we've got CXXRecords.
return cast<CXXRecordDecl>(Record->getDecl())->isPolymorphic();
}
return false;
case UTT_IsAbstract:
- if (const RecordType *RT = QueriedType->getAs<RecordType>())
+ if (const RecordType *RT = QueriedType->getAsRecordType())
return cast<CXXRecordDecl>(RT->getDecl())->isAbstract();
return false;
case UTT_HasTrivialConstructor:
- if (const RecordType *RT = QueriedType->getAs<RecordType>())
+ if (const RecordType *RT = QueriedType->getAsRecordType())
return cast<CXXRecordDecl>(RT->getDecl())->hasTrivialConstructor();
return false;
case UTT_HasTrivialDestructor:
- if (const RecordType *RT = QueriedType->getAs<RecordType>())
+ if (const RecordType *RT = QueriedType->getAsRecordType())
return cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor();
return false;
}
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Jul 17 12:50:17 2009
@@ -222,7 +222,7 @@
if (E->isArrow()) {
if (!EvaluatePointer(E->getBase(), result, Info))
return APValue();
- Ty = E->getBase()->getType()->getAs<PointerType>()->getPointeeType();
+ Ty = E->getBase()->getType()->getAsPointerType()->getPointeeType();
} else {
result = Visit(E->getBase());
if (result.isUninit())
@@ -230,7 +230,7 @@
Ty = E->getBase()->getType();
}
- RecordDecl *RD = Ty->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = Ty->getAsRecordType()->getDecl();
const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD);
FieldDecl *FD = dyn_cast<FieldDecl>(E->getMemberDecl());
@@ -351,7 +351,7 @@
if (!EvaluateInteger(IExp, AdditionalOffset, Info))
return APValue();
- QualType PointeeType = PExp->getType()->getAs<PointerType>()->getPointeeType();
+ QualType PointeeType = PExp->getType()->getAsPointerType()->getPointeeType();
uint64_t SizeOfPointee;
// Explicitly handle GNU void* and function pointer arithmetic extensions.
@@ -1029,7 +1029,7 @@
if (E->getOpcode() == BinaryOperator::Sub) {
const QualType Type = E->getLHS()->getType();
- const QualType ElementType = Type->getAs<PointerType>()->getPointeeType();
+ const QualType ElementType = Type->getAsPointerType()->getPointeeType();
uint64_t D = LHSValue.getLValueOffset() - RHSValue.getLValueOffset();
if (!ElementType->isVoidType() && !ElementType->isFunctionType())
Modified: cfe/trunk/lib/AST/InheritViz.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/InheritViz.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/InheritViz.cpp (original)
+++ cfe/trunk/lib/AST/InheritViz.cpp Fri Jul 17 12:50:17 2009
@@ -90,7 +90,7 @@
// Display the base classes.
const CXXRecordDecl *Decl
- = static_cast<const CXXRecordDecl *>(Type->getAs<RecordType>()->getDecl());
+ = static_cast<const CXXRecordDecl *>(Type->getAsRecordType()->getDecl());
for (CXXRecordDecl::base_class_const_iterator Base = Decl->bases_begin();
Base != Decl->bases_end(); ++Base) {
QualType CanonBaseType = Context.getCanonicalType(Base->getType());
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Fri Jul 17 12:50:17 2009
@@ -192,23 +192,23 @@
}
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 @@
}
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 @@
// 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 @@
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)) {
Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Fri Jul 17 12:50:17 2009
@@ -251,7 +251,7 @@
static bool isHigherOrderRawPtr(QualType T, ASTContext &C) {
bool foundPointer = false;
while (1) {
- const PointerType *PT = T->getAs<PointerType>();
+ const PointerType *PT = T->getAsPointerType();
if (!PT) {
if (!foundPointer)
return false;
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Fri Jul 17 12:50:17 2009
@@ -248,7 +248,7 @@
return false;
// Is the type void*?
- const PointerType* PT = RetTy->getAs<PointerType>();
+ const PointerType* PT = RetTy->getAsPointerType();
if (!(PT->getPointeeType().getUnqualifiedType() == Ctx->VoidTy))
return false;
@@ -1250,7 +1250,7 @@
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
}
}
- else if (RetTy->getAs<PointerType>()) {
+ else if (RetTy->getAsPointerType()) {
if (FD->getAttr<CFReturnsRetainedAttr>()) {
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
}
@@ -1276,7 +1276,7 @@
}
if (!isTrackedLoc)
- isTrackedLoc = MD->getResultType()->getAs<PointerType>() != NULL;
+ isTrackedLoc = MD->getResultType()->getAsPointerType() != NULL;
if (isTrackedLoc && MD->getAttr<CFReturnsRetainedAttr>())
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
Modified: cfe/trunk/lib/Analysis/CheckNSError.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckNSError.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CheckNSError.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckNSError.cpp Fri Jul 17 12:50:17 2009
@@ -161,7 +161,7 @@
bool NSErrorCheck::CheckNSErrorArgument(QualType ArgTy) {
- const PointerType* PPT = ArgTy->getAs<PointerType>();
+ const PointerType* PPT = ArgTy->getAsPointerType();
if (!PPT)
return false;
@@ -182,7 +182,7 @@
bool NSErrorCheck::CheckCFErrorArgument(QualType ArgTy) {
- const PointerType* PPT = ArgTy->getAs<PointerType>();
+ const PointerType* PPT = ArgTy->getAsPointerType();
if (!PPT) return false;
const TypedefType* TT = PPT->getPointeeType()->getAsTypedefType();
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Fri Jul 17 12:50:17 2009
@@ -1274,7 +1274,7 @@
return false;
Expr *theValueExpr = CE->getArg(2);
- const PointerType *theValueType = theValueExpr->getType()->getAs<PointerType>();
+ const PointerType *theValueType = theValueExpr->getType()->getAsPointerType();
// theValueType not a pointer?
if (!theValueType)
@@ -1382,7 +1382,7 @@
// Determine the type of function we're calling (if available).
const FunctionProtoType *Proto = NULL;
QualType FnType = CE->getCallee()->IgnoreParens()->getType();
- if (const PointerType *FnTypePtr = FnType->getAs<PointerType>())
+ if (const PointerType *FnTypePtr = FnType->getAsPointerType())
Proto = FnTypePtr->getPointeeType()->getAsFunctionProtoType();
VisitCallRec(CE, Pred, AI, AE, Dst, Proto, /*ParamIdx=*/0);
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Fri Jul 17 12:50:17 2009
@@ -365,7 +365,7 @@
if (Ty->isVoidType())
return true;
- if (const PointerType *PT = Ty->getAs<PointerType>()) {
+ if (const PointerType *PT = Ty->getAsPointerType()) {
Ty = PT->getPointeeType();
continue;
}
@@ -680,7 +680,7 @@
T = Sym->getType(getContext());
}
- QualType EleTy = T->getAs<PointerType>()->getPointeeType();
+ QualType EleTy = T->getAsPointerType()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, getContext());
break;
@@ -689,7 +689,7 @@
// Get the alloca region's current cast type.
const AllocaRegion *AR = cast<AllocaRegion>(MR);
QualType T = *(state->get<RegionCasts>(AR));
- QualType EleTy = T->getAs<PointerType>()->getPointeeType();
+ QualType EleTy = T->getAsPointerType()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, getContext());
break;
@@ -865,7 +865,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType T = *p;
- RTy = T->getAs<PointerType>()->getPointeeType();
+ RTy = T->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -937,7 +937,7 @@
// If the region is already cast to another type, use that type to create the
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R))
- Ty = (*p)->getAs<PointerType>()->getPointeeType();
+ Ty = (*p)->getAsPointerType()->getPointeeType();
return ValMgr.getRegionValueSymbolValOrUnknown(R, Ty);
}
@@ -976,7 +976,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType tmp = *p;
- Ty = tmp->getAs<PointerType>()->getPointeeType();
+ Ty = tmp->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -1009,7 +1009,7 @@
// symbol value.
if (const QualType *p = state->get<RegionCasts>(R)) {
QualType tmp = *p;
- Ty = tmp->getAs<PointerType>()->getPointeeType();
+ Ty = tmp->getAsPointerType()->getPointeeType();
}
// All other values are symbolic.
@@ -1201,7 +1201,7 @@
QualType T = R->getValueType(getContext());
assert(T->isStructureType());
- const RecordType* RT = T->getAs<RecordType>();
+ const RecordType* RT = T->getAsRecordType();
RecordDecl* RD = RT->getDecl();
if (!RD->isDefinition())
Modified: cfe/trunk/lib/Analysis/Store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Store.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/Store.cpp (original)
+++ cfe/trunk/lib/Analysis/Store.cpp Fri Jul 17 12:50:17 2009
@@ -36,7 +36,7 @@
}
static bool IsCompleteType(ASTContext &Ctx, QualType Ty) {
- if (const RecordType *RT = Ty->getAs<RecordType>()) {
+ if (const RecordType *RT = Ty->getAsRecordType()) {
const RecordDecl *D = RT->getDecl();
if (!D->getDefinition(Ctx))
return false;
@@ -62,7 +62,7 @@
// Now assume we are casting from pointer to pointer. Other cases should
// already be handled.
- QualType PointeeTy = CastToTy->getAs<PointerType>()->getPointeeType();
+ QualType PointeeTy = CastToTy->getAsPointerType()->getPointeeType();
// Process region cast according to the kind of the region being cast.
switch (R->getKind()) {
@@ -243,7 +243,7 @@
// If the region is cast to another type, use that type.
if (const QualType *CastTy = getCastType(state, R)) {
assert(!(*CastTy)->isObjCObjectPointerType());
- QualType NewT = (*CastTy)->getAs<PointerType>()->getPointeeType();
+ QualType NewT = (*CastTy)->getAsPointerType()->getPointeeType();
// The only exception is if the original region had a location type as its
// value type we always want to treat the region as binding to a location.
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Jul 17 12:50:17 2009
@@ -388,7 +388,7 @@
RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
const BlockPointerType *BPT =
- E->getCallee()->getType()->getAs<BlockPointerType>();
+ E->getCallee()->getType()->getAsBlockPointerType();
llvm::Value *Callee = EmitScalarExpr(E->getCallee());
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Fri Jul 17 12:50:17 2009
@@ -179,7 +179,7 @@
assert(Dest && "Must have a destination!");
const CXXRecordDecl *RD =
- cast<CXXRecordDecl>(E->getType()->getAs<RecordType>()->getDecl());
+ cast<CXXRecordDecl>(E->getType()->getAsRecordType()->getDecl());
if (RD->hasTrivialConstructor())
return;
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Jul 17 12:50:17 2009
@@ -934,7 +934,7 @@
assert(E->getBase()->getType()->isVectorType());
Base = EmitLValue(E->getBase());
} else {
- const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
+ const PointerType *PT = E->getBase()->getType()->getAsPointerType();
llvm::Value *Ptr = EmitScalarExpr(E->getBase());
Base = LValue::MakeAddr(Ptr, PT->getPointeeType().getCVRQualifiers());
}
@@ -976,7 +976,7 @@
if (E->isArrow()) {
BaseValue = EmitScalarExpr(BaseExpr);
const PointerType *PTy =
- BaseExpr->getType()->getAs<PointerType>();
+ BaseExpr->getType()->getAsPointerType();
if (PTy->getPointeeType()->isUnionType())
isUnion = true;
CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
@@ -1317,7 +1317,7 @@
assert(CalleeType->isFunctionPointerType() &&
"Call must have function pointer type!");
- QualType FnType = CalleeType->getAs<PointerType>()->getPointeeType();
+ QualType FnType = CalleeType->getAsPointerType()->getPointeeType();
QualType ResultType = FnType->getAsFunctionType()->getResultType();
CallArgList Args;
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Jul 17 12:50:17 2009
@@ -253,7 +253,7 @@
} else {
if (CGF.getContext().getLangOptions().NeXTRuntime) {
QualType LHSTy = E->getLHS()->getType();
- if (const RecordType *FDTTy = LHSTy.getTypePtr()->getAs<RecordType>())
+ if (const RecordType *FDTTy = LHSTy.getTypePtr()->getAsRecordType())
if (FDTTy->getDecl()->hasObjectMember()) {
LValue RHS = CGF.EmitLValue(E->getRHS());
CGF.CGM.getObjCRuntime().EmitGCMemmoveCollectable(CGF, LHS.getAddress(),
@@ -441,7 +441,7 @@
// the disadvantage is that the generated code is more difficult for
// the optimizer, especially with bitfields.
unsigned NumInitElements = E->getNumInits();
- RecordDecl *SD = E->getType()->getAs<RecordType>()->getDecl();
+ RecordDecl *SD = E->getType()->getAsRecordType()->getDecl();
unsigned CurInitVal = 0;
if (E->getType()->isUnionType()) {
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Jul 17 12:50:17 2009
@@ -188,7 +188,7 @@
llvm::Constant *EmitStructInitialization(InitListExpr *ILE) {
const llvm::StructType *SType =
cast<llvm::StructType>(ConvertType(ILE->getType()));
- RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl();
std::vector<llvm::Constant*> Elts;
// Initialize the whole structure to zero.
@@ -264,7 +264,7 @@
#ifndef NDEBUG
// Make sure that it's really an empty and not a failure of
// semantic analysis.
- RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl();
for (RecordDecl::field_iterator Field = RD->field_begin(),
FieldEnd = RD->field_end();
Field != FieldEnd; ++Field)
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Jul 17 12:50:17 2009
@@ -679,7 +679,7 @@
int AmountVal = isInc ? 1 : -1;
if (ValTy->isPointerType() &&
- ValTy->getAs<PointerType>()->isVariableArrayType()) {
+ ValTy->getAsPointerType()->isVariableArrayType()) {
// The amount of the addition/subtraction needs to account for the VLA size
CGF.ErrorUnsupported(E, "VLA pointer inc/dec");
}
@@ -1020,13 +1020,13 @@
}
if (Ops.Ty->isPointerType() &&
- Ops.Ty->getAs<PointerType>()->isVariableArrayType()) {
+ Ops.Ty->getAsPointerType()->isVariableArrayType()) {
// The amount of the addition needs to account for the VLA size
CGF.ErrorUnsupported(Ops.E, "VLA pointer addition");
}
Value *Ptr, *Idx;
Expr *IdxExp;
- const PointerType *PT = Ops.E->getLHS()->getType()->getAs<PointerType>();
+ const PointerType *PT = Ops.E->getLHS()->getType()->getAsPointerType();
const ObjCObjectPointerType *OPT =
Ops.E->getLHS()->getType()->getAsObjCObjectPointerType();
if (PT || OPT) {
@@ -1034,7 +1034,7 @@
Idx = Ops.RHS;
IdxExp = Ops.E->getRHS();
} else { // int + pointer
- PT = Ops.E->getRHS()->getType()->getAs<PointerType>();
+ PT = Ops.E->getRHS()->getType()->getAsPointerType();
OPT = Ops.E->getRHS()->getType()->getAsObjCObjectPointerType();
assert((PT || OPT) && "Invalid add expr");
Ptr = Ops.RHS;
@@ -1091,7 +1091,7 @@
}
if (Ops.E->getLHS()->getType()->isPointerType() &&
- Ops.E->getLHS()->getType()->getAs<PointerType>()->isVariableArrayType()) {
+ Ops.E->getLHS()->getType()->getAsPointerType()->isVariableArrayType()) {
// The amount of the addition needs to account for the VLA size for
// ptr-int
// The amount of the division needs to account for the VLA size for
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jul 17 12:50:17 2009
@@ -3008,7 +3008,7 @@
if (FQT->isObjCObjectPointerType())
return QualType::Strong;
- if (const PointerType *PT = FQT->getAs<PointerType>())
+ if (const PointerType *PT = FQT->getAsPointerType())
return GetGCAttrTypeForType(Ctx, PT->getPointeeType());
return QualType::GCNone;
@@ -3072,7 +3072,7 @@
if (FQT->isUnionType())
HasUnion = true;
- BuildAggrIvarRecordLayout(FQT->getAs<RecordType>(),
+ BuildAggrIvarRecordLayout(FQT->getAsRecordType(),
BytePos + FieldOffset,
ForStrongLayout, HasUnion);
continue;
@@ -3097,7 +3097,7 @@
int OldIndex = IvarsInfo.size() - 1;
int OldSkIndex = SkipIvars.size() -1;
- const RecordType *RT = FQT->getAs<RecordType>();
+ const RecordType *RT = FQT->getAsRecordType();
BuildAggrIvarRecordLayout(RT, BytePos + FieldOffset,
ForStrongLayout, HasUnion);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Jul 17 12:50:17 2009
@@ -380,7 +380,7 @@
/// getCGRecordLayout - Return record layout info.
const CGRecordLayout *CodeGenFunction::getCGRecordLayout(CodeGenTypes &CGT,
QualType Ty) {
- const RecordType *RTy = Ty->getAs<RecordType>();
+ const RecordType *RTy = Ty->getAsRecordType();
assert (RTy && "Unexpected type. RecordType expected here.");
return CGT.getCGRecordLayout(RTy->getDecl());
@@ -490,7 +490,7 @@
return SizeEntry;
} else if (const ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
EmitVLASize(AT->getElementType());
- } else if (const PointerType *PT = Ty->getAs<PointerType>())
+ } else if (const PointerType *PT = Ty->getAsPointerType())
EmitVLASize(PT->getPointeeType());
else {
assert(0 && "unknown VM type!");
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Jul 17 12:50:17 2009
@@ -1251,7 +1251,7 @@
}
QualType CFTy = getContext().getCFConstantStringType();
- RecordDecl *CFRD = CFTy->getAs<RecordType>()->getDecl();
+ RecordDecl *CFRD = CFTy->getAsRecordType()->getDecl();
const llvm::StructType *STy =
cast<llvm::StructType>(getTypes().ConvertType(CFTy));
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Fri Jul 17 12:50:17 2009
@@ -142,12 +142,12 @@
// and all of the argument types are complete.
static const TagType *VerifyFuncTypeComplete(const Type* T) {
const FunctionType *FT = cast<FunctionType>(T);
- if (const TagType* TT = FT->getResultType()->getAs<TagType>())
+ if (const TagType* TT = FT->getResultType()->getAsTagType())
if (!TT->getDecl()->isDefinition())
return TT;
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(T))
for (unsigned i = 0; i < FPT->getNumArgs(); i++)
- if (const TagType* TT = FPT->getArgType(i)->getAs<TagType>())
+ if (const TagType* TT = FPT->getArgType(i)->getAsTagType())
if (!TT->getDecl()->isDefinition())
return TT;
return 0;
Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Fri Jul 17 12:50:17 2009
@@ -68,7 +68,7 @@
/// fields. Note that a structure with a flexible array member is not
/// considered empty.
static bool isEmptyRecord(ASTContext &Context, QualType T) {
- const RecordType *RT = T->getAs<RecordType>();
+ const RecordType *RT = T->getAsRecordType();
if (!RT)
return 0;
const RecordDecl *RD = RT->getDecl();
@@ -168,7 +168,7 @@
Context.getTypeSize(FD->getType()) >= 128)
return true;
- if (const RecordType* RT = FD->getType()->getAs<RecordType>())
+ if (const RecordType* RT = FD->getType()->getAsRecordType())
if (typeContainsSSEVector(RT->getDecl(), Context))
return true;
}
@@ -272,7 +272,7 @@
return shouldReturnTypeInRegister(AT->getElementType(), Context);
// Otherwise, it must be a record type.
- const RecordType *RT = Ty->getAs<RecordType>();
+ const RecordType *RT = Ty->getAsRecordType();
if (!RT) return false;
// Structure types are passed in register if all fields would be
@@ -385,7 +385,7 @@
ASTContext &Context) {
unsigned Align = Context.getTypeAlign(Ty);
if (Align < 128) return 0;
- if (const RecordType* RT = Ty->getAs<RecordType>())
+ if (const RecordType* RT = Ty->getAsRecordType())
if (typeContainsSSEVector(RT->getDecl(), Context))
return 16;
return 0;
@@ -704,7 +704,7 @@
if (Hi == Memory)
Lo = Memory;
assert((Hi != SSEUp || Lo == SSE) && "Invalid SSEUp array classification.");
- } else if (const RecordType *RT = Ty->getAs<RecordType>()) {
+ } else if (const RecordType *RT = Ty->getAsRecordType()) {
uint64_t Size = Context.getTypeSize(Ty);
// AMD64-ABI 3.2.3p2: Rule 1. If the size of an object is larger
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Fri Jul 17 12:50:17 2009
@@ -1543,7 +1543,7 @@
if (const TypedefType *Typedef = FileType->getAsTypedefType())
Context->setFILEDecl(Typedef->getDecl());
else {
- const TagType *Tag = FileType->getAs<TagType>();
+ const TagType *Tag = FileType->getAsTagType();
assert(Tag && "Invalid FILE type in PCH file");
Context->setFILEDecl(Tag->getDecl());
}
Modified: cfe/trunk/lib/Frontend/RewriteBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteBlocks.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteBlocks.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteBlocks.cpp Fri Jul 17 12:50:17 2009
@@ -130,7 +130,7 @@
OCT == Context->getCanonicalType(Context->getObjCClassType()))
return true;
- if (const PointerType *PT = OCT->getAs<PointerType>()) {
+ if (const PointerType *PT = OCT->getAsPointerType()) {
if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||
PT->getPointeeType()->isObjCQualifiedIdType())
return true;
@@ -684,13 +684,13 @@
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
closureName = DRE->getDecl()->getNameAsCString();
- CPT = DRE->getType()->getAs<BlockPointerType>();
+ CPT = DRE->getType()->getAsBlockPointerType();
} else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
closureName = CDRE->getDecl()->getNameAsCString();
- CPT = CDRE->getType()->getAs<BlockPointerType>();
+ CPT = CDRE->getType()->getAsBlockPointerType();
} else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
closureName = MExpr->getMemberDecl()->getNameAsCString();
- CPT = MExpr->getType()->getAs<BlockPointerType>();
+ CPT = MExpr->getType()->getAsBlockPointerType();
} else {
assert(1 && "RewriteBlockClass: Bad type");
}
@@ -813,11 +813,11 @@
bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) {
const FunctionProtoType *FTP;
- const PointerType *PT = QT->getAs<PointerType>();
+ const PointerType *PT = QT->getAsPointerType();
if (PT) {
FTP = PT->getPointeeType()->getAsFunctionProtoType();
} else {
- const BlockPointerType *BPT = QT->getAs<BlockPointerType>();
+ const BlockPointerType *BPT = QT->getAsBlockPointerType();
assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
FTP = BPT->getPointeeType()->getAsFunctionProtoType();
}
@@ -1068,7 +1068,7 @@
}
void RewriteBlocks::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
- const PointerType *PT = funcType->getAs<PointerType>();
+ const PointerType *PT = funcType->getAsPointerType();
if (PT && PointerTypeTakesAnyBlockArguments(funcType))
RewriteFunctionProtoType(PT->getPointeeType(), ND);
}
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Jul 17 12:50:17 2009
@@ -354,7 +354,7 @@
OCT == Context->getCanonicalType(Context->getObjCClassType()))
return true;
- if (const PointerType *PT = OCT->getAs<PointerType>()) {
+ if (const PointerType *PT = OCT->getAsPointerType()) {
if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||
PT->getPointeeType()->isObjCQualifiedIdType())
return true;
@@ -394,7 +394,7 @@
}
void RewriteObjC::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
- const PointerType *PT = funcType->getAs<PointerType>();
+ const PointerType *PT = funcType->getAsPointerType();
if (PT && PointerTypeTakesAnyBlockArguments(funcType))
RewriteBlocksInFunctionProtoType(PT->getPointeeType(), ND);
}
@@ -864,9 +864,9 @@
// syntax (where a decaration models use).
QualType retType = OMD->getResultType();
QualType PointeeTy;
- if (const PointerType* PT = retType->getAs<PointerType>())
+ if (const PointerType* PT = retType->getAsPointerType())
PointeeTy = PT->getPointeeType();
- else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>())
+ else if (const BlockPointerType *BPT = retType->getAsBlockPointerType())
PointeeTy = BPT->getPointeeType();
if ((FPRetType = PointeeTy->getAsFunctionType())) {
ResultStr += FPRetType->getResultType().getAsString();
@@ -939,7 +939,7 @@
std::string Name = PDecl->getNameAsString();
if (isTopLevelBlockPointerType(PDecl->getType())) {
// Make sure we convert "t (^)(...)" to "t (*)(...)".
- const BlockPointerType *BPT = PDecl->getType()->getAs<BlockPointerType>();
+ const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType();
Context->getPointerType(BPT->getPointeeType()).getAsStringInternal(Name,
Context->PrintingPolicy);
} else
@@ -1138,7 +1138,7 @@
SourceLocation OrigStart) {
ObjCIvarDecl *D = IV->getDecl();
if (CurMethodDef) {
- if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
+ if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) {
ObjCInterfaceType *iFaceDecl =
dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
// lookup which class implements the instance variable.
@@ -1184,7 +1184,7 @@
// Explicit ivar refs need to have a cast inserted.
// FIXME: consider sharing some of this code with the code above.
- if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
+ if (const PointerType *pType = IV->getBase()->getType()->getAsPointerType()) {
ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
// lookup which class implements the instance variable.
ObjCInterfaceDecl *clsDeclared = 0;
@@ -1608,7 +1608,7 @@
buf += "1) { ";
ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());
sawIdTypedCatch = true;
- } else if (const PointerType *pType = t->getAs<PointerType>()) {
+ } else if (const PointerType *pType = t->getAsPointerType()) {
ObjCInterfaceType *cls; // Should be a pointer to a class.
cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr());
@@ -1824,7 +1824,7 @@
if (T->isObjCQualifiedIdType())
return true;
- if (const PointerType *pType = T->getAs<PointerType>()) {
+ if (const PointerType *pType = T->getAsPointerType()) {
Type *pointeeType = pType->getPointeeType().getTypePtr();
if (isa<ObjCQualifiedInterfaceType>(pointeeType))
return true; // we have "Class <Protocol> *".
@@ -2485,7 +2485,7 @@
: (*PI)->getType();
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (isTopLevelBlockPointerType(t)) {
- const BlockPointerType *BPT = t->getAs<BlockPointerType>();
+ const BlockPointerType *BPT = t->getAsBlockPointerType();
t = Context->getPointerType(BPT->getPointeeType());
}
ArgTypes.push_back(t);
@@ -3890,13 +3890,13 @@
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
closureName = DRE->getDecl()->getNameAsCString();
- CPT = DRE->getType()->getAs<BlockPointerType>();
+ CPT = DRE->getType()->getAsBlockPointerType();
} else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
closureName = CDRE->getDecl()->getNameAsCString();
- CPT = CDRE->getType()->getAs<BlockPointerType>();
+ CPT = CDRE->getType()->getAsBlockPointerType();
} else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
closureName = MExpr->getMemberDecl()->getNameAsCString();
- CPT = MExpr->getType()->getAs<BlockPointerType>();
+ CPT = MExpr->getType()->getAsBlockPointerType();
} else {
assert(1 && "RewriteBlockClass: Bad type");
}
@@ -3922,7 +3922,7 @@
QualType t = *I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (isTopLevelBlockPointerType(t)) {
- const BlockPointerType *BPT = t->getAs<BlockPointerType>();
+ const BlockPointerType *BPT = t->getAsBlockPointerType();
t = Context->getPointerType(BPT->getPointeeType());
}
ArgTypes.push_back(t);
@@ -4063,11 +4063,11 @@
bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) {
const FunctionProtoType *FTP;
- const PointerType *PT = QT->getAs<PointerType>();
+ const PointerType *PT = QT->getAsPointerType();
if (PT) {
FTP = PT->getPointeeType()->getAsFunctionProtoType();
} else {
- const BlockPointerType *BPT = QT->getAs<BlockPointerType>();
+ const BlockPointerType *BPT = QT->getAsBlockPointerType();
assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
FTP = BPT->getPointeeType()->getAsFunctionProtoType();
}
Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Fri Jul 17 12:50:17 2009
@@ -46,7 +46,7 @@
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate: {
- const TagType *Tag = NNS->getAsType()->getAs<TagType>();
+ const TagType *Tag = NNS->getAsType()->getAsTagType();
assert(Tag && "Non-tag type in nested-name-specifier");
return Tag->getDecl();
} break;
@@ -169,7 +169,7 @@
if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
// If we're currently defining this type, then lookup into the
// type is okay: don't complain that it isn't complete yet.
- const TagType *TagT = Context.getTypeDeclType(Tag)->getAs<TagType>();
+ const TagType *TagT = Context.getTypeDeclType(Tag)->getAsTagType();
if (TagT->isBeingDefined())
return false;
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Jul 17 12:50:17 2009
@@ -205,7 +205,7 @@
bool HasVAListArg = Format->getFirstArg() == 0;
if (!HasVAListArg) {
const FunctionType *FT =
- Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType();
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT))
HasVAListArg = !Proto->isVariadic();
}
@@ -241,7 +241,7 @@
return Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
<< FirstArg->getType() << FirstArg->getSourceRange();
- QualType ValType = FirstArg->getType()->getAs<PointerType>()->getPointeeType();
+ QualType ValType = FirstArg->getType()->getAsPointerType()->getPointeeType();
if (!ValType->isIntegerType() && !ValType->isPointerType() &&
!ValType->isBlockPointerType())
return Diag(DRE->getLocStart(),
@@ -344,7 +344,7 @@
TUScope, false, DRE->getLocStart()));
const FunctionProtoType *BuiltinFT =
NewBuiltinDecl->getType()->getAsFunctionProtoType();
- ValType = BuiltinFT->getArgType(0)->getAs<PointerType>()->getPointeeType();
+ ValType = BuiltinFT->getArgType(0)->getAsPointerType()->getPointeeType();
// If the first type needs to be converted (e.g. void** -> int*), do it now.
if (BuiltinFT->getArgType(0) != FirstArg->getType()) {
@@ -750,7 +750,7 @@
if (const ArrayType *AT = Context.getAsArrayType(T)) {
isConstant = AT->getElementType().isConstant(Context);
}
- else if (const PointerType *PT = T->getAs<PointerType>()) {
+ else if (const PointerType *PT = T->getAsPointerType()) {
isConstant = T.isConstant(Context) &&
PT->getPointeeType().isConstant(Context);
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Jul 17 12:50:17 2009
@@ -1151,7 +1151,7 @@
IdResolver.AddDecl(*F);
}
} else if (const RecordType *InnerRecordType
- = (*F)->getType()->getAs<RecordType>()) {
+ = (*F)->getType()->getAsRecordType()) {
RecordDecl *InnerRecord = InnerRecordType->getDecl();
if (InnerRecord->isAnonymousStructOrUnion())
Invalid = Invalid ||
@@ -2814,7 +2814,7 @@
if ((!Var->hasExternalStorage() && !Var->isExternC(Context)) &&
InitType->isRecordType() && !InitType->isDependentType()) {
CXXRecordDecl *RD =
- cast<CXXRecordDecl>(InitType->getAs<RecordType>()->getDecl());
+ cast<CXXRecordDecl>(InitType->getAsRecordType()->getDecl());
CXXConstructorDecl *Constructor = 0;
if (!RequireCompleteType(Var->getLocation(), InitType,
diag::err_invalid_incomplete_type_use))
@@ -4237,7 +4237,7 @@
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
- } else if (const RecordType *FDTTy = FDTy->getAs<RecordType>()) {
+ } else if (const RecordType *FDTTy = FDTy->getAsRecordType()) {
if (FDTTy->getDecl()->hasFlexibleArrayMember()) {
// If this is a member of a union, then entire union becomes "flexible".
if (Record && Record->isUnion()) {
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Jul 17 12:50:17 2009
@@ -36,9 +36,9 @@
return 0;
if (Ty->isFunctionPointerType())
- Ty = Ty->getAs<PointerType>()->getPointeeType();
+ Ty = Ty->getAsPointerType()->getPointeeType();
else if (blocksToo && Ty->isBlockPointerType())
- Ty = Ty->getAs<BlockPointerType>()->getPointeeType();
+ Ty = Ty->getAsBlockPointerType()->getPointeeType();
return Ty->getAsFunctionType();
}
@@ -133,11 +133,11 @@
}
static inline bool isCFStringType(QualType T, ASTContext &Ctx) {
- const PointerType *PT = T->getAs<PointerType>();
+ const PointerType *PT = T->getAsPointerType();
if (!PT)
return false;
- const RecordType *RT = PT->getPointeeType()->getAs<RecordType>();
+ const RecordType *RT = PT->getPointeeType()->getAsRecordType();
if (!RT)
return false;
@@ -632,7 +632,7 @@
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
QualType T = TD->getUnderlyingType();
if (!T->isPointerType() ||
- !T->getAs<PointerType>()->getPointeeType()->isRecordType()) {
+ !T->getAsPointerType()->getPointeeType()->isRecordType()) {
S.Diag(TD->getLocation(), diag::err_nsobject_attribute);
return;
}
@@ -751,7 +751,7 @@
QualType Ty = V->getType();
if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) {
const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(d)
- : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ : Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType();
if (!cast<FunctionProtoType>(FT)->isVariadic()) {
int m = Ty->isFunctionPointerType() ? 0 : 1;
S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m;
@@ -1147,7 +1147,7 @@
if (not_nsstring_type &&
!isCFStringType(Ty, S.Context) &&
(!Ty->isPointerType() ||
- !Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
+ !Ty->getAsPointerType()->getPointeeType()->isCharType())) {
// FIXME: Should highlight the actual expression that has the wrong type.
S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
<< (not_nsstring_type ? "a string type" : "an NSString")
@@ -1158,7 +1158,7 @@
if (!isNSStringType(Ty, S.Context) &&
!isCFStringType(Ty, S.Context) &&
(!Ty->isPointerType() ||
- !Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
+ !Ty->getAsPointerType()->getPointeeType()->isCharType())) {
// FIXME: Should highlight the actual expression that has the wrong type.
S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
<< (not_nsstring_type ? "string type" : "NSString")
@@ -1266,7 +1266,7 @@
return;
}
} else if (!Ty->isPointerType() ||
- !Ty->getAs<PointerType>()->getPointeeType()->isCharType()) {
+ !Ty->getAsPointerType()->getPointeeType()->isCharType()) {
// FIXME: Should highlight the actual expression that has the wrong type.
S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
<< "a string type" << IdxExpr->getSourceRange();
@@ -1703,7 +1703,7 @@
return;
}
- if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAs<PointerType>()
+ if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAsPointerType()
|| RetTy->getAsObjCObjectPointerType())) {
S.Diag(Attr.getLoc(), diag::warn_ns_attribute_wrong_return_type)
<< Attr.getName();
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Jul 17 12:50:17 2009
@@ -384,7 +384,7 @@
return 0;
// If the base class is polymorphic, the new one is, too.
- RecordDecl *BaseDecl = BaseType->getAs<RecordType>()->getDecl();
+ RecordDecl *BaseDecl = BaseType->getAsRecordType()->getDecl();
assert(BaseDecl && "Record type has no declaration");
BaseDecl = BaseDecl->getDefinition(Context);
assert(BaseDecl && "Base type is not incomplete, but has no definition");
@@ -833,7 +833,7 @@
for (CXXRecordDecl::base_class_iterator VBase =
ClassDecl->vbases_begin(),
E = ClassDecl->vbases_end(); VBase != E; ++VBase)
- AllBaseOrMembers.push_back(VBase->getType()->getAs<RecordType>());
+ AllBaseOrMembers.push_back(VBase->getType()->getAsRecordType());
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
E = ClassDecl->bases_end(); Base != E; ++Base) {
@@ -841,7 +841,7 @@
// first.
if (Base->isVirtual())
continue;
- AllBaseOrMembers.push_back(Base->getType()->getAs<RecordType>());
+ AllBaseOrMembers.push_back(Base->getType()->getAsRecordType());
}
for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
@@ -956,7 +956,7 @@
// First, collect the pure virtual methods for the base classes.
for (CXXRecordDecl::base_class_const_iterator Base = RD->bases_begin(),
BaseEnd = RD->bases_end(); Base != BaseEnd; ++Base) {
- if (const RecordType *RT = Base->getType()->getAs<RecordType>()) {
+ if (const RecordType *RT = Base->getType()->getAsRecordType()) {
const CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(RT->getDecl());
if (BaseDecl && BaseDecl->isAbstract())
Collect(BaseDecl, Methods);
@@ -1009,9 +1009,9 @@
return RequireNonAbstractType(Loc, AT->getElementType(), DiagID, SelID,
CurrentRD);
- if (const PointerType *PT = T->getAs<PointerType>()) {
+ if (const PointerType *PT = T->getAsPointerType()) {
// Find the innermost pointer type.
- while (const PointerType *T = PT->getPointeeType()->getAs<PointerType>())
+ while (const PointerType *T = PT->getPointeeType()->getAsPointerType())
PT = T;
if (const ArrayType *AT = Context.getAsArrayType(PT->getPointeeType()))
@@ -1019,7 +1019,7 @@
CurrentRD);
}
- const RecordType *RT = T->getAs<RecordType>();
+ const RecordType *RT = T->getAsRecordType();
if (!RT)
return false;
@@ -1150,7 +1150,7 @@
while (const ArrayType *AT = Context.getAsArrayType(FTy))
FTy = AT->getElementType();
- if (const RecordType *RT = FTy->getAs<RecordType>()) {
+ if (const RecordType *RT = FTy->getAsRecordType()) {
CXXRecordDecl *FieldRD = cast<CXXRecordDecl>(RT->getDecl());
if (!FieldRD->hasTrivialConstructor())
@@ -1224,7 +1224,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
HasConstCopyConstructor && Base != ClassDecl->bases_end(); ++Base) {
const CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
HasConstCopyConstructor
= BaseClassDecl->hasConstCopyConstructor(Context);
}
@@ -1239,7 +1239,7 @@
QualType FieldType = (*Field)->getType();
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
const CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
HasConstCopyConstructor
@@ -1304,7 +1304,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
HasConstCopyAssignment && Base != ClassDecl->bases_end(); ++Base) {
const CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
HasConstCopyAssignment = BaseClassDecl->hasConstCopyAssignment(Context);
}
@@ -1318,7 +1318,7 @@
QualType FieldType = (*Field)->getType();
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
const CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
HasConstCopyAssignment
@@ -1751,7 +1751,7 @@
// virtual function that overrides a virtual function in a base class.
QualType ClassType
= Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
- if (const ReferenceType *ConvTypeRef = ConvType->getAs<ReferenceType>())
+ if (const ReferenceType *ConvTypeRef = ConvType->getAsReferenceType())
ConvType = ConvTypeRef->getPointeeType();
if (ConvType->isRecordType()) {
ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType();
@@ -2041,7 +2041,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
E = ClassDecl->bases_end(); Base != E; ++Base) {
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (!BaseClassDecl->hasTrivialConstructor()) {
if (CXXConstructorDecl *BaseCtor =
BaseClassDecl->getDefaultConstructor(Context))
@@ -2061,7 +2061,7 @@
QualType FieldType = Context.getCanonicalType((*Field)->getType());
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (!FieldClassDecl->hasTrivialConstructor()) {
@@ -2113,7 +2113,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
E = ClassDecl->bases_end(); Base != E; ++Base) {
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (!BaseClassDecl->hasTrivialDestructor()) {
if (CXXDestructorDecl *BaseDtor =
const_cast<CXXDestructorDecl*>(BaseClassDecl->getDestructor(Context)))
@@ -2129,7 +2129,7 @@
QualType FieldType = Context.getCanonicalType((*Field)->getType());
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (!FieldClassDecl->hasTrivialDestructor()) {
@@ -2165,7 +2165,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
E = ClassDecl->bases_end(); Base != E; ++Base) {
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (CXXMethodDecl *BaseAssignOpMethod =
getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl))
MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod);
@@ -2175,7 +2175,7 @@
QualType FieldType = Context.getCanonicalType((*Field)->getType());
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (CXXMethodDecl *FieldAssignOpMethod =
@@ -2251,7 +2251,7 @@
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
Base != ClassDecl->bases_end(); ++Base) {
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
if (CXXConstructorDecl *BaseCopyCtor =
BaseClassDecl->getCopyConstructor(Context, TypeQuals))
MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
@@ -2262,7 +2262,7 @@
QualType FieldType = Context.getCanonicalType((*Field)->getType());
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
if (CXXConstructorDecl *FieldCopyCtor =
@@ -2286,7 +2286,7 @@
void Sema::MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
{
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(
- DeclInitType->getAs<RecordType>()->getDecl());
+ DeclInitType->getAsRecordType()->getDecl());
if (!ClassDecl->hasTrivialDestructor())
if (CXXDestructorDecl *Destructor =
const_cast<CXXDestructorDecl*>(ClassDecl->getDestructor(Context)))
@@ -2402,7 +2402,7 @@
SourceLocation Loc, SourceRange Range,
DeclarationName InitEntity,
InitializationKind Kind) {
- const RecordType *ClassRec = ClassType->getAs<RecordType>();
+ const RecordType *ClassRec = ClassType->getAsRecordType();
assert(ClassRec && "Can only initialize a class type here");
// C++ [dcl.init]p14:
@@ -2548,7 +2548,7 @@
bool AllowExplicit, bool ForceRValue) {
assert(DeclType->isReferenceType() && "Reference init needs a reference");
- QualType T1 = DeclType->getAs<ReferenceType>()->getPointeeType();
+ QualType T1 = DeclType->getAsReferenceType()->getPointeeType();
QualType T2 = Init->getType();
// If the initializer is the address of an overloaded function, try
@@ -2652,7 +2652,7 @@
if (!isRValRef && !SuppressUserConversions && T2->isRecordType()) {
// FIXME: Look for conversions in base classes!
CXXRecordDecl *T2RecordDecl
- = dyn_cast<CXXRecordDecl>(T2->getAs<RecordType>()->getDecl());
+ = dyn_cast<CXXRecordDecl>(T2->getAsRecordType()->getDecl());
OverloadCandidateSet CandidateSet;
OverloadedFunctionDecl *Conversions
@@ -3079,11 +3079,11 @@
QualType BaseType = ExDeclType;
int Mode = 0; // 0 for direct type, 1 for pointer, 2 for reference
unsigned DK = diag::err_catch_incomplete;
- if (const PointerType *Ptr = BaseType->getAs<PointerType>()) {
+ if (const PointerType *Ptr = BaseType->getAsPointerType()) {
BaseType = Ptr->getPointeeType();
Mode = 1;
DK = diag::err_catch_incomplete_ptr;
- } else if(const ReferenceType *Ref = BaseType->getAs<ReferenceType>()) {
+ } else if(const ReferenceType *Ref = BaseType->getAsReferenceType()) {
// For the purpose of error recovery, we treat rvalue refs like lvalue refs.
BaseType = Ref->getPointeeType();
Mode = 2;
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Jul 17 12:50:17 2009
@@ -133,8 +133,8 @@
QualType Ty = V->getType();
if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) {
const FunctionType *FT = Ty->isFunctionPointerType()
- ? Ty->getAs<PointerType>()->getPointeeType()->getAsFunctionType()
- : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
+ ? Ty->getAsPointerType()->getPointeeType()->getAsFunctionType()
+ : Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType();
if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT)) {
unsigned NumArgsInProto = Proto->getNumArgs();
unsigned k;
@@ -756,7 +756,7 @@
// whether its a pointer and whether it adds any qualifiers to the
// anonymous struct/union fields we're looking into.
QualType ObjectType = BaseObjectExpr->getType();
- if (const PointerType *ObjectPtr = ObjectType->getAs<PointerType>()) {
+ if (const PointerType *ObjectPtr = ObjectType->getAsPointerType()) {
BaseObjectIsPointer = true;
ObjectType = ObjectPtr->getPointeeType();
}
@@ -1073,7 +1073,7 @@
Ctx = FD->getDeclContext();
MemberType = FD->getType();
- if (const ReferenceType *RefType = MemberType->getAs<ReferenceType>())
+ if (const ReferenceType *RefType = MemberType->getAsReferenceType())
MemberType = RefType->getPointeeType();
else if (!FD->isMutable()) {
unsigned combinedQualifiers
@@ -1835,11 +1835,11 @@
BaseExpr = LHSExp;
IndexExpr = RHSExp;
ResultType = Context.DependentTy;
- } else if (const PointerType *PTy = LHSTy->getAs<PointerType>()) {
+ } else if (const PointerType *PTy = LHSTy->getAsPointerType()) {
BaseExpr = LHSExp;
IndexExpr = RHSExp;
ResultType = PTy->getPointeeType();
- } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
+ } else if (const PointerType *PTy = RHSTy->getAsPointerType()) {
// Handle the uncommon case of "123[Ptr]".
BaseExpr = RHSExp;
IndexExpr = LHSExp;
@@ -1874,7 +1874,7 @@
BaseExpr = LHSExp;
IndexExpr = RHSExp;
- ResultType = LHSTy->getAs<PointerType>()->getPointeeType();
+ ResultType = LHSTy->getAsPointerType()->getPointeeType();
} else if (RHSTy->isArrayType()) {
// Same as previous, except for 123[f().a] case
Diag(RHSExp->getLocStart(), diag::ext_subscript_non_lvalue) <<
@@ -1884,7 +1884,7 @@
BaseExpr = RHSExp;
IndexExpr = LHSExp;
- ResultType = RHSTy->getAs<PointerType>()->getPointeeType();
+ ResultType = RHSTy->getAsPointerType()->getPointeeType();
} else {
return ExprError(Diag(LLoc, diag::err_typecheck_subscript_value)
<< LHSExp->getSourceRange() << RHSExp->getSourceRange());
@@ -2098,7 +2098,7 @@
OpLoc,
DeclarationName(&Member),
MemberLoc));
- else if (const PointerType *PT = BaseType->getAs<PointerType>())
+ else if (const PointerType *PT = BaseType->getAsPointerType())
BaseType = PT->getPointeeType();
else if (BaseType->isObjCObjectPointerType())
;
@@ -2119,7 +2119,7 @@
// In Obj-C++, however, the above expression is valid, since it could be
// accessing the 'f' property if T is an Obj-C interface. The extra check
// allows this, while still reporting an error if T is a struct pointer.
- const PointerType *PT = BaseType->getAs<PointerType>();
+ const PointerType *PT = BaseType->getAsPointerType();
if (!PT || (getLangOptions().ObjC1 &&
!PT->getPointeeType()->isRecordType()))
@@ -2133,7 +2133,7 @@
// Handle field access to simple records. This also handles access to fields
// of the ObjC 'id' struct.
- if (const RecordType *RTy = BaseType->getAs<RecordType>()) {
+ if (const RecordType *RTy = BaseType->getAsRecordType()) {
RecordDecl *RDecl = RTy->getDecl();
if (RequireCompleteType(OpLoc, BaseType,
diag::err_typecheck_incomplete_tag,
@@ -2177,7 +2177,7 @@
// Figure out the type of the member; see C99 6.5.2.3p3, C++ [expr.ref]
// FIXME: Handle address space modifiers
QualType MemberType = FD->getType();
- if (const ReferenceType *Ref = MemberType->getAs<ReferenceType>())
+ if (const ReferenceType *Ref = MemberType->getAsReferenceType())
MemberType = Ref->getPointeeType();
else {
unsigned combinedQualifiers =
@@ -2500,7 +2500,7 @@
if (BaseType == Context.OverloadTy ||
BaseType->isFunctionType() ||
(BaseType->isPointerType() &&
- BaseType->getAs<PointerType>()->isFunctionType())) {
+ BaseType->getAsPointerType()->isFunctionType())) {
SourceLocation Loc = PP.getLocForEndOfToken(BaseExpr->getLocEnd());
Diag(Loc, diag::note_member_reference_needs_call)
<< CodeModificationHint::CreateInsertion(Loc, "()");
@@ -2794,13 +2794,13 @@
if (!Fn->getType()->isBlockPointerType()) {
// C99 6.5.2.2p1 - "The expression that denotes the called function shall
// have type pointer to function".
- const PointerType *PT = Fn->getType()->getAs<PointerType>();
+ const PointerType *PT = Fn->getType()->getAsPointerType();
if (PT == 0)
return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
<< Fn->getType() << Fn->getSourceRange());
FuncT = PT->getPointeeType()->getAsFunctionType();
} else { // This is a block call.
- FuncT = Fn->getType()->getAs<BlockPointerType>()->getPointeeType()->
+ FuncT = Fn->getType()->getAsBlockPointerType()->getPointeeType()->
getAsFunctionType();
}
if (FuncT == 0)
@@ -2937,7 +2937,7 @@
<< castType << castExpr->getSourceRange();
} else if (castType->isUnionType()) {
// GCC cast to union extension
- RecordDecl *RD = castType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = castType->getAsRecordType()->getDecl();
RecordDecl::field_iterator Field, FieldEnd;
for (Field = RD->field_begin(), FieldEnd = RD->field_end();
Field != FieldEnd; ++Field) {
@@ -3078,8 +3078,8 @@
// If both operands are the same structure or union type, the result is that
// type.
- if (const RecordType *LHSRT = LHSTy->getAs<RecordType>()) { // C99 6.5.15p3
- if (const RecordType *RHSRT = RHSTy->getAs<RecordType>())
+ if (const RecordType *LHSRT = LHSTy->getAsRecordType()) { // C99 6.5.15p3
+ if (const RecordType *RHSRT = RHSTy->getAsRecordType())
if (LHSRT->getDecl() == RHSRT->getDecl())
// "If both the operands have structure or union type, the result has
// that type." This implies that CV qualifiers are dropped.
@@ -3131,8 +3131,8 @@
return LHSTy;
}
// The block pointer types aren't identical, continue checking.
- QualType lhptee = LHSTy->getAs<BlockPointerType>()->getPointeeType();
- QualType rhptee = RHSTy->getAs<BlockPointerType>()->getPointeeType();
+ QualType lhptee = LHSTy->getAsBlockPointerType()->getPointeeType();
+ QualType rhptee = RHSTy->getAsBlockPointerType()->getPointeeType();
if (!Context.typesAreCompatible(lhptee.getUnqualifiedType(),
rhptee.getUnqualifiedType())) {
@@ -3206,8 +3206,8 @@
// Check constraints for C object pointers types (C99 6.5.15p3,6).
if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
// get the "pointed to" types
- QualType lhptee = LHSTy->getAs<PointerType>()->getPointeeType();
- QualType rhptee = RHSTy->getAs<PointerType>()->getPointeeType();
+ QualType lhptee = LHSTy->getAsPointerType()->getPointeeType();
+ QualType rhptee = RHSTy->getAsPointerType()->getPointeeType();
// ignore qualifiers on void (C99 6.5.15p3, clause 6)
if (lhptee->isVoidType() && rhptee->isIncompleteOrObjectType()) {
@@ -3313,8 +3313,8 @@
QualType lhptee, rhptee;
// get the "pointed to" type (ignoring qualifiers at the top level)
- lhptee = lhsType->getAs<PointerType>()->getPointeeType();
- rhptee = rhsType->getAs<PointerType>()->getPointeeType();
+ lhptee = lhsType->getAsPointerType()->getPointeeType();
+ rhptee = rhsType->getAsPointerType()->getPointeeType();
return CheckPointeeTypesForAssignment(lhptee, rhptee);
}
@@ -3396,8 +3396,8 @@
QualType lhptee, rhptee;
// get the "pointed to" type (ignoring qualifiers at the top level)
- lhptee = lhsType->getAs<BlockPointerType>()->getPointeeType();
- rhptee = rhsType->getAs<BlockPointerType>()->getPointeeType();
+ lhptee = lhsType->getAsBlockPointerType()->getPointeeType();
+ rhptee = rhsType->getAsBlockPointerType()->getPointeeType();
// make sure we operate on the canonical type
lhptee = Context.getCanonicalType(lhptee);
@@ -3447,7 +3447,7 @@
// right-hand side type. The caller is responsible for adjusting
// lhsType so that the resulting expression does not have reference
// type.
- if (const ReferenceType *lhsTypeRef = lhsType->getAs<ReferenceType>()) {
+ if (const ReferenceType *lhsTypeRef = lhsType->getAsReferenceType()) {
if (Context.typesAreCompatible(lhsTypeRef->getPointeeType(), rhsType))
return Compatible;
return Incompatible;
@@ -3496,12 +3496,12 @@
if (isa<ObjCObjectPointerType>(rhsType)) {
QualType rhptee = rhsType->getAsObjCObjectPointerType()->getPointeeType();
- QualType lhptee = lhsType->getAs<PointerType>()->getPointeeType();
+ QualType lhptee = lhsType->getAsPointerType()->getPointeeType();
return CheckPointeeTypesForAssignment(lhptee, rhptee);
}
- if (rhsType->getAs<BlockPointerType>()) {
- if (lhsType->getAs<PointerType>()->getPointeeType()->isVoidType())
+ if (rhsType->getAsBlockPointerType()) {
+ if (lhsType->getAsPointerType()->getPointeeType()->isVoidType())
return Compatible;
// Treat block pointers as objects.
@@ -3522,7 +3522,7 @@
if (rhsType->isBlockPointerType())
return CheckBlockPointerTypesForAssignment(lhsType, rhsType);
- if (const PointerType *RHSPT = rhsType->getAs<PointerType>()) {
+ if (const PointerType *RHSPT = rhsType->getAsPointerType()) {
if (RHSPT->getPointeeType()->isVoidType())
return Compatible;
}
@@ -3535,7 +3535,7 @@
if (isa<PointerType>(rhsType)) {
QualType lhptee = lhsType->getAsObjCObjectPointerType()->getPointeeType();
- QualType rhptee = rhsType->getAs<PointerType>()->getPointeeType();
+ QualType rhptee = rhsType->getAsPointerType()->getPointeeType();
return CheckPointeeTypesForAssignment(lhptee, rhptee);
}
if (rhsType->isObjCObjectPointerType()) {
@@ -3545,7 +3545,7 @@
QualType rhptee = rhsType->getAsObjCObjectPointerType()->getPointeeType();
return CheckPointeeTypesForAssignment(lhptee, rhptee);
}
- if (const PointerType *RHSPT = rhsType->getAs<PointerType>()) {
+ if (const PointerType *RHSPT = rhsType->getAsPointerType()) {
if (RHSPT->getPointeeType()->isVoidType())
return Compatible;
}
@@ -3566,7 +3566,7 @@
return CheckPointerTypesForAssignment(lhsType, rhsType);
if (isa<BlockPointerType>(lhsType) &&
- rhsType->getAs<PointerType>()->getPointeeType()->isVoidType())
+ rhsType->getAsPointerType()->getPointeeType()->isVoidType())
return Compatible;
return Incompatible;
}
@@ -3580,11 +3580,11 @@
if (isa<PointerType>(lhsType)) {
QualType rhptee = lhsType->getAsObjCObjectPointerType()->getPointeeType();
- QualType lhptee = rhsType->getAs<PointerType>()->getPointeeType();
+ QualType lhptee = rhsType->getAsPointerType()->getPointeeType();
return CheckPointeeTypesForAssignment(lhptee, rhptee);
}
if (isa<BlockPointerType>(lhsType) &&
- rhsType->getAs<PointerType>()->getPointeeType()->isVoidType())
+ rhsType->getAsPointerType()->getPointeeType()->isVoidType())
return Compatible;
return Incompatible;
}
@@ -3636,7 +3636,7 @@
// 1) void pointer
// 2) null pointer constant
if (FromType->isPointerType())
- if (FromType->getAs<PointerType>()->getPointeeType()->isVoidType()) {
+ if (FromType->getAsPointerType()->getPointeeType()->isVoidType()) {
ImpCastExprToType(rExpr, it->getType());
InitField = *it;
break;
@@ -3973,7 +3973,7 @@
}
// Handle pointer-pointer subtractions.
- if (const PointerType *RHSPTy = rex->getType()->getAs<PointerType>()) {
+ if (const PointerType *RHSPTy = rex->getType()->getAsPointerType()) {
QualType rpointee = RHSPTy->getPointeeType();
// RHS must be a completely-type object type.
@@ -4168,9 +4168,9 @@
// errors (when -pedantic-errors is enabled).
if (lType->isPointerType() && rType->isPointerType()) { // C99 6.5.8p2
QualType LCanPointeeTy =
- Context.getCanonicalType(lType->getAs<PointerType>()->getPointeeType());
+ Context.getCanonicalType(lType->getAsPointerType()->getPointeeType());
QualType RCanPointeeTy =
- Context.getCanonicalType(rType->getAs<PointerType>()->getPointeeType());
+ Context.getCanonicalType(rType->getAsPointerType()->getPointeeType());
if (isRelational) {
if (lType->isFunctionPointerType() || rType->isFunctionPointerType()) {
@@ -4240,8 +4240,8 @@
}
// Handle block pointer types.
if (!isRelational && lType->isBlockPointerType() && rType->isBlockPointerType()) {
- QualType lpointee = lType->getAs<BlockPointerType>()->getPointeeType();
- QualType rpointee = rType->getAs<BlockPointerType>()->getPointeeType();
+ QualType lpointee = lType->getAsBlockPointerType()->getPointeeType();
+ QualType rpointee = rType->getAsBlockPointerType()->getPointeeType();
if (!LHSIsNull && !RHSIsNull &&
!Context.typesAreCompatible(lpointee, rpointee)) {
@@ -4256,9 +4256,9 @@
&& ((lType->isBlockPointerType() && rType->isPointerType())
|| (lType->isPointerType() && rType->isBlockPointerType()))) {
if (!LHSIsNull && !RHSIsNull) {
- if (!((rType->isPointerType() && rType->getAs<PointerType>()
+ if (!((rType->isPointerType() && rType->getAsPointerType()
->getPointeeType()->isVoidType())
- || (lType->isPointerType() && lType->getAs<PointerType>()
+ || (lType->isPointerType() && lType->getAsPointerType()
->getPointeeType()->isVoidType())))
Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
@@ -4269,8 +4269,8 @@
if ((lType->isObjCObjectPointerType() || rType->isObjCObjectPointerType())) {
if (lType->isPointerType() || rType->isPointerType()) {
- const PointerType *LPT = lType->getAs<PointerType>();
- const PointerType *RPT = rType->getAs<PointerType>();
+ const PointerType *LPT = lType->getAsPointerType();
+ const PointerType *RPT = rType->getAsPointerType();
bool LPtrToVoid = LPT ?
Context.getCanonicalType(LPT->getPointeeType())->isVoidType() : false;
bool RPtrToVoid = RPT ?
@@ -4798,7 +4798,7 @@
// incomplete type or void. It would be possible to warn about dereferencing
// a void pointer, but it's completely well-defined, and such a warning is
// unlikely to catch any mistakes.
- if (const PointerType *PT = Ty->getAs<PointerType>())
+ if (const PointerType *PT = Ty->getAsPointerType())
return PT->getPointeeType();
if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType())
@@ -5256,7 +5256,7 @@
continue;
}
- const RecordType *RC = Res->getType()->getAs<RecordType>();
+ const RecordType *RC = Res->getType()->getAsRecordType();
if (!RC) {
Res->Destroy(Context);
return ExprError(Diag(OC.LocEnd, diag::err_offsetof_record_type)
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jul 17 12:50:17 2009
@@ -83,7 +83,7 @@
Expr *E = static_cast<Expr *>(TyOrExpr);
if (E && !E->isTypeDependent() && E->isLvalue(Context) == Expr::LV_Valid) {
QualType T = E->getType();
- if (const RecordType *RecordT = T->getAs<RecordType>()) {
+ if (const RecordType *RecordT = T->getAsRecordType()) {
CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
if (RecordD->isPolymorphic())
isUnevaluatedOperand = false;
@@ -136,7 +136,7 @@
// to an incomplete type other than (cv) void the program is ill-formed.
QualType Ty = E->getType();
int isPointer = 0;
- if (const PointerType* Ptr = Ty->getAs<PointerType>()) {
+ if (const PointerType* Ptr = Ty->getAsPointerType()) {
Ty = Ptr->getPointeeType();
isPointer = 1;
}
@@ -211,7 +211,7 @@
RParenLoc));
}
- if (const RecordType *RT = Ty->getAs<RecordType>()) {
+ if (const RecordType *RT = Ty->getAsRecordType()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(RT->getDecl());
// FIXME: We should always create a CXXTemporaryObjectExpr here unless
@@ -414,7 +414,7 @@
if (AllocType->isDependentType()) {
// Skip all the checks.
}
- else if ((RT = AllocType->getAs<RecordType>()) &&
+ else if ((RT = AllocType->getAsRecordType()) &&
!AllocType->isAggregateType()) {
Constructor = PerformInitializationByConstructor(
AllocType, ConsArgs, NumConsArgs,
@@ -516,7 +516,7 @@
IsArray ? OO_Array_New : OO_New);
if (AllocType->isRecordType() && !UseGlobal) {
CXXRecordDecl *Record
- = cast<CXXRecordDecl>(AllocType->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(AllocType->getAsRecordType()->getDecl());
// FIXME: We fail to find inherited overloads.
if (FindAllocationOverload(StartLoc, Range, NewName, &AllocArgs[0],
AllocArgs.size(), Record, /*AllowMissing=*/true,
@@ -708,7 +708,7 @@
return ExprError(Diag(StartLoc, diag::err_delete_operand)
<< Type << Ex->getSourceRange());
- QualType Pointee = Type->getAs<PointerType>()->getPointeeType();
+ QualType Pointee = Type->getAsPointerType()->getPointeeType();
if (Pointee->isFunctionType() || Pointee->isVoidType())
return ExprError(Diag(StartLoc, diag::err_delete_operand)
<< Type << Ex->getSourceRange());
@@ -757,7 +757,7 @@
} else if (Ty->isArrayType()) { // ...or an array.
Diag(StartLoc, diag::err_invalid_use_of_array_type)
<< SourceRange(StartLoc, EqualLoc);
- } else if (const RecordType *RT = Ty->getAs<RecordType>()) {
+ } else if (const RecordType *RT = Ty->getAsRecordType()) {
RecordDecl *RD = RT->getDecl();
// The type-specifier-seq shall not declare a new class...
if (RD->isDefinition() &&
@@ -812,7 +812,7 @@
// string literal can be converted to an rvalue of type "pointer
// to wchar_t" (C++ 4.2p2).
if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From))
- if (const PointerType *ToPtrType = ToType->getAs<PointerType>())
+ if (const PointerType *ToPtrType = ToType->getAsPointerType())
if (const BuiltinType *ToPointeeType
= ToPtrType->getPointeeType()->getAsBuiltinType()) {
// This conversion is considered only when there is an
@@ -1051,7 +1051,7 @@
// be of type "pointer to member of T" (where T is a completely-defined
// class type) [...]
QualType RType = rex->getType();
- const MemberPointerType *MemPtr = RType->getAs<MemberPointerType>();
+ const MemberPointerType *MemPtr = RType->getAsMemberPointerType();
if (!MemPtr) {
Diag(Loc, diag::err_bad_memptr_rhs)
<< OpSpelling << RType << rex->getSourceRange();
@@ -1066,7 +1066,7 @@
// such a class]
QualType LType = lex->getType();
if (isIndirect) {
- if (const PointerType *Ptr = LType->getAs<PointerType>())
+ if (const PointerType *Ptr = LType->getAsPointerType())
LType = Ptr->getPointeeType().getNonReferenceType();
else {
Diag(Loc, diag::err_bad_memptr_lhs)
@@ -1163,8 +1163,8 @@
// the same or one is a base class of the other:
QualType FTy = From->getType();
QualType TTy = To->getType();
- const RecordType *FRec = FTy->getAs<RecordType>();
- const RecordType *TRec = TTy->getAs<RecordType>();
+ const RecordType *FRec = FTy->getAsRecordType();
+ const RecordType *TRec = TTy->getAsRecordType();
bool FDerivedFromT = FRec && TRec && Self.IsDerivedFrom(FTy, TTy);
if (FRec && TRec && (FRec == TRec ||
FDerivedFromT || Self.IsDerivedFrom(TTy, FTy))) {
@@ -1418,8 +1418,8 @@
// containing class, and second-level cv-ness.
// cv-ness is not a union, but must match one of the two operands. (Which,
// frankly, is stupid.)
- const MemberPointerType *LMemPtr = LTy->getAs<MemberPointerType>();
- const MemberPointerType *RMemPtr = RTy->getAs<MemberPointerType>();
+ const MemberPointerType *LMemPtr = LTy->getAsMemberPointerType();
+ const MemberPointerType *RMemPtr = RTy->getAsMemberPointerType();
if (LMemPtr && RHS->isNullPointerConstant(Context)) {
ImpCastExprToType(RHS, LTy);
return LTy;
@@ -1515,8 +1515,8 @@
llvm::SmallVector<unsigned, 4> QualifierUnion;
QualType Composite1 = T1, Composite2 = T2;
const PointerType *Ptr1, *Ptr2;
- while ((Ptr1 = Composite1->getAs<PointerType>()) &&
- (Ptr2 = Composite2->getAs<PointerType>())) {
+ while ((Ptr1 = Composite1->getAsPointerType()) &&
+ (Ptr2 = Composite2->getAsPointerType())) {
Composite1 = Ptr1->getPointeeType();
Composite2 = Ptr2->getPointeeType();
QualifierUnion.push_back(
@@ -1562,7 +1562,7 @@
}
Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
- const RecordType *RT = E->getType()->getAs<RecordType>();
+ const RecordType *RT = E->getType()->getAsRecordType();
if (!RT)
return Owned(E);
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Jul 17 12:50:17 2009
@@ -859,7 +859,7 @@
if (!lhs->isPointerType())
return false;
- QualType ltype = lhs->getAs<PointerType>()->getPointeeType();
+ QualType ltype = lhs->getAsPointerType()->getPointeeType();
if (const ObjCQualifiedInterfaceType *lhsQI =
ltype->getAsObjCQualifiedInterfaceType()) {
ObjCObjectPointerType::qual_iterator LHSProtoI = lhsQI->qual_begin();
Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInherit.cpp Fri Jul 17 12:50:17 2009
@@ -114,7 +114,7 @@
return false;
Paths.setOrigin(Derived);
- return LookupInBases(cast<CXXRecordDecl>(Derived->getAs<RecordType>()->getDecl()),
+ return LookupInBases(cast<CXXRecordDecl>(Derived->getAsRecordType()->getDecl()),
MemberLookupCriteria(Base), Paths);
}
@@ -156,7 +156,7 @@
if (Paths.isDetectingVirtual() && Paths.DetectedVirtual == 0) {
// If this is the first virtual we find, remember it. If it turns out
// there is no base path here, we'll reset it later.
- Paths.DetectedVirtual = BaseType->getAs<RecordType>();
+ Paths.DetectedVirtual = BaseType->getAsRecordType();
SetVirtual = true;
}
} else
@@ -175,7 +175,7 @@
}
CXXRecordDecl *BaseRecord
- = cast<CXXRecordDecl>(BaseSpec->getType()->getAs<RecordType>()->getDecl());
+ = cast<CXXRecordDecl>(BaseSpec->getType()->getAsRecordType()->getDecl());
// Either look at the base class type or look into the base class
// type to see if we've found a member that meets the search
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Jul 17 12:50:17 2009
@@ -162,7 +162,7 @@
if ((DeclTypeC.getUnqualifiedType() == InitTypeC.getUnqualifiedType()) ||
IsDerivedFrom(InitTypeC, DeclTypeC)) {
const CXXRecordDecl *RD =
- cast<CXXRecordDecl>(DeclType->getAs<RecordType>()->getDecl());
+ cast<CXXRecordDecl>(DeclType->getAsRecordType()->getDecl());
// No need to make a CXXConstructExpr if both the ctor and dtor are
// trivial.
@@ -341,7 +341,7 @@
if (ILE->getSyntacticForm())
Loc = ILE->getSyntacticForm()->getSourceRange().getBegin();
- if (const RecordType *RType = ILE->getType()->getAs<RecordType>()) {
+ if (const RecordType *RType = ILE->getType()->getAsRecordType()) {
unsigned Init = 0, NumInits = ILE->getNumInits();
for (RecordDecl::field_iterator
Field = RType->getDecl()->field_begin(),
@@ -447,7 +447,7 @@
}
int InitListChecker::numStructUnionElements(QualType DeclType) {
- RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *structDecl = DeclType->getAsRecordType()->getDecl();
int InitializableMembers = 0;
for (RecordDecl::field_iterator
Field = structDecl->field_begin(),
@@ -584,7 +584,7 @@
CheckVectorType(IList, DeclType, Index, StructuredList, StructuredIndex);
} else if (DeclType->isAggregateType()) {
if (DeclType->isRecordType()) {
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
CheckStructUnionTypes(IList, DeclType, RD->field_begin(),
SubobjectIsDesignatorContext, Index,
StructuredList, StructuredIndex,
@@ -939,7 +939,7 @@
InitListExpr *StructuredList,
unsigned &StructuredIndex,
bool TopLevelObject) {
- RecordDecl* structDecl = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl* structDecl = DeclType->getAsRecordType()->getDecl();
// If the record is invalid, some of it's members are invalid. To avoid
// confusion, we forgo checking the intializer for the entire record.
@@ -950,7 +950,7 @@
if (DeclType->isUnionType() && IList->getNumInits() == 0) {
// Value-initialize the first named member of the union.
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
for (RecordDecl::field_iterator FieldEnd = RD->field_end();
Field != FieldEnd; ++Field) {
if (Field->getDeclName()) {
@@ -965,7 +965,7 @@
// anything except look at designated initializers; That's okay,
// because an error should get printed out elsewhere. It might be
// worthwhile to skip over the rest of the initializer, though.
- RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
+ RecordDecl *RD = DeclType->getAsRecordType()->getDecl();
RecordDecl::field_iterator FieldEnd = RD->field_end();
bool InitializedSomething = false;
while (Index < IList->getNumInits()) {
@@ -1204,7 +1204,7 @@
// then the current object (defined below) shall have
// structure or union type and the identifier shall be the
// name of a member of that type.
- const RecordType *RT = CurrentObjectType->getAs<RecordType>();
+ const RecordType *RT = CurrentObjectType->getAsRecordType();
if (!RT) {
SourceLocation Loc = D->getDotLoc();
if (Loc.isInvalid())
@@ -1564,7 +1564,7 @@
}
} else if (const VectorType *VType = CurrentObjectType->getAsVectorType())
NumElements = VType->getNumElements();
- else if (const RecordType *RType = CurrentObjectType->getAs<RecordType>()) {
+ else if (const RecordType *RType = CurrentObjectType->getAsRecordType()) {
RecordDecl *RDecl = RType->getDecl();
if (RDecl->isUnion())
NumElements = 1;
@@ -1758,7 +1758,7 @@
if (const ArrayType *AT = Context.getAsArrayType(Type))
return CheckValueInitialization(AT->getElementType(), Loc);
- if (const RecordType *RT = Type->getAs<RecordType>()) {
+ if (const RecordType *RT = Type->getAsRecordType()) {
if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
// -- if T is a class type (clause 9) with a user-declared
// constructor (12.1), then the default constructor for T is
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Jul 17 12:50:17 2009
@@ -1387,7 +1387,7 @@
for (CXXRecordDecl::base_class_iterator Base = Class->bases_begin(),
BaseEnd = Class->bases_end();
Base != BaseEnd; ++Base) {
- const RecordType *BaseType = Base->getType()->getAs<RecordType>();
+ const RecordType *BaseType = Base->getType()->getAsRecordType();
CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(BaseType->getDecl());
if (AssociatedClasses.insert(BaseDecl)) {
// Find the associated namespace for this base class.
@@ -1435,7 +1435,7 @@
// We handle this by unwrapping pointer and array types immediately,
// to avoid unnecessary recursion.
while (true) {
- if (const PointerType *Ptr = T->getAs<PointerType>())
+ if (const PointerType *Ptr = T->getAsPointerType())
T = Ptr->getPointeeType();
else if (const ArrayType *Ptr = Context.getAsArrayType(T))
T = Ptr->getElementType();
@@ -1453,7 +1453,7 @@
// member, if any; and its direct and indirect base
// classes. Its associated namespaces are the namespaces in
// which its associated classes are defined.
- if (const RecordType *ClassType = T->getAs<RecordType>())
+ if (const RecordType *ClassType = T->getAsRecordType())
if (CXXRecordDecl *ClassDecl
= dyn_cast<CXXRecordDecl>(ClassType->getDecl())) {
addAssociatedClassesAndNamespaces(ClassDecl, Context,
@@ -1519,7 +1519,7 @@
// associated namespaces and classes are those associated
// with the member type together with those associated with
// X.
- if (const MemberPointerType *MemberPtr = T->getAs<MemberPointerType>()) {
+ if (const MemberPointerType *MemberPtr = T->getAsMemberPointerType()) {
// Handle the type that the pointer to member points to.
addAssociatedClassesAndNamespaces(MemberPtr->getPointeeType(),
Context,
@@ -1527,7 +1527,7 @@
GlobalScope);
// Handle the class type into which this points.
- if (const RecordType *Class = MemberPtr->getClass()->getAs<RecordType>())
+ if (const RecordType *Class = MemberPtr->getClass()->getAsRecordType())
addAssociatedClassesAndNamespaces(cast<CXXRecordDecl>(Class->getDecl()),
Context,
AssociatedNamespaces, AssociatedClasses,
Modified: cfe/trunk/lib/Sema/SemaNamedCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaNamedCast.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaNamedCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaNamedCast.cpp Fri Jul 17 12:50:17 2009
@@ -118,7 +118,7 @@
DestType = Self.Context.getCanonicalType(DestType);
QualType SrcType = SrcExpr->getType();
if (const LValueReferenceType *DestTypeTmp =
- DestType->getAs<LValueReferenceType>()) {
+ DestType->getAsLValueReferenceType()) {
if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
// Cannot cast non-lvalue to lvalue reference type.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
@@ -220,7 +220,7 @@
DestType = Self.Context.getCanonicalType(DestType);
QualType SrcType = SrcExpr->getType();
if (const LValueReferenceType *DestTypeTmp =
- DestType->getAs<LValueReferenceType>()) {
+ DestType->getAsLValueReferenceType()) {
if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
// Cannot cast non-lvalue to reference type.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
@@ -235,7 +235,7 @@
DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
SrcType = Self.Context.getPointerType(SrcType);
} else if (const RValueReferenceType *DestTypeTmp =
- DestType->getAs<RValueReferenceType>()) {
+ DestType->getAsRValueReferenceType()) {
// Both the reference conversion and the rvalue rules apply.
Self.DefaultFunctionArrayConversion(SrcExpr);
SrcType = SrcExpr->getType();
@@ -253,8 +253,8 @@
// Canonicalize source for comparison.
SrcType = Self.Context.getCanonicalType(SrcType);
- const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>(),
- *SrcMemPtr = SrcType->getAs<MemberPointerType>();
+ const MemberPointerType *DestMemPtr = DestType->getAsMemberPointerType(),
+ *SrcMemPtr = SrcType->getAsMemberPointerType();
if (DestMemPtr && SrcMemPtr) {
// C++ 5.2.10p9: An rvalue of type "pointer to member of X of type T1"
// can be explicitly converted to an rvalue of type "pointer to member
@@ -529,10 +529,10 @@
// Reverse pointer conversion to void*. C++ 4.10.p2 specifies conversion to
// void*. C++ 5.2.9p10 specifies additional restrictions, which really is
// just the usual constness stuff.
- if (const PointerType *SrcPointer = SrcType->getAs<PointerType>()) {
+ if (const PointerType *SrcPointer = SrcType->getAsPointerType()) {
QualType SrcPointee = SrcPointer->getPointeeType();
if (SrcPointee->isVoidType()) {
- if (const PointerType *DestPointer = DestType->getAs<PointerType>()) {
+ if (const PointerType *DestPointer = DestType->getAsPointerType()) {
QualType DestPointee = DestPointer->getPointeeType();
if (DestPointee->isIncompleteOrObjectType()) {
// This is definitely the intended conversion, but it might fail due
@@ -563,7 +563,7 @@
{
// N2844 5.2.9p3: An lvalue of type "cv1 T1" can be cast to type "rvalue
// reference to cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1".
- const RValueReferenceType *R = DestType->getAs<RValueReferenceType>();
+ const RValueReferenceType *R = DestType->getAsRValueReferenceType();
if (!R)
return TSC_NotApplicable;
@@ -604,7 +604,7 @@
return TSC_NotApplicable;
}
- const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
+ const ReferenceType *DestReference = DestType->getAsReferenceType();
if (!DestReference) {
return TSC_NotApplicable;
}
@@ -627,12 +627,12 @@
// In addition, DR54 clarifies that the base must be accessible in the
// current context.
- const PointerType *SrcPointer = SrcType->getAs<PointerType>();
+ const PointerType *SrcPointer = SrcType->getAsPointerType();
if (!SrcPointer) {
return TSC_NotApplicable;
}
- const PointerType *DestPointer = DestType->getAs<PointerType>();
+ const PointerType *DestPointer = DestType->getAsPointerType();
if (!DestPointer) {
return TSC_NotApplicable;
}
@@ -738,10 +738,10 @@
TryStaticMemberPointerUpcast(Sema &Self, QualType SrcType, QualType DestType,
const SourceRange &OpRange)
{
- const MemberPointerType *SrcMemPtr = SrcType->getAs<MemberPointerType>();
+ const MemberPointerType *SrcMemPtr = SrcType->getAsMemberPointerType();
if (!SrcMemPtr)
return TSC_NotApplicable;
- const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
+ const MemberPointerType *DestMemPtr = DestType->getAsMemberPointerType();
if (!DestMemPtr)
return TSC_NotApplicable;
@@ -828,8 +828,8 @@
// or "pointer to cv void".
QualType DestPointee;
- const PointerType *DestPointer = DestType->getAs<PointerType>();
- const ReferenceType *DestReference = DestType->getAs<ReferenceType>();
+ const PointerType *DestPointer = DestType->getAsPointerType();
+ const ReferenceType *DestReference = DestType->getAsReferenceType();
if (DestPointer) {
DestPointee = DestPointer->getPointeeType();
} else if (DestReference) {
@@ -840,7 +840,7 @@
return;
}
- const RecordType *DestRecord = DestPointee->getAs<RecordType>();
+ const RecordType *DestRecord = DestPointee->getAsRecordType();
if (DestPointee->isVoidType()) {
assert(DestPointer && "Reference to void is not possible");
} else if (DestRecord) {
@@ -863,7 +863,7 @@
QualType SrcType = Self.Context.getCanonicalType(OrigSrcType);
QualType SrcPointee;
if (DestPointer) {
- if (const PointerType *SrcPointer = SrcType->getAs<PointerType>()) {
+ if (const PointerType *SrcPointer = SrcType->getAsPointerType()) {
SrcPointee = SrcPointer->getPointeeType();
} else {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr)
@@ -880,7 +880,7 @@
SrcPointee = SrcType;
}
- const RecordType *SrcRecord = SrcPointee->getAs<RecordType>();
+ const RecordType *SrcRecord = SrcPointee->getAsRecordType();
if (SrcRecord) {
if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
diag::err_bad_dynamic_cast_incomplete,
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jul 17 12:50:17 2009
@@ -173,7 +173,7 @@
FromType = Context.getArrayDecayedType(FromType);
if (Second == ICK_Pointer_Conversion)
- if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
+ if (const PointerType* ToPtrType = ToType->getAsPointerType())
return ToPtrType->getPointeeType()->isVoidType();
return false;
@@ -915,7 +915,7 @@
// Blocks: Block pointers can be converted to void*.
if (FromType->isBlockPointerType() && ToType->isPointerType() &&
- ToType->getAs<PointerType>()->getPointeeType()->isVoidType()) {
+ ToType->getAsPointerType()->getPointeeType()->isVoidType()) {
ConvertedType = ToType;
return true;
}
@@ -933,7 +933,7 @@
return true;
}
- const PointerType* ToTypePtr = ToType->getAs<PointerType>();
+ const PointerType* ToTypePtr = ToType->getAsPointerType();
if (!ToTypePtr)
return false;
@@ -944,7 +944,7 @@
}
// Beyond this point, both types need to be pointers.
- const PointerType *FromTypePtr = FromType->getAs<PointerType>();
+ const PointerType *FromTypePtr = FromType->getAsPointerType();
if (!FromTypePtr)
return false;
@@ -1042,17 +1042,17 @@
}
// Beyond this point, both types need to be C pointers or block pointers.
QualType ToPointeeType;
- if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
+ if (const PointerType *ToCPtr = ToType->getAsPointerType())
ToPointeeType = ToCPtr->getPointeeType();
- else if (const BlockPointerType *ToBlockPtr = ToType->getAs<BlockPointerType>())
+ else if (const BlockPointerType *ToBlockPtr = ToType->getAsBlockPointerType())
ToPointeeType = ToBlockPtr->getPointeeType();
else
return false;
QualType FromPointeeType;
- if (const PointerType *FromCPtr = FromType->getAs<PointerType>())
+ if (const PointerType *FromCPtr = FromType->getAsPointerType())
FromPointeeType = FromCPtr->getPointeeType();
- else if (const BlockPointerType *FromBlockPtr = FromType->getAs<BlockPointerType>())
+ else if (const BlockPointerType *FromBlockPtr = FromType->getAsBlockPointerType())
FromPointeeType = FromBlockPtr->getPointeeType();
else
return false;
@@ -1142,8 +1142,8 @@
bool Sema::CheckPointerConversion(Expr *From, QualType ToType) {
QualType FromType = From->getType();
- if (const PointerType *FromPtrType = FromType->getAs<PointerType>())
- if (const PointerType *ToPtrType = ToType->getAs<PointerType>()) {
+ if (const PointerType *FromPtrType = FromType->getAsPointerType())
+ if (const PointerType *ToPtrType = ToType->getAsPointerType()) {
QualType FromPointeeType = FromPtrType->getPointeeType(),
ToPointeeType = ToPtrType->getPointeeType();
@@ -1178,7 +1178,7 @@
bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
QualType ToType, QualType &ConvertedType)
{
- const MemberPointerType *ToTypePtr = ToType->getAs<MemberPointerType>();
+ const MemberPointerType *ToTypePtr = ToType->getAsMemberPointerType();
if (!ToTypePtr)
return false;
@@ -1189,7 +1189,7 @@
}
// Otherwise, both types have to be member pointers.
- const MemberPointerType *FromTypePtr = FromType->getAs<MemberPointerType>();
+ const MemberPointerType *FromTypePtr = FromType->getAsMemberPointerType();
if (!FromTypePtr)
return false;
@@ -1216,11 +1216,11 @@
/// otherwise.
bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType) {
QualType FromType = From->getType();
- const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>();
+ const MemberPointerType *FromPtrType = FromType->getAsMemberPointerType();
if (!FromPtrType)
return false;
- const MemberPointerType *ToPtrType = ToType->getAs<MemberPointerType>();
+ const MemberPointerType *ToPtrType = ToType->getAsMemberPointerType();
assert(ToPtrType && "No member pointer cast has a target type "
"that is not a member pointer.");
@@ -1340,7 +1340,7 @@
bool AllowExplicit, bool ForceRValue)
{
OverloadCandidateSet CandidateSet;
- if (const RecordType *ToRecordType = ToType->getAs<RecordType>()) {
+ if (const RecordType *ToRecordType = ToType->getAsRecordType()) {
if (CXXRecordDecl *ToRecordDecl
= dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
// C++ [over.match.ctor]p1:
@@ -1369,7 +1369,7 @@
if (!AllowConversionFunctions) {
// Don't allow any conversion functions to enter the overload set.
} else if (const RecordType *FromRecordType
- = From->getType()->getAs<RecordType>()) {
+ = From->getType()->getAsRecordType()) {
if (CXXRecordDecl *FromRecordDecl
= dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
// Add all of the conversion functions as candidates.
@@ -1404,7 +1404,7 @@
User.ConversionFunction = Constructor;
User.After.setAsIdentityConversion();
User.After.FromTypePtr
- = ThisType->getAs<PointerType>()->getPointeeType().getAsOpaquePtr();
+ = ThisType->getAsPointerType()->getPointeeType().getAsOpaquePtr();
User.After.ToTypePtr = ToType.getAsOpaquePtr();
return true;
} else if (CXXConversionDecl *Conversion
@@ -1579,9 +1579,9 @@
FromType2 = Context.getArrayDecayedType(FromType2);
QualType FromPointee1
- = FromType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = FromType1->getAsPointerType()->getPointeeType().getUnqualifiedType();
QualType FromPointee2
- = FromType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = FromType2->getAsPointerType()->getPointeeType().getUnqualifiedType();
if (IsDerivedFrom(FromPointee2, FromPointee1))
return ImplicitConversionSequence::Better;
@@ -1771,13 +1771,13 @@
FromType1->isPointerType() && FromType2->isPointerType() &&
ToType1->isPointerType() && ToType2->isPointerType()) {
QualType FromPointee1
- = FromType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = FromType1->getAsPointerType()->getPointeeType().getUnqualifiedType();
QualType ToPointee1
- = ToType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = ToType1->getAsPointerType()->getPointeeType().getUnqualifiedType();
QualType FromPointee2
- = FromType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = FromType2->getAsPointerType()->getPointeeType().getUnqualifiedType();
QualType ToPointee2
- = ToType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
+ = ToType2->getAsPointerType()->getPointeeType().getUnqualifiedType();
const ObjCInterfaceType* FromIface1 = FromPointee1->getAsObjCInterfaceType();
const ObjCInterfaceType* FromIface2 = FromPointee2->getAsObjCInterfaceType();
@@ -1943,7 +1943,7 @@
// We need to have an object of class type.
QualType FromType = From->getType();
- if (const PointerType *PT = FromType->getAs<PointerType>())
+ if (const PointerType *PT = FromType->getAsPointerType())
FromType = PT->getPointeeType();
assert(FromType->isRecordType());
@@ -1991,9 +1991,9 @@
Sema::PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl *Method) {
QualType FromRecordType, DestType;
QualType ImplicitParamRecordType =
- Method->getThisType(Context)->getAs<PointerType>()->getPointeeType();
+ Method->getThisType(Context)->getAsPointerType()->getPointeeType();
- if (const PointerType *PT = From->getType()->getAs<PointerType>()) {
+ if (const PointerType *PT = From->getType()->getAsPointerType()) {
FromRecordType = PT->getPointeeType();
DestType = Method->getThisType(Context);
} else {
@@ -2500,7 +2500,7 @@
// (13.3.1.1.1); otherwise, the set of member candidates is
// empty.
// FIXME: Lookup in base classes, too!
- if (const RecordType *T1Rec = T1->getAs<RecordType>()) {
+ if (const RecordType *T1Rec = T1->getAsRecordType()) {
DeclContext::lookup_const_iterator Oper, OperEnd;
for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName);
Oper != OperEnd; ++Oper)
@@ -2634,7 +2634,7 @@
if (!PointerTypes.insert(Ty))
return false;
- if (const PointerType *PointerTy = Ty->getAs<PointerType>()) {
+ if (const PointerType *PointerTy = Ty->getAsPointerType()) {
QualType PointeeTy = PointerTy->getPointeeType();
// FIXME: Optimize this so that we don't keep trying to add the same types.
@@ -2668,7 +2668,7 @@
if (!MemberPointerTypes.insert(Ty))
return false;
- if (const MemberPointerType *PointerTy = Ty->getAs<MemberPointerType>()) {
+ if (const MemberPointerType *PointerTy = Ty->getAsMemberPointerType()) {
QualType PointeeTy = PointerTy->getPointeeType();
const Type *ClassTy = PointerTy->getClass();
// FIXME: Optimize this so that we don't keep trying to add the same types.
@@ -2704,13 +2704,13 @@
// Look through reference types; they aren't part of the type of an
// expression for the purposes of conversions.
- if (const ReferenceType *RefTy = Ty->getAs<ReferenceType>())
+ if (const ReferenceType *RefTy = Ty->getAsReferenceType())
Ty = RefTy->getPointeeType();
// We don't care about qualifiers on the type.
Ty = Ty.getUnqualifiedType();
- if (const PointerType *PointerTy = Ty->getAs<PointerType>()) {
+ if (const PointerType *PointerTy = Ty->getAsPointerType()) {
QualType PointeeTy = PointerTy->getPointeeType();
// Insert our type, and its more-qualified variants, into the set
@@ -2728,7 +2728,7 @@
// If this is a pointer to a class type, add pointers to its bases
// (with the same level of cv-qualification as the original
// derived class, of course).
- if (const RecordType *PointeeRec = PointeeTy->getAs<RecordType>()) {
+ if (const RecordType *PointeeRec = PointeeTy->getAsRecordType()) {
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(PointeeRec->getDecl());
for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
Base != ClassDecl->bases_end(); ++Base) {
@@ -2747,7 +2747,7 @@
} else if (Ty->isEnumeralType()) {
EnumerationTypes.insert(Ty);
} else if (AllowUserConversions) {
- if (const RecordType *TyRec = Ty->getAs<RecordType>()) {
+ if (const RecordType *TyRec = Ty->getAsRecordType()) {
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(TyRec->getDecl());
// FIXME: Visit conversion functions in the base classes, too.
OverloadedFunctionDecl *Conversions
@@ -2898,7 +2898,7 @@
for (BuiltinCandidateTypeSet::iterator Ptr = CandidateTypes.pointer_begin();
Ptr != CandidateTypes.pointer_end(); ++Ptr) {
// Skip pointer types that aren't pointers to object types.
- if (!(*Ptr)->getAs<PointerType>()->getPointeeType()->isObjectType())
+ if (!(*Ptr)->getAsPointerType()->getPointeeType()->isObjectType())
continue;
QualType ParamTypes[2] = {
@@ -2936,7 +2936,7 @@
for (BuiltinCandidateTypeSet::iterator Ptr = CandidateTypes.pointer_begin();
Ptr != CandidateTypes.pointer_end(); ++Ptr) {
QualType ParamTy = *Ptr;
- QualType PointeeTy = ParamTy->getAs<PointerType>()->getPointeeType();
+ QualType PointeeTy = ParamTy->getAsPointerType()->getPointeeType();
AddBuiltinCandidate(Context.getLValueReferenceType(PointeeTy),
&ParamTy, Args, 1, CandidateSet);
}
@@ -3336,7 +3336,7 @@
for (BuiltinCandidateTypeSet::iterator Ptr = CandidateTypes.pointer_begin();
Ptr != CandidateTypes.pointer_end(); ++Ptr) {
QualType ParamTypes[2] = { *Ptr, Context.getPointerDiffType() };
- QualType PointeeType = (*Ptr)->getAs<PointerType>()->getPointeeType();
+ QualType PointeeType = (*Ptr)->getAsPointerType()->getPointeeType();
QualType ResultTy = Context.getLValueReferenceType(PointeeType);
// T& operator[](T*, ptrdiff_t)
@@ -3616,15 +3616,15 @@
bool isRValueReference = false;
bool isPointer = false;
if (const LValueReferenceType *FnTypeRef =
- FnType->getAs<LValueReferenceType>()) {
+ FnType->getAsLValueReferenceType()) {
FnType = FnTypeRef->getPointeeType();
isLValueReference = true;
} else if (const RValueReferenceType *FnTypeRef =
- FnType->getAs<RValueReferenceType>()) {
+ FnType->getAsRValueReferenceType()) {
FnType = FnTypeRef->getPointeeType();
isRValueReference = true;
}
- if (const PointerType *FnTypePtr = FnType->getAs<PointerType>()) {
+ if (const PointerType *FnTypePtr = FnType->getAsPointerType()) {
FnType = FnTypePtr->getPointeeType();
isPointer = true;
}
@@ -3673,12 +3673,12 @@
bool Complain) {
QualType FunctionType = ToType;
bool IsMember = false;
- if (const PointerType *ToTypePtr = ToType->getAs<PointerType>())
+ if (const PointerType *ToTypePtr = ToType->getAsPointerType())
FunctionType = ToTypePtr->getPointeeType();
- else if (const ReferenceType *ToTypeRef = ToType->getAs<ReferenceType>())
+ else if (const ReferenceType *ToTypeRef = ToType->getAsReferenceType())
FunctionType = ToTypeRef->getPointeeType();
else if (const MemberPointerType *MemTypePtr =
- ToType->getAs<MemberPointerType>()) {
+ ToType->getAsMemberPointerType()) {
FunctionType = MemTypePtr->getPointeeType();
IsMember = true;
}
@@ -4367,7 +4367,7 @@
SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
assert(Object->getType()->isRecordType() && "Requires object type argument");
- const RecordType *Record = Object->getType()->getAs<RecordType>();
+ const RecordType *Record = Object->getType()->getAsRecordType();
// C++ [over.call.object]p1:
// If the primary-expression E in the function call syntax
@@ -4414,7 +4414,7 @@
// Strip the reference type (if any) and then the pointer type (if
// any) to get down to what might be a function type.
QualType ConvType = Conv->getConversionType().getNonReferenceType();
- if (const PointerType *ConvPtrType = ConvType->getAs<PointerType>())
+ if (const PointerType *ConvPtrType = ConvType->getAsPointerType())
ConvType = ConvPtrType->getPointeeType();
if (const FunctionProtoType *Proto = ConvType->getAsFunctionProtoType())
@@ -4579,7 +4579,7 @@
// FIXME: look in base classes.
DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Arrow);
OverloadCandidateSet CandidateSet;
- const RecordType *BaseRecord = Base->getType()->getAs<RecordType>();
+ const RecordType *BaseRecord = Base->getType()->getAsRecordType();
DeclContext::lookup_const_iterator Oper, OperEnd;
for (llvm::tie(Oper, OperEnd)
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Fri Jul 17 12:50:17 2009
@@ -1204,7 +1204,7 @@
QualType ThrowType = ThrowExpr->getType();
// Make sure the expression type is an ObjC pointer or "void *".
if (!ThrowType->isObjCObjectPointerType()) {
- const PointerType *PT = ThrowType->getAs<PointerType>();
+ const PointerType *PT = ThrowType->getAsPointerType();
if (!PT || !PT->getPointeeType()->isVoidType())
return StmtError(Diag(AtLoc, diag::error_objc_throw_expects_object)
<< ThrowExpr->getType() << ThrowExpr->getSourceRange());
@@ -1221,7 +1221,7 @@
// Make sure the expression type is an ObjC pointer or "void *".
Expr *SyncExpr = static_cast<Expr*>(SynchExpr.get());
if (!SyncExpr->getType()->isObjCObjectPointerType()) {
- const PointerType *PT = SyncExpr->getType()->getAs<PointerType>();
+ const PointerType *PT = SyncExpr->getType()->getAsPointerType();
if (!PT || !PT->getPointeeType()->isVoidType())
return StmtError(Diag(AtLoc, diag::error_objc_synchronized_expects_object)
<< SyncExpr->getType() << SyncExpr->getSourceRange());
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jul 17 12:50:17 2009
@@ -225,8 +225,8 @@
if (T->isIntegralType() || T->isEnumeralType() ||
// -- pointer to object or pointer to function,
(T->isPointerType() &&
- (T->getAs<PointerType>()->getPointeeType()->isObjectType() ||
- T->getAs<PointerType>()->getPointeeType()->isFunctionType())) ||
+ (T->getAsPointerType()->getPointeeType()->isObjectType() ||
+ T->getAsPointerType()->getPointeeType()->isFunctionType())) ||
// -- reference to object or reference to function,
T->isReferenceType() ||
// -- pointer to member.
@@ -1329,7 +1329,7 @@
const TagType *Tag = 0;
if (const EnumType *EnumT = Arg->getAsEnumType())
Tag = EnumT;
- else if (const RecordType *RecordT = Arg->getAs<RecordType>())
+ else if (const RecordType *RecordT = Arg->getAsRecordType())
Tag = RecordT;
if (Tag && Tag->getDecl()->getDeclContext()->isFunctionOrMethod())
return Diag(ArgLoc, diag::err_template_arg_local_type)
@@ -1648,13 +1648,13 @@
// function is selected from the set (13.4).
// In C++0x, any std::nullptr_t value can be converted.
(ParamType->isPointerType() &&
- ParamType->getAs<PointerType>()->getPointeeType()->isFunctionType()) ||
+ ParamType->getAsPointerType()->getPointeeType()->isFunctionType()) ||
// -- For a non-type template-parameter of type reference to
// function, no conversions apply. If the template-argument
// represents a set of overloaded functions, the matching
// function is selected from the set (13.4).
(ParamType->isReferenceType() &&
- ParamType->getAs<ReferenceType>()->getPointeeType()->isFunctionType()) ||
+ ParamType->getAsReferenceType()->getPointeeType()->isFunctionType()) ||
// -- For a non-type template-parameter of type pointer to
// member function, no conversions apply. If the
// template-argument represents a set of overloaded member
@@ -1662,7 +1662,7 @@
// the set (13.4).
// Again, C++0x allows a std::nullptr_t value.
(ParamType->isMemberPointerType() &&
- ParamType->getAs<MemberPointerType>()->getPointeeType()
+ ParamType->getAsMemberPointerType()->getPointeeType()
->isFunctionType())) {
if (Context.hasSameUnqualifiedType(ArgType,
ParamType.getNonReferenceType())) {
@@ -1721,7 +1721,7 @@
// object, qualification conversions (4.4) and the
// array-to-pointer conversion (4.2) are applied.
// C++0x also allows a value of std::nullptr_t.
- assert(ParamType->getAs<PointerType>()->getPointeeType()->isObjectType() &&
+ assert(ParamType->getAsPointerType()->getPointeeType()->isObjectType() &&
"Only object pointers allowed here");
if (ArgType->isNullPtrType()) {
@@ -1755,7 +1755,7 @@
return false;
}
- if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
+ if (const ReferenceType *ParamRefType = ParamType->getAsReferenceType()) {
// -- For a non-type template-parameter of type reference to
// object, no conversions apply. The type referred to by the
// reference may be more cv-qualified than the (otherwise
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Jul 17 12:50:17 2009
@@ -397,7 +397,7 @@
// T *
case Type::Pointer: {
- const PointerType *PointerArg = Arg->getAs<PointerType>();
+ const PointerType *PointerArg = Arg->getAsPointerType();
if (!PointerArg)
return Sema::TDK_NonDeducedMismatch;
@@ -410,7 +410,7 @@
// T &
case Type::LValueReference: {
- const LValueReferenceType *ReferenceArg = Arg->getAs<LValueReferenceType>();
+ const LValueReferenceType *ReferenceArg = Arg->getAsLValueReferenceType();
if (!ReferenceArg)
return Sema::TDK_NonDeducedMismatch;
@@ -422,7 +422,7 @@
// T && [C++0x]
case Type::RValueReference: {
- const RValueReferenceType *ReferenceArg = Arg->getAs<RValueReferenceType>();
+ const RValueReferenceType *ReferenceArg = Arg->getAsRValueReferenceType();
if (!ReferenceArg)
return Sema::TDK_NonDeducedMismatch;
@@ -615,7 +615,7 @@
Base != BaseEnd; ++Base) {
assert(Base->getType()->isRecordType() &&
"Base class that isn't a record?");
- ToVisit.push_back(Base->getType()->getAs<RecordType>());
+ ToVisit.push_back(Base->getType()->getAsRecordType());
}
}
@@ -1282,7 +1282,7 @@
// are ignored for type deduction.
if (CanonParamType.getCVRQualifiers())
ParamType = CanonParamType.getUnqualifiedType();
- if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
+ if (const ReferenceType *ParamRefType = ParamType->getAsReferenceType()) {
// [...] If P is a reference type, the type referred to by P is used
// for type deduction.
ParamType = ParamRefType->getPointeeType();
@@ -1320,7 +1320,7 @@
if (isSimpleTemplateIdType(ParamType) ||
(isa<PointerType>(ParamType) &&
isSimpleTemplateIdType(
- ParamType->getAs<PointerType>()->getPointeeType())))
+ ParamType->getAsPointerType()->getPointeeType())))
TDF |= TDF_DerivedClass;
if (TemplateDeductionResult Result
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=76193&r1=76192&r2=76193&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Jul 17 12:50:17 2009
@@ -300,8 +300,8 @@
if (TypeQuals & QualType::Restrict) {
if (Result->isPointerType() || Result->isReferenceType()) {
QualType EltTy = Result->isPointerType() ?
- Result->getAs<PointerType>()->getPointeeType() :
- Result->getAs<ReferenceType>()->getPointeeType();
+ Result->getAsPointerType()->getPointeeType() :
+ Result->getAsReferenceType()->getPointeeType();
// If we have a pointer or reference, the pointee must have an object
// incomplete type.
@@ -414,7 +414,7 @@
QualType Sema::BuildReferenceType(QualType T, bool LValueRef, unsigned Quals,
SourceLocation Loc, DeclarationName Entity) {
if (LValueRef) {
- if (const RValueReferenceType *R = T->getAs<RValueReferenceType>()) {
+ if (const RValueReferenceType *R = T->getAsRValueReferenceType()) {
// C++0x [dcl.typedef]p9: If a typedef TD names a type that is a
// reference to a type T, and attempt to create the type "lvalue
// reference to cv TD" creates the type "lvalue reference to T".
@@ -524,7 +524,7 @@
return QualType();
}
- if (const RecordType *EltTy = T->getAs<RecordType>()) {
+ if (const RecordType *EltTy = T->getAsRecordType()) {
// If the element type is a struct or union that contains a variadic
// array, accept it as a GNU extension: C99 6.7.2.1p2.
if (EltTy->getDecl()->hasFlexibleArrayMember())
@@ -1185,10 +1185,10 @@
// an incomplete type a pointer or reference to an incomplete type, other
// than (cv) void*.
int kind;
- if (const PointerType* IT = T->getAs<PointerType>()) {
+ if (const PointerType* IT = T->getAsPointerType()) {
T = IT->getPointeeType();
kind = 1;
- } else if (const ReferenceType* IT = T->getAs<ReferenceType>()) {
+ } else if (const ReferenceType* IT = T->getAsReferenceType()) {
T = IT->getPointeeType();
kind = 2;
} else
@@ -1205,9 +1205,9 @@
/// to member to a function with an exception specification. This means that
/// it is invalid to add another level of indirection.
bool Sema::CheckDistantExceptionSpec(QualType T) {
- if (const PointerType *PT = T->getAs<PointerType>())
+ if (const PointerType *PT = T->getAsPointerType())
T = PT->getPointeeType();
- else if (const MemberPointerType *PT = T->getAs<MemberPointerType>())
+ else if (const MemberPointerType *PT = T->getAsMemberPointerType())
T = PT->getPointeeType();
else
return false;
@@ -1285,9 +1285,9 @@
// Take one type from the subset.
QualType CanonicalSubT = Context.getCanonicalType(*SubI);
bool SubIsPointer = false;
- if (const ReferenceType *RefTy = CanonicalSubT->getAs<ReferenceType>())
+ if (const ReferenceType *RefTy = CanonicalSubT->getAsReferenceType())
CanonicalSubT = RefTy->getPointeeType();
- if (const PointerType *PtrTy = CanonicalSubT->getAs<PointerType>()) {
+ if (const PointerType *PtrTy = CanonicalSubT->getAsPointerType()) {
CanonicalSubT = PtrTy->getPointeeType();
SubIsPointer = true;
}
@@ -1305,10 +1305,10 @@
QualType CanonicalSuperT = Context.getCanonicalType(*SuperI);
// SubT must be SuperT or derived from it, or pointer or reference to
// such types.
- if (const ReferenceType *RefTy = CanonicalSuperT->getAs<ReferenceType>())
+ if (const ReferenceType *RefTy = CanonicalSuperT->getAsReferenceType())
CanonicalSuperT = RefTy->getPointeeType();
if (SubIsPointer) {
- if (const PointerType *PtrTy = CanonicalSuperT->getAs<PointerType>())
+ if (const PointerType *PtrTy = CanonicalSuperT->getAsPointerType())
CanonicalSuperT = PtrTy->getPointeeType();
else {
continue;
@@ -1384,16 +1384,16 @@
/// be called in a loop that successively "unwraps" pointer and
/// pointer-to-member types to compare them at each level.
bool Sema::UnwrapSimilarPointerTypes(QualType& T1, QualType& T2) {
- const PointerType *T1PtrType = T1->getAs<PointerType>(),
- *T2PtrType = T2->getAs<PointerType>();
+ const PointerType *T1PtrType = T1->getAsPointerType(),
+ *T2PtrType = T2->getAsPointerType();
if (T1PtrType && T2PtrType) {
T1 = T1PtrType->getPointeeType();
T2 = T2PtrType->getPointeeType();
return true;
}
- const MemberPointerType *T1MPType = T1->getAs<MemberPointerType>(),
- *T2MPType = T2->getAs<MemberPointerType>();
+ const MemberPointerType *T1MPType = T1->getAsMemberPointerType(),
+ *T2MPType = T2->getAsMemberPointerType();
if (T1MPType && T2MPType &&
Context.getCanonicalType(T1MPType->getClass()) ==
Context.getCanonicalType(T2MPType->getClass())) {
@@ -1567,7 +1567,7 @@
// If we have a class template specialization or a class member of a
// class template specialization, try to instantiate it.
- if (const RecordType *Record = T->getAs<RecordType>()) {
+ if (const RecordType *Record = T->getAsRecordType()) {
if (ClassTemplateSpecializationDecl *ClassTemplateSpec
= dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) {
if (ClassTemplateSpec->getSpecializationKind() == TSK_Undeclared) {
@@ -1603,7 +1603,7 @@
// If the type was a forward declaration of a class/struct/union
// type, produce
const TagType *Tag = 0;
- if (const RecordType *Record = T->getAs<RecordType>())
+ if (const RecordType *Record = T->getAsRecordType())
Tag = Record;
else if (const EnumType *Enum = T->getAsEnumType())
Tag = Enum;
More information about the cfe-commits
mailing list