|
@@ -1,4 +1,4 @@
|
|
|
-//===--- TypePrinter.cpp - Pretty-Print Clang Types -----------------------===//
|
|
|
+//===- TypePrinter.cpp - Pretty-Print Clang Types -------------------------===//
|
|
|
//
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
//
|
|
@@ -14,19 +14,39 @@
|
|
|
#include "clang/AST/PrettyPrinter.h"
|
|
|
#include "clang/AST/ASTContext.h"
|
|
|
#include "clang/AST/Decl.h"
|
|
|
+#include "clang/AST/DeclBase.h"
|
|
|
+#include "clang/AST/DeclCXX.h"
|
|
|
#include "clang/AST/DeclObjC.h"
|
|
|
#include "clang/AST/DeclTemplate.h"
|
|
|
#include "clang/AST/Expr.h"
|
|
|
+#include "clang/AST/NestedNameSpecifier.h"
|
|
|
+#include "clang/AST/TemplateBase.h"
|
|
|
+#include "clang/AST/TemplateName.h"
|
|
|
#include "clang/AST/Type.h"
|
|
|
+#include "clang/Basic/AddressSpaces.h"
|
|
|
+#include "clang/Basic/ExceptionSpecificationType.h"
|
|
|
+#include "clang/Basic/IdentifierTable.h"
|
|
|
+#include "clang/Basic/LLVM.h"
|
|
|
#include "clang/Basic/LangOptions.h"
|
|
|
+#include "clang/Basic/SourceLocation.h"
|
|
|
#include "clang/Basic/SourceManager.h"
|
|
|
+#include "clang/Basic/Specifiers.h"
|
|
|
+#include "llvm/ADT/ArrayRef.h"
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
-#include "llvm/ADT/StringExtras.h"
|
|
|
+#include "llvm/ADT/StringRef.h"
|
|
|
+#include "llvm/ADT/Twine.h"
|
|
|
+#include "llvm/Support/Casting.h"
|
|
|
+#include "llvm/Support/Compiler.h"
|
|
|
+#include "llvm/Support/ErrorHandling.h"
|
|
|
#include "llvm/Support/SaveAndRestore.h"
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
+#include <cassert>
|
|
|
+#include <string>
|
|
|
+
|
|
|
using namespace clang;
|
|
|
|
|
|
namespace {
|
|
|
+
|
|
|
/// \brief RAII object that enables printing of the ARC __strong lifetime
|
|
|
/// qualifier.
|
|
|
class IncludeStrongLifetimeRAII {
|
|
@@ -35,7 +55,7 @@ namespace {
|
|
|
|
|
|
public:
|
|
|
explicit IncludeStrongLifetimeRAII(PrintingPolicy &Policy)
|
|
|
- : Policy(Policy), Old(Policy.SuppressStrongLifetime) {
|
|
|
+ : Policy(Policy), Old(Policy.SuppressStrongLifetime) {
|
|
|
if (!Policy.SuppressLifetimeQualifiers)
|
|
|
Policy.SuppressStrongLifetime = false;
|
|
|
}
|
|
@@ -51,7 +71,7 @@ namespace {
|
|
|
|
|
|
public:
|
|
|
explicit ParamPolicyRAII(PrintingPolicy &Policy)
|
|
|
- : Policy(Policy), Old(Policy.SuppressSpecifiers) {
|
|
|
+ : Policy(Policy), Old(Policy.SuppressSpecifiers) {
|
|
|
Policy.SuppressSpecifiers = false;
|
|
|
}
|
|
|
|
|
@@ -82,13 +102,12 @@ namespace {
|
|
|
class TypePrinter {
|
|
|
PrintingPolicy Policy;
|
|
|
unsigned Indentation;
|
|
|
- bool HasEmptyPlaceHolder;
|
|
|
- bool InsideCCAttribute;
|
|
|
+ bool HasEmptyPlaceHolder = false;
|
|
|
+ bool InsideCCAttribute = false;
|
|
|
|
|
|
public:
|
|
|
explicit TypePrinter(const PrintingPolicy &Policy, unsigned Indentation = 0)
|
|
|
- : Policy(Policy), Indentation(Indentation),
|
|
|
- HasEmptyPlaceHolder(false), InsideCCAttribute(false) { }
|
|
|
+ : Policy(Policy), Indentation(Indentation) {}
|
|
|
|
|
|
void print(const Type *ty, Qualifiers qs, raw_ostream &OS,
|
|
|
StringRef PlaceHolder);
|
|
@@ -111,7 +130,8 @@ namespace {
|
|
|
void print##CLASS##After(const CLASS##Type *T, raw_ostream &OS);
|
|
|
#include "clang/AST/TypeNodes.def"
|
|
|
};
|
|
|
-}
|
|
|
+
|
|
|
+} // namespace
|
|
|
|
|
|
static void AppendTypeQualList(raw_ostream &OS, unsigned TypeQuals,
|
|
|
bool HasRestrictKeyword) {
|
|
@@ -169,10 +189,9 @@ bool TypePrinter::canPrefixQualifiers(const Type *T,
|
|
|
bool CanPrefixQualifiers = false;
|
|
|
NeedARCStrongQualifier = false;
|
|
|
Type::TypeClass TC = T->getTypeClass();
|
|
|
- if (const AutoType *AT = dyn_cast<AutoType>(T))
|
|
|
+ if (const auto *AT = dyn_cast<AutoType>(T))
|
|
|
TC = AT->desugar()->getTypeClass();
|
|
|
- if (const SubstTemplateTypeParmType *Subst
|
|
|
- = dyn_cast<SubstTemplateTypeParmType>(T))
|
|
|
+ if (const auto *Subst = dyn_cast<SubstTemplateTypeParmType>(T))
|
|
|
TC = Subst->getReplacementType()->getTypeClass();
|
|
|
|
|
|
switch (TC) {
|
|
@@ -245,8 +264,7 @@ void TypePrinter::printBefore(QualType T, raw_ostream &OS) {
|
|
|
// If we have cv1 T, where T is substituted for cv2 U, only print cv1 - cv2
|
|
|
// at this level.
|
|
|
Qualifiers Quals = Split.Quals;
|
|
|
- if (const SubstTemplateTypeParmType *Subst =
|
|
|
- dyn_cast<SubstTemplateTypeParmType>(Split.Ty))
|
|
|
+ if (const auto *Subst = dyn_cast<SubstTemplateTypeParmType>(Split.Ty))
|
|
|
Quals -= QualType(Subst, 0).getQualifiers();
|
|
|
|
|
|
printBefore(Split.Ty, Quals, OS);
|
|
@@ -321,12 +339,14 @@ void TypePrinter::printBuiltinBefore(const BuiltinType *T, raw_ostream &OS) {
|
|
|
OS << T->getName(Policy);
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
-void TypePrinter::printBuiltinAfter(const BuiltinType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printBuiltinAfter(const BuiltinType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printComplexBefore(const ComplexType *T, raw_ostream &OS) {
|
|
|
OS << "_Complex ";
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printComplexAfter(const ComplexType *T, raw_ostream &OS) {
|
|
|
printAfter(T->getElementType(), OS);
|
|
|
}
|
|
@@ -341,6 +361,7 @@ void TypePrinter::printPointerBefore(const PointerType *T, raw_ostream &OS) {
|
|
|
OS << '(';
|
|
|
OS << '*';
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printPointerAfter(const PointerType *T, raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
@@ -357,6 +378,7 @@ void TypePrinter::printBlockPointerBefore(const BlockPointerType *T,
|
|
|
printBefore(T->getPointeeType(), OS);
|
|
|
OS << '^';
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printBlockPointerAfter(const BlockPointerType *T,
|
|
|
raw_ostream &OS) {
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
@@ -374,6 +396,7 @@ void TypePrinter::printLValueReferenceBefore(const LValueReferenceType *T,
|
|
|
OS << '(';
|
|
|
OS << '&';
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printLValueReferenceAfter(const LValueReferenceType *T,
|
|
|
raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
@@ -396,6 +419,7 @@ void TypePrinter::printRValueReferenceBefore(const RValueReferenceType *T,
|
|
|
OS << '(';
|
|
|
OS << "&&";
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printRValueReferenceAfter(const RValueReferenceType *T,
|
|
|
raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
@@ -423,6 +447,7 @@ void TypePrinter::printMemberPointerBefore(const MemberPointerType *T,
|
|
|
|
|
|
OS << "::*";
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printMemberPointerAfter(const MemberPointerType *T,
|
|
|
raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
@@ -440,6 +465,7 @@ void TypePrinter::printConstantArrayBefore(const ConstantArrayType *T,
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printConstantArrayAfter(const ConstantArrayType *T,
|
|
|
raw_ostream &OS) {
|
|
|
OS << '[';
|
|
@@ -462,6 +488,7 @@ void TypePrinter::printIncompleteArrayBefore(const IncompleteArrayType *T,
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printIncompleteArrayAfter(const IncompleteArrayType *T,
|
|
|
raw_ostream &OS) {
|
|
|
OS << "[]";
|
|
@@ -474,6 +501,7 @@ void TypePrinter::printVariableArrayBefore(const VariableArrayType *T,
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printVariableArrayAfter(const VariableArrayType *T,
|
|
|
raw_ostream &OS) {
|
|
|
OS << '[';
|
|
@@ -499,6 +527,7 @@ void TypePrinter::printAdjustedBefore(const AdjustedType *T, raw_ostream &OS) {
|
|
|
// invisible.
|
|
|
printBefore(T->getAdjustedType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printAdjustedAfter(const AdjustedType *T, raw_ostream &OS) {
|
|
|
printAfter(T->getAdjustedType(), OS);
|
|
|
}
|
|
@@ -507,6 +536,7 @@ void TypePrinter::printDecayedBefore(const DecayedType *T, raw_ostream &OS) {
|
|
|
// Print as though it's a pointer.
|
|
|
printAdjustedBefore(T, OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDecayedAfter(const DecayedType *T, raw_ostream &OS) {
|
|
|
printAdjustedAfter(T, OS);
|
|
|
}
|
|
@@ -518,6 +548,7 @@ void TypePrinter::printDependentSizedArrayBefore(
|
|
|
SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDependentSizedArrayAfter(
|
|
|
const DependentSizedArrayType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -532,6 +563,7 @@ void TypePrinter::printDependentAddressSpaceBefore(
|
|
|
const DependentAddressSpaceType *T, raw_ostream &OS) {
|
|
|
printBefore(T->getPointeeType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDependentAddressSpaceAfter(
|
|
|
const DependentAddressSpaceType *T, raw_ostream &OS) {
|
|
|
OS << " __attribute__((address_space(";
|
|
@@ -546,6 +578,7 @@ void TypePrinter::printDependentSizedExtVectorBefore(
|
|
|
raw_ostream &OS) {
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDependentSizedExtVectorAfter(
|
|
|
const DependentSizedExtVectorType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -592,6 +625,7 @@ void TypePrinter::printVectorBefore(const VectorType *T, raw_ostream &OS) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printVectorAfter(const VectorType *T, raw_ostream &OS) {
|
|
|
printAfter(T->getElementType(), OS);
|
|
|
}
|
|
@@ -600,6 +634,7 @@ void TypePrinter::printExtVectorBefore(const ExtVectorType *T,
|
|
|
raw_ostream &OS) {
|
|
|
printBefore(T->getElementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) {
|
|
|
printAfter(T->getElementType(), OS);
|
|
|
OS << " __attribute__((ext_vector_type(";
|
|
@@ -611,7 +646,6 @@ void
|
|
|
FunctionProtoType::printExceptionSpecification(raw_ostream &OS,
|
|
|
const PrintingPolicy &Policy)
|
|
|
const {
|
|
|
-
|
|
|
if (hasDynamicExceptionSpec()) {
|
|
|
OS << " throw(";
|
|
|
if (getExceptionSpecType() == EST_MSAny)
|
|
@@ -650,7 +684,7 @@ void TypePrinter::printFunctionProtoBefore(const FunctionProtoType *T,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-llvm::StringRef clang::getParameterABISpelling(ParameterABI ABI) {
|
|
|
+StringRef clang::getParameterABISpelling(ParameterABI ABI) {
|
|
|
switch (ABI) {
|
|
|
case ParameterABI::Ordinary:
|
|
|
llvm_unreachable("asking for spelling of ordinary parameter ABI");
|
|
@@ -813,6 +847,7 @@ void TypePrinter::printFunctionNoProtoBefore(const FunctionNoProtoType *T,
|
|
|
if (!PrevPHIsEmpty.get())
|
|
|
OS << '(';
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printFunctionNoProtoAfter(const FunctionNoProtoType *T,
|
|
|
raw_ostream &OS) {
|
|
|
// If needed for precedence reasons, wrap the inner part in grouping parens.
|
|
@@ -842,13 +877,15 @@ void TypePrinter::printUnresolvedUsingBefore(const UnresolvedUsingType *T,
|
|
|
raw_ostream &OS) {
|
|
|
printTypeSpec(T->getDecl(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printUnresolvedUsingAfter(const UnresolvedUsingType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printTypedefBefore(const TypedefType *T, raw_ostream &OS) {
|
|
|
printTypeSpec(T->getDecl(), OS);
|
|
|
}
|
|
|
-void TypePrinter::printTypedefAfter(const TypedefType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printTypedefAfter(const TypedefType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printTypeOfExprBefore(const TypeOfExprType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -857,8 +894,9 @@ void TypePrinter::printTypeOfExprBefore(const TypeOfExprType *T,
|
|
|
T->getUnderlyingExpr()->printPretty(OS, nullptr, Policy);
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printTypeOfExprAfter(const TypeOfExprType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printTypeOfBefore(const TypeOfType *T, raw_ostream &OS) {
|
|
|
OS << "typeof(";
|
|
@@ -866,7 +904,8 @@ void TypePrinter::printTypeOfBefore(const TypeOfType *T, raw_ostream &OS) {
|
|
|
OS << ')';
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
-void TypePrinter::printTypeOfAfter(const TypeOfType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printTypeOfAfter(const TypeOfType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printDecltypeBefore(const DecltypeType *T, raw_ostream &OS) {
|
|
|
OS << "decltype(";
|
|
@@ -875,7 +914,8 @@ void TypePrinter::printDecltypeBefore(const DecltypeType *T, raw_ostream &OS) {
|
|
|
OS << ')';
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
-void TypePrinter::printDecltypeAfter(const DecltypeType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printDecltypeAfter(const DecltypeType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printUnaryTransformBefore(const UnaryTransformType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -892,6 +932,7 @@ void TypePrinter::printUnaryTransformBefore(const UnaryTransformType *T,
|
|
|
|
|
|
printBefore(T->getBaseType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printUnaryTransformAfter(const UnaryTransformType *T,
|
|
|
raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
@@ -917,6 +958,7 @@ void TypePrinter::printAutoBefore(const AutoType *T, raw_ostream &OS) {
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printAutoAfter(const AutoType *T, raw_ostream &OS) {
|
|
|
// If the type has been deduced, do not print 'auto'.
|
|
|
if (!T->getDeducedType().isNull())
|
|
@@ -934,6 +976,7 @@ void TypePrinter::printDeducedTemplateSpecializationBefore(
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDeducedTemplateSpecializationAfter(
|
|
|
const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
|
|
|
// If the type has been deduced, print the deduced type.
|
|
@@ -949,7 +992,8 @@ void TypePrinter::printAtomicBefore(const AtomicType *T, raw_ostream &OS) {
|
|
|
OS << ')';
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
-void TypePrinter::printAtomicAfter(const AtomicType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printAtomicAfter(const AtomicType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream &OS) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
@@ -963,15 +1007,15 @@ void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream &OS) {
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
|
|
|
-void TypePrinter::printPipeAfter(const PipeType *T, raw_ostream &OS) {
|
|
|
-}
|
|
|
+void TypePrinter::printPipeAfter(const PipeType *T, raw_ostream &OS) {}
|
|
|
+
|
|
|
/// Appends the given scope to the end of a string.
|
|
|
void TypePrinter::AppendScope(DeclContext *DC, raw_ostream &OS) {
|
|
|
if (DC->isTranslationUnit()) return;
|
|
|
if (DC->isFunctionOrMethod()) return;
|
|
|
AppendScope(DC->getParent(), OS);
|
|
|
|
|
|
- if (NamespaceDecl *NS = dyn_cast<NamespaceDecl>(DC)) {
|
|
|
+ if (const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
|
|
|
if (Policy.SuppressUnwrittenScope &&
|
|
|
(NS->isAnonymousNamespace() || NS->isInline()))
|
|
|
return;
|
|
@@ -979,14 +1023,13 @@ void TypePrinter::AppendScope(DeclContext *DC, raw_ostream &OS) {
|
|
|
OS << NS->getName() << "::";
|
|
|
else
|
|
|
OS << "(anonymous namespace)::";
|
|
|
- } else if (ClassTemplateSpecializationDecl *Spec
|
|
|
- = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
|
|
|
+ } else if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
|
OS << Spec->getIdentifier()->getName();
|
|
|
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
|
|
|
printTemplateArgumentList(OS, TemplateArgs.asArray(), Policy);
|
|
|
OS << "::";
|
|
|
- } else if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
|
|
|
+ } else if (const auto *Tag = dyn_cast<TagDecl>(DC)) {
|
|
|
if (TypedefNameDecl *Typedef = Tag->getTypedefNameForAnonDecl())
|
|
|
OS << Typedef->getIdentifier()->getName() << "::";
|
|
|
else if (Tag->getIdentifier())
|
|
@@ -1059,8 +1102,7 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
|
|
|
|
|
|
// If this is a class template specialization, print the template
|
|
|
// arguments.
|
|
|
- if (ClassTemplateSpecializationDecl *Spec
|
|
|
- = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
|
|
|
+ if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
|
|
|
ArrayRef<TemplateArgument> Args;
|
|
|
if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) {
|
|
|
const TemplateSpecializationType *TST =
|
|
@@ -1080,12 +1122,14 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
|
|
|
void TypePrinter::printRecordBefore(const RecordType *T, raw_ostream &OS) {
|
|
|
printTag(T->getDecl(), OS);
|
|
|
}
|
|
|
-void TypePrinter::printRecordAfter(const RecordType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printRecordAfter(const RecordType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printEnumBefore(const EnumType *T, raw_ostream &OS) {
|
|
|
printTag(T->getDecl(), OS);
|
|
|
}
|
|
|
-void TypePrinter::printEnumAfter(const EnumType *T, raw_ostream &OS) { }
|
|
|
+
|
|
|
+void TypePrinter::printEnumAfter(const EnumType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printTemplateTypeParmBefore(const TemplateTypeParmType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1095,8 +1139,9 @@ void TypePrinter::printTemplateTypeParmBefore(const TemplateTypeParmType *T,
|
|
|
OS << "type-parameter-" << T->getDepth() << '-' << T->getIndex();
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printTemplateTypeParmAfter(const TemplateTypeParmType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printSubstTemplateTypeParmBefore(
|
|
|
const SubstTemplateTypeParmType *T,
|
|
@@ -1104,6 +1149,7 @@ void TypePrinter::printSubstTemplateTypeParmBefore(
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
|
printBefore(T->getReplacementType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printSubstTemplateTypeParmAfter(
|
|
|
const SubstTemplateTypeParmType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1117,6 +1163,7 @@ void TypePrinter::printSubstTemplateTypeParmPackBefore(
|
|
|
IncludeStrongLifetimeRAII Strong(Policy);
|
|
|
printTemplateTypeParmBefore(T->getReplacedParameter(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printSubstTemplateTypeParmPackAfter(
|
|
|
const SubstTemplateTypeParmPackType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1133,16 +1180,18 @@ void TypePrinter::printTemplateSpecializationBefore(
|
|
|
printTemplateArgumentList(OS, T->template_arguments(), Policy);
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printTemplateSpecializationAfter(
|
|
|
const TemplateSpecializationType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printInjectedClassNameBefore(const InjectedClassNameType *T,
|
|
|
raw_ostream &OS) {
|
|
|
printTemplateSpecializationBefore(T->getInjectedTST(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printInjectedClassNameAfter(const InjectedClassNameType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printElaboratedBefore(const ElaboratedType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1152,7 +1201,7 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T,
|
|
|
OS << TypeWithKeyword::getKeywordName(T->getKeyword());
|
|
|
if (T->getKeyword() != ETK_None)
|
|
|
OS << " ";
|
|
|
- NestedNameSpecifier* Qualifier = T->getQualifier();
|
|
|
+ NestedNameSpecifier *Qualifier = T->getQualifier();
|
|
|
if (Qualifier)
|
|
|
Qualifier->print(OS, Policy);
|
|
|
}
|
|
@@ -1160,6 +1209,7 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T,
|
|
|
ElaboratedTypePolicyRAII PolicyRAII(Policy);
|
|
|
printBefore(T->getNamedType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printElaboratedAfter(const ElaboratedType *T,
|
|
|
raw_ostream &OS) {
|
|
|
ElaboratedTypePolicyRAII PolicyRAII(Policy);
|
|
@@ -1173,6 +1223,7 @@ void TypePrinter::printParenBefore(const ParenType *T, raw_ostream &OS) {
|
|
|
} else
|
|
|
printBefore(T->getInnerType(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printParenAfter(const ParenType *T, raw_ostream &OS) {
|
|
|
if (!HasEmptyPlaceHolder && !isa<FunctionType>(T->getInnerType())) {
|
|
|
OS << ')';
|
|
@@ -1192,8 +1243,9 @@ void TypePrinter::printDependentNameBefore(const DependentNameType *T,
|
|
|
OS << T->getIdentifier()->getName();
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printDependentNameAfter(const DependentNameType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printDependentTemplateSpecializationBefore(
|
|
|
const DependentTemplateSpecializationType *T, raw_ostream &OS) {
|
|
@@ -1211,12 +1263,13 @@ void TypePrinter::printDependentTemplateSpecializationBefore(
|
|
|
}
|
|
|
|
|
|
void TypePrinter::printDependentTemplateSpecializationAfter(
|
|
|
- const DependentTemplateSpecializationType *T, raw_ostream &OS) { }
|
|
|
+ const DependentTemplateSpecializationType *T, raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printPackExpansionBefore(const PackExpansionType *T,
|
|
|
raw_ostream &OS) {
|
|
|
printBefore(T->getPattern(), OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printPackExpansionAfter(const PackExpansionType *T,
|
|
|
raw_ostream &OS) {
|
|
|
printAfter(T->getPattern(), OS);
|
|
@@ -1325,9 +1378,9 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
|
|
|
OS << ')';
|
|
|
break;
|
|
|
|
|
|
- case AttributedType::attr_vector_size: {
|
|
|
+ case AttributedType::attr_vector_size:
|
|
|
OS << "__vector_size__(";
|
|
|
- if (const VectorType *vector =T->getEquivalentType()->getAs<VectorType>()) {
|
|
|
+ if (const auto *vector = T->getEquivalentType()->getAs<VectorType>()) {
|
|
|
OS << vector->getNumElements();
|
|
|
OS << " * sizeof(";
|
|
|
print(vector->getElementType(), OS, StringRef());
|
|
@@ -1335,7 +1388,6 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
|
|
|
}
|
|
|
OS << ')';
|
|
|
break;
|
|
|
- }
|
|
|
|
|
|
case AttributedType::attr_neon_vector_type:
|
|
|
case AttributedType::attr_neon_polyvector_type: {
|
|
@@ -1343,7 +1395,7 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
|
|
|
OS << "neon_vector_type(";
|
|
|
else
|
|
|
OS << "neon_polyvector_type(";
|
|
|
- const VectorType *vector = T->getEquivalentType()->getAs<VectorType>();
|
|
|
+ const auto *vector = T->getEquivalentType()->getAs<VectorType>();
|
|
|
OS << vector->getNumElements();
|
|
|
OS << ')';
|
|
|
break;
|
|
@@ -1420,10 +1472,12 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
|
|
|
OS << ')';
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
case AttributedType::attr_inteloclbicc: OS << "inteloclbicc"; break;
|
|
|
case AttributedType::attr_preserve_most:
|
|
|
OS << "preserve_most";
|
|
|
break;
|
|
|
+
|
|
|
case AttributedType::attr_preserve_all:
|
|
|
OS << "preserve_all";
|
|
|
break;
|
|
@@ -1436,8 +1490,9 @@ void TypePrinter::printObjCInterfaceBefore(const ObjCInterfaceType *T,
|
|
|
OS << T->getDecl()->getName();
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printObjCInterfaceAfter(const ObjCInterfaceType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printObjCTypeParamBefore(const ObjCTypeParamType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1459,7 +1514,7 @@ void TypePrinter::printObjCTypeParamBefore(const ObjCTypeParamType *T,
|
|
|
}
|
|
|
|
|
|
void TypePrinter::printObjCTypeParamAfter(const ObjCTypeParamType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
void TypePrinter::printObjCObjectBefore(const ObjCObjectType *T,
|
|
|
raw_ostream &OS) {
|
|
@@ -1501,6 +1556,7 @@ void TypePrinter::printObjCObjectBefore(const ObjCObjectType *T,
|
|
|
|
|
|
spaceBeforePlaceHolder(OS);
|
|
|
}
|
|
|
+
|
|
|
void TypePrinter::printObjCObjectAfter(const ObjCObjectType *T,
|
|
|
raw_ostream &OS) {
|
|
|
if (T->qual_empty() && T->isUnspecializedAsWritten() &&
|
|
@@ -1522,7 +1578,7 @@ void TypePrinter::printObjCObjectPointerBefore(const ObjCObjectPointerType *T,
|
|
|
}
|
|
|
|
|
|
void TypePrinter::printObjCObjectPointerAfter(const ObjCObjectPointerType *T,
|
|
|
- raw_ostream &OS) { }
|
|
|
+ raw_ostream &OS) {}
|
|
|
|
|
|
static
|
|
|
const TemplateArgument &getArgument(const TemplateArgument &A) { return A; }
|