35#include "llvm/ADT/ArrayRef.h"
36#include "llvm/ADT/DenseMap.h"
37#include "llvm/ADT/SmallString.h"
38#include "llvm/ADT/StringRef.h"
39#include "llvm/ADT/Twine.h"
40#include "llvm/Support/Compiler.h"
41#include "llvm/Support/ErrorHandling.h"
42#include "llvm/Support/SaveAndRestore.h"
43#include "llvm/Support/raw_ostream.h"
53class IncludeStrongLifetimeRAII {
54 PrintingPolicy &Policy;
58 explicit IncludeStrongLifetimeRAII(PrintingPolicy &Policy)
59 : Policy(Policy), Old(Policy.SuppressStrongLifetime) {
60 if (!Policy.SuppressLifetimeQualifiers)
61 Policy.SuppressStrongLifetime =
false;
64 ~IncludeStrongLifetimeRAII() { Policy.SuppressStrongLifetime = Old; }
67class ParamPolicyRAII {
68 PrintingPolicy &Policy;
72 explicit ParamPolicyRAII(PrintingPolicy &Policy)
73 : Policy(Policy), Old(Policy.SuppressSpecifiers) {
74 Policy.SuppressSpecifiers =
false;
77 ~ParamPolicyRAII() { Policy.SuppressSpecifiers = Old; }
80class DefaultTemplateArgsPolicyRAII {
81 PrintingPolicy &Policy;
85 explicit DefaultTemplateArgsPolicyRAII(PrintingPolicy &Policy)
86 : Policy(Policy), Old(Policy.SuppressDefaultTemplateArgs) {
87 Policy.SuppressDefaultTemplateArgs =
false;
90 ~DefaultTemplateArgsPolicyRAII() { Policy.SuppressDefaultTemplateArgs = Old; }
93class ElaboratedTypePolicyRAII {
94 PrintingPolicy &Policy;
95 bool SuppressTagKeyword;
99 explicit ElaboratedTypePolicyRAII(PrintingPolicy &Policy) : Policy(Policy) {
100 SuppressTagKeyword = Policy.SuppressTagKeyword;
101 SuppressScope = Policy.SuppressScope;
102 Policy.SuppressTagKeyword =
true;
103 Policy.SuppressScope =
true;
106 ~ElaboratedTypePolicyRAII() {
107 Policy.SuppressTagKeyword = SuppressTagKeyword;
108 Policy.SuppressScope = SuppressScope;
113 PrintingPolicy Policy;
114 unsigned Indentation;
115 bool HasEmptyPlaceHolder =
false;
116 bool InsideCCAttribute =
false;
119 explicit TypePrinter(
const PrintingPolicy &Policy,
unsigned Indentation = 0)
120 : Policy(Policy), Indentation(Indentation) {}
122 void print(
const Type *ty, Qualifiers qs, raw_ostream &OS,
123 StringRef PlaceHolder);
124 void print(QualType T, raw_ostream &OS, StringRef PlaceHolder);
126 static bool canPrefixQualifiers(
const Type *T,
bool &NeedARCStrongQualifier);
127 void spaceBeforePlaceHolder(raw_ostream &OS);
128 void printTypeSpec(NamedDecl *D, raw_ostream &OS);
129 void printTemplateId(
const TemplateSpecializationType *T, raw_ostream &OS,
132 void printBefore(QualType T, raw_ostream &OS);
133 void printAfter(QualType T, raw_ostream &OS);
134 void printTagType(
const TagType *T, raw_ostream &OS);
135 void printFunctionAfter(
const FunctionType::ExtInfo &Info, raw_ostream &OS);
136#define ABSTRACT_TYPE(CLASS, PARENT)
137#define TYPE(CLASS, PARENT) \
138 void print##CLASS##Before(const CLASS##Type *T, raw_ostream &OS); \
139 void print##CLASS##After(const CLASS##Type *T, raw_ostream &OS);
140#include "clang/AST/TypeNodes.inc"
150 bool HasRestrictKeyword) {
151 bool appendSpace =
false;
157 if (appendSpace) OS <<
' ';
162 if (appendSpace) OS <<
' ';
163 if (HasRestrictKeyword) {
171void TypePrinter::spaceBeforePlaceHolder(raw_ostream &OS) {
172 if (!HasEmptyPlaceHolder)
183void TypePrinter::print(QualType t, raw_ostream &OS, StringRef PlaceHolder) {
188void TypePrinter::print(
const Type *T, Qualifiers Quals, raw_ostream &OS,
189 StringRef PlaceHolder) {
195 SaveAndRestore PHVal(HasEmptyPlaceHolder, PlaceHolder.empty());
197 printBefore(T, Quals, OS);
199 printAfter(T, Quals, OS);
202bool TypePrinter::canPrefixQualifiers(
const Type *T,
203 bool &NeedARCStrongQualifier) {
209 bool CanPrefixQualifiers =
false;
210 NeedARCStrongQualifier =
false;
211 const Type *UnderlyingType = T;
212 if (
const auto *AT = dyn_cast<AutoType>(T))
213 UnderlyingType = AT->desugar().getTypePtr();
214 if (
const auto *Subst = dyn_cast<SubstTemplateTypeParmType>(T))
215 UnderlyingType = Subst->getReplacementType().getTypePtr();
222 case Type::UnresolvedUsing:
225 case Type::TypeOfExpr:
228 case Type::UnaryTransform:
231 case Type::TemplateTypeParm:
232 case Type::SubstTemplateTypeParmPack:
233 case Type::SubstBuiltinTemplatePack:
234 case Type::DeducedTemplateSpecialization:
235 case Type::TemplateSpecialization:
236 case Type::InjectedClassName:
237 case Type::DependentName:
238 case Type::ObjCObject:
239 case Type::ObjCTypeParam:
240 case Type::ObjCInterface:
244 case Type::DependentBitInt:
245 case Type::BTFTagAttributed:
246 case Type::HLSLAttributedResource:
247 case Type::HLSLInlineSpirv:
248 case Type::PredefinedSugar:
249 CanPrefixQualifiers =
true;
252 case Type::ObjCObjectPointer:
257 case Type::VariableArray:
258 case Type::DependentSizedArray:
259 NeedARCStrongQualifier =
true;
262 case Type::ConstantArray:
263 case Type::IncompleteArray:
264 return canPrefixQualifiers(
266 NeedARCStrongQualifier);
270 case Type::ArrayParameter:
272 case Type::BlockPointer:
273 case Type::LValueReference:
274 case Type::RValueReference:
275 case Type::MemberPointer:
276 case Type::DependentAddressSpace:
277 case Type::DependentVector:
278 case Type::DependentSizedExtVector:
280 case Type::ExtVector:
281 case Type::ConstantMatrix:
282 case Type::DependentSizedMatrix:
283 case Type::FunctionProto:
284 case Type::FunctionNoProto:
286 case Type::PackExpansion:
287 case Type::SubstTemplateTypeParm:
288 case Type::MacroQualified:
289 case Type::OverflowBehavior:
290 case Type::CountAttributed:
291 CanPrefixQualifiers =
false;
294 case Type::Attributed: {
298 CanPrefixQualifiers = AttrTy->getAttrKind() == attr::AddressSpace;
301 case Type::PackIndexing: {
302 return canPrefixQualifiers(
304 NeedARCStrongQualifier);
308 return CanPrefixQualifiers;
311void TypePrinter::printBefore(QualType T, raw_ostream &OS) {
316 Qualifiers Quals =
Split.Quals;
317 if (
const auto *Subst = dyn_cast<SubstTemplateTypeParmType>(
Split.Ty))
318 Quals -= QualType(Subst, 0).getQualifiers();
320 printBefore(
Split.Ty, Quals, OS);
325void TypePrinter::printBefore(
const Type *T,Qualifiers Quals, raw_ostream &OS) {
329 SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder);
333 bool CanPrefixQualifiers =
false;
334 bool NeedARCStrongQualifier =
false;
335 CanPrefixQualifiers = canPrefixQualifiers(T, NeedARCStrongQualifier);
337 if (CanPrefixQualifiers && !Quals.
empty()) {
338 if (NeedARCStrongQualifier) {
339 IncludeStrongLifetimeRAII Strong(Policy);
340 Quals.
print(OS, Policy,
true);
342 Quals.
print(OS, Policy,
true);
346 bool hasAfterQuals =
false;
347 if (!CanPrefixQualifiers && !Quals.
empty()) {
350 HasEmptyPlaceHolder =
false;
354#define ABSTRACT_TYPE(CLASS, PARENT)
355#define TYPE(CLASS, PARENT) case Type::CLASS: \
356 print##CLASS##Before(cast<CLASS##Type>(T), OS); \
358#include "clang/AST/TypeNodes.inc"
362 if (NeedARCStrongQualifier) {
363 IncludeStrongLifetimeRAII Strong(Policy);
364 Quals.
print(OS, Policy, !PrevPHIsEmpty.get());
366 Quals.
print(OS, Policy, !PrevPHIsEmpty.get());
371void TypePrinter::printAfter(QualType t, raw_ostream &OS) {
373 printAfter(split.
Ty, split.
Quals, OS);
378void TypePrinter::printAfter(
const Type *T, Qualifiers Quals, raw_ostream &OS) {
380#define ABSTRACT_TYPE(CLASS, PARENT)
381#define TYPE(CLASS, PARENT) case Type::CLASS: \
382 print##CLASS##After(cast<CLASS##Type>(T), OS); \
384#include "clang/AST/TypeNodes.inc"
388void TypePrinter::printBuiltinBefore(
const BuiltinType *T, raw_ostream &OS) {
390 spaceBeforePlaceHolder(OS);
393void TypePrinter::printBuiltinAfter(
const BuiltinType *T, raw_ostream &OS) {}
395void TypePrinter::printComplexBefore(
const ComplexType *T, raw_ostream &OS) {
400void TypePrinter::printComplexAfter(
const ComplexType *T, raw_ostream &OS) {
404void TypePrinter::printPointerBefore(
const PointerType *T, raw_ostream &OS) {
405 IncludeStrongLifetimeRAII Strong(Policy);
406 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
415void TypePrinter::printPointerAfter(
const PointerType *T, raw_ostream &OS) {
416 IncludeStrongLifetimeRAII Strong(Policy);
417 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
425void TypePrinter::printBlockPointerBefore(
const BlockPointerType *T,
427 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
432void TypePrinter::printBlockPointerAfter(
const BlockPointerType *T,
434 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
446void TypePrinter::printLValueReferenceBefore(
const LValueReferenceType *T,
448 IncludeStrongLifetimeRAII Strong(Policy);
449 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
451 printBefore(Inner, OS);
459void TypePrinter::printLValueReferenceAfter(
const LValueReferenceType *T,
461 IncludeStrongLifetimeRAII Strong(Policy);
462 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
468 printAfter(Inner, OS);
471void TypePrinter::printRValueReferenceBefore(
const RValueReferenceType *T,
473 IncludeStrongLifetimeRAII Strong(Policy);
474 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
476 printBefore(Inner, OS);
484void TypePrinter::printRValueReferenceAfter(
const RValueReferenceType *T,
486 IncludeStrongLifetimeRAII Strong(Policy);
487 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
493 printAfter(Inner, OS);
496void TypePrinter::printMemberPointerBefore(
const MemberPointerType *T,
498 IncludeStrongLifetimeRAII Strong(Policy);
499 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
509void TypePrinter::printMemberPointerAfter(
const MemberPointerType *T,
511 IncludeStrongLifetimeRAII Strong(Policy);
512 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
520void TypePrinter::printConstantArrayBefore(
const ConstantArrayType *T,
522 IncludeStrongLifetimeRAII Strong(Policy);
526void TypePrinter::printConstantArrayAfter(
const ConstantArrayType *T,
542void TypePrinter::printIncompleteArrayBefore(
const IncompleteArrayType *T,
544 IncludeStrongLifetimeRAII Strong(Policy);
548void TypePrinter::printIncompleteArrayAfter(
const IncompleteArrayType *T,
554void TypePrinter::printVariableArrayBefore(
const VariableArrayType *T,
556 IncludeStrongLifetimeRAII Strong(Policy);
560void TypePrinter::printVariableArrayAfter(
const VariableArrayType *T,
580void TypePrinter::printAdjustedBefore(
const AdjustedType *T, raw_ostream &OS) {
586void TypePrinter::printAdjustedAfter(
const AdjustedType *T, raw_ostream &OS) {
590void TypePrinter::printDecayedBefore(
const DecayedType *T, raw_ostream &OS) {
592 printAdjustedBefore(T, OS);
595void TypePrinter::printArrayParameterAfter(
const ArrayParameterType *T,
597 printConstantArrayAfter(T, OS);
600void TypePrinter::printArrayParameterBefore(
const ArrayParameterType *T,
602 printConstantArrayBefore(T, OS);
605void TypePrinter::printDecayedAfter(
const DecayedType *T, raw_ostream &OS) {
606 printAdjustedAfter(T, OS);
609void TypePrinter::printDependentSizedArrayBefore(
610 const DependentSizedArrayType *T,
612 IncludeStrongLifetimeRAII Strong(Policy);
616void TypePrinter::printDependentSizedArrayAfter(
617 const DependentSizedArrayType *T,
626void TypePrinter::printDependentAddressSpaceBefore(
627 const DependentAddressSpaceType *T, raw_ostream &OS) {
631void TypePrinter::printDependentAddressSpaceAfter(
632 const DependentAddressSpaceType *T, raw_ostream &OS) {
633 OS <<
" __attribute__((address_space(";
640void TypePrinter::printDependentSizedExtVectorBefore(
641 const DependentSizedExtVectorType *T,
648void TypePrinter::printDependentSizedExtVectorAfter(
649 const DependentSizedExtVectorType *T,
657 OS <<
" __attribute__((ext_vector_type(";
665void TypePrinter::printVectorBefore(
const VectorType *T, raw_ostream &OS) {
667 case VectorKind::AltiVecPixel:
668 OS <<
"__vector __pixel ";
670 case VectorKind::AltiVecBool:
671 OS <<
"__vector __bool ";
674 case VectorKind::AltiVecVector:
678 case VectorKind::Neon:
679 OS <<
"__attribute__((neon_vector_type("
683 case VectorKind::NeonPoly:
684 OS <<
"__attribute__((neon_polyvector_type(" <<
688 case VectorKind::Generic: {
691 OS <<
"__attribute__((__vector_size__("
699 case VectorKind::SveFixedLengthData:
700 case VectorKind::SveFixedLengthPredicate:
703 OS <<
"__attribute__((__arm_sve_vector_bits__(";
705 if (T->
getVectorKind() == VectorKind::SveFixedLengthPredicate)
718 case VectorKind::RVVFixedLengthData:
719 case VectorKind::RVVFixedLengthMask:
720 case VectorKind::RVVFixedLengthMask_1:
721 case VectorKind::RVVFixedLengthMask_2:
722 case VectorKind::RVVFixedLengthMask_4:
725 OS <<
"__attribute__((__riscv_rvv_vector_bits__(";
738void TypePrinter::printVectorAfter(
const VectorType *T, raw_ostream &OS) {
742void TypePrinter::printDependentVectorBefore(
743 const DependentVectorType *T, raw_ostream &OS) {
745 case VectorKind::AltiVecPixel:
746 OS <<
"__vector __pixel ";
748 case VectorKind::AltiVecBool:
749 OS <<
"__vector __bool ";
752 case VectorKind::AltiVecVector:
756 case VectorKind::Neon:
757 OS <<
"__attribute__((neon_vector_type(";
763 case VectorKind::NeonPoly:
764 OS <<
"__attribute__((neon_polyvector_type(";
770 case VectorKind::Generic: {
773 OS <<
"__attribute__((__vector_size__(";
782 case VectorKind::SveFixedLengthData:
783 case VectorKind::SveFixedLengthPredicate:
786 OS <<
"__attribute__((__arm_sve_vector_bits__(";
789 if (T->
getVectorKind() == VectorKind::SveFixedLengthPredicate)
801 case VectorKind::RVVFixedLengthData:
802 case VectorKind::RVVFixedLengthMask:
803 case VectorKind::RVVFixedLengthMask_1:
804 case VectorKind::RVVFixedLengthMask_2:
805 case VectorKind::RVVFixedLengthMask_4:
808 OS <<
"__attribute__((__riscv_rvv_vector_bits__(";
822void TypePrinter::printDependentVectorAfter(
823 const DependentVectorType *T, raw_ostream &OS) {
827void TypePrinter::printExtVectorBefore(
const ExtVectorType *T,
834void TypePrinter::printExtVectorAfter(
const ExtVectorType *T, raw_ostream &OS) {
842 OS <<
" __attribute__((ext_vector_type(";
849 OS << T->getNumRows() <<
", " << T->getNumColumns();
855 TP.printBefore(T->getElementType(), OS);
866 TP.printBefore(T->getElementType(), OS);
867 OS <<
" __attribute__((matrix_type(";
872void TypePrinter::printConstantMatrixBefore(
const ConstantMatrixType *T,
881void TypePrinter::printConstantMatrixAfter(
const ConstantMatrixType *T,
890void TypePrinter::printDependentSizedMatrixBefore(
891 const DependentSizedMatrixType *T, raw_ostream &OS) {
893 OS <<
" __attribute__((matrix_type(";
904void TypePrinter::printDependentSizedMatrixAfter(
905 const DependentSizedMatrixType *T, raw_ostream &OS) {
926 OS <<
" __attribute__((nothrow))";
942 if (T->hasTrailingReturn()) {
944 if (!HasEmptyPlaceHolder)
949 printBefore(T->getReturnType(), OS);
950 if (!PrevPHIsEmpty.get())
958 llvm_unreachable(
"asking for spelling of ordinary parameter ABI");
960 return "swift_context";
962 return "swift_async_context";
964 return "swift_error_result";
966 return "swift_indirect_result";
972 llvm_unreachable(
"bad parameter ABI kind");
978 if (!HasEmptyPlaceHolder)
984 ParamPolicyRAII ParamPolicy(Policy);
985 for (
unsigned i = 0, e = T->getNumParams(); i != e; ++i) {
988 auto EPI = T->getExtParameterInfo(i);
989 if (EPI.isConsumed()) OS <<
"__attribute__((ns_consumed)) ";
990 if (EPI.isNoEscape())
991 OS <<
"__attribute__((noescape)) ";
992 auto ABI = EPI.getABI();
1000 print(T->getParamType(i).getNonReferenceType(), OS, StringRef());
1003 }
else if (ABI != ParameterABI::Ordinary)
1021 FunctionType::ExtInfo Info = T->
getExtInfo();
1025 OS <<
" __arm_streaming_compatible";
1027 OS <<
" __arm_streaming";
1029 OS <<
"__arm_agnostic(\"sme_za_state\")";
1031 OS <<
" __arm_preserves(\"za\")";
1033 OS <<
" __arm_in(\"za\")";
1035 OS <<
" __arm_out(\"za\")";
1037 OS <<
" __arm_inout(\"za\")";
1039 OS <<
" __arm_preserves(\"zt0\")";
1041 OS <<
" __arm_in(\"zt0\")";
1043 OS <<
" __arm_out(\"zt0\")";
1045 OS <<
" __arm_inout(\"zt0\")";
1047 printFunctionAfter(Info, OS);
1067 for (
const auto &CFE : FX) {
1068 OS <<
" __attribute__((" << CFE.Effect.name();
1069 if (
const Expr *E = CFE.Cond.getCondition()) {
1071 E->printPretty(OS,
nullptr, Policy);
1078 OS <<
" __attribute__((cfi_unchecked_callee))";
1087void TypePrinter::printFunctionAfter(
const FunctionType::ExtInfo &Info,
1089 if (!InsideCCAttribute) {
1090 switch (Info.
getCC()) {
1101 OS <<
" __attribute__((stdcall))";
1104 OS <<
" __attribute__((fastcall))";
1107 OS <<
" __attribute__((thiscall))";
1110 OS <<
" __attribute__((vectorcall))";
1113 OS <<
" __attribute__((pascal))";
1116 OS <<
" __attribute__((pcs(\"aapcs\")))";
1119 OS <<
" __attribute__((pcs(\"aapcs-vfp\")))";
1122 OS <<
" __attribute__((aarch64_vector_pcs))";
1125 OS <<
" __attribute__((aarch64_sve_pcs))";
1128 OS <<
" __attribute__((device_kernel))";
1131 OS <<
" __attribute__((intel_ocl_bicc))";
1134 OS <<
" __attribute__((ms_abi))";
1137 OS <<
" __attribute__((sysv_abi))";
1140 OS <<
" __attribute__((regcall))";
1146 OS <<
" __attribute__((swiftcall))";
1149 OS <<
"__attribute__((swiftasynccall))";
1152 OS <<
" __attribute__((preserve_most))";
1155 OS <<
" __attribute__((preserve_all))";
1158 OS <<
" __attribute__((m68k_rtd))";
1161 OS <<
" __attribute__((preserve_none))";
1164 OS <<
"__attribute__((riscv_vector_cc))";
1166#define CC_VLS_CASE(ABI_VLEN) \
1167 case CC_RISCVVLSCall_##ABI_VLEN: \
1168 OS << "__attribute__((riscv_vls_cc" #ABI_VLEN "))"; \
1187 OS <<
" __attribute__((noreturn))";
1189 OS <<
" __attribute__((cmse_nonsecure_call))";
1191 OS <<
" __attribute__((ns_returns_retained))";
1193 OS <<
" __attribute__((regparm ("
1196 OS <<
" __attribute__((no_caller_saved_registers))";
1198 OS <<
" __attribute__((nocf_check))";
1201void TypePrinter::printFunctionNoProtoBefore(
const FunctionNoProtoType *T,
1204 SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder,
false);
1206 if (!PrevPHIsEmpty.get())
1210void TypePrinter::printFunctionNoProtoAfter(
const FunctionNoProtoType *T,
1213 if (!HasEmptyPlaceHolder)
1215 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
1222void TypePrinter::printTypeSpec(NamedDecl *D, raw_ostream &OS) {
1232 spaceBeforePlaceHolder(OS);
1235void TypePrinter::printUnresolvedUsingBefore(
const UnresolvedUsingType *T,
1237 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1238 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1247 spaceBeforePlaceHolder(OS);
1250void TypePrinter::printUnresolvedUsingAfter(
const UnresolvedUsingType *T,
1253void TypePrinter::printUsingBefore(
const UsingType *T, raw_ostream &OS) {
1254 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1255 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1264 spaceBeforePlaceHolder(OS);
1267void TypePrinter::printUsingAfter(
const UsingType *T, raw_ostream &OS) {}
1269void TypePrinter::printTypedefBefore(
const TypedefType *T, raw_ostream &OS) {
1270 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1271 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1280 spaceBeforePlaceHolder(OS);
1283void TypePrinter::printMacroQualifiedBefore(
const MacroQualifiedType *T,
1286 OS << MacroName <<
" ";
1293void TypePrinter::printMacroQualifiedAfter(
const MacroQualifiedType *T,
1298void TypePrinter::printTypedefAfter(
const TypedefType *T, raw_ostream &OS) {}
1300void TypePrinter::printTypeOfExprBefore(
const TypeOfExprType *T,
1302 OS << (T->
getKind() == TypeOfKind::Unqualified ?
"typeof_unqual "
1306 spaceBeforePlaceHolder(OS);
1309void TypePrinter::printTypeOfExprAfter(
const TypeOfExprType *T,
1312void TypePrinter::printTypeOfBefore(
const TypeOfType *T, raw_ostream &OS) {
1313 OS << (T->getKind() == TypeOfKind::Unqualified ?
"typeof_unqual("
1315 print(T->getUnmodifiedType(), OS, StringRef());
1317 spaceBeforePlaceHolder(OS);
1320void TypePrinter::printTypeOfAfter(
const TypeOfType *T, raw_ostream &OS) {}
1322void TypePrinter::printDecltypeBefore(
const DecltypeType *T, raw_ostream &OS) {
1324 if (
const Expr *E = T->getUnderlyingExpr()) {
1325 PrintingPolicy ExprPolicy = Policy;
1327 E->printPretty(OS,
nullptr, ExprPolicy);
1330 spaceBeforePlaceHolder(OS);
1333void TypePrinter::printPackIndexingBefore(
const PackIndexingType *T,
1335 if (T->hasSelectedType()) {
1336 OS << T->getSelectedType();
1338 OS << T->getPattern() <<
"...[";
1339 T->getIndexExpr()->printPretty(OS,
nullptr, Policy);
1342 spaceBeforePlaceHolder(OS);
1345void TypePrinter::printPackIndexingAfter(
const PackIndexingType *T,
1348void TypePrinter::printDecltypeAfter(
const DecltypeType *T, raw_ostream &OS) {}
1350void TypePrinter::printUnaryTransformBefore(
const UnaryTransformType *T,
1352 IncludeStrongLifetimeRAII Strong(Policy);
1354 static const llvm::DenseMap<int, const char *> Transformation = {{
1355#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
1356 {UnaryTransformType::Enum, "__" #Trait},
1357#include "clang/Basic/TransformTypeTraits.def"
1359 OS << Transformation.lookup(T->getUTTKind()) <<
'(';
1360 print(T->getBaseType(), OS, StringRef());
1362 spaceBeforePlaceHolder(OS);
1365void TypePrinter::printUnaryTransformAfter(
const UnaryTransformType *T,
1368void TypePrinter::printAutoBefore(
const AutoType *T, raw_ostream &OS) {
1370 if (!T->getDeducedType().isNull()) {
1371 printBefore(T->getDeducedType(), OS);
1373 if (T->isConstrained()) {
1376 T->getTypeConstraintConcept()->getDeclName().print(OS, Policy);
1377 auto Args = T->getTypeConstraintArguments();
1379 printTemplateArgumentList(
1381 T->getTypeConstraintConcept()->getTemplateParameters());
1384 switch (T->getKeyword()) {
1385 case AutoTypeKeyword::Auto:
OS <<
"auto";
break;
1386 case AutoTypeKeyword::DecltypeAuto:
OS <<
"decltype(auto)";
break;
1387 case AutoTypeKeyword::GNUAutoType:
OS <<
"__auto_type";
break;
1389 spaceBeforePlaceHolder(OS);
1393void TypePrinter::printAutoAfter(
const AutoType *T, raw_ostream &OS) {
1395 if (!T->getDeducedType().isNull())
1396 printAfter(T->getDeducedType(), OS);
1399void TypePrinter::printDeducedTemplateSpecializationBefore(
1400 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1402 T->getKeyword() != ElaboratedTypeKeyword::None)
1412 ArrayRef<TemplateArgument> Args;
1413 TemplateDecl *DeducedTD =
nullptr;
1414 if (!T->getDeducedType().isNull()) {
1415 if (
const auto *TST =
1416 dyn_cast<TemplateSpecializationType>(T->getDeducedType())) {
1417 DeducedTD = TST->getTemplateName().getAsTemplateDecl(
1419 Args = TST->template_arguments();
1424 DeducedTD = CD->getSpecializedTemplate();
1425 Args = CD->getTemplateArgs().asArray();
1439 IncludeStrongLifetimeRAII Strong(Policy);
1440 Name.
print(OS, Policy);
1443 printTemplateArgumentList(OS, Args, Policy,
1447 spaceBeforePlaceHolder(OS);
1450void TypePrinter::printDeducedTemplateSpecializationAfter(
1451 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1453 if (!T->getDeducedType().isNull())
1454 printAfter(T->getDeducedType(), OS);
1457void TypePrinter::printAtomicBefore(
const AtomicType *T, raw_ostream &OS) {
1458 IncludeStrongLifetimeRAII Strong(Policy);
1463 spaceBeforePlaceHolder(OS);
1466void TypePrinter::printAtomicAfter(
const AtomicType *T, raw_ostream &OS) {}
1468void TypePrinter::printPipeBefore(
const PipeType *T, raw_ostream &OS) {
1469 IncludeStrongLifetimeRAII Strong(Policy);
1474 OS <<
"write_only ";
1477 spaceBeforePlaceHolder(OS);
1480void TypePrinter::printPipeAfter(
const PipeType *T, raw_ostream &OS) {}
1482void TypePrinter::printBitIntBefore(
const BitIntType *T, raw_ostream &OS) {
1486 spaceBeforePlaceHolder(OS);
1489void TypePrinter::printBitIntAfter(
const BitIntType *T, raw_ostream &OS) {}
1491void TypePrinter::printDependentBitIntBefore(
const DependentBitIntType *T,
1498 spaceBeforePlaceHolder(OS);
1501void TypePrinter::printDependentBitIntAfter(
const DependentBitIntType *T,
1504void TypePrinter::printPredefinedSugarBefore(
const PredefinedSugarType *T,
1507 spaceBeforePlaceHolder(OS);
1510void TypePrinter::printPredefinedSugarAfter(
const PredefinedSugarType *T,
1513void TypePrinter::printTagType(
const TagType *T, raw_ostream &OS) {
1514 TagDecl *D = T->getDecl();
1517 D->
print(OS, Policy, Indentation);
1518 spaceBeforePlaceHolder(OS);
1522 bool PrintedKindDecoration =
false;
1523 if (T->isCanonicalUnqualified()) {
1525 PrintedKindDecoration =
true;
1530 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1531 if (T->getKeyword() != ElaboratedTypeKeyword::None) {
1532 PrintedKindDecoration =
true;
1538 T->getQualifier().print(OS, Policy);
1549 clang::PrintingPolicy
Copy(Policy);
1552 if (PrintedKindDecoration) {
1553 Copy.SuppressTagKeywordInAnonNames =
true;
1554 Copy.SuppressTagKeyword =
true;
1562 if (
auto *S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
1563 const TemplateParameterList *TParams =
1564 S->getSpecializedTemplate()->getTemplateParameters();
1565 const ASTTemplateArgumentListInfo *TArgAsWritten =
1566 S->getTemplateArgsAsWritten();
1567 IncludeStrongLifetimeRAII Strong(Policy);
1569 printTemplateArgumentList(OS, TArgAsWritten->
arguments(), Policy,
1572 printTemplateArgumentList(OS, S->getTemplateArgs().asArray(), Policy,
1576 spaceBeforePlaceHolder(OS);
1579void TypePrinter::printRecordBefore(
const RecordType *T, raw_ostream &OS) {
1582 for (
const auto *PNA : T->getDecl()
1583 ->getMostRecentDecl()
1584 ->specific_attrs<PreferredNameAttr>()) {
1589 QualType T = PNA->getTypedefType();
1591 if (
auto *TT = dyn_cast<TypedefType>(T))
1592 return printTypeSpec(TT->getDecl(), OS);
1593 if (
auto *TST = dyn_cast<TemplateSpecializationType>(T))
1594 return printTemplateId(TST, OS,
true);
1600 printTagType(T, OS);
1603void TypePrinter::printRecordAfter(
const RecordType *T, raw_ostream &OS) {}
1605void TypePrinter::printEnumBefore(
const EnumType *T, raw_ostream &OS) {
1606 printTagType(T, OS);
1609void TypePrinter::printEnumAfter(
const EnumType *T, raw_ostream &OS) {}
1611void TypePrinter::printInjectedClassNameBefore(
const InjectedClassNameType *T,
1613 const ASTContext &Ctx = T->getDecl()->getASTContext();
1614 IncludeStrongLifetimeRAII Strong(Policy);
1615 T->getTemplateName(Ctx).print(OS, Policy);
1617 auto *
Decl = T->getDecl();
1620 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(Decl)) {
1621 printTemplateArgumentList(OS, RD->getTemplateArgsAsWritten()->arguments(),
1623 T->getTemplateDecl()->getTemplateParameters());
1625 ClassTemplateDecl *TD =
Decl->getDescribedClassTemplate();
1627 printTemplateArgumentList(
1629 T->getTemplateDecl()->getTemplateParameters());
1632 spaceBeforePlaceHolder(OS);
1635void TypePrinter::printInjectedClassNameAfter(
const InjectedClassNameType *T,
1638void TypePrinter::printTemplateTypeParmBefore(
const TemplateTypeParmType *T,
1640 TemplateTypeParmDecl *D = T->getDecl();
1643 TC->print(OS, Policy);
1647 }
else if (IdentifierInfo *Id = T->getIdentifier())
1651 OS <<
"type-parameter-" << T->getDepth() <<
'-' << T->getIndex();
1653 spaceBeforePlaceHolder(OS);
1656void TypePrinter::printTemplateTypeParmAfter(
const TemplateTypeParmType *T,
1659void TypePrinter::printSubstTemplateTypeParmBefore(
1660 const SubstTemplateTypeParmType *T,
1662 IncludeStrongLifetimeRAII Strong(Policy);
1663 printBefore(T->getReplacementType(), OS);
1666void TypePrinter::printSubstTemplateTypeParmAfter(
1667 const SubstTemplateTypeParmType *T,
1669 IncludeStrongLifetimeRAII Strong(Policy);
1670 printAfter(T->getReplacementType(), OS);
1673void TypePrinter::printSubstBuiltinTemplatePackBefore(
1674 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {
1675 IncludeStrongLifetimeRAII Strong(Policy);
1679void TypePrinter::printSubstBuiltinTemplatePackAfter(
1680 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {}
1682void TypePrinter::printSubstTemplateTypeParmPackBefore(
1683 const SubstTemplateTypeParmPackType *T,
1685 IncludeStrongLifetimeRAII Strong(Policy);
1686 if (
const TemplateTypeParmDecl *D = T->getReplacedParameter()) {
1689 TC->print(OS, Policy);
1699 spaceBeforePlaceHolder(OS);
1703void TypePrinter::printSubstTemplateTypeParmPackAfter(
1704 const SubstTemplateTypeParmPackType *T,
1706 IncludeStrongLifetimeRAII Strong(Policy);
1709void TypePrinter::printTemplateId(
const TemplateSpecializationType *T,
1710 raw_ostream &OS,
bool FullyQualify) {
1711 IncludeStrongLifetimeRAII Strong(Policy);
1714 K != ElaboratedTypeKeyword::None)
1715 OS << TypeWithKeyword::getKeywordName(K) <<
' ';
1718 T->getTemplateName().getAsTemplateDecl(
true);
1720 if (FullyQualify && TD) {
1726 T->getTemplateName().print(OS, Policy,
1728 ? TemplateName::Qualified::AsWritten
1729 : TemplateName::Qualified::None);
1732 DefaultTemplateArgsPolicyRAII TemplateArgs(Policy);
1734 printTemplateArgumentList(OS, T->template_arguments(), Policy, TPL);
1735 spaceBeforePlaceHolder(OS);
1738void TypePrinter::printTemplateSpecializationBefore(
1739 const TemplateSpecializationType *T,
1744void TypePrinter::printTemplateSpecializationAfter(
1745 const TemplateSpecializationType *T,
1748void TypePrinter::printParenBefore(
const ParenType *T, raw_ostream &OS) {
1756void TypePrinter::printParenAfter(
const ParenType *T, raw_ostream &OS) {
1764void TypePrinter::printDependentNameBefore(
const DependentNameType *T,
1766 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1767 if (T->getKeyword() != ElaboratedTypeKeyword::None)
1769 T->getQualifier().print(OS, Policy);
1770 OS << T->getIdentifier()->getName();
1771 spaceBeforePlaceHolder(OS);
1774void TypePrinter::printDependentNameAfter(
const DependentNameType *T,
1777void TypePrinter::printPackExpansionBefore(
const PackExpansionType *T,
1779 printBefore(T->getPattern(), OS);
1782void TypePrinter::printPackExpansionAfter(
const PackExpansionType *T,
1784 printAfter(T->getPattern(), OS);
1792 if (T->isCountInBytes() && T->isOrNull())
1793 OS <<
"__sized_by_or_null(";
1794 else if (T->isCountInBytes())
1795 OS <<
"__sized_by(";
1796 else if (T->isOrNull())
1797 OS <<
"__counted_by_or_null(";
1799 OS <<
"__counted_by(";
1800 if (T->getCountExpr())
1801 T->getCountExpr()->printPretty(OS,
nullptr, Policy);
1805void TypePrinter::printCountAttributedBefore(
const CountAttributedType *T,
1807 printBefore(T->
desugar(), OS);
1812void TypePrinter::printCountAttributedAfter(
const CountAttributedType *T,
1819void TypePrinter::printAttributedBefore(
const AttributedType *T,
1824 if (T->getAttrKind() == attr::ObjCGC ||
1825 T->getAttrKind() == attr::ObjCOwnership)
1826 return printBefore(T->getEquivalentType(), OS);
1828 if (T->getAttrKind() == attr::ObjCKindOf)
1831 if (T->getAttrKind() == attr::PreserveNone) {
1832 OS <<
"__attribute__((preserve_none)) ";
1833 spaceBeforePlaceHolder(OS);
1834 }
else if (T->getAttrKind() == attr::PreserveMost) {
1835 OS <<
"__attribute__((preserve_most)) ";
1836 spaceBeforePlaceHolder(OS);
1837 }
else if (T->getAttrKind() == attr::PreserveAll) {
1838 OS <<
"__attribute__((preserve_all)) ";
1839 spaceBeforePlaceHolder(OS);
1842 if (T->getAttrKind() == attr::AddressSpace)
1843 printBefore(T->getEquivalentType(), OS);
1845 printBefore(T->getModifiedType(), OS);
1847 if (T->isMSTypeSpec()) {
1848 switch (T->getAttrKind()) {
1850 case attr::Ptr32:
OS <<
" __ptr32";
break;
1851 case attr::Ptr64:
OS <<
" __ptr64";
break;
1852 case attr::SPtr:
OS <<
" __sptr";
break;
1853 case attr::UPtr:
OS <<
" __uptr";
break;
1855 spaceBeforePlaceHolder(OS);
1858 if (T->isWebAssemblyFuncrefSpec())
1862 if (T->getImmediateNullability()) {
1863 if (T->getAttrKind() == attr::TypeNonNull)
1865 else if (T->getAttrKind() == attr::TypeNullable)
1867 else if (T->getAttrKind() == attr::TypeNullUnspecified)
1868 OS <<
" _Null_unspecified";
1869 else if (T->getAttrKind() == attr::TypeNullableResult)
1870 OS <<
" _Nullable_result";
1872 llvm_unreachable(
"unhandled nullability");
1873 spaceBeforePlaceHolder(OS);
1877void TypePrinter::printAttributedAfter(
const AttributedType *T,
1882 if (T->getAttrKind() == attr::ObjCGC ||
1883 T->getAttrKind() == attr::ObjCOwnership)
1884 return printAfter(T->getEquivalentType(), OS);
1888 SaveAndRestore MaybeSuppressCC(InsideCCAttribute, T->isCallingConv());
1890 printAfter(T->getModifiedType(), OS);
1894 if (T->getAttrKind() == attr::ObjCKindOf || T->isMSTypeSpec() ||
1895 T->getImmediateNullability() || T->isWebAssemblyFuncrefSpec())
1899 if (T->getAttrKind() == attr::ObjCInertUnsafeUnretained)
1903 if (T->getAttrKind() == attr::NSReturnsRetained &&
1904 !T->getEquivalentType()->castAs<FunctionType>()
1905 ->getExtInfo().getProducesResult())
1908 if (T->getAttrKind() == attr::LifetimeBound) {
1909 OS <<
" [[clang::lifetimebound]]";
1912 if (T->getAttrKind() == attr::LifetimeCaptureBy) {
1913 OS <<
" [[clang::lifetime_capture_by(";
1914 if (
auto *attr = dyn_cast_or_null<LifetimeCaptureByAttr>(T->getAttr()))
1915 llvm::interleaveComma(
attr->getArgIdents(), OS,
1916 [&](
auto it) { OS << it->getName(); });
1924 if (T->getAttrKind() == attr::AddressSpace)
1927 if (T->getAttrKind() == attr::AnnotateType) {
1932 OS <<
" [[clang::annotate_type(...)]]";
1936 if (T->getAttrKind() == attr::ArmStreaming) {
1937 OS <<
"__arm_streaming";
1940 if (T->getAttrKind() == attr::ArmStreamingCompatible) {
1941 OS <<
"__arm_streaming_compatible";
1945 if (T->getAttrKind() == attr::SwiftAttr) {
1946 if (
auto *swiftAttr = dyn_cast_or_null<SwiftAttrAttr>(T->getAttr())) {
1947 OS <<
" __attribute__((swift_attr(\"" << swiftAttr->getAttribute()
1953 if (T->getAttrKind() == attr::PreserveAll ||
1954 T->getAttrKind() == attr::PreserveMost ||
1955 T->getAttrKind() == attr::PreserveNone) {
1960 OS <<
" __attribute__((";
1961 switch (T->getAttrKind()) {
1962#define TYPE_ATTR(NAME)
1963#define DECL_OR_TYPE_ATTR(NAME)
1964#define ATTR(NAME) case attr::NAME:
1965#include "clang/Basic/AttrList.inc"
1966 llvm_unreachable(
"non-type attribute attached to type");
1968 case attr::BTFTypeTag:
1969 llvm_unreachable(
"BTFTypeTag attribute handled separately");
1971 case attr::HLSLResourceClass:
1973 case attr::HLSLRawBuffer:
1974 case attr::HLSLContainedType:
1975 case attr::HLSLIsCounter:
1976 case attr::HLSLResourceDimension:
1977 llvm_unreachable(
"HLSL resource type attributes handled separately");
1979 case attr::OpenCLPrivateAddressSpace:
1980 case attr::OpenCLGlobalAddressSpace:
1981 case attr::OpenCLGlobalDeviceAddressSpace:
1982 case attr::OpenCLGlobalHostAddressSpace:
1983 case attr::OpenCLLocalAddressSpace:
1984 case attr::OpenCLConstantAddressSpace:
1985 case attr::OpenCLGenericAddressSpace:
1986 case attr::HLSLGroupSharedAddressSpace:
1991 case attr::CountedBy:
1992 case attr::CountedByOrNull:
1994 case attr::SizedByOrNull:
1995 case attr::LifetimeBound:
1996 case attr::LifetimeCaptureBy:
1997 case attr::TypeNonNull:
1998 case attr::TypeNullable:
1999 case attr::TypeNullableResult:
2000 case attr::TypeNullUnspecified:
2002 case attr::ObjCInertUnsafeUnretained:
2003 case attr::ObjCKindOf:
2004 case attr::ObjCOwnership:
2009 case attr::PointerAuth:
2010 case attr::AddressSpace:
2011 case attr::CmseNSCall:
2012 case attr::AnnotateType:
2013 case attr::WebAssemblyFuncref:
2014 case attr::ArmAgnostic:
2015 case attr::ArmStreaming:
2016 case attr::ArmStreamingCompatible:
2019 case attr::ArmInOut:
2020 case attr::ArmPreserves:
2021 case attr::NonBlocking:
2022 case attr::NonAllocating:
2023 case attr::Blocking:
2024 case attr::Allocating:
2025 case attr::SwiftAttr:
2026 case attr::PreserveAll:
2027 case attr::PreserveMost:
2028 case attr::PreserveNone:
2029 case attr::OverflowBehavior:
2030 llvm_unreachable(
"This attribute should have been handled already");
2032 case attr::NSReturnsRetained:
2033 OS <<
"ns_returns_retained";
2038 case attr::AnyX86NoCfCheck:
OS <<
"nocf_check";
break;
2039 case attr::CDecl:
OS <<
"cdecl";
break;
2040 case attr::FastCall:
OS <<
"fastcall";
break;
2041 case attr::StdCall:
OS <<
"stdcall";
break;
2042 case attr::ThisCall:
OS <<
"thiscall";
break;
2043 case attr::SwiftCall:
OS <<
"swiftcall";
break;
2044 case attr::SwiftAsyncCall:
OS <<
"swiftasynccall";
break;
2045 case attr::VectorCall:
OS <<
"vectorcall";
break;
2046 case attr::Pascal:
OS <<
"pascal";
break;
2047 case attr::MSABI:
OS <<
"ms_abi";
break;
2048 case attr::SysVABI:
OS <<
"sysv_abi";
break;
2049 case attr::RegCall:
OS <<
"regcall";
break;
2052 QualType t = T->getEquivalentType();
2056 "\"aapcs\"" :
"\"aapcs-vfp\"");
2060 case attr::AArch64VectorPcs:
OS <<
"aarch64_vector_pcs";
break;
2061 case attr::AArch64SVEPcs:
OS <<
"aarch64_sve_pcs";
break;
2062 case attr::IntelOclBicc:
2063 OS <<
"inteloclbicc";
2068 case attr::RISCVVectorCC:
2069 OS <<
"riscv_vector_cc";
2071 case attr::RISCVVLSCC:
2072 OS <<
"riscv_vls_cc";
2077 case attr::CFIUncheckedCallee:
2078 OS <<
"cfi_unchecked_callee";
2080 case attr::AcquireHandle:
2081 OS <<
"acquire_handle";
2083 case attr::ArmMveStrictPolymorphism:
2084 OS <<
"__clang_arm_mve_strict_polymorphism";
2086 case attr::ExtVectorType:
2087 OS <<
"ext_vector_type";
2092 case attr::NoFieldProtection:
2093 OS <<
"no_field_protection";
2095 case attr::PointerFieldProtection:
2096 OS <<
"pointer_field_protection";
2102void TypePrinter::printBTFTagAttributedBefore(
const BTFTagAttributedType *T,
2104 printBefore(T->getWrappedType(), OS);
2105 OS <<
" __attribute__((btf_type_tag(\"" << T->getAttr()->getBTFTypeTag() <<
"\")))";
2108void TypePrinter::printBTFTagAttributedAfter(
const BTFTagAttributedType *T,
2110 printAfter(T->getWrappedType(), OS);
2113void TypePrinter::printOverflowBehaviorBefore(
const OverflowBehaviorType *T,
2115 switch (T->getBehaviorKind()) {
2116 case clang::OverflowBehaviorType::OverflowBehaviorKind::Wrap:
2119 case clang::OverflowBehaviorType::OverflowBehaviorKind::Trap:
2123 printBefore(T->getUnderlyingType(), OS);
2126void TypePrinter::printOverflowBehaviorAfter(
const OverflowBehaviorType *T,
2128 printAfter(T->getUnderlyingType(), OS);
2131void TypePrinter::printHLSLAttributedResourceBefore(
2132 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2133 printBefore(T->getWrappedType(), OS);
2136void TypePrinter::printHLSLAttributedResourceAfter(
2137 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2138 printAfter(T->getWrappedType(), OS);
2139 const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
2140 OS <<
" [[hlsl::resource_class("
2141 << HLSLResourceClassAttr::ConvertResourceClassToStr(Attrs.ResourceClass)
2144 OS <<
" [[hlsl::is_rov]]";
2145 if (Attrs.RawBuffer)
2146 OS <<
" [[hlsl::raw_buffer]]";
2147 if (Attrs.IsCounter)
2148 OS <<
" [[hlsl::is_counter]]";
2150 QualType ContainedTy = T->getContainedType();
2151 if (!ContainedTy.
isNull()) {
2152 OS <<
" [[hlsl::contained_type(";
2153 printBefore(ContainedTy, OS);
2154 printAfter(ContainedTy, OS);
2158 if (Attrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown)
2159 OS <<
" [[hlsl::resource_dimension("
2160 << HLSLResourceDimensionAttr::ConvertResourceDimensionToStr(
2161 Attrs.ResourceDimension)
2165void TypePrinter::printHLSLInlineSpirvBefore(
const HLSLInlineSpirvType *T,
2167 OS <<
"__hlsl_spirv_type<" << T->getOpcode();
2169 OS <<
", " << T->getSize();
2170 OS <<
", " << T->getAlignment();
2172 for (
auto &Operand : T->getOperands()) {
2173 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
2177 case SpirvOperandKind::ConstantId: {
2178 QualType ConstantType =
Operand.getResultType();
2179 OS <<
"vk::integral_constant<";
2180 printBefore(ConstantType, OS);
2181 printAfter(ConstantType, OS);
2187 case SpirvOperandKind::Literal:
2188 OS <<
"vk::Literal<vk::integral_constant<uint, ";
2192 case SpirvOperandKind::TypeId: {
2194 printBefore(
Type, OS);
2195 printAfter(
Type, OS);
2199 llvm_unreachable(
"Invalid SpirvOperand kind!");
2207void TypePrinter::printHLSLInlineSpirvAfter(
const HLSLInlineSpirvType *T,
2212void TypePrinter::printObjCInterfaceBefore(
const ObjCInterfaceType *T,
2215 spaceBeforePlaceHolder(OS);
2218void TypePrinter::printObjCInterfaceAfter(
const ObjCInterfaceType *T,
2221void TypePrinter::printObjCTypeParamBefore(
const ObjCTypeParamType *T,
2223 OS << T->getDecl()->getName();
2224 if (!T->qual_empty()) {
2225 bool isFirst =
true;
2227 for (
const auto *I : T->quals()) {
2237 spaceBeforePlaceHolder(OS);
2240void TypePrinter::printObjCTypeParamAfter(
const ObjCTypeParamType *T,
2243void TypePrinter::printObjCObjectBefore(
const ObjCObjectType *T,
2245 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2246 !T->isKindOfTypeAsWritten())
2247 return printBefore(T->getBaseType(), OS);
2249 if (T->isKindOfTypeAsWritten())
2252 print(T->getBaseType(), OS, StringRef());
2254 if (T->isSpecializedAsWritten()) {
2255 bool isFirst =
true;
2257 for (
auto typeArg : T->getTypeArgsAsWritten()) {
2263 print(typeArg, OS, StringRef());
2268 if (!T->qual_empty()) {
2269 bool isFirst =
true;
2271 for (
const auto *I : T->quals()) {
2281 spaceBeforePlaceHolder(OS);
2284void TypePrinter::printObjCObjectAfter(
const ObjCObjectType *T,
2286 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2287 !T->isKindOfTypeAsWritten())
2288 return printAfter(T->getBaseType(), OS);
2291void TypePrinter::printObjCObjectPointerBefore(
const ObjCObjectPointerType *T,
2298 if (HasEmptyPlaceHolder)
2304void TypePrinter::printObjCObjectPointerAfter(
const ObjCObjectPointerType *T,
2315 llvm::raw_ostream &OS,
bool IncludeType) {
2316 A.
print(PP, OS, IncludeType);
2329 TemplateArgument Pattern,
2330 ArrayRef<TemplateArgument> Args,
2339 if (
auto *TTPT = Pattern->
getAsCanonical<TemplateTypeParmType>()) {
2340 if (TTPT->getDepth() == Depth && TTPT->getIndex() < Args.size() &&
2343 Args[TTPT->getIndex()].getAsType(), Pattern.
getQualifiers());
2355 if (TQual != PatQual)
2372 if (
auto *TTST = T->getAs<TemplateSpecializationType>()) {
2373 Template = TTST->getTemplateName();
2374 TemplateArgs = TTST->template_arguments();
2375 }
else if (
auto *CTSD = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
2376 T->getAsCXXRecordDecl())) {
2378 TemplateArgs = CTSD->getTemplateArgs().asArray();
2386 if (TemplateArgs.size() != PTST->template_arguments().size())
2388 for (
unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
2390 Ctx, TemplateArgs[I], PTST->template_arguments()[I], Args, Depth))
2441 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl()))
2442 return NTTP->getDepth() == Depth && Args.size() > NTTP->getIndex() &&
2443 Args[NTTP->getIndex()].structurallyEquals(Arg);
2459 if (
auto *TTPD = dyn_cast_or_null<TemplateTemplateParmDecl>(PatTD))
2460 return TTPD->getDepth() == Depth && Args.size() > TTPD->getIndex() &&
2469bool clang::isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
2470 const NamedDecl *Param,
2471 ArrayRef<TemplateArgument> Args,
2477 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param)) {
2478 return TTPD->hasDefaultArgument() &&
2480 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2481 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Param)) {
2482 return TTPD->hasDefaultArgument() &&
2484 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2485 }
else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2486 return NTTPD->hasDefaultArgument() &&
2488 Ctx, Arg, NTTPD->getDefaultArgument().getArgument(), Args,
2494template <
typename TA>
2500 !Args.empty() && !IsPack && Args.size() <= TPL->
size()) {
2502 for (
const TA &A : Args)
2504 while (!Args.empty() &&
getArgument(Args.back()).getIsDefaulted())
2505 Args = Args.drop_back();
2512 bool NeedSpace =
false;
2513 bool FirstArg =
true;
2514 for (
const auto &Arg : Args) {
2517 llvm::raw_svector_ostream ArgOS(Buf);
2530 Policy, TPL, ParmIndex));
2532 StringRef ArgString = ArgOS.str();
2537 if (FirstArg && ArgString.starts_with(
":"))
2544 if (!ArgString.empty()) {
2561void clang::printTemplateArgumentList(raw_ostream &OS,
2562 const TemplateArgumentListInfo &Args,
2563 const PrintingPolicy &Policy,
2564 const TemplateParameterList *TPL) {
2565 printTemplateArgumentList(OS, Args.
arguments(), Policy, TPL);
2568void clang::printTemplateArgumentList(raw_ostream &OS,
2569 ArrayRef<TemplateArgument> Args,
2570 const PrintingPolicy &Policy,
2571 const TemplateParameterList *TPL) {
2572 PrintingPolicy InnerPolicy = Policy;
2574 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2577void clang::printTemplateArgumentList(raw_ostream &OS,
2578 ArrayRef<TemplateArgumentLoc> Args,
2579 const PrintingPolicy &Policy,
2580 const TemplateParameterList *TPL) {
2581 PrintingPolicy InnerPolicy = Policy;
2583 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2593 llvm::raw_svector_ostream StrOS(Buf);
2595 return StrOS.str().str();
2623 llvm::raw_svector_ostream StrOS(Buf);
2624 print(StrOS, Policy);
2625 return std::string(StrOS.str());
2643 PointerAuth && !PointerAuth.isEmptyWhenPrinted(Policy))
2663 return "__constant";
2668 return "__global_device";
2671 return "__global_host";
2673 return "__device__";
2675 return "__constant__";
2677 return "__shared__";
2679 return "__sptr __ptr32";
2681 return "__uptr __ptr32";
2685 return "groupshared";
2687 return "hlsl_constant";
2689 return "hlsl_private";
2691 return "hlsl_device";
2693 return "hlsl_input";
2695 return "hlsl_push_constant";
2707 bool appendSpaceIfNonEmpty)
const {
2708 bool addSpace =
false;
2718 OS <<
"__unaligned";
2722 if (!ASStr.empty()) {
2728 OS <<
"__attribute__((address_space(" << ASStr <<
")))";
2767 PointerAuth.print(OS, Policy);
2770 if (appendSpaceIfNonEmpty && addSpace)
2792 const Twine &PlaceHolder,
unsigned Indentation)
const {
2799 const Twine &PlaceHolder,
unsigned Indentation) {
2801 StringRef PH = PlaceHolder.toStringRef(PHBuf);
2803 TypePrinter(policy, Indentation).print(ty, qs, OS, PH);
2813 std::string &buffer,
2816 llvm::raw_svector_ostream StrOS(Buf);
2817 TypePrinter(policy).print(ty, qs, StrOS, buffer);
2818 std::string str = std::string(StrOS.str());
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
Defines the clang::attr::Kind enum.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty)
#define CC_VLS_CASE(ABI_VLEN)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
static void printHLSLMatrixBefore(TypePrinter &TP, const ConstantMatrixType *T, raw_ostream &OS)
static void printTo(raw_ostream &OS, ArrayRef< TA > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL, bool IsPack, unsigned ParmIndex)
static const TemplateArgument & getArgument(const TemplateArgument &A)
static bool isSubstitutedType(ASTContext &Ctx, QualType T, QualType Pattern, ArrayRef< TemplateArgument > Args, unsigned Depth)
static void printArgument(const TemplateArgument &A, const PrintingPolicy &PP, llvm::raw_ostream &OS, bool IncludeType)
static QualType skipTopLevelReferences(QualType T)
static void printClangMatrixBefore(TypePrinter &TP, const ConstantMatrixType *T, raw_ostream &OS)
static void printDims(const ConstantMatrixType *T, raw_ostream &OS)
static void printHLSLMatrixAfter(const ConstantMatrixType *T, raw_ostream &OS)
static void printCountAttributedImpl(const CountAttributedType *T, raw_ostream &OS, const PrintingPolicy &Policy)
static SplitQualType splitAccordingToPolicy(QualType QT, const PrintingPolicy &Policy)
static bool isSubstitutedTemplateArgument(ASTContext &Ctx, TemplateArgument Arg, TemplateArgument Pattern, ArrayRef< TemplateArgument > Args, unsigned Depth)
static void AppendTypeQualList(raw_ostream &OS, unsigned TypeQuals, bool HasRestrictKeyword)
static bool templateArgumentExpressionsEqual(ASTContext const &Ctx, TemplateArgument const &Pattern, TemplateArgument const &Arg)
Evaluates the expression template argument 'Pattern' and returns true if 'Arg' evaluates to the same ...
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
QualType getAdjustedType() const
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
unsigned getNumBits() const
QualType getPointeeType() const
StringRef getName(const PrintingPolicy &Policy) const
QualType getElementType() const
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
Expr * getAddrSpaceExpr() const
QualType getPointeeType() const
Expr * getNumBitsExpr() const
Expr * getSizeExpr() const
Expr * getSizeExpr() const
QualType getElementType() const
Expr * getColumnExpr() const
Expr * getRowExpr() const
Expr * getSizeExpr() const
VectorKind getVectorKind() const
QualType getElementType() const
This represents one expression.
bool isIntegerConstantExpr(const ASTContext &Ctx) const
bool isValueDependent() const
Determines whether the value of this expression depends on.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumParams() const
void printExceptionSpecification(raw_ostream &OS, const PrintingPolicy &Policy) const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
Qualifiers getMethodQuals() const
QualType getParamType(unsigned i) const
FunctionEffectsRef getFunctionEffects() const
unsigned getAArch64SMEAttributes() const
Return a bitmask describing the SME attributes on the function type, see AArch64SMETypeAttributes for...
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
bool hasCFIUncheckedCallee() const
unsigned getNumExceptions() const
Return the number of types in the exception specification.
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
bool isVariadic() const
Whether this function prototype is variadic.
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
CallingConv getCC() const
bool getCmseNSCall() const
bool getNoCfCheck() const
unsigned getRegParm() const
bool getNoCallerSavedRegs() const
bool getProducesResult() const
ExtInfo getExtInfo() const
@ SME_PStateSMEnabledMask
@ SME_PStateSMCompatibleMask
@ SME_AgnosticZAStateMask
static ArmStateValue getArmZT0State(unsigned AttrBits)
static ArmStateValue getArmZAState(unsigned AttrBits)
QualType getReturnType() const
StringRef getName() const
Return the actual identifier string.
ElaboratedTypeKeyword getKeyword() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getModifiedType() const
Return this attributed type's modified type with no qualifiers attached to it.
const IdentifierInfo * getMacroIdentifier() const
QualType getElementType() const
Returns type of the elements being stored in the matrix.
NestedNameSpecifier getQualifier() const
QualType getPointeeType() const
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
void printNestedNameSpecifier(raw_ostream &OS) const
Print only the nested name specifier part of a fully-qualified name, including the '::' at the end.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false, bool PrintFinalScopeResOp=true) const
Print this nested name specifier to the given output stream.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
QualType getInnerType() const
QualType getElementType() const
Pointer-authentication qualifiers.
bool isAddressDiscriminated() const
unsigned getExtraDiscriminator() const
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
std::string getAsString() const
QualType getPointeeType() const
const IdentifierInfo * getIdentifier() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
QualType getCanonicalType() const
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
std::string getAsString() const
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
bool hasQualifiers() const
Return true if the set contains any qualifiers.
bool hasUnaligned() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
PointerAuthQualifier getPointerAuth() const
ObjCLifetime getObjCLifetime() const
std::string getAsString() const
LangAS getAddressSpace() const
static std::string getAddrSpaceAsString(LangAS AS)
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeTypeAsWritten() const
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
StringRef getKindName() const
TypedefNameDecl * getTypedefNameForAnonDecl() const
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
ArrayRef< TemplateArgumentLoc > arguments() const
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
TypeSourceInfo * getTypeSourceInfo() const
Represents a template argument.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
void print(const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const
Print this template argument to the given output stream.
ArgKind
The kind of template argument we're storing.
@ Template
The template argument is a template name that was provided for a template template parameter.
@ Pack
The template argument is actually a parameter pack.
@ Type
The template argument is a type.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
void print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const
Print the template name.
Stores a list of template parameters for a TemplateDecl and its derived classes.
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context)
Get the template argument list of the template parameter list.
static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)
unsigned getIndex() const
Retrieve the index of the template parameter.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
unsigned getDepth() const
Retrieve the depth of the template parameter.
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
Expr * getUnderlyingExpr() const
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
const T * castAs() const
Member-template castAs<specific type>.
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isObjCIdType() const
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
bool isFunctionType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
TypedefNameDecl * getDecl() const
NestedNameSpecifier getQualifier() const
NestedNameSpecifier getQualifier() const
UnresolvedUsingTypenameDecl * getDecl() const
UsingShadowDecl * getDecl() const
NestedNameSpecifier getQualifier() const
Expr * getSizeExpr() const
unsigned getNumElements() const
VectorKind getVectorKind() const
QualType getElementType() const
const internal::VariadicAllOfMatcher< Attr > attr
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
llvm::StringRef getParameterABISpelling(ParameterABI kind)
bool isTargetAddressSpace(LangAS AS)
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
unsigned toTargetAddressSpace(LangAS AS)
ParameterABI
Kinds of parameter ABI.
@ SwiftAsyncContext
This parameter (which must have pointer type) uses the special Swift asynchronous context-pointer ABI...
@ SwiftErrorResult
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
@ Ordinary
This parameter uses ordinary ABI rules for its type.
@ SwiftIndirectResult
This parameter (which must have pointer type) is a Swift indirect result parameter.
@ SwiftContext
This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
@ Keyword
The name has been typo-corrected to a keyword.
@ Type
The name was classified as a type.
LangAS
Defines the address space values used by the address space qualifier of QualType.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
llvm::StringRef getAsString(SyncScope S)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
U cast(CodeGen::Address addr)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_MSAny
Microsoft throw(...) extension.
ArrayRef< TemplateArgumentLoc > arguments() const
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
Describes how types, statements, expressions, and declarations should be printed.
unsigned FullyQualifiedName
When true, print the fully qualified name of function declarations.
unsigned MSVCFormatting
Use whitespace and punctuation like MSVC does.
unsigned SuppressDefaultTemplateArgs
When true, attempt to suppress template arguments that match the default argument for the parameter.
unsigned SplitTemplateClosers
Whether nested templates must be closed like 'a<b<c> >' rather than 'a<b<c>>'.
unsigned PrintInjectedClassNameWithArguments
Whether to print an InjectedClassNameType with template arguments or as written.
unsigned UseVoidForZeroParams
Whether we should use '(void)' rather than '()' for a function prototype with zero parameters.
unsigned CleanUglifiedParameters
Whether to strip underscores when printing reserved parameter names.
unsigned SuppressSpecifiers
Whether we should suppress printing of the actual specifiers for the given type or declaration.
unsigned SuppressTagKeyword
Whether type printing should skip printing the tag keyword.
unsigned UsePreferredNames
Whether to use C++ template preferred_name attributes when printing templates.
unsigned SuppressStrongLifetime
When true, suppress printing of the __strong lifetime qualifier in ARC.
unsigned Restrict
Whether we can use 'restrict' rather than '__restrict'.
unsigned UseHLSLTypes
Whether or not we're printing known HLSL code and should print HLSL sugared types when possible.
unsigned SuppressScope
Suppresses printing of scope specifiers.
unsigned IncludeTagDefinition
When true, include the body of a tag definition.
unsigned PrintAsCanonical
Whether to print entities as written or canonically.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.