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 case attr::HLSLIsArray:
1994 llvm_unreachable(
"HLSL resource type attributes handled separately");
1996 case attr::OpenCLPrivateAddressSpace:
1997 case attr::OpenCLGlobalAddressSpace:
1998 case attr::OpenCLGlobalDeviceAddressSpace:
1999 case attr::OpenCLGlobalHostAddressSpace:
2000 case attr::OpenCLLocalAddressSpace:
2001 case attr::OpenCLConstantAddressSpace:
2002 case attr::OpenCLGenericAddressSpace:
2003 case attr::HLSLGroupSharedAddressSpace:
2008 case attr::CountedBy:
2009 case attr::CountedByOrNull:
2011 case attr::SizedByOrNull:
2012 case attr::LifetimeBound:
2013 case attr::LifetimeCaptureBy:
2014 case attr::TypeNonNull:
2015 case attr::TypeNullable:
2016 case attr::TypeNullableResult:
2017 case attr::TypeNullUnspecified:
2019 case attr::ObjCInertUnsafeUnretained:
2020 case attr::ObjCKindOf:
2021 case attr::ObjCOwnership:
2026 case attr::PointerAuth:
2027 case attr::AddressSpace:
2028 case attr::CmseNSCall:
2029 case attr::AnnotateType:
2030 case attr::WebAssemblyFuncref:
2031 case attr::ArmAgnostic:
2032 case attr::ArmStreaming:
2033 case attr::ArmStreamingCompatible:
2036 case attr::ArmInOut:
2037 case attr::ArmPreserves:
2038 case attr::NonBlocking:
2039 case attr::NonAllocating:
2040 case attr::Blocking:
2041 case attr::Allocating:
2042 case attr::SwiftAttr:
2043 case attr::PreserveAll:
2044 case attr::PreserveMost:
2045 case attr::PreserveNone:
2046 case attr::OverflowBehavior:
2047 llvm_unreachable(
"This attribute should have been handled already");
2049 case attr::NSReturnsRetained:
2050 OS <<
"ns_returns_retained";
2053 case attr::HLSLRowMajor:
2056 case attr::HLSLColumnMajor:
2057 OS <<
"column_major";
2062 case attr::AnyX86NoCfCheck:
OS <<
"nocf_check";
break;
2063 case attr::CDecl:
OS <<
"cdecl";
break;
2064 case attr::FastCall:
OS <<
"fastcall";
break;
2065 case attr::StdCall:
OS <<
"stdcall";
break;
2066 case attr::ThisCall:
OS <<
"thiscall";
break;
2067 case attr::SwiftCall:
OS <<
"swiftcall";
break;
2068 case attr::SwiftAsyncCall:
OS <<
"swiftasynccall";
break;
2069 case attr::VectorCall:
OS <<
"vectorcall";
break;
2070 case attr::Pascal:
OS <<
"pascal";
break;
2071 case attr::MSABI:
OS <<
"ms_abi";
break;
2072 case attr::SysVABI:
OS <<
"sysv_abi";
break;
2073 case attr::RegCall:
OS <<
"regcall";
break;
2076 QualType t = T->getEquivalentType();
2080 "\"aapcs\"" :
"\"aapcs-vfp\"");
2084 case attr::AArch64VectorPcs:
OS <<
"aarch64_vector_pcs";
break;
2085 case attr::AArch64SVEPcs:
OS <<
"aarch64_sve_pcs";
break;
2086 case attr::IntelOclBicc:
2087 OS <<
"inteloclbicc";
2092 case attr::RISCVVectorCC:
2093 OS <<
"riscv_vector_cc";
2095 case attr::RISCVVLSCC:
2096 OS <<
"riscv_vls_cc";
2101 case attr::CFIUncheckedCallee:
2102 OS <<
"cfi_unchecked_callee";
2104 case attr::AcquireHandle:
2105 OS <<
"acquire_handle";
2107 case attr::ArmMveStrictPolymorphism:
2108 OS <<
"__clang_arm_mve_strict_polymorphism";
2110 case attr::ExtVectorType:
2111 OS <<
"ext_vector_type";
2116 case attr::NoFieldProtection:
2117 OS <<
"no_field_protection";
2119 case attr::PointerFieldProtection:
2120 OS <<
"pointer_field_protection";
2126void TypePrinter::printBTFTagAttributedBefore(
const BTFTagAttributedType *T,
2128 printBefore(T->getWrappedType(), OS);
2129 OS <<
" __attribute__((btf_type_tag(\"" << T->getAttr()->getBTFTypeTag() <<
"\")))";
2132void TypePrinter::printBTFTagAttributedAfter(
const BTFTagAttributedType *T,
2134 printAfter(T->getWrappedType(), OS);
2137void TypePrinter::printOverflowBehaviorBefore(
const OverflowBehaviorType *T,
2139 switch (T->getBehaviorKind()) {
2140 case clang::OverflowBehaviorType::OverflowBehaviorKind::Wrap:
2143 case clang::OverflowBehaviorType::OverflowBehaviorKind::Trap:
2147 printBefore(T->getUnderlyingType(), OS);
2150void TypePrinter::printOverflowBehaviorAfter(
const OverflowBehaviorType *T,
2152 printAfter(T->getUnderlyingType(), OS);
2155void TypePrinter::printHLSLAttributedResourceBefore(
2156 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2157 printBefore(T->getWrappedType(), OS);
2160void TypePrinter::printHLSLAttributedResourceAfter(
2161 const HLSLAttributedResourceType *T, raw_ostream &OS) {
2162 printAfter(T->getWrappedType(), OS);
2163 const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
2164 OS <<
" [[hlsl::resource_class("
2165 << HLSLResourceClassAttr::ConvertResourceClassToStr(Attrs.ResourceClass)
2168 OS <<
" [[hlsl::is_rov]]";
2169 if (Attrs.RawBuffer)
2170 OS <<
" [[hlsl::raw_buffer]]";
2171 if (Attrs.IsCounter)
2172 OS <<
" [[hlsl::is_counter]]";
2174 OS <<
" [[hlsl::is_array]]";
2176 QualType ContainedTy = T->getContainedType();
2177 if (!ContainedTy.
isNull()) {
2178 OS <<
" [[hlsl::contained_type(";
2179 printBefore(ContainedTy, OS);
2180 printAfter(ContainedTy, OS);
2184 if (Attrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown)
2185 OS <<
" [[hlsl::resource_dimension("
2186 << HLSLResourceDimensionAttr::ConvertResourceDimensionToStr(
2187 Attrs.ResourceDimension)
2191void TypePrinter::printHLSLInlineSpirvBefore(
const HLSLInlineSpirvType *T,
2193 OS <<
"__hlsl_spirv_type<" << T->getOpcode();
2195 OS <<
", " << T->getSize();
2196 OS <<
", " << T->getAlignment();
2198 for (
auto &Operand : T->getOperands()) {
2199 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
2203 case SpirvOperandKind::ConstantId: {
2204 QualType ConstantType =
Operand.getResultType();
2205 OS <<
"vk::integral_constant<";
2206 printBefore(ConstantType, OS);
2207 printAfter(ConstantType, OS);
2213 case SpirvOperandKind::Literal:
2214 OS <<
"vk::Literal<vk::integral_constant<uint, ";
2218 case SpirvOperandKind::TypeId: {
2220 printBefore(
Type, OS);
2221 printAfter(
Type, OS);
2225 llvm_unreachable(
"Invalid SpirvOperand kind!");
2233void TypePrinter::printHLSLInlineSpirvAfter(
const HLSLInlineSpirvType *T,
2238void TypePrinter::printObjCInterfaceBefore(
const ObjCInterfaceType *T,
2241 spaceBeforePlaceHolder(OS);
2244void TypePrinter::printObjCInterfaceAfter(
const ObjCInterfaceType *T,
2247void TypePrinter::printObjCTypeParamBefore(
const ObjCTypeParamType *T,
2249 OS << T->getDecl()->getName();
2250 if (!T->qual_empty()) {
2251 bool isFirst =
true;
2253 for (
const auto *I : T->quals()) {
2263 spaceBeforePlaceHolder(OS);
2266void TypePrinter::printObjCTypeParamAfter(
const ObjCTypeParamType *T,
2269void TypePrinter::printObjCObjectBefore(
const ObjCObjectType *T,
2271 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2272 !T->isKindOfTypeAsWritten())
2273 return printBefore(T->getBaseType(), OS);
2275 if (T->isKindOfTypeAsWritten())
2278 print(T->getBaseType(), OS, StringRef());
2280 if (T->isSpecializedAsWritten()) {
2281 bool isFirst =
true;
2283 for (
auto typeArg : T->getTypeArgsAsWritten()) {
2289 print(typeArg, OS, StringRef());
2294 if (!T->qual_empty()) {
2295 bool isFirst =
true;
2297 for (
const auto *I : T->quals()) {
2307 spaceBeforePlaceHolder(OS);
2310void TypePrinter::printObjCObjectAfter(
const ObjCObjectType *T,
2312 if (T->qual_empty() && T->isUnspecializedAsWritten() &&
2313 !T->isKindOfTypeAsWritten())
2314 return printAfter(T->getBaseType(), OS);
2317void TypePrinter::printObjCObjectPointerBefore(
const ObjCObjectPointerType *T,
2324 if (HasEmptyPlaceHolder)
2330void TypePrinter::printObjCObjectPointerAfter(
const ObjCObjectPointerType *T,
2341 llvm::raw_ostream &OS,
bool IncludeType) {
2342 A.
print(PP, OS, IncludeType);
2355 TemplateArgument Pattern,
2356 ArrayRef<TemplateArgument> Args,
2365 if (
auto *TTPT = Pattern->
getAsCanonical<TemplateTypeParmType>()) {
2366 if (TTPT->getDepth() == Depth && TTPT->getIndex() < Args.size() &&
2369 Args[TTPT->getIndex()].getAsType(), Pattern.
getQualifiers());
2381 if (TQual != PatQual)
2398 if (
auto *TTST = T->getAs<TemplateSpecializationType>()) {
2399 Template = TTST->getTemplateName();
2400 TemplateArgs = TTST->template_arguments();
2401 }
else if (
auto *CTSD = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
2402 T->getAsCXXRecordDecl())) {
2404 TemplateArgs = CTSD->getTemplateArgs().asArray();
2412 if (TemplateArgs.size() != PTST->template_arguments().size())
2414 for (
unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
2416 Ctx, TemplateArgs[I], PTST->template_arguments()[I], Args, Depth))
2467 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl()))
2468 return NTTP->getDepth() == Depth && Args.size() > NTTP->getIndex() &&
2469 Args[NTTP->getIndex()].structurallyEquals(Arg);
2485 if (
auto *TTPD = dyn_cast_or_null<TemplateTemplateParmDecl>(PatTD))
2486 return TTPD->getDepth() == Depth && Args.size() > TTPD->getIndex() &&
2495bool clang::isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
2496 const NamedDecl *Param,
2497 ArrayRef<TemplateArgument> Args,
2503 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param)) {
2504 return TTPD->hasDefaultArgument() &&
2506 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2507 }
else if (
auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(Param)) {
2508 return TTPD->hasDefaultArgument() &&
2510 Ctx, Arg, TTPD->getDefaultArgument().getArgument(), Args, Depth);
2511 }
else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2512 return NTTPD->hasDefaultArgument() &&
2514 Ctx, Arg, NTTPD->getDefaultArgument().getArgument(), Args,
2520template <
typename TA>
2526 !Args.empty() && !IsPack && Args.size() <= TPL->
size()) {
2528 for (
const TA &A : Args)
2530 while (!Args.empty() &&
getArgument(Args.back()).getIsDefaulted())
2531 Args = Args.drop_back();
2538 bool NeedSpace =
false;
2539 bool FirstArg =
true;
2540 for (
const auto &Arg : Args) {
2543 llvm::raw_svector_ostream ArgOS(Buf);
2556 Policy, TPL, ParmIndex));
2558 StringRef ArgString = ArgOS.str();
2563 if (FirstArg && ArgString.starts_with(
":"))
2570 if (!ArgString.empty()) {
2587void clang::printTemplateArgumentList(raw_ostream &OS,
2588 const TemplateArgumentListInfo &Args,
2589 const PrintingPolicy &Policy,
2590 const TemplateParameterList *TPL) {
2591 printTemplateArgumentList(OS, Args.
arguments(), Policy, TPL);
2594void clang::printTemplateArgumentList(raw_ostream &OS,
2595 ArrayRef<TemplateArgument> Args,
2596 const PrintingPolicy &Policy,
2597 const TemplateParameterList *TPL) {
2598 PrintingPolicy InnerPolicy = Policy;
2600 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2603void clang::printTemplateArgumentList(raw_ostream &OS,
2604 ArrayRef<TemplateArgumentLoc> Args,
2605 const PrintingPolicy &Policy,
2606 const TemplateParameterList *TPL) {
2607 PrintingPolicy InnerPolicy = Policy;
2609 printTo(OS, Args, InnerPolicy, TPL,
false, 0);
2619 llvm::raw_svector_ostream StrOS(Buf);
2621 return StrOS.str().str();
2649 llvm::raw_svector_ostream StrOS(Buf);
2650 print(StrOS, Policy);
2651 return std::string(StrOS.str());
2669 PointerAuth && !PointerAuth.isEmptyWhenPrinted(Policy))
2689 return "__constant";
2694 return "__global_device";
2697 return "__global_host";
2699 return "__device__";
2701 return "__constant__";
2703 return "__shared__";
2705 return "__sptr __ptr32";
2707 return "__uptr __ptr32";
2711 return "groupshared";
2713 return "hlsl_constant";
2715 return "hlsl_private";
2717 return "hlsl_device";
2719 return "hlsl_input";
2721 return "hlsl_output";
2723 return "hlsl_push_constant";
2735 bool appendSpaceIfNonEmpty)
const {
2736 bool addSpace =
false;
2746 OS <<
"__unaligned";
2750 if (!ASStr.empty()) {
2756 OS <<
"__attribute__((address_space(" << ASStr <<
")))";
2795 PointerAuth.print(OS, Policy);
2798 if (appendSpaceIfNonEmpty && addSpace)
2820 const Twine &PlaceHolder,
unsigned Indentation)
const {
2827 const Twine &PlaceHolder,
unsigned Indentation) {
2829 StringRef PH = PlaceHolder.toStringRef(PHBuf);
2831 TypePrinter(policy, Indentation).print(ty, qs, OS, PH);
2841 std::string &buffer,
2844 llvm::raw_svector_ostream StrOS(Buf);
2845 TypePrinter(policy).print(ty, qs, StrOS, buffer);
2846 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.