17#include "llvm/Support/Path.h"
18#include "llvm/Support/raw_ostream.h"
33 Loc =
SM.getExpansionLoc(Loc);
34 const std::pair<FileID, unsigned> &Decomposed =
SM.getDecomposedLoc(Loc);
37 OS << llvm::sys::path::filename(FE->
getName());
46 OS <<
'@' << Decomposed.second;
55 return attr->getDefinedIn();
63 llvm::raw_svector_ostream Out;
68 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
82 bool ignoreResults()
const {
return IgnoreResults; }
98 void VisitTagDecl(
const TagDecl *D);
101 void VisitVarDecl(
const VarDecl *D);
110 IgnoreResults =
true;
114 IgnoreResults =
true;
117 void VisitUsingDecl(
const UsingDecl *D) {
121 bool EmittedDeclName = !EmitDeclName(D);
122 assert(EmittedDeclName &&
"EmitDeclName can not fail for UsingDecls");
123 (void)EmittedDeclName;
126 bool ShouldGenerateLocation(
const NamedDecl *D);
132 void GenExtSymbolContainer(
const NamedDecl *D);
136 bool GenLoc(
const Decl *D,
bool IncludeOffset);
145 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
146 StringRef CategoryContextExtSymbolDefinedIn) {
148 CategoryContextExtSymbolDefinedIn);
152 void GenObjCCategory(StringRef cls, StringRef cat,
153 StringRef clsExt, StringRef catExt) {
158 void GenObjCProperty(StringRef prop,
bool isClassProp) {
163 void GenObjCProtocol(StringRef prot, StringRef ext) {
184bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
192bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
201 return !
SM.isInSystemHeader(Loc);
204void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
205 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
207 else if (isa<LinkageSpecDecl>(DC))
211void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
218 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
219 if (EmitDeclName(D)) {
221 IgnoreResults =
true;
226void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
227 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
231 IgnoreResults =
true;
235 const unsigned StartSize = Buf.size();
237 if (Buf.size() == StartSize)
238 GenExtSymbolContainer(D);
240 bool IsTemplate =
false;
244 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
251 Policy.SuppressTemplateArgsInCXXConstructors =
true;
256 !D->
hasAttr<OverloadableAttr>())
262 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
264 VisitTemplateArgument(SpecArgs->get(I));
272 VisitType(PD->getType());
290 if (
unsigned quals = MD->getMethodQualifiers().getCVRUQualifiers())
291 Out << (char)(
'0' + quals);
292 switch (MD->getRefQualifier()) {
300void USRGenerator::VisitNamedDecl(
const NamedDecl *D) {
304 if (EmitDeclName(D)) {
309 IgnoreResults =
true;
313void USRGenerator::VisitVarDecl(
const VarDecl *D) {
317 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
324 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
326 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
328 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
339 IgnoreResults =
true;
345 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
348 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
350 VisitTemplateArgument(Args.
get(I));
355void USRGenerator::VisitBindingDecl(
const BindingDecl *D) {
356 if (isLocal(D) && GenLoc(D,
true))
361void USRGenerator::VisitNonTypeTemplateParmDecl(
366void USRGenerator::VisitTemplateTemplateParmDecl(
371void USRGenerator::VisitNamespaceDecl(
const NamespaceDecl *D) {
399 if (
auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->
getDeclContext()))
400 return ICD->getCategoryDecl();
414 IgnoreResults =
true;
418 VisitObjCContainerDecl(ID, CD);
431 llvm_unreachable(
"Invalid ObjC container.");
432 case Decl::ObjCInterface:
433 case Decl::ObjCImplementation:
437 case Decl::ObjCCategory: {
445 IgnoreResults =
true;
451 Out <<
"objc(ext)" <<
ID->getName() <<
'@';
455 GenObjCCategory(
ID->getName(), CD->
getName(),
461 case Decl::ObjCCategoryImpl: {
469 IgnoreResults =
true;
472 GenObjCCategory(
ID->getName(), CD->
getName(),
477 case Decl::ObjCProtocol: {
497 VisitObjCPropertyDecl(PD);
501 IgnoreResults =
true;
504void USRGenerator::VisitTagDecl(
const TagDecl *D) {
507 if (!isa<EnumDecl>(D) &&
508 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
511 GenExtSymbolContainer(D);
516 bool AlreadyStarted =
false;
517 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
519 AlreadyStarted =
true;
522 case TagTypeKind::Interface:
523 case TagTypeKind::Class:
524 case TagTypeKind::Struct:
527 case TagTypeKind::Union:
530 case TagTypeKind::Enum:
531 llvm_unreachable(
"enum template");
533 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
535 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
536 AlreadyStarted =
true;
539 case TagTypeKind::Interface:
540 case TagTypeKind::Class:
541 case TagTypeKind::Struct:
544 case TagTypeKind::Union:
547 case TagTypeKind::Enum:
548 llvm_unreachable(
"enum partial specialization");
550 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
554 if (!AlreadyStarted) {
556 case TagTypeKind::Interface:
557 case TagTypeKind::Class:
558 case TagTypeKind::Struct:
561 case TagTypeKind::Union:
564 case TagTypeKind::Enum:
571 assert(Buf.size() > 0);
572 const unsigned off = Buf.size() - 1;
574 if (EmitDeclName(D)) {
583 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
586 auto enum_range = ED->enumerators();
587 if (enum_range.begin() != enum_range.end()) {
588 Out <<
'@' << **enum_range.begin();
597 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
600 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
602 VisitTemplateArgument(Args.
get(I));
607void USRGenerator::VisitTypedefDecl(
const TypedefDecl *D) {
608 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
611 if (
const NamedDecl *DCN = dyn_cast<NamedDecl>(DC))
621void USRGenerator::GenExtSymbolContainer(
const NamedDecl *D) {
623 if (!Container.empty())
624 Out <<
"@M@" << Container;
627bool USRGenerator::GenLoc(
const Decl *D,
bool IncludeOffset) {
629 return IgnoreResults;
634 IgnoreResults =
true;
645 return IgnoreResults;
658void USRGenerator::VisitType(
QualType T) {
675 Out << ((char) (
'0' + qVal));
681 T = Expansion->getPattern();
685 switch (BT->getKind()) {
686 case BuiltinType::Void:
688 case BuiltinType::Bool:
690 case BuiltinType::UChar:
692 case BuiltinType::Char8:
694 case BuiltinType::Char16:
696 case BuiltinType::Char32:
698 case BuiltinType::UShort:
700 case BuiltinType::UInt:
702 case BuiltinType::ULong:
704 case BuiltinType::ULongLong:
706 case BuiltinType::UInt128:
708 case BuiltinType::Char_U:
709 case BuiltinType::Char_S:
711 case BuiltinType::SChar:
713 case BuiltinType::WChar_S:
714 case BuiltinType::WChar_U:
716 case BuiltinType::Short:
718 case BuiltinType::Int:
720 case BuiltinType::Long:
722 case BuiltinType::LongLong:
724 case BuiltinType::Int128:
726 case BuiltinType::Float16:
727 case BuiltinType::Half:
729 case BuiltinType::Float:
731 case BuiltinType::Double:
733 case BuiltinType::LongDouble:
735 case BuiltinType::Float128:
737 case BuiltinType::NullPtr:
739#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
740 case BuiltinType::Id: \
741 Out << "@BT@" << #Suffix << "_" << #ImgType; break;
742#include "clang/Basic/OpenCLImageTypes.def"
743#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
744 case BuiltinType::Id: \
745 Out << "@BT@" << #ExtType; break;
746#include "clang/Basic/OpenCLExtensionTypes.def"
747 case BuiltinType::OCLEvent:
748 Out <<
"@BT@OCLEvent";
break;
749 case BuiltinType::OCLClkEvent:
750 Out <<
"@BT@OCLClkEvent";
break;
751 case BuiltinType::OCLQueue:
752 Out <<
"@BT@OCLQueue";
break;
753 case BuiltinType::OCLReserveID:
754 Out <<
"@BT@OCLReserveID";
break;
755 case BuiltinType::OCLSampler:
756 Out <<
"@BT@OCLSampler";
break;
757#define SVE_TYPE(Name, Id, SingletonId) \
758 case BuiltinType::Id: \
759 Out << "@BT@" << Name; break;
760#include "clang/Basic/AArch64SVEACLETypes.def"
761#define PPC_VECTOR_TYPE(Name, Id, Size) \
762 case BuiltinType::Id: \
763 Out << "@BT@" << #Name; break;
764#include "clang/Basic/PPCTypes.def"
765#define RVV_TYPE(Name, Id, SingletonId) \
766 case BuiltinType::Id: \
767 Out << "@BT@" << Name; break;
768#include "clang/Basic/RISCVVTypes.def"
769#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
770#include "clang/Basic/WebAssemblyReferenceTypes.def"
771 case BuiltinType::ShortAccum:
772 Out <<
"@BT@ShortAccum";
break;
773 case BuiltinType::Accum:
774 Out <<
"@BT@Accum";
break;
775 case BuiltinType::LongAccum:
776 Out <<
"@BT@LongAccum";
break;
777 case BuiltinType::UShortAccum:
778 Out <<
"@BT@UShortAccum";
break;
779 case BuiltinType::UAccum:
780 Out <<
"@BT@UAccum";
break;
781 case BuiltinType::ULongAccum:
782 Out <<
"@BT@ULongAccum";
break;
783 case BuiltinType::ShortFract:
784 Out <<
"@BT@ShortFract";
break;
785 case BuiltinType::Fract:
786 Out <<
"@BT@Fract";
break;
787 case BuiltinType::LongFract:
788 Out <<
"@BT@LongFract";
break;
789 case BuiltinType::UShortFract:
790 Out <<
"@BT@UShortFract";
break;
791 case BuiltinType::UFract:
792 Out <<
"@BT@UFract";
break;
793 case BuiltinType::ULongFract:
794 Out <<
"@BT@ULongFract";
break;
795 case BuiltinType::SatShortAccum:
796 Out <<
"@BT@SatShortAccum";
break;
797 case BuiltinType::SatAccum:
798 Out <<
"@BT@SatAccum";
break;
799 case BuiltinType::SatLongAccum:
800 Out <<
"@BT@SatLongAccum";
break;
801 case BuiltinType::SatUShortAccum:
802 Out <<
"@BT@SatUShortAccum";
break;
803 case BuiltinType::SatUAccum:
804 Out <<
"@BT@SatUAccum";
break;
805 case BuiltinType::SatULongAccum:
806 Out <<
"@BT@SatULongAccum";
break;
807 case BuiltinType::SatShortFract:
808 Out <<
"@BT@SatShortFract";
break;
809 case BuiltinType::SatFract:
810 Out <<
"@BT@SatFract";
break;
811 case BuiltinType::SatLongFract:
812 Out <<
"@BT@SatLongFract";
break;
813 case BuiltinType::SatUShortFract:
814 Out <<
"@BT@SatUShortFract";
break;
815 case BuiltinType::SatUFract:
816 Out <<
"@BT@SatUFract";
break;
817 case BuiltinType::SatULongFract:
818 Out <<
"@BT@SatULongFract";
break;
819 case BuiltinType::BFloat16:
820 Out <<
"@BT@__bf16";
break;
821 case BuiltinType::Ibm128:
822 Out <<
"@BT@__ibm128";
break;
823 case BuiltinType::ObjCId:
825 case BuiltinType::ObjCClass:
827 case BuiltinType::ObjCSel:
829#define BUILTIN_TYPE(Id, SingletonId)
830#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
831#include "clang/AST/BuiltinTypes.def"
832 case BuiltinType::Dependent:
835 IgnoreResults =
true;
843 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
845 if (Substitution != TypeSubstitutions.end()) {
846 Out <<
'S' << Substitution->second <<
'_';
850 unsigned Number = TypeSubstitutions.size();
876 VisitType(FT->getReturnType());
878 for (
const auto &I : FT->param_types()) {
883 if (FT->isVariadic())
894 T = CT->getElementType();
899 VisitTagDecl(TT->getDecl());
904 VisitObjCInterfaceDecl(OIT->getDecl());
909 VisitType(OIT->getBaseType());
910 for (
auto *Prot : OIT->getProtocols())
911 VisitObjCProtocolDecl(Prot);
915 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
921 VisitTemplateName(Spec->getTemplateName());
922 Out << Spec->template_arguments().size();
923 for (
const auto &Arg : Spec->template_arguments())
924 VisitTemplateArgument(Arg);
930 Out <<
':' << DNT->getIdentifier()->getName();
934 T = InjT->getInjectedSpecializationType();
939 Out << VT->getNumElements();
940 T = VT->getElementType();
943 if (
const auto *
const AT = dyn_cast<ArrayType>(T)) {
945 switch (AT->getSizeModifier()) {
946 case ArraySizeModifier::Static:
949 case ArraySizeModifier::Star:
952 case ArraySizeModifier::Normal:
956 if (
const auto *
const CAT = dyn_cast<ConstantArrayType>(T))
957 Out << CAT->getSize();
959 T = AT->getElementType();
969void USRGenerator::VisitTemplateParameterList(
973 Out <<
'>' << Params->
size();
975 PEnd = Params->
end();
978 if (isa<TemplateTypeParmDecl>(*
P)) {
979 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack())
986 if (NTTP->isParameterPack())
989 VisitType(NTTP->getType());
1001void USRGenerator::VisitTemplateName(
TemplateName Name) {
1002 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
1004 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
1005 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
1042 VisitTemplateArgument(
P);
1058 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1067 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1075void USRGenerator::VisitConceptDecl(
const ConceptDecl *D) {
1076 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
1083void USRGenerator::VisitMSGuidDecl(
const MSGuidDecl *D) {
1086 D->NamedDecl::printName(Out);
1094 StringRef CatSymDefinedIn,
1096 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty())
1098 if (CatSymDefinedIn.empty()) {
1099 OS <<
"@M@" << ClsSymDefinedIn <<
'@';
1102 OS <<
"@CM@" << CatSymDefinedIn <<
'@';
1103 if (ClsSymDefinedIn != CatSymDefinedIn) {
1104 OS << ClsSymDefinedIn <<
'@';
1109 StringRef ExtSymDefinedIn,
1110 StringRef CategoryContextExtSymbolDefinedIn) {
1112 CategoryContextExtSymbolDefinedIn, OS);
1113 OS <<
"objc(cs)" << Cls;
1118 StringRef ClsSymDefinedIn,
1119 StringRef CatSymDefinedIn) {
1121 OS <<
"objc(cy)" << Cls <<
'@' << Cat;
1129 bool IsInstanceMethod,
1131 OS << (IsInstanceMethod ?
"(im)" :
"(cm)") << Sel;
1136 OS << (isClassProp ?
"(cpy)" :
"(py)") << Prop;
1140 StringRef ExtSymDefinedIn) {
1141 if (!ExtSymDefinedIn.empty())
1142 OS <<
"@M@" << ExtSymDefinedIn <<
'@';
1143 OS <<
"objc(pl)" << Prot;
1147 StringRef ExtSymDefinedIn) {
1148 if (!ExtSymDefinedIn.empty())
1149 OS <<
"@M@" << ExtSymDefinedIn;
1150 OS <<
"@E@" << EnumName;
1155 OS <<
'@' << EnumConstantName;
1168 if (
auto *ExternalSymAttr = CD->
getAttr<ExternalSourceSymbolAttr>()) {
1169 if (!ExternalSymAttr->getUSR().empty()) {
1170 llvm::raw_svector_ostream Out(Buf);
1171 Out << ExternalSymAttr->getUSR();
1177 return UG.ignoreResults();
1193 if (MacroName.empty())
1196 llvm::raw_svector_ostream Out(Buf);
1200 bool ShouldGenerateLocation = Loc.
isValid() && !
SM.isInSystemHeader(Loc);
1203 if (ShouldGenerateLocation)
1216 USRGenerator UG(&Ctx, Buf);
1218 return UG.ignoreResults();
1243 OS <<
"@M@" << ModName;
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
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 __ockl_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.
StringRef getName() const
The name of this FileEntry.
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 (&&).
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.