18#include "llvm/Support/Path.h"
19#include "llvm/Support/raw_ostream.h"
35 const std::pair<FileID, unsigned> &Decomposed =
SM.getDecomposedLoc(
Loc);
38 OS << llvm::sys::path::filename(FE->
getName());
47 OS <<
'@' << Decomposed.second;
56 return attr->getDefinedIn();
64 llvm::raw_svector_ostream Out;
69 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
83 bool ignoreResults()
const {
return IgnoreResults; }
102 void VisitVarDecl(
const VarDecl *
D);
111 IgnoreResults =
true;
115 IgnoreResults =
true;
122 bool EmittedDeclName = !EmitDeclName(
D);
123 assert(EmittedDeclName &&
"EmitDeclName can not fail for UsingDecls");
124 (void)EmittedDeclName;
127 bool ShouldGenerateLocation(
const NamedDecl *
D);
133 void GenExtSymbolContainer(
const NamedDecl *
D);
137 bool GenLoc(
const Decl *
D,
bool IncludeOffset);
146 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
147 StringRef CategoryContextExtSymbolDefinedIn) {
149 CategoryContextExtSymbolDefinedIn);
153 void GenObjCCategory(StringRef cls, StringRef cat,
154 StringRef clsExt, StringRef catExt) {
159 void GenObjCProperty(StringRef prop,
bool isClassProp) {
164 void GenObjCProtocol(StringRef prot, StringRef ext) {
185bool USRGenerator::EmitDeclName(
const NamedDecl *
D) {
193bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *
D) {
194 if (
D->isExternallyVisible())
202 return !
SM.isInSystemHeader(
Loc);
205void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
206 if (
const NamedDecl *
D = dyn_cast<NamedDecl>(DC))
208 else if (isa<LinkageSpecDecl>(DC))
212void USRGenerator::VisitFieldDecl(
const FieldDecl *
D) {
219 Out << (isa<ObjCIvarDecl>(
D) ?
"@" :
"@FI@");
220 if (EmitDeclName(
D)) {
222 IgnoreResults =
true;
228 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
231 if (
D->getType().isNull()) {
232 IgnoreResults =
true;
236 const unsigned StartSize = Buf.size();
238 if (Buf.size() == StartSize)
239 GenExtSymbolContainer(
D);
241 bool IsTemplate =
false;
245 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
252 Policy.SuppressTemplateArgsInCXXConstructors =
true;
253 D->getDeclName().
print(Out, Policy);
260 if (
D->isFunctionTemplateSpecialization()) {
263 D->getTemplateSpecializationArgs()) {
264 for (
const auto &Arg : SpecArgs->asArray()) {
266 VisitTemplateArgument(Arg);
269 D->getTemplateSpecializationArgsAsWritten()) {
270 for (
const auto &ArgLoc : SpecArgsWritten->arguments()) {
272 VisitTemplateArgument(ArgLoc.getArgument());
278 QualType CanonicalType =
D->getType().getCanonicalType();
281 for (
QualType PT : FPT->param_types()) {
295 VisitType(
D->getReturnType());
302 if (
unsigned quals = MD->getMethodQualifiers().getCVRUQualifiers())
303 Out << (char)(
'0' + quals);
304 switch (MD->getRefQualifier()) {
312void USRGenerator::VisitNamedDecl(
const NamedDecl *
D) {
316 if (EmitDeclName(
D)) {
321 IgnoreResults =
true;
325void USRGenerator::VisitVarDecl(
const VarDecl *
D) {
329 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
336 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
338 = dyn_cast<VarTemplatePartialSpecializationDecl>(
D)) {
340 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
344 StringRef
s =
D->getName();
351 IgnoreResults =
true;
357 = dyn_cast<VarTemplateSpecializationDecl>(
D)) {
360 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
362 VisitTemplateArgument(Args.
get(I));
367void USRGenerator::VisitBindingDecl(
const BindingDecl *
D) {
368 if (isLocal(
D) && GenLoc(
D,
true))
373void USRGenerator::VisitNonTypeTemplateParmDecl(
378void USRGenerator::VisitTemplateTemplateParmDecl(
387 if (
D->isAnonymousNamespace()) {
391 Out <<
"@N@" <<
D->getName();
395 VisitFunctionDecl(
D->getTemplatedDecl());
399 VisitTagDecl(
D->getTemplatedDecl());
405 Out <<
"@NA@" <<
D->getName();
412 return ICD->getCategoryDecl();
426 IgnoreResults =
true;
430 VisitObjCContainerDecl(ID, CD);
435 Out << (
D->isInstanceMethod() ?
"(im)" :
"(cm)")
443 llvm_unreachable(
"Invalid ObjC container.");
444 case Decl::ObjCInterface:
445 case Decl::ObjCImplementation:
449 case Decl::ObjCCategory: {
457 IgnoreResults =
true;
463 Out <<
"objc(ext)" <<
ID->getName() <<
'@';
467 GenObjCCategory(
ID->getName(), CD->
getName(),
473 case Decl::ObjCCategoryImpl: {
481 IgnoreResults =
true;
484 GenObjCCategory(
ID->getName(), CD->
getName(),
489 case Decl::ObjCProtocol: {
504 GenObjCProperty(
D->getName(),
D->isClassProperty());
509 VisitObjCPropertyDecl(PD);
513 IgnoreResults =
true;
516void USRGenerator::VisitTagDecl(
const TagDecl *
D) {
519 if (!isa<EnumDecl>(
D) &&
520 ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
523 GenExtSymbolContainer(
D);
528 bool AlreadyStarted =
false;
529 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(
D)) {
531 AlreadyStarted =
true;
533 switch (
D->getTagKind()) {
534 case TagTypeKind::Interface:
535 case TagTypeKind::Class:
536 case TagTypeKind::Struct:
539 case TagTypeKind::Union:
542 case TagTypeKind::Enum:
543 llvm_unreachable(
"enum template");
545 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
547 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
548 AlreadyStarted =
true;
550 switch (
D->getTagKind()) {
551 case TagTypeKind::Interface:
552 case TagTypeKind::Class:
553 case TagTypeKind::Struct:
556 case TagTypeKind::Union:
559 case TagTypeKind::Enum:
560 llvm_unreachable(
"enum partial specialization");
562 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
566 if (!AlreadyStarted) {
567 switch (
D->getTagKind()) {
568 case TagTypeKind::Interface:
569 case TagTypeKind::Class:
570 case TagTypeKind::Struct:
573 case TagTypeKind::Union:
576 case TagTypeKind::Enum:
583 assert(Buf.size() > 0);
584 const unsigned off = Buf.size() - 1;
586 if (EmitDeclName(
D)) {
591 if (
D->isEmbeddedInDeclarator() && !
D->isFreeStanding()) {
595 if (
auto *ED = dyn_cast<EnumDecl>(
D)) {
598 auto enum_range = ED->enumerators();
599 if (enum_range.begin() != enum_range.end()) {
600 Out <<
'@' << **enum_range.begin();
609 = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
612 for (
unsigned I = 0, N = Args.
size(); I != N; ++I) {
614 VisitTemplateArgument(Args.
get(I));
619void USRGenerator::VisitTypedefDecl(
const TypedefDecl *
D) {
620 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
623 if (
const NamedDecl *DCN = dyn_cast<NamedDecl>(DC))
633void USRGenerator::GenExtSymbolContainer(
const NamedDecl *
D) {
635 if (!Container.empty())
636 Out <<
"@M@" << Container;
639bool USRGenerator::GenLoc(
const Decl *
D,
bool IncludeOffset) {
641 return IgnoreResults;
646 IgnoreResults =
true;
657 return IgnoreResults;
670void USRGenerator::VisitType(
QualType T) {
687 Out << ((char) (
'0' + qVal));
693 T = Expansion->getPattern();
697 switch (BT->getKind()) {
698 case BuiltinType::Void:
700 case BuiltinType::Bool:
702 case BuiltinType::UChar:
704 case BuiltinType::Char8:
706 case BuiltinType::Char16:
708 case BuiltinType::Char32:
710 case BuiltinType::UShort:
712 case BuiltinType::UInt:
714 case BuiltinType::ULong:
716 case BuiltinType::ULongLong:
718 case BuiltinType::UInt128:
720 case BuiltinType::Char_U:
721 case BuiltinType::Char_S:
723 case BuiltinType::SChar:
725 case BuiltinType::WChar_S:
726 case BuiltinType::WChar_U:
728 case BuiltinType::Short:
730 case BuiltinType::Int:
732 case BuiltinType::Long:
734 case BuiltinType::LongLong:
736 case BuiltinType::Int128:
738 case BuiltinType::Float16:
739 case BuiltinType::Half:
741 case BuiltinType::Float:
743 case BuiltinType::Double:
745 case BuiltinType::LongDouble:
747 case BuiltinType::Float128:
749 case BuiltinType::NullPtr:
751#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
752 case BuiltinType::Id: \
753 Out << "@BT@" << #Suffix << "_" << #ImgType; break;
754#include "clang/Basic/OpenCLImageTypes.def"
755#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
756 case BuiltinType::Id: \
757 Out << "@BT@" << #ExtType; break;
758#include "clang/Basic/OpenCLExtensionTypes.def"
759 case BuiltinType::OCLEvent:
760 Out <<
"@BT@OCLEvent";
break;
761 case BuiltinType::OCLClkEvent:
762 Out <<
"@BT@OCLClkEvent";
break;
763 case BuiltinType::OCLQueue:
764 Out <<
"@BT@OCLQueue";
break;
765 case BuiltinType::OCLReserveID:
766 Out <<
"@BT@OCLReserveID";
break;
767 case BuiltinType::OCLSampler:
768 Out <<
"@BT@OCLSampler";
break;
769#define SVE_TYPE(Name, Id, SingletonId) \
770 case BuiltinType::Id: \
771 Out << "@BT@" << Name; break;
772#include "clang/Basic/AArch64SVEACLETypes.def"
773#define PPC_VECTOR_TYPE(Name, Id, Size) \
774 case BuiltinType::Id: \
775 Out << "@BT@" << #Name; break;
776#include "clang/Basic/PPCTypes.def"
777#define RVV_TYPE(Name, Id, SingletonId) \
778 case BuiltinType::Id: \
779 Out << "@BT@" << Name; break;
780#include "clang/Basic/RISCVVTypes.def"
781#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
782#include "clang/Basic/WebAssemblyReferenceTypes.def"
783#define AMDGPU_TYPE(Name, Id, SingletonId) \
784 case BuiltinType::Id: \
785 Out << "@BT@" << #Name; \
787#include "clang/Basic/AMDGPUTypes.def"
788 case BuiltinType::ShortAccum:
789 Out <<
"@BT@ShortAccum";
break;
790 case BuiltinType::Accum:
791 Out <<
"@BT@Accum";
break;
792 case BuiltinType::LongAccum:
793 Out <<
"@BT@LongAccum";
break;
794 case BuiltinType::UShortAccum:
795 Out <<
"@BT@UShortAccum";
break;
796 case BuiltinType::UAccum:
797 Out <<
"@BT@UAccum";
break;
798 case BuiltinType::ULongAccum:
799 Out <<
"@BT@ULongAccum";
break;
800 case BuiltinType::ShortFract:
801 Out <<
"@BT@ShortFract";
break;
802 case BuiltinType::Fract:
803 Out <<
"@BT@Fract";
break;
804 case BuiltinType::LongFract:
805 Out <<
"@BT@LongFract";
break;
806 case BuiltinType::UShortFract:
807 Out <<
"@BT@UShortFract";
break;
808 case BuiltinType::UFract:
809 Out <<
"@BT@UFract";
break;
810 case BuiltinType::ULongFract:
811 Out <<
"@BT@ULongFract";
break;
812 case BuiltinType::SatShortAccum:
813 Out <<
"@BT@SatShortAccum";
break;
814 case BuiltinType::SatAccum:
815 Out <<
"@BT@SatAccum";
break;
816 case BuiltinType::SatLongAccum:
817 Out <<
"@BT@SatLongAccum";
break;
818 case BuiltinType::SatUShortAccum:
819 Out <<
"@BT@SatUShortAccum";
break;
820 case BuiltinType::SatUAccum:
821 Out <<
"@BT@SatUAccum";
break;
822 case BuiltinType::SatULongAccum:
823 Out <<
"@BT@SatULongAccum";
break;
824 case BuiltinType::SatShortFract:
825 Out <<
"@BT@SatShortFract";
break;
826 case BuiltinType::SatFract:
827 Out <<
"@BT@SatFract";
break;
828 case BuiltinType::SatLongFract:
829 Out <<
"@BT@SatLongFract";
break;
830 case BuiltinType::SatUShortFract:
831 Out <<
"@BT@SatUShortFract";
break;
832 case BuiltinType::SatUFract:
833 Out <<
"@BT@SatUFract";
break;
834 case BuiltinType::SatULongFract:
835 Out <<
"@BT@SatULongFract";
break;
836 case BuiltinType::BFloat16:
837 Out <<
"@BT@__bf16";
break;
838 case BuiltinType::Ibm128:
839 Out <<
"@BT@__ibm128";
break;
840 case BuiltinType::ObjCId:
842 case BuiltinType::ObjCClass:
844 case BuiltinType::ObjCSel:
846#define BUILTIN_TYPE(Id, SingletonId)
847#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
848#include "clang/AST/BuiltinTypes.def"
849 case BuiltinType::Dependent:
852 IgnoreResults =
true;
860 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
861 = TypeSubstitutions.find(
T.getTypePtr());
862 if (Substitution != TypeSubstitutions.end()) {
863 Out <<
'S' << Substitution->second <<
'_';
867 unsigned Number = TypeSubstitutions.size();
868 TypeSubstitutions[
T.getTypePtr()] = Number;
893 VisitType(FT->getReturnType());
895 for (
const auto &I : FT->param_types()) {
900 if (FT->isVariadic())
911 T = CT->getElementType();
916 VisitTagDecl(TT->getDecl());
921 VisitObjCInterfaceDecl(OIT->getDecl());
926 VisitType(OIT->getBaseType());
927 for (
auto *Prot : OIT->getProtocols())
928 VisitObjCProtocolDecl(Prot);
932 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
938 VisitTemplateName(Spec->getTemplateName());
939 Out << Spec->template_arguments().size();
940 for (
const auto &Arg : Spec->template_arguments())
941 VisitTemplateArgument(Arg);
947 Out <<
':' << DNT->getIdentifier()->getName();
951 T = InjT->getInjectedSpecializationType();
956 Out << VT->getNumElements();
957 T = VT->getElementType();
960 if (
const auto *
const AT = dyn_cast<ArrayType>(
T)) {
962 switch (AT->getSizeModifier()) {
963 case ArraySizeModifier::Static:
966 case ArraySizeModifier::Star:
969 case ArraySizeModifier::Normal:
973 if (
const auto *
const CAT = dyn_cast<ConstantArrayType>(
T))
974 Out << CAT->getSize();
976 T = AT->getElementType();
986void USRGenerator::VisitTemplateParameterList(
990 Out <<
'>' << Params->
size();
992 PEnd = Params->
end();
995 if (isa<TemplateTypeParmDecl>(*
P)) {
996 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack())
1003 if (NTTP->isParameterPack())
1006 VisitType(NTTP->getType());
1018void USRGenerator::VisitTemplateName(
TemplateName Name) {
1019 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
1021 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
1022 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
1059 VisitTemplateArgument(
P);
1077 Out << Hash.CalculateHash();
1084 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
1093 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
1098 Out <<
D->getName();
1101void USRGenerator::VisitConceptDecl(
const ConceptDecl *
D) {
1102 if (ShouldGenerateLocation(
D) && GenLoc(
D, isLocal(
D)))
1109void USRGenerator::VisitMSGuidDecl(
const MSGuidDecl *
D) {
1112 D->NamedDecl::printName(Out);
1120 StringRef CatSymDefinedIn,
1122 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty())
1124 if (CatSymDefinedIn.empty()) {
1125 OS <<
"@M@" << ClsSymDefinedIn <<
'@';
1128 OS <<
"@CM@" << CatSymDefinedIn <<
'@';
1129 if (ClsSymDefinedIn != CatSymDefinedIn) {
1130 OS << ClsSymDefinedIn <<
'@';
1135 StringRef ExtSymDefinedIn,
1136 StringRef CategoryContextExtSymbolDefinedIn) {
1138 CategoryContextExtSymbolDefinedIn, OS);
1139 OS <<
"objc(cs)" << Cls;
1144 StringRef ClsSymDefinedIn,
1145 StringRef CatSymDefinedIn) {
1147 OS <<
"objc(cy)" << Cls <<
'@' << Cat;
1155 bool IsInstanceMethod,
1157 OS << (IsInstanceMethod ?
"(im)" :
"(cm)") << Sel;
1162 OS << (isClassProp ?
"(cpy)" :
"(py)") << Prop;
1166 StringRef ExtSymDefinedIn) {
1167 if (!ExtSymDefinedIn.empty())
1168 OS <<
"@M@" << ExtSymDefinedIn <<
'@';
1169 OS <<
"objc(pl)" << Prot;
1173 StringRef ExtSymDefinedIn) {
1174 if (!ExtSymDefinedIn.empty())
1175 OS <<
"@M@" << ExtSymDefinedIn;
1176 OS <<
"@E@" << EnumName;
1181 OS <<
'@' << EnumConstantName;
1194 if (
auto *ExternalSymAttr = CD->
getAttr<ExternalSourceSymbolAttr>()) {
1195 if (!ExternalSymAttr->getUSR().empty()) {
1196 llvm::raw_svector_ostream Out(Buf);
1197 Out << ExternalSymAttr->getUSR();
1203 return UG.ignoreResults();
1219 if (MacroName.empty())
1222 llvm::raw_svector_ostream Out(Buf);
1226 bool ShouldGenerateLocation =
Loc.
isValid() && !
SM.isInSystemHeader(
Loc);
1229 if (ShouldGenerateLocation)
1240 T =
T.getCanonicalType();
1242 USRGenerator UG(&Ctx, Buf);
1244 return UG.ignoreResults();
1269 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.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
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.
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
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
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.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
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.
Represents a C++ namespace alias.
Represent a C++ namespace.
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.
void AddStructuralValue(const APValue &)
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.
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents an Objective-C protocol declaration.
Represents a pack expansion of types.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
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.
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 getStructuralValueType() const
Get the type of a StructuralValue.
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.
@ 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,...
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,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
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.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a variable declaration or definition.
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.
The JSON file list parser is used to communicate input to InstallAPI.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
const FunctionProtoType * T
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
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.