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__(";
740void TypePrinter::printVectorAfter(
const VectorType *T, raw_ostream &OS) {
744void TypePrinter::printDependentVectorBefore(
745 const DependentVectorType *T, raw_ostream &OS) {
747 case VectorKind::AltiVecPixel:
748 OS <<
"__vector __pixel ";
750 case VectorKind::AltiVecBool:
751 OS <<
"__vector __bool ";
754 case VectorKind::AltiVecVector:
758 case VectorKind::Neon:
759 OS <<
"__attribute__((neon_vector_type(";
765 case VectorKind::NeonPoly:
766 OS <<
"__attribute__((neon_polyvector_type(";
772 case VectorKind::Generic: {
775 OS <<
"__attribute__((__vector_size__(";
784 case VectorKind::SveFixedLengthData:
785 case VectorKind::SveFixedLengthPredicate:
788 OS <<
"__attribute__((__arm_sve_vector_bits__(";
791 if (T->
getVectorKind() == VectorKind::SveFixedLengthPredicate)
803 case VectorKind::RVVFixedLengthData:
804 case VectorKind::RVVFixedLengthMask:
805 case VectorKind::RVVFixedLengthMask_1:
806 case VectorKind::RVVFixedLengthMask_2:
807 case VectorKind::RVVFixedLengthMask_4:
810 OS <<
"__attribute__((__riscv_rvv_vector_bits__(";
824void TypePrinter::printDependentVectorAfter(
825 const DependentVectorType *T, raw_ostream &OS) {
829void TypePrinter::printExtVectorBefore(
const ExtVectorType *T,
835 spaceBeforePlaceHolder(OS);
841void TypePrinter::printExtVectorAfter(
const ExtVectorType *T, raw_ostream &OS) {
846 OS <<
" __attribute__((ext_vector_type(";
852 OS << T->getNumRows() <<
", " << T->getNumColumns();
858 TP.print(T->getElementType(), OS, StringRef());
862 TP.spaceBeforePlaceHolder(OS);
870 TP.printBefore(T->getElementType(), OS);
871 OS <<
" __attribute__((matrix_type(";
876void TypePrinter::printConstantMatrixBefore(
const ConstantMatrixType *T,
885void TypePrinter::printConstantMatrixAfter(
const ConstantMatrixType *T,
894void TypePrinter::printDependentSizedMatrixBefore(
895 const DependentSizedMatrixType *T, raw_ostream &OS) {
906 spaceBeforePlaceHolder(OS);
909 OS <<
" __attribute__((matrix_type(";
919void TypePrinter::printDependentSizedMatrixAfter(
920 const DependentSizedMatrixType *T, raw_ostream &OS) {
942 OS <<
" __attribute__((nothrow))";
958 if (T->hasTrailingReturn()) {
960 if (!HasEmptyPlaceHolder)
965 printBefore(T->getReturnType(), OS);
966 if (!PrevPHIsEmpty.get())
974 llvm_unreachable(
"asking for spelling of ordinary parameter ABI");
976 return "swift_context";
978 return "swift_async_context";
980 return "swift_error_result";
982 return "swift_indirect_result";
988 llvm_unreachable(
"bad parameter ABI kind");
994 if (!HasEmptyPlaceHolder)
1000 ParamPolicyRAII ParamPolicy(Policy);
1001 for (
unsigned i = 0, e = T->getNumParams(); i != e; ++i) {
1004 auto EPI = T->getExtParameterInfo(i);
1005 if (EPI.isConsumed()) OS <<
"__attribute__((ns_consumed)) ";
1006 if (EPI.isNoEscape())
1007 OS <<
"__attribute__((noescape)) ";
1008 auto ABI = EPI.getABI();
1016 print(T->getParamType(i).getNonReferenceType(), OS, StringRef());
1019 }
else if (ABI != ParameterABI::Ordinary)
1037 FunctionType::ExtInfo Info = T->
getExtInfo();
1041 OS <<
" __arm_streaming_compatible";
1043 OS <<
" __arm_streaming";
1045 OS <<
"__arm_agnostic(\"sme_za_state\")";
1047 OS <<
" __arm_preserves(\"za\")";
1049 OS <<
" __arm_in(\"za\")";
1051 OS <<
" __arm_out(\"za\")";
1053 OS <<
" __arm_inout(\"za\")";
1055 OS <<
" __arm_preserves(\"zt0\")";
1057 OS <<
" __arm_in(\"zt0\")";
1059 OS <<
" __arm_out(\"zt0\")";
1061 OS <<
" __arm_inout(\"zt0\")";
1063 printFunctionAfter(Info, OS);
1083 for (
const auto &CFE : FX) {
1084 OS <<
" __attribute__((" << CFE.Effect.name();
1085 if (
const Expr *E = CFE.Cond.getCondition()) {
1087 E->printPretty(OS,
nullptr, Policy);
1094 OS <<
" __attribute__((cfi_unchecked_callee))";
1103void TypePrinter::printFunctionAfter(
const FunctionType::ExtInfo &Info,
1105 if (!InsideCCAttribute) {
1106 switch (Info.
getCC()) {
1117 OS <<
" __attribute__((stdcall))";
1120 OS <<
" __attribute__((fastcall))";
1123 OS <<
" __attribute__((thiscall))";
1126 OS <<
" __attribute__((vectorcall))";
1129 OS <<
" __attribute__((pascal))";
1132 OS <<
" __attribute__((pcs(\"aapcs\")))";
1135 OS <<
" __attribute__((pcs(\"aapcs-vfp\")))";
1138 OS <<
" __attribute__((aarch64_vector_pcs))";
1141 OS <<
" __attribute__((aarch64_sve_pcs))";
1144 OS <<
" __attribute__((device_kernel))";
1147 OS <<
" __attribute__((intel_ocl_bicc))";
1150 OS <<
" __attribute__((ms_abi))";
1153 OS <<
" __attribute__((sysv_abi))";
1156 OS <<
" __attribute__((regcall))";
1162 OS <<
" __attribute__((swiftcall))";
1165 OS <<
"__attribute__((swiftasynccall))";
1168 OS <<
" __attribute__((preserve_most))";
1171 OS <<
" __attribute__((preserve_all))";
1174 OS <<
" __attribute__((m68k_rtd))";
1177 OS <<
" __attribute__((preserve_none))";
1180 OS <<
"__attribute__((riscv_vector_cc))";
1182#define CC_VLS_CASE(ABI_VLEN) \
1183 case CC_RISCVVLSCall_##ABI_VLEN: \
1184 OS << "__attribute__((riscv_vls_cc" #ABI_VLEN "))"; \
1203 OS <<
" __attribute__((noreturn))";
1205 OS <<
" __attribute__((cmse_nonsecure_call))";
1207 OS <<
" __attribute__((ns_returns_retained))";
1209 OS <<
" __attribute__((regparm ("
1212 OS <<
" __attribute__((no_caller_saved_registers))";
1214 OS <<
" __attribute__((nocf_check))";
1217void TypePrinter::printFunctionNoProtoBefore(
const FunctionNoProtoType *T,
1220 SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder,
false);
1222 if (!PrevPHIsEmpty.get())
1226void TypePrinter::printFunctionNoProtoAfter(
const FunctionNoProtoType *T,
1229 if (!HasEmptyPlaceHolder)
1231 SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder,
false);
1238void TypePrinter::printTypeSpec(NamedDecl *D, raw_ostream &OS) {
1248 spaceBeforePlaceHolder(OS);
1251void TypePrinter::printUnresolvedUsingBefore(
const UnresolvedUsingType *T,
1253 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1254 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1263 spaceBeforePlaceHolder(OS);
1266void TypePrinter::printUnresolvedUsingAfter(
const UnresolvedUsingType *T,
1269void TypePrinter::printUsingBefore(
const UsingType *T, raw_ostream &OS) {
1270 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1271 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1280 spaceBeforePlaceHolder(OS);
1283void TypePrinter::printUsingAfter(
const UsingType *T, raw_ostream &OS) {}
1285void TypePrinter::printTypedefBefore(
const TypedefType *T, raw_ostream &OS) {
1286 OS << TypeWithKeyword::getKeywordName(T->
getKeyword());
1287 if (T->
getKeyword() != ElaboratedTypeKeyword::None)
1296 spaceBeforePlaceHolder(OS);
1299void TypePrinter::printMacroQualifiedBefore(
const MacroQualifiedType *T,
1302 OS << MacroName <<
" ";
1309void TypePrinter::printMacroQualifiedAfter(
const MacroQualifiedType *T,
1314void TypePrinter::printTypedefAfter(
const TypedefType *T, raw_ostream &OS) {}
1316void TypePrinter::printTypeOfExprBefore(
const TypeOfExprType *T,
1318 OS << (T->
getKind() == TypeOfKind::Unqualified ?
"typeof_unqual "
1322 spaceBeforePlaceHolder(OS);
1325void TypePrinter::printTypeOfExprAfter(
const TypeOfExprType *T,
1328void TypePrinter::printTypeOfBefore(
const TypeOfType *T, raw_ostream &OS) {
1329 OS << (T->getKind() == TypeOfKind::Unqualified ?
"typeof_unqual("
1331 print(T->getUnmodifiedType(), OS, StringRef());
1333 spaceBeforePlaceHolder(OS);
1336void TypePrinter::printTypeOfAfter(
const TypeOfType *T, raw_ostream &OS) {}
1338void TypePrinter::printDecltypeBefore(
const DecltypeType *T, raw_ostream &OS) {
1340 if (
const Expr *E = T->getUnderlyingExpr()) {
1341 PrintingPolicy ExprPolicy = Policy;
1343 E->printPretty(OS,
nullptr, ExprPolicy);
1346 spaceBeforePlaceHolder(OS);
1349void TypePrinter::printPackIndexingBefore(
const PackIndexingType *T,
1351 if (T->hasSelectedType()) {
1352 OS << T->getSelectedType();
1354 OS << T->getPattern() <<
"...[";
1355 T->getIndexExpr()->printPretty(OS,
nullptr, Policy);
1358 spaceBeforePlaceHolder(OS);
1361void TypePrinter::printPackIndexingAfter(
const PackIndexingType *T,
1364void TypePrinter::printDecltypeAfter(
const DecltypeType *T, raw_ostream &OS) {}
1366void TypePrinter::printUnaryTransformBefore(
const UnaryTransformType *T,
1368 IncludeStrongLifetimeRAII Strong(Policy);
1370 static const llvm::DenseMap<int, const char *> Transformation = {{
1371#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
1372 {UnaryTransformType::Enum, "__" #Trait},
1373#include "clang/Basic/TransformTypeTraits.def"
1375 OS << Transformation.lookup(T->getUTTKind()) <<
'(';
1376 print(T->getBaseType(), OS, StringRef());
1378 spaceBeforePlaceHolder(OS);
1381void TypePrinter::printUnaryTransformAfter(
const UnaryTransformType *T,
1384void TypePrinter::printAutoBefore(
const AutoType *T, raw_ostream &OS) {
1386 if (!T->getDeducedType().isNull()) {
1387 printBefore(T->getDeducedType(), OS);
1389 if (T->isConstrained()) {
1392 T->getTypeConstraintConcept()->getDeclName().print(OS, Policy);
1393 auto Args = T->getTypeConstraintArguments();
1395 printTemplateArgumentList(
1397 T->getTypeConstraintConcept()->getTemplateParameters());
1400 switch (T->getKeyword()) {
1401 case AutoTypeKeyword::Auto:
OS <<
"auto";
break;
1402 case AutoTypeKeyword::DecltypeAuto:
OS <<
"decltype(auto)";
break;
1403 case AutoTypeKeyword::GNUAutoType:
OS <<
"__auto_type";
break;
1405 spaceBeforePlaceHolder(OS);
1409void TypePrinter::printAutoAfter(
const AutoType *T, raw_ostream &OS) {
1411 if (!T->getDeducedType().isNull())
1412 printAfter(T->getDeducedType(), OS);
1415void TypePrinter::printDeducedTemplateSpecializationBefore(
1416 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1418 T->getKeyword() != ElaboratedTypeKeyword::None)
1428 ArrayRef<TemplateArgument> Args;
1429 TemplateDecl *DeducedTD =
nullptr;
1430 if (!T->getDeducedType().isNull()) {
1431 if (
const auto *TST =
1432 dyn_cast<TemplateSpecializationType>(T->getDeducedType())) {
1433 DeducedTD = TST->getTemplateName().getAsTemplateDecl(
1435 Args = TST->template_arguments();
1440 DeducedTD = CD->getSpecializedTemplate();
1441 Args = CD->getTemplateArgs().asArray();
1455 IncludeStrongLifetimeRAII Strong(Policy);
1456 Name.
print(OS, Policy);
1459 printTemplateArgumentList(OS, Args, Policy,
1463 spaceBeforePlaceHolder(OS);
1466void TypePrinter::printDeducedTemplateSpecializationAfter(
1467 const DeducedTemplateSpecializationType *T, raw_ostream &OS) {
1469 if (!T->getDeducedType().isNull())
1470 printAfter(T->getDeducedType(), OS);
1473void TypePrinter::printAtomicBefore(
const AtomicType *T, raw_ostream &OS) {
1474 IncludeStrongLifetimeRAII Strong(Policy);
1479 spaceBeforePlaceHolder(OS);
1482void TypePrinter::printAtomicAfter(
const AtomicType *T, raw_ostream &OS) {}
1484void TypePrinter::printPipeBefore(
const PipeType *T, raw_ostream &OS) {
1485 IncludeStrongLifetimeRAII Strong(Policy);
1490 OS <<
"write_only ";
1493 spaceBeforePlaceHolder(OS);
1496void TypePrinter::printPipeAfter(
const PipeType *T, raw_ostream &OS) {}
1498void TypePrinter::printBitIntBefore(
const BitIntType *T, raw_ostream &OS) {
1502 spaceBeforePlaceHolder(OS);
1505void TypePrinter::printBitIntAfter(
const BitIntType *T, raw_ostream &OS) {}
1507void TypePrinter::printDependentBitIntBefore(
const DependentBitIntType *T,
1514 spaceBeforePlaceHolder(OS);
1517void TypePrinter::printDependentBitIntAfter(
const DependentBitIntType *T,
1520void TypePrinter::printPredefinedSugarBefore(
const PredefinedSugarType *T,
1523 spaceBeforePlaceHolder(OS);
1526void TypePrinter::printPredefinedSugarAfter(
const PredefinedSugarType *T,
1529void TypePrinter::printTagType(
const TagType *T, raw_ostream &OS) {
1530 TagDecl *D = T->getDecl();
1533 D->
print(OS, Policy, Indentation);
1534 spaceBeforePlaceHolder(OS);
1538 bool PrintedKindDecoration =
false;
1539 if (T->isCanonicalUnqualified()) {
1541 PrintedKindDecoration =
true;
1546 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1547 if (T->getKeyword() != ElaboratedTypeKeyword::None) {
1548 PrintedKindDecoration =
true;
1554 T->getQualifier().print(OS, Policy);
1565 clang::PrintingPolicy
Copy(Policy);
1568 if (PrintedKindDecoration) {
1569 Copy.SuppressTagKeywordInAnonNames =
true;
1570 Copy.SuppressTagKeyword =
true;
1578 if (
auto *S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
1579 const TemplateParameterList *TParams =
1580 S->getSpecializedTemplate()->getTemplateParameters();
1581 const ASTTemplateArgumentListInfo *TArgAsWritten =
1582 S->getTemplateArgsAsWritten();
1583 IncludeStrongLifetimeRAII Strong(Policy);
1585 printTemplateArgumentList(OS, TArgAsWritten->
arguments(), Policy,
1588 printTemplateArgumentList(OS, S->getTemplateArgs().asArray(), Policy,
1592 spaceBeforePlaceHolder(OS);
1595void TypePrinter::printRecordBefore(
const RecordType *T, raw_ostream &OS) {
1598 for (
const auto *PNA : T->getDecl()
1599 ->getMostRecentDecl()
1600 ->specific_attrs<PreferredNameAttr>()) {
1605 QualType T = PNA->getTypedefType();
1607 if (
auto *TT = dyn_cast<TypedefType>(T))
1608 return printTypeSpec(TT->getDecl(), OS);
1609 if (
auto *TST = dyn_cast<TemplateSpecializationType>(T))
1610 return printTemplateId(TST, OS,
true);
1616 printTagType(T, OS);
1619void TypePrinter::printRecordAfter(
const RecordType *T, raw_ostream &OS) {}
1621void TypePrinter::printEnumBefore(
const EnumType *T, raw_ostream &OS) {
1622 printTagType(T, OS);
1625void TypePrinter::printEnumAfter(
const EnumType *T, raw_ostream &OS) {}
1627void TypePrinter::printInjectedClassNameBefore(
const InjectedClassNameType *T,
1629 const ASTContext &Ctx = T->getDecl()->getASTContext();
1630 IncludeStrongLifetimeRAII Strong(Policy);
1631 T->getTemplateName(Ctx).print(OS, Policy);
1633 auto *
Decl = T->getDecl();
1636 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(Decl)) {
1637 printTemplateArgumentList(OS, RD->getTemplateArgsAsWritten()->arguments(),
1639 T->getTemplateDecl()->getTemplateParameters());
1641 ClassTemplateDecl *TD =
Decl->getDescribedClassTemplate();
1643 printTemplateArgumentList(
1645 T->getTemplateDecl()->getTemplateParameters());
1648 spaceBeforePlaceHolder(OS);
1651void TypePrinter::printInjectedClassNameAfter(
const InjectedClassNameType *T,
1654void TypePrinter::printTemplateTypeParmBefore(
const TemplateTypeParmType *T,
1656 TemplateTypeParmDecl *D = T->getDecl();
1659 TC->print(OS, Policy);
1663 }
else if (IdentifierInfo *Id = T->getIdentifier())
1667 OS <<
"type-parameter-" << T->getDepth() <<
'-' << T->getIndex();
1669 spaceBeforePlaceHolder(OS);
1672void TypePrinter::printTemplateTypeParmAfter(
const TemplateTypeParmType *T,
1675void TypePrinter::printSubstTemplateTypeParmBefore(
1676 const SubstTemplateTypeParmType *T,
1678 IncludeStrongLifetimeRAII Strong(Policy);
1679 printBefore(T->getReplacementType(), OS);
1682void TypePrinter::printSubstTemplateTypeParmAfter(
1683 const SubstTemplateTypeParmType *T,
1685 IncludeStrongLifetimeRAII Strong(Policy);
1686 printAfter(T->getReplacementType(), OS);
1689void TypePrinter::printSubstBuiltinTemplatePackBefore(
1690 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {
1691 IncludeStrongLifetimeRAII Strong(Policy);
1695void TypePrinter::printSubstBuiltinTemplatePackAfter(
1696 const SubstBuiltinTemplatePackType *T, raw_ostream &OS) {}
1698void TypePrinter::printSubstTemplateTypeParmPackBefore(
1699 const SubstTemplateTypeParmPackType *T,
1701 IncludeStrongLifetimeRAII Strong(Policy);
1702 if (
const TemplateTypeParmDecl *D = T->getReplacedParameter()) {
1705 TC->print(OS, Policy);
1715 spaceBeforePlaceHolder(OS);
1719void TypePrinter::printSubstTemplateTypeParmPackAfter(
1720 const SubstTemplateTypeParmPackType *T,
1722 IncludeStrongLifetimeRAII Strong(Policy);
1725void TypePrinter::printTemplateId(
const TemplateSpecializationType *T,
1726 raw_ostream &OS,
bool FullyQualify) {
1727 IncludeStrongLifetimeRAII Strong(Policy);
1730 K != ElaboratedTypeKeyword::None)
1731 OS << TypeWithKeyword::getKeywordName(K) <<
' ';
1734 T->getTemplateName().getAsTemplateDecl(
true);
1736 if (FullyQualify && TD) {
1742 T->getTemplateName().print(OS, Policy,
1744 ? TemplateName::Qualified::AsWritten
1745 : TemplateName::Qualified::None);
1748 DefaultTemplateArgsPolicyRAII TemplateArgs(Policy);
1750 printTemplateArgumentList(OS, T->template_arguments(), Policy, TPL);
1751 spaceBeforePlaceHolder(OS);
1754void TypePrinter::printTemplateSpecializationBefore(
1755 const TemplateSpecializationType *T,
1760void TypePrinter::printTemplateSpecializationAfter(
1761 const TemplateSpecializationType *T,
1764void TypePrinter::printParenBefore(
const ParenType *T, raw_ostream &OS) {
1772void TypePrinter::printParenAfter(
const ParenType *T, raw_ostream &OS) {
1780void TypePrinter::printDependentNameBefore(
const DependentNameType *T,
1782 OS << TypeWithKeyword::getKeywordName(T->getKeyword());
1783 if (T->getKeyword() != ElaboratedTypeKeyword::None)
1785 T->getQualifier().print(OS, Policy);
1786 OS << T->getIdentifier()->getName();
1787 spaceBeforePlaceHolder(OS);
1790void TypePrinter::printDependentNameAfter(
const DependentNameType *T,
1793void TypePrinter::printPackExpansionBefore(
const PackExpansionType *T,
1795 printBefore(T->getPattern(), OS);
1798void TypePrinter::printPackExpansionAfter(
const PackExpansionType *T,
1800 printAfter(T->getPattern(), OS);
1808 if (T->isCountInBytes() && T->isOrNull())
1809 OS <<
"__sized_by_or_null(";
1810 else if (T->isCountInBytes())
1811 OS <<
"__sized_by(";
1812 else if (T->isOrNull())
1813 OS <<
"__counted_by_or_null(";
1815 OS <<
"__counted_by(";
1816 if (T->getCountExpr())
1817 T->getCountExpr()->printPretty(OS,
nullptr, Policy);
1821void TypePrinter::printCountAttributedBefore(
const CountAttributedType *T,
1823 printBefore(T->
desugar(), OS);
1828void TypePrinter::printCountAttributedAfter(
const CountAttributedType *T,
1835void TypePrinter::printAttributedBefore(
const AttributedType *T,
1840 if (T->getAttrKind() == attr::ObjCGC ||
1841 T->getAttrKind() == attr::ObjCOwnership)
1842 return printBefore(T->getEquivalentType(), OS);
1844 if (T->getAttrKind() == attr::ObjCKindOf)
1847 if (T->getAttrKind() == attr::PreserveNone) {
1848 OS <<
"__attribute__((preserve_none)) ";
1849 spaceBeforePlaceHolder(OS);
1850 }
else if (T->getAttrKind() == attr::PreserveMost) {
1851 OS <<
"__attribute__((preserve_most)) ";
1852 spaceBeforePlaceHolder(OS);
1853 }
else if (T->getAttrKind() == attr::PreserveAll) {
1854 OS <<
"__attribute__((preserve_all)) ";
1855 spaceBeforePlaceHolder(OS);
1858 if (T->getAttrKind() == attr::AddressSpace)
1859 printBefore(T->getEquivalentType(), OS);
1861 printBefore(T->getModifiedType(), OS);
1863 if (T->isMSTypeSpec()) {
1864 switch (T->getAttrKind()) {
1866 case attr::Ptr32:
OS <<
" __ptr32";
break;
1867 case attr::Ptr64:
OS <<
" __ptr64";
break;
1868 case attr::SPtr:
OS <<
" __sptr";
break;
1869 case attr::UPtr:
OS <<
" __uptr";
break;
1871 spaceBeforePlaceHolder(OS);
1874 if (T->isWebAssemblyFuncrefSpec())
1878 if (T->getImmediateNullability()) {
1879 if (T->getAttrKind() == attr::TypeNonNull)
1881 else if (T->getAttrKind() == attr::TypeNullable)
1883 else if (T->getAttrKind() == attr::TypeNullUnspecified)
1884 OS <<
" _Null_unspecified";
1885 else if (T->getAttrKind() == attr::TypeNullableResult)
1886 OS <<
" _Nullable_result";
1888 llvm_unreachable(
"unhandled nullability");
1889 spaceBeforePlaceHolder(OS);
1893void TypePrinter::printAttributedAfter(
const AttributedType *T,
1898 if (T->getAttrKind() == attr::ObjCGC ||
1899 T->getAttrKind() == attr::ObjCOwnership)
1900 return printAfter(T->getEquivalentType(), OS);
1904 SaveAndRestore MaybeSuppressCC(InsideCCAttribute, T->isCallingConv());
1906 printAfter(T->getModifiedType(), OS);
1910 if (T->getAttrKind() == attr::ObjCKindOf || T->isMSTypeSpec() ||
1911 T->getImmediateNullability() || T->isWebAssemblyFuncrefSpec())
1915 if (T->getAttrKind() == attr::ObjCInertUnsafeUnretained)
1919 if (T->getAttrKind() == attr::NSReturnsRetained &&
1920 !T->getEquivalentType()->castAs<FunctionType>()
1921 ->getExtInfo().getProducesResult())
1924 if (T->getAttrKind() == attr::LifetimeBound) {
1925 OS <<
" [[clang::lifetimebound]]";
1928 if (T->getAttrKind() == attr::LifetimeCaptureBy) {
1929 OS <<
" [[clang::lifetime_capture_by(";
1930 if (
auto *attr = dyn_cast_or_null<LifetimeCaptureByAttr>(T->getAttr()))
1931 llvm::interleaveComma(
attr->getArgIdents(), OS,
1932 [&](
auto it) { OS << it->getName(); });
1940 if (T->getAttrKind() == attr::AddressSpace)
1943 if (T->getAttrKind() == attr::AnnotateType) {
1948 OS <<
" [[clang::annotate_type(...)]]";
1952 if (T->getAttrKind() == attr::ArmStreaming) {
1953 OS <<
"__arm_streaming";
1956 if (T->getAttrKind() == attr::ArmStreamingCompatible) {
1957 OS <<
"__arm_streaming_compatible";
1961 if (T->getAttrKind() == attr::SwiftAttr) {
1962 if (
auto *swiftAttr = dyn_cast_or_null<SwiftAttrAttr>(T->getAttr())) {
1963 OS <<
" __attribute__((swift_attr(\"" << swiftAttr->getAttribute()
1969 if (T->getAttrKind() == attr::PreserveAll ||
1970 T->getAttrKind() == attr::PreserveMost ||
1971 T->getAttrKind() == attr::PreserveNone) {
1976 OS <<
" __attribute__((";
1977 switch (T->getAttrKind()) {
1978#define TYPE_ATTR(NAME)
1979#define DECL_OR_TYPE_ATTR(NAME)
1980#define ATTR(NAME) case attr::NAME:
1981#include "clang/Basic/AttrList.inc"
1982 llvm_unreachable(
"non-type attribute attached to type");
1984 case attr::BTFTypeTag:
1985 llvm_unreachable(
"BTFTypeTag attribute handled separately");
1987 case attr::HLSLResourceClass:
1989 case attr::HLSLRawBuffer:
1990 case attr::HLSLContainedType:
1991 case attr::HLSLIsCounter:
1992 case attr::HLSLResourceDimension:
1993 llvm_unreachable(
"HLSL resource type attributes handled separately");
1995 case attr::OpenCLPrivateAddressSpace:
1996 case attr::OpenCLGlobalAddressSpace:
1997 case attr::OpenCLGlobalDeviceAddressSpace:
1998 case attr::OpenCLGlobalHostAddressSpace:
1999 case attr::OpenCLLocalAddressSpace:
2000 case attr::OpenCLConstantAddressSpace:
2001 case attr::OpenCLGenericAddressSpace:
2002 case attr::HLSLGroupSharedAddressSpace:
2007 case attr::CountedBy:
2008 case attr::CountedByOrNull:
2010 case attr::SizedByOrNull:
2011 case attr::LifetimeBound:
2012 case attr::LifetimeCaptureBy:
2013 case attr::TypeNonNull:
2014 case attr::TypeNullable:
2015 case attr::TypeNullableResult:
2016 case attr::TypeNullUnspecified:
2018 case attr::ObjCInertUnsafeUnretained:
2019 case attr::ObjCKindOf:
2020 case attr::ObjCOwnership:
2025 case attr::PointerAuth:
2026 case attr::AddressSpace:
2027 case attr::CmseNSCall:
2028 case attr::AnnotateType:
2029 case attr::WebAssemblyFuncref:
2030 case attr::ArmAgnostic:
2031 case attr::ArmStreaming:
2032 case attr::ArmStreamingCompatible:
2035 case attr::ArmInOut:
2036 case attr::ArmPreserves:
2037 case attr::NonBlocking:
2038 case attr::NonAllocating:
2039 case attr::Blocking:
2040 case attr::Allocating:
2041 case attr::SwiftAttr:
2042 case attr::PreserveAll:
2043 case attr::PreserveMost:
2044 case attr::PreserveNone:
2045 case attr::OverflowBehavior:
2046 llvm_unreachable(
"This attribute should have been handled already");
2048 case attr::NSReturnsRetained:
2049 OS <<
"ns_returns_retained";
2054 case attr::AnyX86NoCfCheck:
OS <<
"nocf_check";
break;
2055 case attr::CDecl:
OS <<
"cdecl";
break;
2056 case attr::FastCall:
OS <<
"fastcall";
break;
2057 case attr::StdCall:
OS <<
"stdcall";
break;
2058 case attr::ThisCall:
OS <<
"thiscall";
break;
2059 case attr::SwiftCall:
OS <<
"swiftcall";
break;
2060 case attr::SwiftAsyncCall:
OS <<
"swiftasynccall";
break;
2061 case attr::VectorCall:
OS <<
"vectorcall";
break;
2062 case attr::Pascal:
OS <<
"pascal";
break;
2063 case attr::MSABI:
OS <<
"ms_abi";
break;
2064 case attr::SysVABI:
OS <<
"sysv_abi";
break;
2065 case attr::RegCall:
OS <<
"regcall";
break;
2068 QualType t = T->getEquivalentType();
2072 "\"aapcs\"" :
"\"aapcs-vfp\"");
2076 case attr::AArch64VectorPcs:
OS <<
"aarch64_vector_pcs";
break;
2077 case attr::AArch64SVEPcs:
OS <<
"aarch64_sve_pcs";
break;
2078 case attr::IntelOclBicc:
2079 OS <<
"inteloclbicc";
2084 case attr::RISCVVectorCC:
2085 OS <<
"riscv_vector_cc";
2087 case attr::RISCVVLSCC:
2088 OS <<
"riscv_vls_cc";
2093 case attr::CFIUncheckedCallee:
2094 OS <<
"cfi_unchecked_callee";
2096 case attr::AcquireHandle:
2097 OS <<
"acquire_handle";
2099 case attr::ArmMveStrictPolymorphism:
2100 OS <<
"__clang_arm_mve_strict_polymorphism";
2102 case attr::ExtVectorType:
2103 OS <<
"ext_vector_type";
2108 case attr::NoFieldProtection:
2109 OS <<
"no_field_protection";
2111 case attr::PointerFieldProtection:
2112 OS <<
"pointer_field_protection";
2118void TypePrinter::printBTFTagAttributedBefore(
const BTFTagAttributedType *T,
2120 printBefore(T->getWrappedType(), OS);
2121 OS <<
" __attribute__((btf_type_tag(\"" << T->getAttr()->getBTFTypeTag() <<
"\")))";
2124void TypePrinter::printBTFTagAttributedAfter(
const BTFTagAttributedType *T,
2126 printAfter(T->getWrappedType(), OS);
2129void TypePrinter::printOverflowBehaviorBefore(
const OverflowBehaviorType *T,
2131 switch (T->getBehaviorKind()) {
2132 case clang::OverflowBehaviorType::OverflowBehaviorKind::Wrap:
2135 case clang::OverflowBehaviorType::OverflowBehaviorKind::Trap:
2139 printBefore(T->getUnderlyingType(), OS);
2142void TypePrinter::printOverflowBehaviorAfter(
const OverflowBehaviorType *T,
2144 printAfter(T->getUnderlyingType(), OS);
2147void TypePrinter::printHLSLAttributedResourceBefore(
2148 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2149 printBefore(T->getWrappedType(), OS);
2152void TypePrinter::printHLSLAttributedResourceAfter(
2153 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2154 printAfter(T->getWrappedType(), OS);
2155 const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
2156 OS <<
" [[hlsl::resource_class("
2157 << HLSLResourceClassAttr::ConvertResourceClassToStr(Attrs.ResourceClass)
2160 OS <<
" [[hlsl::is_rov]]";
2161 if (Attrs.RawBuffer)
2162 OS <<
" [[hlsl::raw_buffer]]";
2163 if (Attrs.IsCounter)
2164 OS <<
" [[hlsl::is_counter]]";
2166 QualType ContainedTy = T->getContainedType();
2167 if (!ContainedTy.
isNull()) {
2168 OS <<
" [[hlsl::contained_type(";
2169 printBefore(ContainedTy, OS);
2170 printAfter(ContainedTy, OS);
2174 if (Attrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown)
2175 OS <<
" [[hlsl::resource_dimension("
2176 << HLSLResourceDimensionAttr::ConvertResourceDimensionToStr(
2177 Attrs.ResourceDimension)
2181void TypePrinter::printHLSLInlineSpirvBefore(
const HLSLInlineSpirvType *T,
2183 OS <<
"__hlsl_spirv_type<" << T->getOpcode();
2185 OS <<
", " << T->getSize();
2186 OS <<
", " << T->getAlignment();
2188 for (
auto &Operand : T->getOperands()) {
2189 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
2193 case SpirvOperandKind::ConstantId: {
2194 QualType ConstantType =
Operand.getResultType();
2195 OS <<
"vk::integral_constant<";
2196 printBefore(ConstantType, OS);
2197 printAfter(ConstantType, OS);
2203 case SpirvOperandKind::Literal:
2204 OS <<
"vk::Literal<vk::integral_constant<uint, ";
2208 case SpirvOperandKind::TypeId: {
2210 printBefore(
Type, OS);
2211 printAfter(
Type, OS);
2215 llvm_unreachable(
"Invalid SpirvOperand kind!");
2223void TypePrinter::printHLSLInlineSpirvAfter(
const HLSLInlineSpirvType *T,
2228void TypePrinter::printObjCInterfaceBefore(
const ObjCInterfaceType *T,
2231 spaceBeforePlaceHolder(OS);
2234void TypePrinter::printObjCInterfaceAfter(
const ObjCInterfaceType *T,
2237void TypePrinter::printObjCTypeParamBefore(
const ObjCTypeParamType *T,
2239 OS << T->getDecl()->getName();
2240 if (!T->qual_empty()) {
2241 bool isFirst =
true;
2243 for (
const auto *I : T->quals()) {
2253 spaceBeforePlaceHolder(OS);
2256void TypePrinter::printObjCTypeParamAfter(
const ObjCTypeParamType *T,
2259void TypePrinter::printObjCObjectBefore(
const ObjCObjectType *T,
2261 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2262 !T->isKindOfTypeAsWritten())
2263 return printBefore(T->getBaseType(), OS);
2265 if (T->isKindOfTypeAsWritten())
2268 print(T->getBaseType(), OS, StringRef());
2270 if (T->isSpecializedAsWritten()) {
2271 bool isFirst =
true;
2273 for (
auto typeArg : T->getTypeArgsAsWritten()) {
2279 print(typeArg, OS, StringRef());
2284 if (!T->qual_empty()) {
2285 bool isFirst =
true;
2287 for (
const auto *I : T->quals()) {
2297 spaceBeforePlaceHolder(OS);
2300void TypePrinter::printObjCObjectAfter(
const ObjCObjectType *T,
2302 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2303 !T->isKindOfTypeAsWritten())
2304 return printAfter(T->getBaseType(), OS);
2307void TypePrinter::printObjCObjectPointerBefore(
const ObjCObjectPointerType *T,
2314 if (HasEmptyPlaceHolder)
2320void TypePrinter::printObjCObjectPointerAfter(
const ObjCObjectPointerType *T,
2331 llvm::raw_ostream &OS,
bool IncludeType) {
2332 A.
print(PP, OS, IncludeType);
2345 TemplateArgument Pattern,
2346 ArrayRef<TemplateArgument> Args,
2355 if (
auto *TTPT = Pattern->
getAsCanonical<TemplateTypeParmType>()) {
2356 if (TTPT->getDepth() == Depth && TTPT->getIndex() < Args.size() &&
2359 Args[TTPT->getIndex()].getAsType(), Pattern.
getQualifiers());
2371 if (TQual != PatQual)
2388 if (
auto *TTST = T->getAs<TemplateSpecializationType>()) {
2389 Template = TTST->getTemplateName();
2390 TemplateArgs = TTST->template_arguments();
2391 }
else if (
auto *CTSD = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
2392 T->getAsCXXRecordDecl())) {
2394 TemplateArgs = CTSD->getTemplateArgs().asArray();
2402 if (TemplateArgs.size() != PTST->template_arguments().size())
2404 for (
unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
2406 Ctx, TemplateArgs[I], PTST->template_arguments()[I], Args, Depth))
2457 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl()))
2458 return NTTP->getDepth() == Depth && Args.size() > NTTP->getIndex() &&
2459 Args[NTTP->getIndex()].structurallyEquals(Arg);
2475 if (
auto *TTPD = dyn_cast_or_null<TemplateTemplateParmDecl>(PatTD))
2476 return TTPD->getDepth() == Depth && Args.size() > TTPD->getIndex() &&
2485bool clang::isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
2486 const NamedDecl *Param,
2487 ArrayRef<TemplateArgument> Args,
2493 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param)) {
2494 return TTPD->hasDefaultArgument() &&
2496 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2497 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Param)) {
2498 return TTPD->hasDefaultArgument() &&
2500 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2501 }
else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2502 return NTTPD->hasDefaultArgument() &&
2504 Ctx, Arg, NTTPD->getDefaultArgument().getArgument(), Args,
2510template <
typename TA>
2516 !Args.empty() && !IsPack && Args.size() <= TPL->
size()) {
2518 for (
const TA &A : Args)
2520 while (!Args.empty() &&
getArgument(Args.back()).getIsDefaulted())
2521 Args = Args.drop_back();
2528 bool NeedSpace =
false;
2529 bool FirstArg =
true;
2530 for (
const auto &Arg : Args) {
2533 llvm::raw_svector_ostream ArgOS(Buf);
2546 Policy, TPL, ParmIndex));
2548 StringRef ArgString = ArgOS.str();
2553 if (FirstArg && ArgString.starts_with(
":"))
2560 if (!ArgString.empty()) {
2577void clang::printTemplateArgumentList(raw_ostream &OS,
2578 const TemplateArgumentListInfo &Args,
2579 const PrintingPolicy &Policy,
2580 const TemplateParameterList *TPL) {
2581 printTemplateArgumentList(OS, Args.
arguments(), Policy, TPL);
2584void clang::printTemplateArgumentList(raw_ostream &OS,
2585 ArrayRef<TemplateArgument> Args,
2586 const PrintingPolicy &Policy,
2587 const TemplateParameterList *TPL) {
2588 PrintingPolicy InnerPolicy = Policy;
2590 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2593void clang::printTemplateArgumentList(raw_ostream &OS,
2594 ArrayRef<TemplateArgumentLoc> Args,
2595 const PrintingPolicy &Policy,
2596 const TemplateParameterList *TPL) {
2597 PrintingPolicy InnerPolicy = Policy;
2599 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2609 llvm::raw_svector_ostream StrOS(Buf);
2611 return StrOS.str().str();
2639 llvm::raw_svector_ostream StrOS(Buf);
2640 print(StrOS, Policy);
2641 return std::string(StrOS.str());
2659 PointerAuth && !PointerAuth.isEmptyWhenPrinted(Policy))
2679 return "__constant";
2684 return "__global_device";
2687 return "__global_host";
2689 return "__device__";
2691 return "__constant__";
2693 return "__shared__";
2695 return "__sptr __ptr32";
2697 return "__uptr __ptr32";
2701 return "groupshared";
2703 return "hlsl_constant";
2705 return "hlsl_private";
2707 return "hlsl_device";
2709 return "hlsl_input";
2711 return "hlsl_push_constant";
2723 bool appendSpaceIfNonEmpty)
const {
2724 bool addSpace =
false;
2734 OS <<
"__unaligned";
2738 if (!ASStr.empty()) {
2744 OS <<
"__attribute__((address_space(" << ASStr <<
")))";
2783 PointerAuth.print(OS, Policy);
2786 if (appendSpaceIfNonEmpty && addSpace)
2808 const Twine &PlaceHolder,
unsigned Indentation)
const {
2815 const Twine &PlaceHolder,
unsigned Indentation) {
2817 StringRef PH = PlaceHolder.toStringRef(PHBuf);
2819 TypePrinter(policy, Indentation).print(ty, qs, OS, PH);
2829 std::string &buffer,
2832 llvm::raw_svector_ostream StrOS(Buf);
2833 TypePrinter(policy).print(ty, qs, StrOS, buffer);
2834 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.