15 #include "llvm/Support/Path.h" 16 #include "llvm/Support/raw_ostream.h" 18 using namespace clang;
35 OS << llvm::sys::path::filename(FE->
getName());
44 OS <<
'@' << Decomposed.second;
53 return attr->getDefinedIn();
61 llvm::raw_svector_ostream Out;
66 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
80 bool ignoreResults()
const {
return IgnoreResults; }
96 void VisitTagDecl(
const TagDecl *D);
99 void VisitVarDecl(
const VarDecl *D);
107 IgnoreResults =
true;
111 IgnoreResults =
true;
114 void VisitUsingDecl(
const UsingDecl *D) {
115 IgnoreResults =
true;
118 bool ShouldGenerateLocation(
const NamedDecl *D);
124 void GenExtSymbolContainer(
const NamedDecl *D);
128 bool GenLoc(
const Decl *D,
bool IncludeOffset);
137 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
138 StringRef CategoryContextExtSymbolDefinedIn) {
140 CategoryContextExtSymbolDefinedIn);
144 void GenObjCCategory(StringRef cls, StringRef cat,
145 StringRef clsExt, StringRef catExt) {
150 void GenObjCProperty(StringRef prop,
bool isClassProp) {
155 void GenObjCProtocol(StringRef prot, StringRef ext) {
174 bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
175 const unsigned startSize = Buf.size();
177 const unsigned endSize = Buf.size();
178 return startSize == endSize;
181 bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
193 void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
194 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
196 else if (isa<LinkageSpecDecl>(DC))
200 void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
207 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
208 if (EmitDeclName(D)) {
210 IgnoreResults =
true;
215 void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
216 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
219 const unsigned StartSize = Buf.size();
221 if (Buf.size() == StartSize)
222 GenExtSymbolContainer(D);
224 bool IsTemplate =
false;
228 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
240 !D->
hasAttr<OverloadableAttr>())
246 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
248 VisitTemplateArgument(SpecArgs->get(I));
253 // Mangle in type information for the arguments. 254 for (auto PD : D->parameters()) { 256 VisitType(PD->getType()); 261 // Function templates can be overloaded by return type, for example: 263 // template <class T> typename T::A foo() {} 264 // template <class T> typename T::B foo() {} 267 VisitType(D->getReturnType()); 270 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { 273 // FIXME: OpenCL: Need to consider address spaces 274 if (unsigned quals = MD->getTypeQualifiers().getCVRUQualifiers()) 275 Out << (char)('0
' + quals); 276 switch (MD->getRefQualifier()) { 278 case RQ_LValue: Out << '&
'; break; 279 case RQ_RValue: Out << "&&"; break; 284 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { 285 VisitDeclContext(D->getDeclContext()); 288 if (EmitDeclName(D)) { 289 // The string can be empty if the declaration has no name; e.g., it is 290 // the ParmDecl with no name for declaration of a function pointer type, 291 // e.g.: void (*f)(void *); 292 // In this case, don't generate a USR.
293 IgnoreResults =
true;
297 void USRGenerator::VisitVarDecl(
const VarDecl *D) {
301 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
308 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
310 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
312 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
323 IgnoreResults =
true;
329 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
332 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 334 VisitTemplateArgument(Args.get(I)); 339 void USRGenerator::VisitBindingDecl(const BindingDecl *D) { 340 if (isLocal(D) && GenLoc(D, /*IncludeOffset=*/true)) 345 void USRGenerator::VisitNonTypeTemplateParmDecl( 346 const NonTypeTemplateParmDecl *D) { 347 GenLoc(D, /*IncludeOffset=*/true); 350 void USRGenerator::VisitTemplateTemplateParmDecl( 351 const TemplateTemplateParmDecl *D) { 352 GenLoc(D, /*IncludeOffset=*/true); 355 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { 356 if (D->isAnonymousNamespace()) { 361 VisitDeclContext(D->getDeclContext()); 363 Out << "@N@" << D->getName(); 366 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { 367 VisitFunctionDecl(D->getTemplatedDecl()); 370 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { 371 VisitTagDecl(D->getTemplatedDecl()); 374 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { 375 VisitDeclContext(D->getDeclContext()); 377 Out << "@NA@" << D->getName(); 380 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { 381 const DeclContext *container = D->getDeclContext(); 382 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) { 386 // The USR for a method declared in a class extension or category is based on 387 // the ObjCInterfaceDecl, not the ObjCCategoryDecl. 388 const ObjCInterfaceDecl *ID = D->getClassInterface(); 390 IgnoreResults = true; 393 auto getCategoryContext = [](const ObjCMethodDecl *D) -> 394 const ObjCCategoryDecl * { 395 if (auto *CD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext())) 397 if (auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext())) 398 return ICD->getCategoryDecl(); 401 auto *CD = getCategoryContext(D); 402 VisitObjCContainerDecl(ID, CD); 404 // Ideally we would use 'GenObjCMethod
', but this is such a hot path 405 // for Objective-C code that we don't want to use
407 Out << (D->isInstanceMethod() ?
"(im)" :
"(cm)")
415 llvm_unreachable(
"Invalid ObjC container.");
416 case Decl::ObjCInterface:
417 case Decl::ObjCImplementation:
421 case Decl::ObjCCategory: {
429 IgnoreResults =
true;
435 Out <<
"objc(ext)" << ID->
getName() <<
'@';
439 GenObjCCategory(ID->getName(), CD->
getName(),
445 case Decl::ObjCCategoryImpl: {
453 IgnoreResults =
true;
456 GenObjCCategory(ID->getName(), CD->
getName(),
461 case Decl::ObjCProtocol: {
481 VisitObjCPropertyDecl(PD);
485 IgnoreResults =
true;
488 void USRGenerator::VisitTagDecl(
const TagDecl *D) {
491 if (!isa<EnumDecl>(D) &&
492 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
495 GenExtSymbolContainer(D);
500 bool AlreadyStarted =
false;
501 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
503 AlreadyStarted =
true;
510 case TTK_Enum: llvm_unreachable(
"enum template");
512 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
514 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
515 AlreadyStarted =
true;
522 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
524 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
528 if (!AlreadyStarted) {
539 assert(Buf.size() > 0);
540 const unsigned off = Buf.size() - 1;
542 if (EmitDeclName(D)) {
552 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
554 auto enum_range = ED->enumerators();
555 if (enum_range.begin() != enum_range.end()) {
556 Out <<
'@' << **enum_range.begin();
565 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
568 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 570 VisitTemplateArgument(Args.get(I)); 575 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { 576 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 578 const DeclContext *DC = D->getDeclContext(); 579 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC)) 585 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { 586 GenLoc(D, /*IncludeOffset=*/true); 589 void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) { 590 StringRef Container = GetExternalSourceContainer(D); 591 if (!Container.empty()) 592 Out << "@M@" << Container; 595 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { 597 return IgnoreResults; 600 // Guard against null declarations in invalid code. 602 IgnoreResults = true; 606 // Use the location of canonical decl. 607 D = D->getCanonicalDecl(); 610 IgnoreResults || printLoc(Out, D->getBeginLoc(), 611 Context->getSourceManager(), IncludeOffset); 613 return IgnoreResults; 616 static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS) { 617 // FIXME: Encode the qualifier, don't just print it.
620 PO.SuppressUnwrittenScope =
true;
621 PO.ConstantArraySizeAsWritten =
false;
622 PO.AnonymousTagLocations =
false;
626 void USRGenerator::VisitType(
QualType T) {
643 Out << ((char) (
'0' + qVal));
649 T = Expansion->getPattern();
653 unsigned char c =
'\0';
654 switch (BT->getKind()) {
655 case BuiltinType::Void:
657 case BuiltinType::Bool:
659 case BuiltinType::UChar:
661 case BuiltinType::Char8:
663 case BuiltinType::Char16:
665 case BuiltinType::Char32:
667 case BuiltinType::UShort:
669 case BuiltinType::UInt:
671 case BuiltinType::ULong:
673 case BuiltinType::ULongLong:
675 case BuiltinType::UInt128:
677 case BuiltinType::Char_U:
678 case BuiltinType::Char_S:
680 case BuiltinType::SChar:
682 case BuiltinType::WChar_S:
683 case BuiltinType::WChar_U:
685 case BuiltinType::Short:
687 case BuiltinType::Int:
689 case BuiltinType::Long:
691 case BuiltinType::LongLong:
693 case BuiltinType::Int128:
695 case BuiltinType::Float16:
696 case BuiltinType::Half:
698 case BuiltinType::Float:
700 case BuiltinType::Double:
702 case BuiltinType::LongDouble:
704 case BuiltinType::Float128:
706 case BuiltinType::NullPtr:
708 #define BUILTIN_TYPE(Id, SingletonId) 709 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: 710 #include "clang/AST/BuiltinTypes.def" 711 case BuiltinType::Dependent:
712 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 713 case BuiltinType::Id: 714 #include "clang/Basic/OpenCLImageTypes.def" 715 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 716 case BuiltinType::Id: 717 #include "clang/Basic/OpenCLExtensionTypes.def" 718 case BuiltinType::OCLEvent:
719 case BuiltinType::OCLClkEvent:
720 case BuiltinType::OCLQueue:
721 case BuiltinType::OCLReserveID:
722 case BuiltinType::OCLSampler:
723 case BuiltinType::ShortAccum:
724 case BuiltinType::Accum:
725 case BuiltinType::LongAccum:
726 case BuiltinType::UShortAccum:
727 case BuiltinType::UAccum:
728 case BuiltinType::ULongAccum:
729 case BuiltinType::ShortFract:
730 case BuiltinType::Fract:
731 case BuiltinType::LongFract:
732 case BuiltinType::UShortFract:
733 case BuiltinType::UFract:
734 case BuiltinType::ULongFract:
735 case BuiltinType::SatShortAccum:
736 case BuiltinType::SatAccum:
737 case BuiltinType::SatLongAccum:
738 case BuiltinType::SatUShortAccum:
739 case BuiltinType::SatUAccum:
740 case BuiltinType::SatULongAccum:
741 case BuiltinType::SatShortFract:
742 case BuiltinType::SatFract:
743 case BuiltinType::SatLongFract:
744 case BuiltinType::SatUShortFract:
745 case BuiltinType::SatUFract:
746 case BuiltinType::SatULongFract:
747 IgnoreResults =
true;
749 case BuiltinType::ObjCId:
751 case BuiltinType::ObjCClass:
753 case BuiltinType::ObjCSel:
762 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
764 if (Substitution != TypeSubstitutions.end()) {
765 Out <<
'S' << Substitution->second <<
'_';
769 unsigned Number = TypeSubstitutions.size();
795 VisitType(FT->getReturnType());
797 for (
const auto &I : FT->param_types()) {
802 if (FT->isVariadic())
813 T = CT->getElementType();
818 VisitTagDecl(TT->getDecl());
823 VisitObjCInterfaceDecl(OIT->getDecl());
828 VisitType(OIT->getBaseType());
829 for (
auto *Prot : OIT->getProtocols())
830 VisitObjCProtocolDecl(Prot);
834 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
840 VisitTemplateName(Spec->getTemplateName()); 841 Out << Spec->getNumArgs(); 842 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I) 843 VisitTemplateArgument(Spec->getArg(I)); 846 if (const DependentNameType *DNT = T->getAs<DependentNameType>()) { 848 printQualifier(Out, Ctx, DNT->getQualifier()); 849 Out << ':
' << DNT->getIdentifier()->getName(); 852 if (const InjectedClassNameType *InjT = T->getAs<InjectedClassNameType>()) { 853 T = InjT->getInjectedSpecializationType(); 856 if (const auto *VT = T->getAs<VectorType>()) { 857 Out << (T->isExtVectorType() ? ']
' : '[
'); 858 Out << VT->getNumElements(); 859 T = VT->getElementType(); 862 if (const auto *const AT = dyn_cast<ArrayType>(T)) { 864 switch (AT->getSizeModifier()) { 865 case ArrayType::Static: 868 case ArrayType::Star: 871 case ArrayType::Normal: 875 if (const auto *const CAT = dyn_cast<ConstantArrayType>(T)) 876 Out << CAT->getSize(); 878 T = AT->getElementType(); 888 void USRGenerator::VisitTemplateParameterList( 889 const TemplateParameterList *Params) { 892 Out << '>
' << Params->size(); 893 for (TemplateParameterList::const_iterator P = Params->begin(), 894 PEnd = Params->end(); 897 if (isa<TemplateTypeParmDecl>(*P)) { 898 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack()) 904 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) { 905 if (NTTP->isParameterPack()) 908 VisitType(NTTP->getType()); 912 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P); 913 if (TTP->isParameterPack()) 916 VisitTemplateParameterList(TTP->getTemplateParameters()); 920 void USRGenerator::VisitTemplateName(TemplateName Name) { 921 if (TemplateDecl *Template = Name.getAsTemplateDecl()) { 922 if (TemplateTemplateParmDecl *TTP 923 = dyn_cast<TemplateTemplateParmDecl>(Template)) { 924 Out << 't
' << TTP->getDepth() << '.
' << TTP->getIndex(); 932 // FIXME: Visit dependent template names. 935 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { 936 switch (Arg.getKind()) { 937 case TemplateArgument::Null: 940 case TemplateArgument::Declaration: 941 Visit(Arg.getAsDecl()); 944 case TemplateArgument::NullPtr: 947 case TemplateArgument::TemplateExpansion: 948 Out << 'P
'; // pack expansion of... 950 case TemplateArgument::Template: 951 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); 954 case TemplateArgument::Expression: 955 // FIXME: Visit expressions. 958 case TemplateArgument::Pack: 959 Out << 'p
' << Arg.pack_size(); 960 for (const auto &P : Arg.pack_elements()) 961 VisitTemplateArgument(P); 964 case TemplateArgument::Type: 965 VisitType(Arg.getAsType()); 968 case TemplateArgument::Integral: 970 VisitType(Arg.getIntegralType()); 971 Out << Arg.getAsIntegral(); 976 void USRGenerator::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { 977 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 979 VisitDeclContext(D->getDeclContext()); 981 printQualifier(Out, D->getASTContext(), D->getQualifier()); 985 void USRGenerator::VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { 986 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 988 VisitDeclContext(D->getDeclContext()); 990 printQualifier(Out, D->getASTContext(), D->getQualifier()); 991 Out << D->getName(); // Simple name. 996 //===----------------------------------------------------------------------===// 997 // USR generation functions. 998 //===----------------------------------------------------------------------===// 1000 static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn, 1001 StringRef CatSymDefinedIn, 1003 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty()) 1005 if (CatSymDefinedIn.empty()) { 1006 OS << "@M@" << ClsSymDefinedIn << '@
'; 1009 OS << "@CM@" << CatSymDefinedIn << '@
'; 1010 if (ClsSymDefinedIn != CatSymDefinedIn) { 1011 OS << ClsSymDefinedIn << '@
'; 1015 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, 1016 StringRef ExtSymDefinedIn, 1017 StringRef CategoryContextExtSymbolDefinedIn) { 1018 combineClassAndCategoryExtContainers(ExtSymDefinedIn, 1019 CategoryContextExtSymbolDefinedIn, OS); 1020 OS << "objc(cs)" << Cls; 1023 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat, 1025 StringRef ClsSymDefinedIn, 1026 StringRef CatSymDefinedIn) { 1027 combineClassAndCategoryExtContainers(ClsSymDefinedIn, CatSymDefinedIn, OS); 1028 OS << "objc(cy)" << Cls << '@
' << Cat; 1031 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) { 1035 void clang::index::generateUSRForObjCMethod(StringRef Sel, 1036 bool IsInstanceMethod, 1038 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel; 1041 void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp, 1043 OS << (isClassProp ? "(cpy)" : "(py)") << Prop; 1046 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, 1047 StringRef ExtSymDefinedIn) { 1048 if (!ExtSymDefinedIn.empty()) 1049 OS << "@M@" << ExtSymDefinedIn << '@
'; 1050 OS << "objc(pl)" << Prot; 1053 void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, 1054 StringRef ExtSymDefinedIn) { 1055 if (!ExtSymDefinedIn.empty()) 1056 OS << "@M@" << ExtSymDefinedIn; 1057 OS << "@E@" << EnumName; 1060 void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName, 1062 OS << '@
' << EnumConstantName; 1065 bool clang::index::generateUSRForDecl(const Decl *D, 1066 SmallVectorImpl<char> &Buf) { 1069 // We don't ignore decls with invalid source locations.
Implicit decls, like
1075 return UG.ignoreResults();
1092 if (MacroName.empty() || Loc.
isInvalid())
1095 llvm::raw_svector_ostream Out(Buf);
1102 if (ShouldGenerateLocation)
1115 USRGenerator UG(&Ctx, Buf);
1117 return UG.ignoreResults();
1142 OS <<
"@M@" << ModName;
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Defines the clang::ASTContext interface.
Represents a function declaration or definition.
std::string Name
The name of this module.
bool generateUSRForMacro(const MacroDefinitionRecord *MD, const SourceManager &SM, SmallVectorImpl< char > &Buf)
Generate a USR for a macro, including the USR prefix.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
ObjCInterfaceDecl * getClassInterface()
void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, StringRef ClsExtSymbolDefinedIn="", StringRef CatExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C class category.
bool isExternC() const
Determines whether this function is a function with external, C linkage.
bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl< char > &Buf)
Generates a USR for a type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS)
Generate a USR for a top-level module name, including the USR prefix.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS)
Generate a USR fragment for a module name.
Decl - This represents one declaration (or definition), e.g.
bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS)
Generate a USR for a module, including the USR prefix.
Defines the C++ template declaration subclasses.
Declaration of a variable template.
Represent a C++ namespace.
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, StringRef ExtSymbolDefinedIn="", StringRef CategoryContextExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C class.
Represents a variable declaration or definition.
const T * getAs() const
Member-template getAs<specific type>'.
The "__interface" keyword.
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
Stores a list of template parameters for a TemplateDecl and its derived classes.
ExternalSourceSymbolAttr * getExternalSourceSymbolAttr() const
Looks on this and related declarations for an applicable external source symbol attribute.
Describes how types, statements, expressions, and declarations should be printed. ...
The collection of all-type qualifiers we support.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a class template specialization, which refers to a class template with a given set of temp...
Represents a class type in Objective C.
static StringRef getUSRSpacePrefix()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Record the location of a macro definition.
static bool printLoc(llvm::raw_ostream &OS, SourceLocation Loc, const SourceManager &SM, bool IncludeOffset)
Represents a member of a struct/union/class.
Describes a module or submodule.
bool isClassProperty() const
Represents a C++ using-declaration.
An rvalue reference type, per C++11 [dcl.ref].
ObjCContainerDecl - Represents a container for method declarations.
TagKind getTagKind() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Module * Parent
The parent of this module.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS)
Generate a USR fragment for a module.
Represents an Objective-C protocol declaration.
Represents an ObjC class declaration.
Represents a linkage specification.
A binding in a decomposition declaration.
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents a prototype with parameter type info, e.g.
unsigned SuppressTagKeyword
Whether type printing should skip printing the tag keyword.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
Declaration of a template type parameter.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
DeclContext * getDeclContext()
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
static StringRef GetExternalSourceContainer(const NamedDecl *D)
virtual void printName(raw_ostream &os) const
QualType getCanonicalType() const
Encodes a location in the source.
StringRef getName() const
Interfaces are the core concept in Objective-C for object oriented design.
Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a dependent using declaration which was not marked with typename.
Cached information about one file (either on disk or in the virtual file system). ...
ObjCCategoryDecl - Represents a category declaration.
const IdentifierInfo * getName() const
Retrieve the name of the macro being defined.
Represents one property declaration in an Objective-C interface.
Represents a pack expansion of types.
StringRef getName() const
Return the actual identifier string.
Base class for declarations which introduce a typedef-name.
Represents a template argument.
const ObjCInterfaceDecl * getClassInterface() const
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isEmbeddedInDeclarator() const
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
Represents a dependent using declaration which was marked with typename.
The name of a declaration.
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, StringRef ExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C protocol.
Represents a pointer to an Objective C object.
Complex values, per C99 6.2.5p11.
SourceLocation getLocation() const
Retrieve the location of the macro name in the definition.
Base for LValueReferenceType and RValueReferenceType.
SourceManager & getSourceManager()
bool IsClassExtension() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A template argument list.
TypedefNameDecl * getTypedefNameForAnonDecl() const
Represents a C++ struct/union/class.
void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS)
Generate a USR fragment for an Objective-C property.
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...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Declaration of a class template.
This class is used for builtin types like 'int'.
void print(raw_ostream &OS, const PrintingPolicy &Policy)
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Represents a type template specialization; the template must be a class template, a type alias templa...
ObjCPropertyDecl * getPropertyDecl() const
This represents a decl that may have a name.
Represents a C++ namespace alias.
Represents C++ using-directive.
A simple visitor class that helps create declaration visitors.
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
const LangOptions & getLangOpts() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
This class handles loading and caching of source files into memory.
Declaration of a template function.
SourceLocation getLocation() const
bool isExternallyVisible() const
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.