clang: lib/AST/TypeLoc.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
25#include "llvm/ADT/SmallVector.h"
26#include "llvm/Support/ErrorHandling.h"
27#include "llvm/Support/MathExtras.h"
28#include
29#include
30#include
31#include
32
33using namespace clang;
34
36
37
38
39
40
41namespace {
42
43class TypeLocRanger : public TypeLocVisitor<TypeLocRanger, SourceRange> {
44public:
45#define ABSTRACT_TYPELOC(CLASS, PARENT)
46#define TYPELOC(CLASS, PARENT) \
47 SourceRange Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
48 return TyLoc.getLocalSourceRange(); \
49 }
50#include "clang/AST/TypeLocNodes.def"
51};
52
53}
54
56 if (TL.isNull()) return SourceRange();
57 return TypeLocRanger().Visit(TL);
58}
59
60namespace {
61
62class TypeAligner : public TypeLocVisitor<TypeAligner, unsigned> {
63public:
64#define ABSTRACT_TYPELOC(CLASS, PARENT)
65#define TYPELOC(CLASS, PARENT) \
66 unsigned Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
67 return TyLoc.getLocalDataAlignment(); \
68 }
69#include "clang/AST/TypeLocNodes.def"
70};
71
72}
73
74
76 if (Ty.isNull()) return 1;
77 return TypeAligner().Visit(TypeLoc(Ty, nullptr));
78}
79
80namespace {
81
82class TypeSizer : public TypeLocVisitor<TypeSizer, unsigned> {
83public:
84#define ABSTRACT_TYPELOC(CLASS, PARENT)
85#define TYPELOC(CLASS, PARENT) \
86 unsigned Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
87 return TyLoc.getLocalDataSize(); \
88 }
89#include "clang/AST/TypeLocNodes.def"
90};
91
92}
93
94
96 unsigned Total = 0;
98 unsigned MaxAlign = 1;
99 while (!TyLoc.isNull()) {
101 MaxAlign = std::max(Align, MaxAlign);
102 Total = llvm::alignTo(Total, Align);
103 Total += TypeSizer().Visit(TyLoc);
105 }
106 Total = llvm::alignTo(Total, MaxAlign);
107 return Total;
108}
109
110namespace {
111
112class NextLoc : public TypeLocVisitor<NextLoc, TypeLoc> {
113public:
114#define ABSTRACT_TYPELOC(CLASS, PARENT)
115#define TYPELOC(CLASS, PARENT) \
116 TypeLoc Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
117 return TyLoc.getNextTypeLoc(); \
118 }
119#include "clang/AST/TypeLocNodes.def"
120};
121
122}
123
124
125
127 return NextLoc().Visit(TL);
128}
129
130
131
132
135 while (true) {
137#define ABSTRACT_TYPELOC(CLASS, PARENT)
138#define TYPELOC(CLASS, PARENT) \
139 case CLASS: { \
140 CLASS##TypeLoc TLCasted = TL.castAs<CLASS##TypeLoc>(); \
141 TLCasted.initializeLocal(Context, Loc); \
142 TL = TLCasted.getNextTypeLoc(); \
143 if (!TL) return; \
144 continue; \
145 }
146#include "clang/AST/TypeLocNodes.def"
147 }
148 }
149}
150
151namespace {
152
153class TypeLocCopier : public TypeLocVisitor {
154 TypeLoc Source;
155
156public:
157 TypeLocCopier(TypeLoc source) : Source(source) {}
158
159#define ABSTRACT_TYPELOC(CLASS, PARENT)
160#define TYPELOC(CLASS, PARENT) \
161 void Visit##CLASS##TypeLoc(CLASS##TypeLoc dest) { \
162 dest.copyLocal(Source.castAs<CLASS##TypeLoc>()); \
163 }
164#include "clang/AST/TypeLocNodes.def"
165};
166
167}
168
171
172
173
174
179 llvm::alignTo(reinterpret_cast<uintptr_t>(other.Data),
182 return;
183 }
184
185
187 do {
188 TypeLocCopier(other).Visit(TL);
191}
192
196 while (true) {
198 case FunctionProto:
201 LeftMost = Cur;
202 break;
203 }
204 [[fallthrough]];
205 case FunctionNoProto:
206 case ConstantArray:
207 case DependentSizedArray:
208 case IncompleteArray:
209 case VariableArray:
210
213 continue;
214 default:
216 LeftMost = Cur;
219 break;
220 continue;
221 }
222 break;
223 }
225}
226
230 while (true) {
232 default:
235 return Last.getLocalSourceRange().getEnd();
237 case ConstantArray:
238 case DependentSizedArray:
239 case IncompleteArray:
240 case VariableArray:
241 case FunctionNoProto:
242
243
245 break;
246 case FunctionProto:
249 else
251 break;
252 case ObjCObjectPointer:
253
255 break;
256 [[fallthrough]];
258 case BlockPointer:
259 case MemberPointer:
260 case LValueReference:
261 case RValueReference:
262 case PackExpansion:
263
264
267 break;
269 break;
270 }
272 }
273}
274
275namespace {
276
277struct TSTChecker : public TypeLocVisitor<TSTChecker, bool> {
278
279 static bool isTypeSpec(TypeSpecTypeLoc _) { return true; }
280 static bool isTypeSpec(TypeLoc _) { return false; }
281
282#define ABSTRACT_TYPELOC(CLASS, PARENT)
283#define TYPELOC(CLASS, PARENT) \
284 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
285 return isTypeSpec(TyLoc); \
286 }
287#include "clang/AST/TypeLocNodes.def"
288};
289
290}
291
292
293
294
295
296
297
298
299
300bool TypeSpecTypeLoc::isKind(const TypeLoc &TL) {
302 return TSTChecker().Visit(TL);
303}
304
308
309
310
311
319
320
325 case BuiltinType::Void:
327 case BuiltinType::Bool:
329 case BuiltinType::Char_U:
330 case BuiltinType::Char_S:
332 case BuiltinType::Char8:
334 case BuiltinType::Char16:
336 case BuiltinType::Char32:
338 case BuiltinType::WChar_S:
339 case BuiltinType::WChar_U:
341 case BuiltinType::UChar:
342 case BuiltinType::UShort:
343 case BuiltinType::UInt:
344 case BuiltinType::ULong:
345 case BuiltinType::ULongLong:
346 case BuiltinType::UInt128:
347 case BuiltinType::SChar:
348 case BuiltinType::Short:
349 case BuiltinType::Int:
350 case BuiltinType::Long:
351 case BuiltinType::LongLong:
352 case BuiltinType::Int128:
353 case BuiltinType::Half:
354 case BuiltinType::Float:
355 case BuiltinType::Double:
356 case BuiltinType::LongDouble:
357 case BuiltinType::Float16:
358 case BuiltinType::Float128:
359 case BuiltinType::Ibm128:
360 case BuiltinType::ShortAccum:
361 case BuiltinType::Accum:
362 case BuiltinType::LongAccum:
363 case BuiltinType::UShortAccum:
364 case BuiltinType::UAccum:
365 case BuiltinType::ULongAccum:
366 case BuiltinType::ShortFract:
367 case BuiltinType::Fract:
368 case BuiltinType::LongFract:
369 case BuiltinType::UShortFract:
370 case BuiltinType::UFract:
371 case BuiltinType::ULongFract:
372 case BuiltinType::SatShortAccum:
373 case BuiltinType::SatAccum:
374 case BuiltinType::SatLongAccum:
375 case BuiltinType::SatUShortAccum:
376 case BuiltinType::SatUAccum:
377 case BuiltinType::SatULongAccum:
378 case BuiltinType::SatShortFract:
379 case BuiltinType::SatFract:
380 case BuiltinType::SatLongFract:
381 case BuiltinType::SatUShortFract:
382 case BuiltinType::SatUFract:
383 case BuiltinType::SatULongFract:
384 case BuiltinType::BFloat16:
385 llvm_unreachable("Builtin type needs extra local data!");
386
387
388 case BuiltinType::NullPtr:
389 case BuiltinType::Overload:
390 case BuiltinType::Dependent:
391 case BuiltinType::UnresolvedTemplate:
392 case BuiltinType::BoundMember:
393 case BuiltinType::UnknownAny:
394 case BuiltinType::ARCUnbridgedCast:
395 case BuiltinType::PseudoObject:
396 case BuiltinType::ObjCId:
397 case BuiltinType::ObjCClass:
398 case BuiltinType::ObjCSel:
399#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
400 case BuiltinType::Id:
401#include "clang/Basic/OpenCLImageTypes.def"
402#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
403 case BuiltinType::Id:
404#include "clang/Basic/OpenCLExtensionTypes.def"
405 case BuiltinType::OCLSampler:
406 case BuiltinType::OCLEvent:
407 case BuiltinType::OCLClkEvent:
408 case BuiltinType::OCLQueue:
409 case BuiltinType::OCLReserveID:
410#define SVE_TYPE(Name, Id, SingletonId) \
411 case BuiltinType::Id:
412#include "clang/Basic/AArch64ACLETypes.def"
413#define PPC_VECTOR_TYPE(Name, Id, Size) \
414 case BuiltinType::Id:
415#include "clang/Basic/PPCTypes.def"
416#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
417#include "clang/Basic/RISCVVTypes.def"
418#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
419#include "clang/Basic/WebAssemblyReferenceTypes.def"
420#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
421#include "clang/Basic/AMDGPUTypes.def"
422#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
423#include "clang/Basic/HLSLIntangibleTypes.def"
424 case BuiltinType::BuiltinFn:
425 case BuiltinType::IncompleteMatrixIdx:
426 case BuiltinType::ArraySection:
427 case BuiltinType::OMPArrayShaping:
428 case BuiltinType::OMPIterator:
430 }
431
432 llvm_unreachable("Invalid BuiltinType Kind!");
433}
434
437 TL = PTL.getInnerLoc();
438 return TL;
439}
440
443 const Attr *A = ATL.getAttr();
447 }
448
449 return {};
450}
451
453
455 return qual;
456
458
459
461 if (attr.isQualifier()) return attr;
462 return attr.getModifiedLoc().findExplicitQualifierLoc();
463 }
464
465
467 return atomic;
468 }
469
470 return {};
471}
472
475 case TypeLoc::DependentName:
477 case TypeLoc::TemplateSpecialization:
479 case TypeLoc::DeducedTemplateSpecialization:
481 case TypeLoc::Enum:
482 case TypeLoc::Record:
483 case TypeLoc::InjectedClassName:
485 case TypeLoc::Typedef:
487 case TypeLoc::UnresolvedUsing:
489 case TypeLoc::Using:
491 default:
493 }
494}
495
497
498
502 .getUnqualifiedLoc()
503 .getNonElaboratedBeginLoc();
504 case TypeLoc::TemplateSpecialization: {
507 return QualifierLoc.getBeginLoc();
508 return T.getTemplateNameLoc();
509 }
510 case TypeLoc::DeducedTemplateSpecialization: {
513 return QualifierLoc.getBeginLoc();
514 return T.getTemplateNameLoc();
515 }
516 case TypeLoc::DependentName: {
519 return QualifierLoc.getBeginLoc();
520 return T.getNameLoc();
521 }
522 case TypeLoc::Enum:
523 case TypeLoc::Record:
524 case TypeLoc::InjectedClassName: {
527 return QualifierLoc.getBeginLoc();
528 return T.getNameLoc();
529 }
530 case TypeLoc::Typedef: {
533 return QualifierLoc.getBeginLoc();
534 return T.getNameLoc();
535 }
536 case TypeLoc::UnresolvedUsing: {
539 return QualifierLoc.getBeginLoc();
540 return T.getNameLoc();
541 }
542 case TypeLoc::Using: {
545 return QualifierLoc.getBeginLoc();
546 return T.getNameLoc();
547 }
548 default:
550 }
551}
552
563
569 for (unsigned i = 0, e = getNumTypeArgs(); i != e; ++i) {
571 Context.getTrivialTypeSourceInfo(
572 getTypePtr()->getTypeArgsAsWritten()[i], Loc));
573 }
578}
579
581
582
583
584
585
586
587
588
589
591}
592
596
600
608
617
618template
620 T.setElaboratedKeywordLoc(T.getTypePtr()->getKeyword() !=
622 ? Loc
624}
625
629 if (!Qualifier)
632 Builder.MakeTrivial(Context, Qualifier, Loc);
633 return Builder.getWithLocInContext(Context);
634}
635
643
651
652 Data.ElaboratedKWLoc = ElaboratedKeywordLoc;
654
656
658 getTypePtr()->getTemplateName().getQualifier());
659 Data.QualifierData = QualifierLoc ? QualifierLoc.getOpaqueData() : nullptr;
660 if (QualifierLoc && !BeginLoc.isValid())
662
663 Data.TemplateKWLoc = TemplateKeywordLoc;
665 BeginLoc = TemplateKeywordLoc;
666
667 Data.NameLoc = NameLoc;
669 BeginLoc = NameLoc;
670
671 Data.LAngleLoc = LAngleLoc;
673}
674
680 set(ElaboratedKeywordLoc, QualifierLoc, TemplateKeywordLoc, NameLoc,
683 assert(TAL.size() == ArgInfos.size());
684 for (unsigned I = 0, N = TAL.size(); I != N; ++I)
685 ArgInfos[I] = TAL[I].getLocInfo();
686}
687
690
691 auto [Qualifier, HasTemplateKeyword] =
692 getTypePtr()->getTemplateName().getQualifierAndTemplateKeyword();
693
696 ? Loc
698
700 if (Qualifier) {
702 Builder.MakeTrivial(Context, Qualifier, Loc);
703 QualifierLoc = Builder.getWithLocInContext(Context);
704 }
705
707 set(ElaboratedKeywordLoc, QualifierLoc,
708 HasTemplateKeyword ? Loc : SourceLocation(),
709 Loc, Loc, Loc);
711 Loc);
712}
713
717 for (unsigned i = 0, e = Args.size(); i != e; ++i) {
718 switch (Args[i].getKind()) {
720 llvm_unreachable("Impossible TemplateArgument");
721
727 break;
728
731 break;
732
735 Context.getTrivialTypeSourceInfo(Args[i].getAsType(),
736 Loc));
737 break;
738
744 Builder.MakeTrivial(Context, DTN->getQualifier(), Loc);
746 Builder.MakeTrivial(Context, QTN->getQualifier(), Loc);
747
749 Context, Loc, Builder.getWithLocInContext(Context), Loc,
751 : Loc);
752 break;
753 }
754
757 break;
758 }
759 }
760}
761
762
763
766 const AutoType *AT) {
769 AT->getTypeConstraintConcept()->getDeclName());
770 unsigned size = AT->getTypeConstraintArguments().size();
773 Context, AT->getTypeConstraintArguments(), TALI.data(), Loc);
775 for (unsigned i = 0; i < size; ++i) {
778 TALI[i]));
779 }
780
783 AT->getTypeConstraintConcept(),
785 return ConceptRef;
786}
787
797
802 Context, getTypePtr()->getTemplateName().getQualifier(), Loc));
804}
805
806namespace {
807
808 class GetContainedAutoTypeLocVisitor :
809 public TypeLocVisitor<GetContainedAutoTypeLocVisitor, TypeLoc> {
810 public:
812
814 return TL;
815 }
816
817
818
820 return Visit(T.getUnqualifiedLoc());
821 }
822
823 TypeLoc VisitPointerTypeLoc(PointerTypeLoc T) {
824 return Visit(T.getPointeeLoc());
825 }
826
827 TypeLoc VisitBlockPointerTypeLoc(BlockPointerTypeLoc T) {
828 return Visit(T.getPointeeLoc());
829 }
830
831 TypeLoc VisitReferenceTypeLoc(ReferenceTypeLoc T) {
832 return Visit(T.getPointeeLoc());
833 }
834
835 TypeLoc VisitMemberPointerTypeLoc(MemberPointerTypeLoc T) {
836 return Visit(T.getPointeeLoc());
837 }
838
839 TypeLoc VisitArrayTypeLoc(ArrayTypeLoc T) {
840 return Visit(T.getElementLoc());
841 }
842
843 TypeLoc VisitFunctionTypeLoc(FunctionTypeLoc T) {
844 return Visit(T.getReturnLoc());
845 }
846
847 TypeLoc VisitParenTypeLoc(ParenTypeLoc T) {
848 return Visit(T.getInnerLoc());
849 }
850
851 TypeLoc VisitAttributedTypeLoc(AttributedTypeLoc T) {
852 return Visit(T.getModifiedLoc());
853 }
854
855 TypeLoc VisitBTFTagAttributedTypeLoc(BTFTagAttributedTypeLoc T) {
856 return Visit(T.getWrappedLoc());
857 }
858
859 TypeLoc
860 VisitHLSLAttributedResourceTypeLoc(HLSLAttributedResourceTypeLoc T) {
861 return Visit(T.getWrappedLoc());
862 }
863
864 TypeLoc VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc T) {
865 return Visit(T.getInnerLoc());
866 }
867
868 TypeLoc VisitAdjustedTypeLoc(AdjustedTypeLoc T) {
869 return Visit(T.getOriginalLoc());
870 }
871
872 TypeLoc VisitPackExpansionTypeLoc(PackExpansionTypeLoc T) {
873 return Visit(T.getPatternLoc());
874 }
875 };
876
877}
878
880 TypeLoc Res = GetContainedAutoTypeLocVisitor().Visit(*this);
884}
885
888 return TSTL.getTemplateKeywordLoc();
890}
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static ConceptReference * createTrivialConceptReference(ASTContext &Context, SourceLocation Loc, const AutoType *AT)
Definition TypeLoc.cpp:764
static const unsigned TypeLocMaxDataAlign
Definition TypeLoc.cpp:35
static NestedNameSpecifierLoc initializeQualifier(ASTContext &Context, NestedNameSpecifier Qualifier, SourceLocation Loc)
Definition TypeLoc.cpp:626
static void initializeElaboratedKeyword(TL T, SourceLocation Loc)
Definition TypeLoc.cpp:619
Defines the clang::TypeLoc interface and its subclasses.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
Attr - This represents one attribute.
SourceLocation getLocation() const
SourceRange getRange() const
Type source information for an attributed type.
const Attr * getAttr() const
The type attribute.
SourceRange getLocalSourceRange() const
Definition TypeLoc.cpp:580
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:788
void setConceptReference(ConceptReference *CR)
bool isConstrained() const
void setRParenLoc(SourceLocation Loc)
const BTFTypeTagAttr * getAttr() const
The btf_type_tag attribute.
SourceRange getLocalSourceRange() const
Definition TypeLoc.cpp:597
TypeSpecifierType getWrittenTypeSpec() const
Definition TypeLoc.cpp:321
bool needsExtraLocalData() const
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
A reference to a concept and its template args, as it appears in the code.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TagType * getTypePtr() const
TypeOfTypeLocInfo * getLocalData() const
Expr * getCountExpr() const
SourceRange getLocalSourceRange() const
Definition TypeLoc.cpp:593
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:798
void setTemplateNameLoc(SourceLocation Loc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:636
void setNameLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
const TypeClass * getTypePtr() const
Class that aids in the construction of nested-name-specifiers along with source-location information ...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
Represents a C++ nested name specifier, such as "\::std::vector::".
Wraps an ObjCPointerType with source location information.
SourceLocation getStarLoc() const
void setTypeArgsRAngleLoc(SourceLocation Loc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:564
unsigned getNumTypeArgs() const
unsigned getNumProtocols() const
void setTypeArgsLAngleLoc(SourceLocation Loc)
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
void setProtocolLAngleLoc(SourceLocation Loc)
void setProtocolRAngleLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
void setProtocolLoc(unsigned i, SourceLocation Loc)
unsigned getNumProtocols() const
void setProtocolLoc(unsigned i, SourceLocation Loc)
void setProtocolLAngleLoc(SourceLocation Loc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:553
void setProtocolRAngleLoc(SourceLocation Loc)
void setNameLoc(SourceLocation Loc)
A (possibly-)qualified type.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
TagDecl * getDecl() const
bool isDefinition() const
True if the tag was defined in this type specifier.
Definition TypeLoc.cpp:305
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
void addArgument(const TemplateArgumentLoc &Loc)
SourceLocation getLAngleLoc() const
Location wrapper for a TemplateArgument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ 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,...
Represents a C++ template name within the type system.
static void initializeArgLocs(ASTContext &Context, ArrayRef< TemplateArgument > Args, TemplateArgumentLocInfo *ArgInfos, SourceLocation Loc)
Definition TypeLoc.cpp:714
MutableArrayRef< TemplateArgumentLocInfo > getArgLocInfos()
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKeywordLoc, SourceLocation NameLoc, SourceLocation LAngleLoc, SourceLocation RAngleLoc)
Definition TypeLoc.cpp:644
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:688
RetTy Visit(TypeLoc TyLoc)
Base wrapper for a particular "section" of type source info.
SourceLocation findNullabilityLoc() const
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier),...
Definition TypeLoc.cpp:441
static unsigned getLocalAlignmentForType(QualType Ty)
Returns the alignment of type source info data block for the given type.
Definition TypeLoc.cpp:75
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
Definition TypeLoc.cpp:452
QualType getType() const
Get the type for which this source info wrapper provides information.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
NestedNameSpecifierLoc getPrefix() const
If this type represents a qualified-id, this returns it's nested name specifier.
Definition TypeLoc.cpp:473
TypeLoc IgnoreParens() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceLocation getNonElaboratedBeginLoc() const
This returns the position of the type after any elaboration, such as the 'struct' keyword.
Definition TypeLoc.cpp:496
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
SourceRange getLocalSourceRange() const
Get the local source range.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
Definition TypeLoc.cpp:879
SourceLocation getTemplateKeywordLoc() const
Get the SourceLocation of the template keyword (if any).
Definition TypeLoc.cpp:886
void copy(TypeLoc other)
Copies the other type loc into this one.
Definition TypeLoc.cpp:169
TypeLocClass getTypeLocClass() const
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
Definition TypeLoc.cpp:95
SourceLocation getEndLoc() const
Get the end source location.
Definition TypeLoc.cpp:227
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
Definition TypeLoc.cpp:193
SourceRange getLocalSourceRange() const
Definition TypeLoc.cpp:312
Expr * getUnderlyingExpr() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:601
QualType getUnmodifiedType() const
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier.
void setNameLoc(SourceLocation Loc)
SourceLocation getRParenLoc() const
SourceLocation getTypeofLoc() const
void setRParenLoc(SourceLocation Loc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition TypeLoc.cpp:609
void setKWLoc(SourceLocation Loc)
void setUnderlyingTInfo(TypeSourceInfo *TInfo)
void setLParenLoc(SourceLocation Loc)
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
bool isa(CodeGen::Address addr)
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
@ None
No keyword precedes the qualified type name.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
Location information for a TemplateArgument.
TypeSourceInfo * UnmodifiedTInfo