16#include "llvm/Support/Path.h"
17#include "llvm/Support/raw_ostream.h"
32 Loc =
SM.getExpansionLoc(Loc);
33 const std::pair<FileID, unsigned> &Decomposed =
SM.getDecomposedLoc(Loc);
34 const FileEntry *FE =
SM.getFileEntryForID(Decomposed.first);
36 OS << llvm::sys::path::filename(FE->
getName());
45 OS <<
'@' << Decomposed.second;
54 return attr->getDefinedIn();
62 llvm::raw_svector_ostream Out;
67 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
81 bool ignoreResults()
const {
return IgnoreResults; }
97 void VisitTagDecl(
const TagDecl *D);
100 void VisitVarDecl(
const VarDecl *D);
109 IgnoreResults =
true;
113 IgnoreResults =
true;
116 void VisitUsingDecl(
const UsingDecl *D) {
120 bool EmittedDeclName = !EmitDeclName(D);
121 assert(EmittedDeclName &&
"EmitDeclName can not fail for UsingDecls");
122 (void)EmittedDeclName;
125 bool ShouldGenerateLocation(
const NamedDecl *D);
131 void GenExtSymbolContainer(
const NamedDecl *D);
135 bool GenLoc(
const Decl *D,
bool IncludeOffset);
144 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
145 StringRef CategoryContextExtSymbolDefinedIn) {
147 CategoryContextExtSymbolDefinedIn);
151 void GenObjCCategory(StringRef cls, StringRef cat,
152 StringRef clsExt, StringRef catExt) {
157 void GenObjCProperty(StringRef prop,
bool isClassProp) {
162 void GenObjCProtocol(StringRef prot, StringRef ext) {
183bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
191bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
200 return !
SM.isInSystemHeader(Loc);
203void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
204 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
206 else if (isa<LinkageSpecDecl>(DC))
210void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
217 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
218 if (EmitDeclName(D)) {
220 IgnoreResults =
true;
225void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
226 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
230 IgnoreResults =
true;
234 const unsigned StartSize = Buf.size();
236 if (Buf.size() == StartSize)
237 GenExtSymbolContainer(D);
239 bool IsTemplate =
false;
243 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
250 Policy.SuppressTemplateArgsInCXXConstructors =
true;
255 !D->
hasAttr<OverloadableAttr>())
261 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
263 VisitTemplateArgument(SpecArgs->get(I));
271 VisitType(PD->getType());
289 if (
unsigned quals = MD->getMethodQualifiers().getCVRUQualifiers())
290 Out << (char)(
'0' + quals);
291 switch (MD->getRefQualifier()) {
299void USRGenerator::VisitNamedDecl(
const NamedDecl *D) {
303 if (EmitDeclName(D)) {
308 IgnoreResults =
true;
312void USRGenerator::VisitVarDecl(
const VarDecl *D) {
316 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
323 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
325 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
327 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
338 IgnoreResults =
true;
344 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
347 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
349 VisitTemplateArgument(Args.
get(I));
354void USRGenerator::VisitBindingDecl(
const BindingDecl *D) {
355 if (isLocal(D) && GenLoc(D,
true))
360void USRGenerator::VisitNonTypeTemplateParmDecl(
365void USRGenerator::VisitTemplateTemplateParmDecl(
370void USRGenerator::VisitNamespaceDecl(
const NamespaceDecl *D) {
398 if (
auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->
getDeclContext()))
399 return ICD->getCategoryDecl();
413 IgnoreResults =
true;
417 VisitObjCContainerDecl(ID, CD);
430 llvm_unreachable(
"Invalid ObjC container.");
431 case Decl::ObjCInterface:
432 case Decl::ObjCImplementation:
436 case Decl::ObjCCategory: {
444 IgnoreResults =
true;
450 Out <<
"objc(ext)" <<
ID->getName() <<
'@';
454 GenObjCCategory(
ID->getName(), CD->
getName(),
460 case Decl::ObjCCategoryImpl: {
468 IgnoreResults =
true;
471 GenObjCCategory(
ID->getName(), CD->
getName(),
476 case Decl::ObjCProtocol: {
496 VisitObjCPropertyDecl(PD);
500 IgnoreResults =
true;
503void USRGenerator::VisitTagDecl(
const TagDecl *D) {
506 if (!isa<EnumDecl>(D) &&
507 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
510 GenExtSymbolContainer(D);
515 bool AlreadyStarted =
false;
516 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
518 AlreadyStarted =
true;
525 case TTK_Enum: llvm_unreachable(
"enum template");
527 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
529 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
530 AlreadyStarted =
true;
537 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
539 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
543 if (!AlreadyStarted) {
554 assert(Buf.size() > 0);
555 const unsigned off = Buf.size() - 1;
557 if (EmitDeclName(D)) {
566 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
569 auto enum_range = ED->enumerators();
570 if (enum_range.begin() != enum_range.end()) {
571 Out <<
'@' << **enum_range.begin();
580 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
583 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
585 VisitTemplateArgument(Args.
get(I));
590void USRGenerator::VisitTypedefDecl(
const TypedefDecl *D) {
591 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
594 if (
const NamedDecl *DCN = dyn_cast<NamedDecl>(DC))
604void USRGenerator::GenExtSymbolContainer(
const NamedDecl *D) {
606 if (!Container.empty())
607 Out <<
"@M@" << Container;
610bool USRGenerator::GenLoc(
const Decl *D,
bool IncludeOffset) {
612 return IgnoreResults;
617 IgnoreResults =
true;
628 return IgnoreResults;
641void USRGenerator::VisitType(
QualType T) {
658 Out << ((char) (
'0' + qVal));
664 T = Expansion->getPattern();
668 switch (BT->getKind()) {
669 case BuiltinType::Void:
671 case BuiltinType::Bool:
673 case BuiltinType::UChar:
675 case BuiltinType::Char8:
677 case BuiltinType::Char16:
679 case BuiltinType::Char32:
681 case BuiltinType::UShort:
683 case BuiltinType::UInt:
685 case BuiltinType::ULong:
687 case BuiltinType::ULongLong:
689 case BuiltinType::UInt128:
691 case BuiltinType::Char_U:
692 case BuiltinType::Char_S:
694 case BuiltinType::SChar:
696 case BuiltinType::WChar_S:
697 case BuiltinType::WChar_U:
699 case BuiltinType::Short:
701 case BuiltinType::Int:
703 case BuiltinType::Long:
705 case BuiltinType::LongLong:
707 case BuiltinType::Int128:
709 case BuiltinType::Float16:
710 case BuiltinType::Half:
712 case BuiltinType::Float:
714 case BuiltinType::Double:
716 case BuiltinType::LongDouble:
718 case BuiltinType::Float128:
720 case BuiltinType::NullPtr:
722#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
723 case BuiltinType::Id: \
724 Out << "@BT@" << #Suffix << "_" << #ImgType; break;
725#include "clang/Basic/OpenCLImageTypes.def"
726#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
727 case BuiltinType::Id: \
728 Out << "@BT@" << #ExtType; break;
729#include "clang/Basic/OpenCLExtensionTypes.def"
730 case BuiltinType::OCLEvent:
731 Out <<
"@BT@OCLEvent";
break;
732 case BuiltinType::OCLClkEvent:
733 Out <<
"@BT@OCLClkEvent";
break;
734 case BuiltinType::OCLQueue:
735 Out <<
"@BT@OCLQueue";
break;
736 case BuiltinType::OCLReserveID:
737 Out <<
"@BT@OCLReserveID";
break;
738 case BuiltinType::OCLSampler:
739 Out <<
"@BT@OCLSampler";
break;
740#define SVE_TYPE(Name, Id, SingletonId) \
741 case BuiltinType::Id: \
742 Out << "@BT@" << Name; break;
743#include "clang/Basic/AArch64SVEACLETypes.def"
744#define PPC_VECTOR_TYPE(Name, Id, Size) \
745 case BuiltinType::Id: \
746 Out << "@BT@" << #Name; break;
747#include "clang/Basic/PPCTypes.def"
748#define RVV_TYPE(Name, Id, SingletonId) \
749 case BuiltinType::Id: \
750 Out << "@BT@" << Name; break;
751#include "clang/Basic/RISCVVTypes.def"
752#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
753#include "clang/Basic/WebAssemblyReferenceTypes.def"
754 case BuiltinType::ShortAccum:
755 Out <<
"@BT@ShortAccum";
break;
756 case BuiltinType::Accum:
757 Out <<
"@BT@Accum";
break;
758 case BuiltinType::LongAccum:
759 Out <<
"@BT@LongAccum";
break;
760 case BuiltinType::UShortAccum:
761 Out <<
"@BT@UShortAccum";
break;
762 case BuiltinType::UAccum:
763 Out <<
"@BT@UAccum";
break;
764 case BuiltinType::ULongAccum:
765 Out <<
"@BT@ULongAccum";
break;
766 case BuiltinType::ShortFract:
767 Out <<
"@BT@ShortFract";
break;
768 case BuiltinType::Fract:
769 Out <<
"@BT@Fract";
break;
770 case BuiltinType::LongFract:
771 Out <<
"@BT@LongFract";
break;
772 case BuiltinType::UShortFract:
773 Out <<
"@BT@UShortFract";
break;
774 case BuiltinType::UFract:
775 Out <<
"@BT@UFract";
break;
776 case BuiltinType::ULongFract:
777 Out <<
"@BT@ULongFract";
break;
778 case BuiltinType::SatShortAccum:
779 Out <<
"@BT@SatShortAccum";
break;
780 case BuiltinType::SatAccum:
781 Out <<
"@BT@SatAccum";
break;
782 case BuiltinType::SatLongAccum:
783 Out <<
"@BT@SatLongAccum";
break;
784 case BuiltinType::SatUShortAccum:
785 Out <<
"@BT@SatUShortAccum";
break;
786 case BuiltinType::SatUAccum:
787 Out <<
"@BT@SatUAccum";
break;
788 case BuiltinType::SatULongAccum:
789 Out <<
"@BT@SatULongAccum";
break;
790 case BuiltinType::SatShortFract:
791 Out <<
"@BT@SatShortFract";
break;
792 case BuiltinType::SatFract:
793 Out <<
"@BT@SatFract";
break;
794 case BuiltinType::SatLongFract:
795 Out <<
"@BT@SatLongFract";
break;
796 case BuiltinType::SatUShortFract:
797 Out <<
"@BT@SatUShortFract";
break;
798 case BuiltinType::SatUFract:
799 Out <<
"@BT@SatUFract";
break;
800 case BuiltinType::SatULongFract:
801 Out <<
"@BT@SatULongFract";
break;
802 case BuiltinType::BFloat16:
803 Out <<
"@BT@__bf16";
break;
804 case BuiltinType::Ibm128:
805 Out <<
"@BT@__ibm128";
break;
806 case BuiltinType::ObjCId:
808 case BuiltinType::ObjCClass:
810 case BuiltinType::ObjCSel:
812#define BUILTIN_TYPE(Id, SingletonId)
813#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
814#include "clang/AST/BuiltinTypes.def"
815 case BuiltinType::Dependent:
818 IgnoreResults =
true;
826 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
828 if (Substitution != TypeSubstitutions.end()) {
829 Out <<
'S' << Substitution->second <<
'_';
833 unsigned Number = TypeSubstitutions.size();
859 VisitType(FT->getReturnType());
861 for (
const auto &I : FT->param_types()) {
866 if (FT->isVariadic())
877 T = CT->getElementType();
882 VisitTagDecl(TT->getDecl());
887 VisitObjCInterfaceDecl(OIT->getDecl());
892 VisitType(OIT->getBaseType());
893 for (
auto *Prot : OIT->getProtocols())
894 VisitObjCProtocolDecl(Prot);
898 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
904 VisitTemplateName(Spec->getTemplateName());
905 Out << Spec->template_arguments().size();
906 for (
const auto &Arg : Spec->template_arguments())
907 VisitTemplateArgument(Arg);
913 Out <<
':' << DNT->getIdentifier()->getName();
917 T = InjT->getInjectedSpecializationType();
922 Out << VT->getNumElements();
923 T = VT->getElementType();
926 if (
const auto *
const AT = dyn_cast<ArrayType>(T)) {
928 switch (AT->getSizeModifier()) {
939 if (
const auto *
const CAT = dyn_cast<ConstantArrayType>(T))
940 Out << CAT->getSize();
942 T = AT->getElementType();
952void USRGenerator::VisitTemplateParameterList(
956 Out <<
'>' << Params->
size();
958 PEnd = Params->
end();
961 if (isa<TemplateTypeParmDecl>(*
P)) {
962 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack())
969 if (NTTP->isParameterPack())
972 VisitType(NTTP->getType());
984void USRGenerator::VisitTemplateName(
TemplateName Name) {
985 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
987 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
988 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
1025 VisitTemplateArgument(
P);
1041 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1050 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1058void USRGenerator::VisitConceptDecl(
const ConceptDecl *D) {
1059 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1066void USRGenerator::VisitMSGuidDecl(
const MSGuidDecl *D) {
1069 D->NamedDecl::printName(Out);
1077 StringRef CatSymDefinedIn,
1079 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty())
1081 if (CatSymDefinedIn.empty()) {
1082 OS <<
"@M@" << ClsSymDefinedIn <<
'@';
1085 OS <<
"@CM@" << CatSymDefinedIn <<
'@';
1086 if (ClsSymDefinedIn != CatSymDefinedIn) {
1087 OS << ClsSymDefinedIn <<
'@';
1092 StringRef ExtSymDefinedIn,
1093 StringRef CategoryContextExtSymbolDefinedIn) {
1095 CategoryContextExtSymbolDefinedIn, OS);
1096 OS <<
"objc(cs)" << Cls;
1101 StringRef ClsSymDefinedIn,
1102 StringRef CatSymDefinedIn) {
1104 OS <<
"objc(cy)" << Cls <<
'@' << Cat;
1112 bool IsInstanceMethod,
1114 OS << (IsInstanceMethod ?
"(im)" :
"(cm)") << Sel;
1119 OS << (isClassProp ?
"(cpy)" :
"(py)") << Prop;
1123 StringRef ExtSymDefinedIn) {
1124 if (!ExtSymDefinedIn.empty())
1125 OS <<
"@M@" << ExtSymDefinedIn <<
'@';
1126 OS <<
"objc(pl)" << Prot;
1130 StringRef ExtSymDefinedIn) {
1131 if (!ExtSymDefinedIn.empty())
1132 OS <<
"@M@" << ExtSymDefinedIn;
1133 OS <<
"@E@" << EnumName;
1138 OS <<
'@' << EnumConstantName;
1151 if (
auto *ExternalSymAttr = CD->
getAttr<ExternalSourceSymbolAttr>()) {
1152 if (!ExternalSymAttr->getUSR().empty()) {
1153 llvm::raw_svector_ostream Out(Buf);
1154 Out << ExternalSymAttr->getUSR();
1160 return UG.ignoreResults();
1176 if (MacroName.empty())
1179 llvm::raw_svector_ostream Out(Buf);
1183 bool ShouldGenerateLocation = Loc.
isValid() && !
SM.isInSystemHeader(Loc);
1186 if (ShouldGenerateLocation)
1199 USRGenerator UG(&Ctx, Buf);
1201 return UG.ignoreResults();
1226 OS <<
"@M@" << ModName;
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
Defines the clang::FileManager interface and associated types.
static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn, StringRef CatSymDefinedIn, raw_ostream &OS)
static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS)
static bool printLoc(llvm::raw_ostream &OS, SourceLocation Loc, const SourceManager &SM, bool IncludeOffset)
static const ObjCCategoryDecl * getCategoryContext(const NamedDecl *D)
static StringRef GetExternalSourceContainer(const NamedDecl *D)
__device__ __2f16 float bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
A binding in a decomposition declaration.
This class is used for builtin types like 'int'.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
Declaration of a class template.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Complex values, per C99 6.2.5p11.
Declaration of a C++20 concept.
A simple visitor class that helps create declaration visitors.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Decl - This represents one declaration (or definition), e.g.
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
ASTContext & getASTContext() const LLVM_READONLY
ExternalSourceSymbolAttr * getExternalSourceSymbolAttr() const
Looks on this and related declarations for an applicable external source symbol attribute.
SourceLocation getLocation() const
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
bool isEmpty() const
Evaluates true when this declaration name is empty.
Represents a qualified type name for which the type name is dependent.
Represents a member of a struct/union/class.
Cached information about one file (either on disk or in the virtual file system).
StringRef getName() const
Represents a function declaration or definition.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
bool isVariadic() const
Whether this function is variadic.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
bool isExternC() const
Determines whether this function is a function with external, C linkage.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
StringRef getName() const
Return the actual identifier string.
The injected class name of a C++ class template or class template partial specialization.
Represents a linkage specification.
Record the location of a macro definition.
SourceLocation getLocation() const
Retrieve the location of the macro name in the definition.
const IdentifierInfo * getName() const
Retrieve the name of the macro being defined.
Describes a module or submodule.
Module * Parent
The parent of this module.
std::string Name
The name of this module.
This represents a decl that may have a name.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
bool isExternallyVisible() const
Represents a C++ namespace alias.
Represent a C++ namespace.
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ObjCCategoryDecl - Represents a category declaration.
ObjCInterfaceDecl * getClassInterface()
bool IsClassExtension() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
const ObjCInterfaceDecl * getClassInterface() const
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
ObjCMethodDecl - Represents an instance or class method declaration.
Selector getSelector() const
bool isInstanceMethod() const
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
bool isClassProperty() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCPropertyDecl * getPropertyDecl() const
Represents an Objective-C protocol declaration.
Represents a pack expansion of types.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getCanonicalType() const
The collection of all-type qualifiers we support.
An rvalue reference type, per C++11 [dcl.ref].
Base for LValueReferenceType and RValueReferenceType.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
Represents the declaration of a struct/union/class/enum.
bool isEmbeddedInDeclarator() const
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
TypedefNameDecl * getTypedefNameForAnonDecl() const
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
TagKind getTagKind() const
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ 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.
@ 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,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
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.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
Declaration of a template type parameter.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isExtVectorType() const
const T * getAs() const
Member-template getAs<specific type>'.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Base class for declarations which introduce a typedef-name.
Represents a dependent using declaration which was marked with typename.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents a dependent using declaration which was not marked with typename.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a GCC generic vector type.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS)
Generate a USR for a top-level module name, including the USR prefix.
static StringRef getUSRSpacePrefix()
void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, StringRef ClsExtSymbolDefinedIn="", StringRef CatExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C class category.
bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS)
Generate a USR for a module, including the USR prefix.
bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS)
Generate a USR fragment for a module name.
bool generateUSRForMacro(const MacroDefinitionRecord *MD, const SourceManager &SM, SmallVectorImpl< char > &Buf)
Generate a USR for a macro, including the USR prefix.
void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS)
Generate a USR fragment for an Objective-C property.
void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS)
Generate a USR fragment for an enum constant.
void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS)
Generate a USR fragment for an Objective-C instance variable.
void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod, raw_ostream &OS)
Generate a USR fragment for an Objective-C method.
bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl< char > &Buf)
Generates a USR for a type.
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, StringRef ExtSymbolDefinedIn="", StringRef CategoryContextExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C class.
void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, StringRef ExtSymbolDefinedIn="")
Generate USR fragment for a global (non-nested) enum.
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, StringRef ExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C protocol.
bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS)
Generate a USR fragment for a module.
bool generateUSRForDecl(const Decl *D, SmallVectorImpl< char > &Buf)
Generate a USR for a Decl, including the USR prefix.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
@ TTK_Class
The "class" keyword.
@ TTK_Enum
The "enum" keyword.
@ TTK_Struct
The "struct" keyword.
@ TTK_Union
The "union" keyword.
@ TTK_Interface
The "__interface" keyword.
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressUnwrittenScope
Suppress printing parts of scope specifiers that are never written, e.g., for anonymous namespaces.
unsigned AnonymousTagLocations
When printing an anonymous tag name, also print the location of that entity (e.g.,...
unsigned ConstantArraySizeAsWritten
Whether we should print the sizes of constant array expressions as written in the sources.
unsigned SuppressTagKeyword
Whether type printing should skip printing the tag keyword.