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, raw_ostream &OS) {
649 spaceBeforePlaceHolder(OS);
655void TypePrinter::printDependentSizedExtVectorAfter(
656 const DependentSizedExtVectorType *T, raw_ostream &OS) {
660 OS <<
" __attribute__((ext_vector_type(";
667void TypePrinter::printVectorBefore(
const VectorType *T, raw_ostream &OS) {
669 case VectorKind::AltiVecPixel:
670 OS <<
"__vector __pixel ";
672 case VectorKind::AltiVecBool:
673 OS <<
"__vector __bool ";
676 case VectorKind::AltiVecVector:
680 case VectorKind::Neon:
681 OS <<
"__attribute__((neon_vector_type("
685 case VectorKind::NeonPoly:
686 OS <<
"__attribute__((neon_polyvector_type(" <<
690 case VectorKind::Generic: {
693 OS <<
"__attribute__((__vector_size__("
701 case VectorKind::SveFixedLengthData:
702 case VectorKind::SveFixedLengthPredicate:
705 OS <<
"__attribute__((__arm_sve_vector_bits__(";
707 if (T->
getVectorKind() == VectorKind::SveFixedLengthPredicate)
720 case VectorKind::RVVFixedLengthData:
721 case VectorKind::RVVFixedLengthMask:
722 case VectorKind::RVVFixedLengthMask_1:
723 case VectorKind::RVVFixedLengthMask_2:
724 case VectorKind::RVVFixedLengthMask_4:
727 OS <<
"__attribute__((__riscv_rvv_vector_bits__(";
729 case VectorKind::RVVFixedLengthMask_1:
732 case VectorKind::RVVFixedLengthMask_2:
735 case VectorKind::RVVFixedLengthMask_4:
752void TypePrinter::printVectorAfter(
const VectorType *T, raw_ostream &OS) {
756void TypePrinter::printDependentVectorBefore(
757 const DependentVectorType *T, raw_ostream &OS) {
759 case VectorKind::AltiVecPixel:
760 OS <<
"__vector __pixel ";
762 case VectorKind::AltiVecBool:
763 OS <<
"__vector __bool ";
766 case VectorKind::AltiVecVector:
770 case VectorKind::Neon:
771 OS <<
"__attribute__((neon_vector_type(";
777 case VectorKind::NeonPoly:
778 OS <<
"__attribute__((neon_polyvector_type(";
784 case VectorKind::Generic: {
787 OS <<
"__attribute__((__vector_size__(";
796 case VectorKind::SveFixedLengthData:
797 case VectorKind::SveFixedLengthPredicate:
800 OS <<
"__attribute__((__arm_sve_vector_bits__(";
803 if (T->
getVectorKind() == VectorKind::SveFixedLengthPredicate)
815 case VectorKind::RVVFixedLengthData:
816 case VectorKind::RVVFixedLengthMask:
817 case VectorKind::RVVFixedLengthMask_1:
818 case VectorKind::RVVFixedLengthMask_2:
819 case VectorKind::RVVFixedLengthMask_4:
822 OS <<
"__attribute__((__riscv_rvv_vector_bits__(";
824 case VectorKind::RVVFixedLengthMask_1:
827 case VectorKind::RVVFixedLengthMask_2:
830 case VectorKind::RVVFixedLengthMask_4:
849void TypePrinter::printDependentVectorAfter(
850 const DependentVectorType *T, raw_ostream &OS) {
854void TypePrinter::printExtVectorBefore(
const ExtVectorType *T,
860 spaceBeforePlaceHolder(OS);
866void TypePrinter::printExtVectorAfter(
const ExtVectorType *T, raw_ostream &OS) {
871 OS <<
" __attribute__((ext_vector_type(";
877 OS << T->getNumRows() <<
", " << T->getNumColumns();
883 TP.print(T->getElementType(), OS, StringRef());
887 TP.spaceBeforePlaceHolder(OS);
895 TP.printBefore(T->getElementType(), OS);
896 OS <<
" __attribute__((matrix_type(";
901void TypePrinter::printConstantMatrixBefore(
const ConstantMatrixType *T,
910void TypePrinter::printConstantMatrixAfter(
const ConstantMatrixType *T,
919void TypePrinter::printDependentSizedMatrixBefore(
920 const DependentSizedMatrixType *T, raw_ostream &OS) {
931 spaceBeforePlaceHolder(OS);
934 OS <<
" __attribute__((matrix_type(";
944void TypePrinter::printDependentSizedMatrixAfter(
945 const DependentSizedMatrixType *T, raw_ostream &OS) {
967 OS <<
" __attribute__((nothrow))";
983 if (T->hasTrailingReturn()) {
985 if (!HasEmptyPlaceHolder)
990 printBefore(T->getReturnType(), OS);
991 if (!PrevPHIsEmpty.get())
999 llvm_unreachable(
"asking for spelling of ordinary parameter ABI");
1001 return "swift_context";
1003 return "swift_async_context";
1005 return "swift_error_result";
1007 return "swift_indirect_result";
1013 llvm_unreachable(
"bad parameter ABI kind");
1019 if (!HasEmptyPlaceHolder)
1025 ParamPolicyRAII ParamPolicy(Policy);
1026 for (
unsigned i = 0, e = T->getNumParams(); i != e; ++i) {
1029 auto EPI = T->getExtParameterInfo(i);
1030 if (EPI.isConsumed()) OS <<
"__attribute__((ns_consumed)) ";
1031 if (EPI.isNoEscape())
1032 OS <<
"__attribute__((noescape)) ";
1033 auto ABI = EPI.getABI();
1041 print(T->getParamType(i).getNonReferenceType(), OS, StringRef());
1044 }
else if (ABI != ParameterABI::Ordinary)
1062 FunctionType::ExtInfo Info = T->
getExtInfo();
1066 OS <<
" __arm_streaming_compatible";
1068 OS <<
" __arm_streaming";
1070 OS <<
"__arm_agnostic(\"sme_za_state\")";
1072 OS <<
" __arm_preserves(\"za\")";
1074 OS <<
" __arm_in(\"za\")";
1076 OS <<
" __arm_out(\"za\")";
1078 OS <<
" __arm_inout(\"za\")";
1080 OS <<
" __arm_preserves(\"zt0\")";
1082 OS <<
" __arm_in(\"zt0\")";
1084 OS <<
" __arm_out(\"zt0\")";
1086 OS <<
" __arm_inout(\"zt0\")";
1088 printFunctionAfter(Info, OS);
1108 for (
const auto &CFE : FX) {
1109 OS <<
" __attribute__((" << CFE.Effect.name();
1110 if (
const Expr *E = CFE.Cond.getCondition()) {
1112 E->printPretty(OS,
nullptr, Policy);
1119 OS <<
" __attribute__((cfi_unchecked_callee))";
1128void TypePrinter::printFunctionAfter(
const FunctionType::ExtInfo &Info,
1130 if (!InsideCCAttribute) {
1131 switch (Info.
getCC()) {
1142 OS <<
" __attribute__((stdcall))";
1145 OS <<
" __attribute__((fastcall))";
1148 OS <<
" __attribute__((thiscall))";
1151 OS <<
" __attribute__((vectorcall))";
1154 OS <<
" __attribute__((pascal))";
1157 OS <<
" __attribute__((pcs(\"aapcs\")))";
1160 OS <<
" __attribute__((pcs(\"aapcs-vfp\")))";
1163 OS <<
" __attribute__((aarch64_vector_pcs))";
1166 OS <<
" __attribute__((aarch64_sve_pcs))";
1169 OS <<
" __attribute__((device_kernel))";
1172 OS <<
" __attribute__((intel_ocl_bicc))";
1175 OS <<
" __attribute__((ms_abi))";
1178 OS <<
" __attribute__((sysv_abi))";
1181 OS <<
" __attribute__((regcall))";
1187 OS <<
" __attribute__((swiftcall))";
1190 OS <<
"__attribute__((swiftasynccall))";
1193 OS <<
" __attribute__((preserve_most))";
1196 OS <<
" __attribute__((preserve_all))";
1199 OS <<
" __attribute__((m68k_rtd))";
1202 OS <<
" __attribute__((preserve_none))";
1205 OS <<
"__attribute__((riscv_vector_cc))";
1207#define CC_VLS_CASE(ABI_VLEN) \
1208 case CC_RISCVVLSCall_##ABI_VLEN: \
1209 OS << "__attribute__((riscv_vls_cc" #ABI_VLEN "))"; \
1228 OS <<
" __attribute__((noreturn))";
1230 OS <<
" __attribute__((cmse_nonsecure_call))";
1232 OS <<
" __attribute__((ns_returns_retained))";
1234 OS <<
" __attribute__((regparm ("
1237 OS <<
" __attribute__((no_caller_saved_registers))";
1239 OS <<
" __attribute__((nocf_check))";
1242void TypePrinter::printFunctionNoProtoBefore(
const FunctionNoProtoType *T,
1245 SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder,
false);
1247 if (!PrevPHIsEmpty.get())
1251void TypePrinter::printFunctionNoProtoAfter(
const FunctionNoProtoType *T,
1254 if (!HasEmptyPlaceHolder)
1256 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
1263void TypePrinter::printTypeSpec(NamedDecl *D, raw_ostream &OS) {
1273 spaceBeforePlaceHolder(OS);
1276void TypePrinter::printUnresolvedUsingBefore(
const UnresolvedUsingType *T,
1278 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1279 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1288 spaceBeforePlaceHolder(OS);
1291void TypePrinter::printUnresolvedUsingAfter(
const UnresolvedUsingType *T,
1294void TypePrinter::printUsingBefore(
const UsingType *T, raw_ostream &OS) {
1295 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1296 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1305 spaceBeforePlaceHolder(OS);
1308void TypePrinter::printUsingAfter(
const UsingType *T, raw_ostream &OS) {}
1310void TypePrinter::printTypedefBefore(
const TypedefType *T, raw_ostream &OS) {
1311 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1312 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1321 spaceBeforePlaceHolder(OS);
1324void TypePrinter::printMacroQualifiedBefore(
const MacroQualifiedType *T,
1327 OS << MacroName <<
" ";
1334void TypePrinter::printMacroQualifiedAfter(
const MacroQualifiedType *T,
1339void TypePrinter::printTypedefAfter(
const TypedefType *T, raw_ostream &OS) {}
1341void TypePrinter::printTypeOfExprBefore(
const TypeOfExprType *T,
1343 OS << (T->
getKind() == TypeOfKind::Unqualified ?
"typeof_unqual "
1347 spaceBeforePlaceHolder(OS);
1350void TypePrinter::printTypeOfExprAfter(
const TypeOfExprType *T,
1353void TypePrinter::printTypeOfBefore(
const TypeOfType *T, raw_ostream &OS) {
1354 OS << (T->getKind() == TypeOfKind::Unqualified ?
"typeof_unqual("
1356 print(T->getUnmodifiedType(), OS, StringRef());
1358 spaceBeforePlaceHolder(OS);
1361void TypePrinter::printTypeOfAfter(
const TypeOfType *T, raw_ostream &OS) {}
1363void TypePrinter::printDecltypeBefore(
const DecltypeType *T, raw_ostream &OS) {
1365 if (
const Expr *E = T->getUnderlyingExpr()) {
1366 PrintingPolicy ExprPolicy = Policy;
1368 E->printPretty(OS,
nullptr, ExprPolicy);
1371 spaceBeforePlaceHolder(OS);
1374void TypePrinter::printPackIndexingBefore(
const PackIndexingType *T,
1376 if (T->hasSelectedType()) {
1377 OS << T->getSelectedType();
1379 OS << T->getPattern() <<
"...[";
1380 T->getIndexExpr()->printPretty(OS,
nullptr, Policy);
1383 spaceBeforePlaceHolder(OS);
1386void TypePrinter::printPackIndexingAfter(
const PackIndexingType *T,
1389void TypePrinter::printDecltypeAfter(
const DecltypeType *T, raw_ostream &OS) {}
1391void TypePrinter::printUnaryTransformBefore(
const UnaryTransformType *T,
1393 IncludeStrongLifetimeRAII Strong(Policy);
1395 static const llvm::DenseMap<int, const char *> Transformation = {{
1396#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
1397 {UnaryTransformType::Enum, "__" #Trait},
1398#include "clang/Basic/TransformTypeTraits.def"
1400 OS << Transformation.lookup(T->getUTTKind()) <<
'(';
1401 print(T->getBaseType(), OS, StringRef());
1403 spaceBeforePlaceHolder(OS);
1406void TypePrinter::printUnaryTransformAfter(
const UnaryTransformType *T,
1409void TypePrinter::printAutoBefore(
const AutoType *T, raw_ostream &OS) {
1411 if (!T->getDeducedType().isNull()) {
1412 printBefore(T->getDeducedType(), OS);
1414 if (T->isConstrained()) {
1417 T->getTypeConstraintConcept()->getDeclName().print(OS, Policy);
1418 auto Args = T->getTypeConstraintArguments();
1420 printTemplateArgumentList(
1422 T->getTypeConstraintConcept()->getTemplateParameters());
1425 switch (T->getKeyword()) {
1426 case AutoTypeKeyword::Auto:
OS <<
"auto";
break;
1427 case AutoTypeKeyword::DecltypeAuto:
OS <<
"decltype(auto)";
break;
1428 case AutoTypeKeyword::GNUAutoType:
OS <<
"__auto_type";
break;
1430 spaceBeforePlaceHolder(OS);
1434void TypePrinter::printAutoAfter(
const AutoType *T, raw_ostream &OS) {
1436 if (!T->getDeducedType().isNull())
1437 printAfter(T->getDeducedType(), OS);
1440void TypePrinter::printDeducedTemplateSpecializationBefore(
1441 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1443 T->getKeyword() != ElaboratedTypeKeyword::None)
1453 ArrayRef<TemplateArgument> Args;
1454 TemplateDecl *DeducedTD =
nullptr;
1455 if (!T->getDeducedType().isNull()) {
1456 if (
const auto *TST =
1457 dyn_cast<TemplateSpecializationType>(T->getDeducedType())) {
1458 DeducedTD = TST->getTemplateName().getAsTemplateDecl(
1460 Args = TST->template_arguments();
1465 DeducedTD = CD->getSpecializedTemplate();
1466 Args = CD->getTemplateArgs().asArray();
1480 IncludeStrongLifetimeRAII Strong(Policy);
1481 Name.
print(OS, Policy);
1484 printTemplateArgumentList(OS, Args, Policy,
1488 spaceBeforePlaceHolder(OS);
1491void TypePrinter::printDeducedTemplateSpecializationAfter(
1492 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1494 if (!T->getDeducedType().isNull())
1495 printAfter(T->getDeducedType(), OS);
1498void TypePrinter::printAtomicBefore(
const AtomicType *T, raw_ostream &OS) {
1499 IncludeStrongLifetimeRAII Strong(Policy);
1504 spaceBeforePlaceHolder(OS);
1507void TypePrinter::printAtomicAfter(
const AtomicType *T, raw_ostream &OS) {}
1509void TypePrinter::printPipeBefore(
const PipeType *T, raw_ostream &OS) {
1510 IncludeStrongLifetimeRAII Strong(Policy);
1515 OS <<
"write_only ";
1518 spaceBeforePlaceHolder(OS);
1521void TypePrinter::printPipeAfter(
const PipeType *T, raw_ostream &OS) {}
1523void TypePrinter::printBitIntBefore(
const BitIntType *T, raw_ostream &OS) {
1527 spaceBeforePlaceHolder(OS);
1530void TypePrinter::printBitIntAfter(
const BitIntType *T, raw_ostream &OS) {}
1532void TypePrinter::printDependentBitIntBefore(
const DependentBitIntType *T,
1539 spaceBeforePlaceHolder(OS);
1542void TypePrinter::printDependentBitIntAfter(
const DependentBitIntType *T,
1545void TypePrinter::printPredefinedSugarBefore(
const PredefinedSugarType *T,
1548 spaceBeforePlaceHolder(OS);
1551void TypePrinter::printPredefinedSugarAfter(
const PredefinedSugarType *T,
1554void TypePrinter::printTagType(
const TagType *T, raw_ostream &OS) {
1555 TagDecl *D = T->getDecl();
1558 D->
print(OS, Policy, Indentation);
1559 spaceBeforePlaceHolder(OS);
1563 bool PrintedKindDecoration =
false;
1564 if (T->isCanonicalUnqualified()) {
1566 PrintedKindDecoration =
true;
1571 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1572 if (T->getKeyword() != ElaboratedTypeKeyword::None) {
1573 PrintedKindDecoration =
true;
1579 T->getQualifier().print(OS, Policy);
1590 clang::PrintingPolicy
Copy(Policy);
1593 if (PrintedKindDecoration) {
1594 Copy.SuppressTagKeywordInAnonNames =
true;
1595 Copy.SuppressTagKeyword =
true;
1603 if (
auto *S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
1604 const TemplateParameterList *TParams =
1605 S->getSpecializedTemplate()->getTemplateParameters();
1606 const ASTTemplateArgumentListInfo *TArgAsWritten =
1607 S->getTemplateArgsAsWritten();
1608 IncludeStrongLifetimeRAII Strong(Policy);
1610 printTemplateArgumentList(OS, TArgAsWritten->
arguments(), Policy,
1613 printTemplateArgumentList(OS, S->getTemplateArgs().asArray(), Policy,
1617 spaceBeforePlaceHolder(OS);
1620void TypePrinter::printRecordBefore(
const RecordType *T, raw_ostream &OS) {
1623 for (
const auto *PNA : T->getDecl()
1624 ->getMostRecentDecl()
1625 ->specific_attrs<PreferredNameAttr>()) {
1630 QualType T = PNA->getTypedefType();
1632 if (
auto *TT = dyn_cast<TypedefType>(T))
1633 return printTypeSpec(TT->getDecl(), OS);
1634 if (
auto *TST = dyn_cast<TemplateSpecializationType>(T))
1635 return printTemplateId(TST, OS,
true);
1641 printTagType(T, OS);
1644void TypePrinter::printRecordAfter(
const RecordType *T, raw_ostream &OS) {}
1646void TypePrinter::printEnumBefore(
const EnumType *T, raw_ostream &OS) {
1647 printTagType(T, OS);
1650void TypePrinter::printEnumAfter(
const EnumType *T, raw_ostream &OS) {}
1652void TypePrinter::printInjectedClassNameBefore(
const InjectedClassNameType *T,
1654 const ASTContext &Ctx = T->getDecl()->getASTContext();
1655 IncludeStrongLifetimeRAII Strong(Policy);
1656 T->getTemplateName(Ctx).print(OS, Policy);
1658 auto *
Decl = T->getDecl();
1661 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(Decl)) {
1662 printTemplateArgumentList(OS, RD->getTemplateArgsAsWritten()->arguments(),
1664 T->getTemplateDecl()->getTemplateParameters());
1666 ClassTemplateDecl *TD =
Decl->getDescribedClassTemplate();
1668 printTemplateArgumentList(
1670 T->getTemplateDecl()->getTemplateParameters());
1673 spaceBeforePlaceHolder(OS);
1676void TypePrinter::printInjectedClassNameAfter(
const InjectedClassNameType *T,
1679void TypePrinter::printTemplateTypeParmBefore(
const TemplateTypeParmType *T,
1681 TemplateTypeParmDecl *D = T->getDecl();
1684 TC->print(OS, Policy);
1688 }
else if (IdentifierInfo *Id = T->getIdentifier())
1692 OS <<
"type-parameter-" << T->getDepth() <<
'-' << T->getIndex();
1694 spaceBeforePlaceHolder(OS);
1697void TypePrinter::printTemplateTypeParmAfter(
const TemplateTypeParmType *T,
1700void TypePrinter::printSubstTemplateTypeParmBefore(
1701 const SubstTemplateTypeParmType *T,
1703 IncludeStrongLifetimeRAII Strong(Policy);
1704 printBefore(T->getReplacementType(), OS);
1707void TypePrinter::printSubstTemplateTypeParmAfter(
1708 const SubstTemplateTypeParmType *T,
1710 IncludeStrongLifetimeRAII Strong(Policy);
1711 printAfter(T->getReplacementType(), OS);
1714void TypePrinter::printSubstBuiltinTemplatePackBefore(
1715 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {
1716 IncludeStrongLifetimeRAII Strong(Policy);
1720void TypePrinter::printSubstBuiltinTemplatePackAfter(
1721 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {}
1723void TypePrinter::printSubstTemplateTypeParmPackBefore(
1724 const SubstTemplateTypeParmPackType *T,
1726 IncludeStrongLifetimeRAII Strong(Policy);
1727 if (
const TemplateTypeParmDecl *D = T->getReplacedParameter()) {
1730 TC->print(OS, Policy);
1740 spaceBeforePlaceHolder(OS);
1744void TypePrinter::printSubstTemplateTypeParmPackAfter(
1745 const SubstTemplateTypeParmPackType *T,
1747 IncludeStrongLifetimeRAII Strong(Policy);
1750void TypePrinter::printTemplateId(
const TemplateSpecializationType *T,
1751 raw_ostream &OS,
bool FullyQualify) {
1752 IncludeStrongLifetimeRAII Strong(Policy);
1755 K != ElaboratedTypeKeyword::None)
1756 OS << TypeWithKeyword::getKeywordName(K) <<
' ';
1759 T->getTemplateName().getAsTemplateDecl(
true);
1761 if (FullyQualify && TD) {
1767 T->getTemplateName().print(OS, Policy,
1769 ? TemplateName::Qualified::AsWritten
1770 : TemplateName::Qualified::None);
1773 DefaultTemplateArgsPolicyRAII TemplateArgs(Policy);
1775 printTemplateArgumentList(OS, T->template_arguments(), Policy, TPL);
1776 spaceBeforePlaceHolder(OS);
1779void TypePrinter::printTemplateSpecializationBefore(
1780 const TemplateSpecializationType *T,
1785void TypePrinter::printTemplateSpecializationAfter(
1786 const TemplateSpecializationType *T,
1789void TypePrinter::printParenBefore(
const ParenType *T, raw_ostream &OS) {
1797void TypePrinter::printParenAfter(
const ParenType *T, raw_ostream &OS) {
1805void TypePrinter::printDependentNameBefore(
const DependentNameType *T,
1807 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1808 if (T->getKeyword() != ElaboratedTypeKeyword::None)
1810 T->getQualifier().print(OS, Policy);
1811 OS << T->getIdentifier()->getName();
1812 spaceBeforePlaceHolder(OS);
1815void TypePrinter::printDependentNameAfter(
const DependentNameType *T,
1818void TypePrinter::printPackExpansionBefore(
const PackExpansionType *T,
1820 printBefore(T->getPattern(), OS);
1823void TypePrinter::printPackExpansionAfter(
const PackExpansionType *T,
1825 printAfter(T->getPattern(), OS);
1833 if (T->isCountInBytes() && T->isOrNull())
1834 OS <<
"__sized_by_or_null(";
1835 else if (T->isCountInBytes())
1836 OS <<
"__sized_by(";
1837 else if (T->isOrNull())
1838 OS <<
"__counted_by_or_null(";
1840 OS <<
"__counted_by(";
1841 if (T->getCountExpr())
1842 T->getCountExpr()->printPretty(OS,
nullptr, Policy);
1846void TypePrinter::printCountAttributedBefore(
const CountAttributedType *T,
1848 printBefore(T->
desugar(), OS);
1853void TypePrinter::printCountAttributedAfter(
const CountAttributedType *T,
1860void TypePrinter::printAttributedBefore(
const AttributedType *T,
1865 if (T->getAttrKind() == attr::ObjCGC ||
1866 T->getAttrKind() == attr::ObjCOwnership)
1867 return printBefore(T->getEquivalentType(), OS);
1869 if (T->getAttrKind() == attr::ObjCKindOf)
1872 if (T->getAttrKind() == attr::PreserveNone) {
1873 OS <<
"__attribute__((preserve_none)) ";
1874 spaceBeforePlaceHolder(OS);
1875 }
else if (T->getAttrKind() == attr::PreserveMost) {
1876 OS <<
"__attribute__((preserve_most)) ";
1877 spaceBeforePlaceHolder(OS);
1878 }
else if (T->getAttrKind() == attr::PreserveAll) {
1879 OS <<
"__attribute__((preserve_all)) ";
1880 spaceBeforePlaceHolder(OS);
1883 if (T->getAttrKind() == attr::AddressSpace)
1884 printBefore(T->getEquivalentType(), OS);
1886 printBefore(T->getModifiedType(), OS);
1888 if (T->isMSTypeSpec()) {
1889 switch (T->getAttrKind()) {
1891 case attr::Ptr32:
OS <<
" __ptr32";
break;
1892 case attr::Ptr64:
OS <<
" __ptr64";
break;
1893 case attr::SPtr:
OS <<
" __sptr";
break;
1894 case attr::UPtr:
OS <<
" __uptr";
break;
1896 spaceBeforePlaceHolder(OS);
1899 if (T->isWebAssemblyFuncrefSpec())
1903 if (T->getImmediateNullability()) {
1904 if (T->getAttrKind() == attr::TypeNonNull)
1906 else if (T->getAttrKind() == attr::TypeNullable)
1908 else if (T->getAttrKind() == attr::TypeNullUnspecified)
1909 OS <<
" _Null_unspecified";
1910 else if (T->getAttrKind() == attr::TypeNullableResult)
1911 OS <<
" _Nullable_result";
1913 llvm_unreachable(
"unhandled nullability");
1914 spaceBeforePlaceHolder(OS);
1918void TypePrinter::printAttributedAfter(
const AttributedType *T,
1923 if (T->getAttrKind() == attr::ObjCGC ||
1924 T->getAttrKind() == attr::ObjCOwnership)
1925 return printAfter(T->getEquivalentType(), OS);
1929 SaveAndRestore MaybeSuppressCC(InsideCCAttribute, T->isCallingConv());
1931 printAfter(T->getModifiedType(), OS);
1935 if (T->getAttrKind() == attr::ObjCKindOf || T->isMSTypeSpec() ||
1936 T->getImmediateNullability() || T->isWebAssemblyFuncrefSpec())
1940 if (T->getAttrKind() == attr::ObjCInertUnsafeUnretained)
1944 if (T->getAttrKind() == attr::NSReturnsRetained &&
1945 !T->getEquivalentType()->castAs<FunctionType>()
1946 ->getExtInfo().getProducesResult())
1949 if (T->getAttrKind() == attr::LifetimeBound) {
1950 OS <<
" [[clang::lifetimebound]]";
1953 if (T->getAttrKind() == attr::LifetimeCaptureBy) {
1954 OS <<
" [[clang::lifetime_capture_by(";
1955 if (
auto *attr = dyn_cast_or_null<LifetimeCaptureByAttr>(T->getAttr()))
1956 llvm::interleaveComma(
attr->getArgIdents(), OS,
1957 [&](
auto it) { OS << it->getName(); });
1965 if (T->getAttrKind() == attr::AddressSpace)
1968 if (T->getAttrKind() == attr::AnnotateType) {
1973 OS <<
" [[clang::annotate_type(...)]]";
1977 if (T->getAttrKind() == attr::ArmStreaming) {
1978 OS <<
"__arm_streaming";
1981 if (T->getAttrKind() == attr::ArmStreamingCompatible) {
1982 OS <<
"__arm_streaming_compatible";
1986 if (T->getAttrKind() == attr::SwiftAttr) {
1987 if (
auto *swiftAttr = dyn_cast_or_null<SwiftAttrAttr>(T->getAttr())) {
1988 OS <<
" __attribute__((swift_attr(\"" << swiftAttr->getAttribute()
1994 if (T->getAttrKind() == attr::PreserveAll ||
1995 T->getAttrKind() == attr::PreserveMost ||
1996 T->getAttrKind() == attr::PreserveNone) {
2001 OS <<
" __attribute__((";
2002 switch (T->getAttrKind()) {
2003#define TYPE_ATTR(NAME)
2004#define DECL_OR_TYPE_ATTR(NAME)
2005#define ATTR(NAME) case attr::NAME:
2006#include "clang/Basic/AttrList.inc"
2007 llvm_unreachable(
"non-type attribute attached to type");
2009 case attr::BTFTypeTag:
2010 llvm_unreachable(
"BTFTypeTag attribute handled separately");
2012 case attr::HLSLResourceClass:
2014 case attr::HLSLRawBuffer:
2015 case attr::HLSLContainedType:
2016 case attr::HLSLIsCounter:
2017 case attr::HLSLResourceDimension:
2018 case attr::HLSLIsArray:
2019 llvm_unreachable(
"HLSL resource type attributes handled separately");
2021 case attr::OpenCLPrivateAddressSpace:
2022 case attr::OpenCLGlobalAddressSpace:
2023 case attr::OpenCLGlobalDeviceAddressSpace:
2024 case attr::OpenCLGlobalHostAddressSpace:
2025 case attr::OpenCLLocalAddressSpace:
2026 case attr::OpenCLConstantAddressSpace:
2027 case attr::OpenCLGenericAddressSpace:
2028 case attr::HLSLGroupSharedAddressSpace:
2033 case attr::CountedBy:
2034 case attr::CountedByOrNull:
2036 case attr::SizedByOrNull:
2037 case attr::LifetimeBound:
2038 case attr::LifetimeCaptureBy:
2039 case attr::TypeNonNull:
2040 case attr::TypeNullable:
2041 case attr::TypeNullableResult:
2042 case attr::TypeNullUnspecified:
2044 case attr::ObjCInertUnsafeUnretained:
2045 case attr::ObjCKindOf:
2046 case attr::ObjCOwnership:
2051 case attr::PointerAuth:
2052 case attr::AddressSpace:
2053 case attr::CmseNSCall:
2054 case attr::AnnotateType:
2055 case attr::WebAssemblyFuncref:
2056 case attr::ArmAgnostic:
2057 case attr::ArmStreaming:
2058 case attr::ArmStreamingCompatible:
2061 case attr::ArmInOut:
2062 case attr::ArmPreserves:
2063 case attr::NonBlocking:
2064 case attr::NonAllocating:
2065 case attr::Blocking:
2066 case attr::Allocating:
2067 case attr::SwiftAttr:
2068 case attr::PreserveAll:
2069 case attr::PreserveMost:
2070 case attr::PreserveNone:
2071 case attr::OverflowBehavior:
2072 llvm_unreachable(
"This attribute should have been handled already");
2074 case attr::NSReturnsRetained:
2075 OS <<
"ns_returns_retained";
2078 case attr::HLSLRowMajor:
2081 case attr::HLSLColumnMajor:
2082 OS <<
"column_major";
2087 case attr::AnyX86NoCfCheck:
OS <<
"nocf_check";
break;
2088 case attr::CDecl:
OS <<
"cdecl";
break;
2089 case attr::FastCall:
OS <<
"fastcall";
break;
2090 case attr::StdCall:
OS <<
"stdcall";
break;
2091 case attr::ThisCall:
OS <<
"thiscall";
break;
2092 case attr::SwiftCall:
OS <<
"swiftcall";
break;
2093 case attr::SwiftAsyncCall:
OS <<
"swiftasynccall";
break;
2094 case attr::VectorCall:
OS <<
"vectorcall";
break;
2095 case attr::Pascal:
OS <<
"pascal";
break;
2096 case attr::MSABI:
OS <<
"ms_abi";
break;
2097 case attr::SysVABI:
OS <<
"sysv_abi";
break;
2098 case attr::RegCall:
OS <<
"regcall";
break;
2101 QualType t = T->getEquivalentType();
2105 "\"aapcs\"" :
"\"aapcs-vfp\"");
2109 case attr::AArch64VectorPcs:
OS <<
"aarch64_vector_pcs";
break;
2110 case attr::AArch64SVEPcs:
OS <<
"aarch64_sve_pcs";
break;
2111 case attr::IntelOclBicc:
2112 OS <<
"inteloclbicc";
2117 case attr::RISCVVectorCC:
2118 OS <<
"riscv_vector_cc";
2120 case attr::RISCVVLSCC:
2121 OS <<
"riscv_vls_cc";
2126 case attr::CFIUncheckedCallee:
2127 OS <<
"cfi_unchecked_callee";
2129 case attr::AcquireHandle:
2130 OS <<
"acquire_handle";
2132 case attr::ArmMveStrictPolymorphism:
2133 OS <<
"__clang_arm_mve_strict_polymorphism";
2135 case attr::ExtVectorType:
2136 OS <<
"ext_vector_type";
2141 case attr::NoFieldProtection:
2142 OS <<
"no_field_protection";
2144 case attr::PointerFieldProtection:
2145 OS <<
"pointer_field_protection";
2151void TypePrinter::printBTFTagAttributedBefore(
const BTFTagAttributedType *T,
2153 printBefore(T->getWrappedType(), OS);
2154 OS <<
" __attribute__((btf_type_tag(\"" << T->getAttr()->getBTFTypeTag() <<
"\")))";
2157void TypePrinter::printBTFTagAttributedAfter(
const BTFTagAttributedType *T,
2159 printAfter(T->getWrappedType(), OS);
2162void TypePrinter::printOverflowBehaviorBefore(
const OverflowBehaviorType *T,
2164 switch (T->getBehaviorKind()) {
2165 case clang::OverflowBehaviorType::OverflowBehaviorKind::Wrap:
2168 case clang::OverflowBehaviorType::OverflowBehaviorKind::Trap:
2172 printBefore(T->getUnderlyingType(), OS);
2175void TypePrinter::printOverflowBehaviorAfter(
const OverflowBehaviorType *T,
2177 printAfter(T->getUnderlyingType(), OS);
2180void TypePrinter::printHLSLAttributedResourceBefore(
2181 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2182 printBefore(T->getWrappedType(), OS);
2185void TypePrinter::printHLSLAttributedResourceAfter(
2186 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2187 printAfter(T->getWrappedType(), OS);
2188 const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
2189 OS <<
" [[hlsl::resource_class("
2190 << HLSLResourceClassAttr::ConvertResourceClassToStr(Attrs.ResourceClass)
2193 OS <<
" [[hlsl::is_rov]]";
2194 if (Attrs.RawBuffer)
2195 OS <<
" [[hlsl::raw_buffer]]";
2196 if (Attrs.IsCounter)
2197 OS <<
" [[hlsl::is_counter]]";
2199 OS <<
" [[hlsl::is_array]]";
2201 QualType ContainedTy = T->getContainedType();
2202 if (!ContainedTy.
isNull()) {
2203 OS <<
" [[hlsl::contained_type(";
2204 printBefore(ContainedTy, OS);
2205 printAfter(ContainedTy, OS);
2209 if (Attrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown)
2210 OS <<
" [[hlsl::resource_dimension("
2211 << HLSLResourceDimensionAttr::ConvertResourceDimensionToStr(
2212 Attrs.ResourceDimension)
2216void TypePrinter::printHLSLInlineSpirvBefore(
const HLSLInlineSpirvType *T,
2218 OS <<
"__hlsl_spirv_type<" << T->getOpcode();
2220 OS <<
", " << T->getSize();
2221 OS <<
", " << T->getAlignment();
2223 for (
auto &Operand : T->getOperands()) {
2224 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
2228 case SpirvOperandKind::ConstantId: {
2229 QualType ConstantType =
Operand.getResultType();
2230 OS <<
"vk::integral_constant<";
2231 printBefore(ConstantType, OS);
2232 printAfter(ConstantType, OS);
2238 case SpirvOperandKind::Literal:
2239 OS <<
"vk::Literal<vk::integral_constant<uint, ";
2243 case SpirvOperandKind::TypeId: {
2245 printBefore(
Type, OS);
2246 printAfter(
Type, OS);
2250 llvm_unreachable(
"Invalid SpirvOperand kind!");
2258void TypePrinter::printHLSLInlineSpirvAfter(
const HLSLInlineSpirvType *T,
2263void TypePrinter::printObjCInterfaceBefore(
const ObjCInterfaceType *T,
2266 spaceBeforePlaceHolder(OS);
2269void TypePrinter::printObjCInterfaceAfter(
const ObjCInterfaceType *T,
2272void TypePrinter::printObjCTypeParamBefore(
const ObjCTypeParamType *T,
2274 OS << T->getDecl()->getName();
2275 if (!T->qual_empty()) {
2276 bool isFirst =
true;
2278 for (
const auto *I : T->quals()) {
2288 spaceBeforePlaceHolder(OS);
2291void TypePrinter::printObjCTypeParamAfter(
const ObjCTypeParamType *T,
2294void TypePrinter::printObjCObjectBefore(
const ObjCObjectType *T,
2296 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2297 !T->isKindOfTypeAsWritten())
2298 return printBefore(T->getBaseType(), OS);
2300 if (T->isKindOfTypeAsWritten())
2303 print(T->getBaseType(), OS, StringRef());
2305 if (T->isSpecializedAsWritten()) {
2306 bool isFirst =
true;
2308 for (
auto typeArg : T->getTypeArgsAsWritten()) {
2314 print(typeArg, OS, StringRef());
2319 if (!T->qual_empty()) {
2320 bool isFirst =
true;
2322 for (
const auto *I : T->quals()) {
2332 spaceBeforePlaceHolder(OS);
2335void TypePrinter::printObjCObjectAfter(
const ObjCObjectType *T,
2337 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2338 !T->isKindOfTypeAsWritten())
2339 return printAfter(T->getBaseType(), OS);
2342void TypePrinter::printObjCObjectPointerBefore(
const ObjCObjectPointerType *T,
2349 if (HasEmptyPlaceHolder)
2355void TypePrinter::printObjCObjectPointerAfter(
const ObjCObjectPointerType *T,
2366 llvm::raw_ostream &OS,
bool IncludeType) {
2367 A.
print(PP, OS, IncludeType);
2380 TemplateArgument Pattern,
2381 ArrayRef<TemplateArgument> Args,
2390 if (
auto *TTPT = Pattern->
getAsCanonical<TemplateTypeParmType>()) {
2391 if (TTPT->getDepth() == Depth && TTPT->getIndex() < Args.size() &&
2394 Args[TTPT->getIndex()].getAsType(), Pattern.
getQualifiers());
2406 if (TQual != PatQual)
2423 if (
auto *TTST = T->getAs<TemplateSpecializationType>()) {
2424 Template = TTST->getTemplateName();
2425 TemplateArgs = TTST->template_arguments();
2426 }
else if (
auto *CTSD = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
2427 T->getAsCXXRecordDecl())) {
2429 TemplateArgs = CTSD->getTemplateArgs().asArray();
2437 if (TemplateArgs.size() != PTST->template_arguments().size())
2439 for (
unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
2441 Ctx, TemplateArgs[I], PTST->template_arguments()[I], Args, Depth))
2492 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl()))
2493 return NTTP->getDepth() == Depth && Args.size() > NTTP->getIndex() &&
2494 Args[NTTP->getIndex()].structurallyEquals(Arg);
2510 if (
auto *TTPD = dyn_cast_or_null<TemplateTemplateParmDecl>(PatTD))
2511 return TTPD->getDepth() == Depth && Args.size() > TTPD->getIndex() &&
2520bool clang::isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
2521 const NamedDecl *Param,
2522 ArrayRef<TemplateArgument> Args,
2528 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param)) {
2529 return TTPD->hasDefaultArgument() &&
2531 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2532 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Param)) {
2533 return TTPD->hasDefaultArgument() &&
2535 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2536 }
else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2537 return NTTPD->hasDefaultArgument() &&
2539 Ctx, Arg, NTTPD->getDefaultArgument().getArgument(), Args,
2545template <
typename TA>
2551 !Args.empty() && !IsPack && Args.size() <= TPL->
size()) {
2553 for (
const TA &A : Args)
2555 while (!Args.empty() &&
getArgument(Args.back()).getIsDefaulted())
2556 Args = Args.drop_back();
2563 bool NeedSpace =
false;
2564 bool FirstArg =
true;
2565 for (
const auto &Arg : Args) {
2568 llvm::raw_svector_ostream ArgOS(Buf);
2581 Policy, TPL, ParmIndex));
2583 StringRef ArgString = ArgOS.str();
2588 if (FirstArg && ArgString.starts_with(
":"))
2595 if (!ArgString.empty()) {
2612void clang::printTemplateArgumentList(raw_ostream &OS,
2613 const TemplateArgumentListInfo &Args,
2614 const PrintingPolicy &Policy,
2615 const TemplateParameterList *TPL) {
2616 printTemplateArgumentList(OS, Args.
arguments(), Policy, TPL);
2619void clang::printTemplateArgumentList(raw_ostream &OS,
2620 ArrayRef<TemplateArgument> Args,
2621 const PrintingPolicy &Policy,
2622 const TemplateParameterList *TPL) {
2623 PrintingPolicy InnerPolicy = Policy;
2625 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2628void clang::printTemplateArgumentList(raw_ostream &OS,
2629 ArrayRef<TemplateArgumentLoc> Args,
2630 const PrintingPolicy &Policy,
2631 const TemplateParameterList *TPL) {
2632 PrintingPolicy InnerPolicy = Policy;
2634 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2644 llvm::raw_svector_ostream StrOS(Buf);
2646 return StrOS.str().str();
2674 llvm::raw_svector_ostream StrOS(Buf);
2675 print(StrOS, Policy);
2676 return std::string(StrOS.str());
2694 PointerAuth && !PointerAuth.isEmptyWhenPrinted(Policy))
2714 return "__constant";
2719 return "__global_device";
2722 return "__global_host";
2724 return "__device__";
2726 return "__constant__";
2728 return "__shared__";
2730 return "__sptr __ptr32";
2732 return "__uptr __ptr32";
2736 return "groupshared";
2738 return "hlsl_constant";
2740 return "hlsl_private";
2742 return "hlsl_device";
2744 return "hlsl_input";
2746 return "hlsl_output";
2748 return "hlsl_push_constant";
2760 bool appendSpaceIfNonEmpty)
const {
2761 bool addSpace =
false;
2771 OS <<
"__unaligned";
2775 if (!ASStr.empty()) {
2781 OS <<
"__attribute__((address_space(" << ASStr <<
")))";
2820 PointerAuth.print(OS, Policy);
2823 if (appendSpaceIfNonEmpty && addSpace)
2845 const Twine &PlaceHolder,
unsigned Indentation)
const {
2852 const Twine &PlaceHolder,
unsigned Indentation) {
2854 StringRef PH = PlaceHolder.toStringRef(PHBuf);
2856 TypePrinter(policy, Indentation).print(ty, qs, OS, PH);
2866 std::string &buffer,
2869 llvm::raw_svector_ostream StrOS(Buf);
2870 TypePrinter(policy).print(ty, qs, StrOS, buffer);
2871 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, const Context &Ctx, 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.