summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ExprCXX.cpp9
-rw-r--r--lib/AST/Interp/Program.cpp2
-rw-r--r--lib/AST/Mangle.cpp2
-rw-r--r--lib/AST/StmtPrinter.cpp8
-rw-r--r--lib/AST/TemplateBase.cpp2
-rw-r--r--lib/AST/TypePrinter.cpp2
6 files changed, 11 insertions, 14 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 1d5fd80d0d..cb6b8703f5 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -251,7 +251,7 @@ QualType CXXDeleteExpr::getDestroyedType() const {
if (ArgType->isDependentType() && !ArgType->isPointerType())
return QualType();
- return ArgType->getAs<PointerType>()->getPointeeType();
+ return ArgType->castAs<PointerType>()->getPointeeType();
}
// CXXPseudoDestructorExpr
@@ -1512,11 +1512,8 @@ CXXRecordDecl *UnresolvedMemberExpr::getNamingClass() {
// Otherwise the naming class must have been the base class.
else {
QualType BaseType = getBaseType().getNonReferenceType();
- if (isArrow()) {
- const auto *PT = BaseType->getAs<PointerType>();
- assert(PT && "base of arrow member access is not pointer");
- BaseType = PT->getPointeeType();
- }
+ if (isArrow())
+ BaseType = BaseType->castAs<PointerType>()->getPointeeType();
Record = BaseType->getAsCXXRecordDecl();
assert(Record && "base of member expression does not name record");
diff --git a/lib/AST/Interp/Program.cpp b/lib/AST/Interp/Program.cpp
index d947b4746f..fcbab0ea81 100644
--- a/lib/AST/Interp/Program.cpp
+++ b/lib/AST/Interp/Program.cpp
@@ -123,7 +123,7 @@ llvm::Optional<unsigned> Program::getOrCreateDummy(const ParmVarDecl *PD) {
auto &ASTCtx = Ctx.getASTContext();
// Create a pointer to an incomplete array of the specified elements.
- QualType ElemTy = PD->getType()->getAs<PointerType>()->getPointeeType();
+ QualType ElemTy = PD->getType()->castAs<PointerType>()->getPointeeType();
QualType Ty = ASTCtx.getIncompleteArrayType(ElemTy, ArrayType::Normal, 0);
// Dedup blocks since they are immutable and pointers cannot be compared.
diff --git a/lib/AST/Mangle.cpp b/lib/AST/Mangle.cpp
index b158fe85a4..32d466cb57 100644
--- a/lib/AST/Mangle.cpp
+++ b/lib/AST/Mangle.cpp
@@ -386,7 +386,7 @@ public:
auto hasDefaultCXXMethodCC = [](ASTContext &C, const CXXMethodDecl *MD) {
auto DefaultCC = C.getDefaultCallingConvention(/*IsVariadic=*/false,
/*IsCXXMethod=*/true);
- auto CC = MD->getType()->getAs<FunctionProtoType>()->getCallConv();
+ auto CC = MD->getType()->castAs<FunctionProtoType>()->getCallConv();
return CC == DefaultCC;
};
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 46802d765e..e86f9c7063 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -1102,7 +1102,7 @@ void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
OS << Node->getValue().toString(10, isSigned);
// Emit suffixes. Integer literals are always a builtin integer type.
- switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
+ switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
default: llvm_unreachable("Unexpected type for integer literal!");
case BuiltinType::Char_S:
case BuiltinType::Char_U: OS << "i8"; break;
@@ -1123,7 +1123,7 @@ void StmtPrinter::VisitFixedPointLiteral(FixedPointLiteral *Node) {
return;
OS << Node->getValueAsString(/*Radix=*/10);
- switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
+ switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
default: llvm_unreachable("Unexpected type for fixed point literal!");
case BuiltinType::ShortFract: OS << "hr"; break;
case BuiltinType::ShortAccum: OS << "hk"; break;
@@ -1152,7 +1152,7 @@ static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
return;
// Emit suffixes. Float literals are always a builtin float type.
- switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
+ switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
default: llvm_unreachable("Unexpected type for float literal!");
case BuiltinType::Half: break; // FIXME: suffix?
case BuiltinType::Double: break; // no suffix.
@@ -1952,7 +1952,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
if (Node->isMutable())
OS << " mutable";
- auto *Proto = Method->getType()->getAs<FunctionProtoType>();
+ auto *Proto = Method->getType()->castAs<FunctionProtoType>();
Proto->printExceptionSpecification(OS, Policy);
// FIXME: Attributes
diff --git a/lib/AST/TemplateBase.cpp b/lib/AST/TemplateBase.cpp
index cb4cbd2f76..db16c2a06b 100644
--- a/lib/AST/TemplateBase.cpp
+++ b/lib/AST/TemplateBase.cpp
@@ -370,7 +370,7 @@ TemplateArgument TemplateArgument::getPackExpansionPattern() const {
switch (getKind()) {
case Type:
- return getAsType()->getAs<PackExpansionType>()->getPattern();
+ return getAsType()->castAs<PackExpansionType>()->getPattern();
case Expression:
return cast<PackExpansionExpr>(getAsExpr())->getPattern();
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 9c6a3dfeb8..d7b7103faa 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -1537,7 +1537,7 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
QualType t = T->getEquivalentType();
while (!t->isFunctionType())
t = t->getPointeeType();
- OS << (t->getAs<FunctionType>()->getCallConv() == CC_AAPCS ?
+ OS << (t->castAs<FunctionType>()->getCallConv() == CC_AAPCS ?
"\"aapcs\"" : "\"aapcs-vfp\"");
OS << ')';
break;