change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 53f3102..0984ca0 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -569,7 +569,7 @@
OS << Node->getValue().toString(10, isSigned);
// Emit suffixes. Integer literals are always a builtin integer type.
- switch (cast<BuiltinType>(Node->getType().getCanonicalType())->getKind()) {
+ switch (Node->getType()->getAsBuiltinType()->getKind()) {
default: assert(0 && "Unexpected type for integer literal!");
case BuiltinType::Int: break; // no suffix.
case BuiltinType::UInt: OS << 'U'; break;
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 08f889a..d5bef07 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -171,6 +171,11 @@
return getDesugaredType()->getAsFunctionType();
}
+const FunctionTypeProto *Type::getAsFunctionTypeProto() const {
+ return dyn_cast_or_null<FunctionTypeProto>(getAsFunctionType());
+}
+
+
const PointerLikeType *Type::getAsPointerLikeType() const {
// If this is directly a pointer-like type, return it.
if (const PointerLikeType *PTy = dyn_cast<PointerLikeType>(this))