diff options
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 7b45b21e5d..9894adf8d0 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1052,6 +1052,11 @@ TypeOfExprType::TypeOfExprType(Expr *E, QualType can) assert(!isa<TypedefType>(can) && "Invalid canonical type"); } +DecltypeType::DecltypeType(Expr *E, QualType can) + : Type(Decltype, can, E->isTypeDependent()), E(E) { + assert(!isa<TypedefType>(can) && "Invalid canonical type"); +} + TagType::TagType(TypeClass TC, TagDecl *D, QualType can) : Type(TC, can, D->isDependentType()), decl(D, 0) {} @@ -1421,6 +1426,16 @@ void TypeOfType::getAsStringInternal(std::string &InnerString, const PrintingPol InnerString = "typeof(" + Tmp + ")" + InnerString; } +void DecltypeType::getAsStringInternal(std::string &InnerString, + const PrintingPolicy &Policy) const { + if (!InnerString.empty()) // Prefix the basic type, e.g. 'decltype(t) X'. + InnerString = ' ' + InnerString; + std::string Str; + llvm::raw_string_ostream s(Str); + getUnderlyingExpr()->printPretty(s, 0, Policy); + InnerString = "decltype(" + s.str() + ")" + InnerString; +} + void FunctionNoProtoType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const { // If needed for precedence reasons, wrap the inner part in grouping parens. if (!S.empty()) |