14 #include "llvm/Support/Path.h" 15 #include "llvm/Support/raw_ostream.h" 17 using namespace clang;
34 OS << llvm::sys::path::filename(FE->
getName());
43 OS <<
'@' << Decomposed.second;
52 return attr->getDefinedIn();
60 llvm::raw_svector_ostream Out;
65 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
79 bool ignoreResults()
const {
return IgnoreResults; }
95 void VisitTagDecl(
const TagDecl *D);
98 void VisitVarDecl(
const VarDecl *D);
106 IgnoreResults =
true;
110 IgnoreResults =
true;
113 void VisitUsingDecl(
const UsingDecl *D) {
117 bool EmittedDeclName = !EmitDeclName(D);
118 assert(EmittedDeclName &&
"EmitDeclName can not fail for UsingDecls");
119 (void)EmittedDeclName;
122 bool ShouldGenerateLocation(
const NamedDecl *D);
128 void GenExtSymbolContainer(
const NamedDecl *D);
132 bool GenLoc(
const Decl *D,
bool IncludeOffset);
141 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
142 StringRef CategoryContextExtSymbolDefinedIn) {
144 CategoryContextExtSymbolDefinedIn);
148 void GenObjCCategory(StringRef cls, StringRef
cat,
149 StringRef clsExt, StringRef catExt) {
154 void GenObjCProperty(StringRef prop,
bool isClassProp) {
159 void GenObjCProtocol(StringRef prot, StringRef ext) {
178 bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
179 const unsigned startSize = Buf.size();
181 const unsigned endSize = Buf.size();
182 return startSize == endSize;
185 bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
197 void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
198 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
200 else if (isa<LinkageSpecDecl>(DC))
204 void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
211 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
212 if (EmitDeclName(D)) {
214 IgnoreResults =
true;
219 void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
220 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
223 const unsigned StartSize = Buf.size();
225 if (Buf.size() == StartSize)
226 GenExtSymbolContainer(D);
228 bool IsTemplate =
false;
232 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
244 !D->
hasAttr<OverloadableAttr>())
250 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
252 VisitTemplateArgument(SpecArgs->get(I));
257 // Mangle in type information for the arguments. 258 for (auto PD : D->parameters()) { 260 VisitType(PD->getType()); 265 // Function templates can be overloaded by return type, for example: 267 // template <class T> typename T::A foo() {} 268 // template <class T> typename T::B foo() {} 271 VisitType(D->getReturnType()); 274 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { 277 // FIXME: OpenCL: Need to consider address spaces 278 if (unsigned quals = MD->getMethodQualifiers().getCVRUQualifiers()) 279 Out << (char)('0
' + quals); 280 switch (MD->getRefQualifier()) { 282 case RQ_LValue: Out << '&
'; break; 283 case RQ_RValue: Out << "&&"; break; 288 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { 289 VisitDeclContext(D->getDeclContext()); 292 if (EmitDeclName(D)) { 293 // The string can be empty if the declaration has no name; e.g., it is 294 // the ParmDecl with no name for declaration of a function pointer type, 295 // e.g.: void (*f)(void *); 296 // In this case, don't generate
a USR.
297 IgnoreResults =
true;
301 void USRGenerator::VisitVarDecl(
const VarDecl *D) {
305 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
312 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
314 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
316 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
327 IgnoreResults =
true;
333 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
336 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 338 VisitTemplateArgument(Args.get(I)); 343 void USRGenerator::VisitBindingDecl(const BindingDecl *D) { 344 if (isLocal(D) && GenLoc(D, /*IncludeOffset=*/true)) 349 void USRGenerator::VisitNonTypeTemplateParmDecl( 350 const NonTypeTemplateParmDecl *D) { 351 GenLoc(D, /*IncludeOffset=*/true); 354 void USRGenerator::VisitTemplateTemplateParmDecl( 355 const TemplateTemplateParmDecl *D) { 356 GenLoc(D, /*IncludeOffset=*/true); 359 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { 360 if (D->isAnonymousNamespace()) { 365 VisitDeclContext(D->getDeclContext()); 367 Out << "@N@" << D->getName(); 370 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { 371 VisitFunctionDecl(D->getTemplatedDecl()); 374 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { 375 VisitTagDecl(D->getTemplatedDecl()); 378 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { 379 VisitDeclContext(D->getDeclContext()); 381 Out << "@NA@" << D->getName(); 384 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { 385 const DeclContext *container = D->getDeclContext(); 386 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) { 390 // The USR for a method declared in a class extension or category is based on 391 // the ObjCInterfaceDecl, not the ObjCCategoryDecl. 392 const ObjCInterfaceDecl *ID = D->getClassInterface(); 394 IgnoreResults = true; 397 auto getCategoryContext = [](const ObjCMethodDecl *D) -> 398 const ObjCCategoryDecl * { 399 if (auto *CD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext())) 401 if (auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext())) 402 return ICD->getCategoryDecl(); 405 auto *CD = getCategoryContext(D); 406 VisitObjCContainerDecl(ID, CD); 408 // Ideally we would use 'GenObjCMethod
', but this is such a hot path 409 // for Objective-C code that we don't want to use
411 Out << (D->isInstanceMethod() ?
"(im)" :
"(cm)")
419 llvm_unreachable(
"Invalid ObjC container.");
420 case Decl::ObjCInterface:
421 case Decl::ObjCImplementation:
425 case Decl::ObjCCategory: {
433 IgnoreResults =
true;
439 Out <<
"objc(ext)" << ID->
getName() <<
'@';
443 GenObjCCategory(ID->getName(), CD->
getName(),
449 case Decl::ObjCCategoryImpl: {
457 IgnoreResults =
true;
460 GenObjCCategory(ID->getName(), CD->
getName(),
465 case Decl::ObjCProtocol: {
485 VisitObjCPropertyDecl(PD);
489 IgnoreResults =
true;
492 void USRGenerator::VisitTagDecl(
const TagDecl *D) {
495 if (!isa<EnumDecl>(D) &&
496 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
499 GenExtSymbolContainer(D);
504 bool AlreadyStarted =
false;
505 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
507 AlreadyStarted =
true;
514 case TTK_Enum: llvm_unreachable(
"enum template");
516 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
518 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
519 AlreadyStarted =
true;
526 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
528 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
532 if (!AlreadyStarted) {
543 assert(Buf.size() > 0);
544 const unsigned off = Buf.size() - 1;
546 if (EmitDeclName(D)) {
556 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
558 auto enum_range = ED->enumerators();
559 if (enum_range.begin() != enum_range.end()) {
560 Out <<
'@' << **enum_range.begin();
569 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
572 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 574 VisitTemplateArgument(Args.get(I)); 579 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { 580 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 582 const DeclContext *DC = D->getDeclContext(); 583 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC)) 589 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { 590 GenLoc(D, /*IncludeOffset=*/true); 593 void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) { 594 StringRef Container = GetExternalSourceContainer(D); 595 if (!Container.empty()) 596 Out << "@M@" << Container; 599 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { 601 return IgnoreResults; 604 // Guard against null declarations in invalid code. 606 IgnoreResults = true; 610 // Use the location of canonical decl. 611 D = D->getCanonicalDecl(); 614 IgnoreResults || printLoc(Out, D->getBeginLoc(), 615 Context->getSourceManager(), IncludeOffset); 617 return IgnoreResults; 620 static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS) { 621 // FIXME: Encode the qualifier, don't just print it.
624 PO.SuppressUnwrittenScope =
true;
625 PO.ConstantArraySizeAsWritten =
false;
626 PO.AnonymousTagLocations =
false;
630 void USRGenerator::VisitType(
QualType T) {
647 Out << ((char) (
'0' + qVal));
653 T = Expansion->getPattern();
657 unsigned char c =
'\0';
658 switch (BT->getKind()) {
659 case BuiltinType::Void:
661 case BuiltinType::Bool:
663 case BuiltinType::UChar:
665 case BuiltinType::Char8:
667 case BuiltinType::Char16:
669 case BuiltinType::Char32:
671 case BuiltinType::UShort:
673 case BuiltinType::UInt:
675 case BuiltinType::ULong:
677 case BuiltinType::ULongLong:
679 case BuiltinType::UInt128:
681 case BuiltinType::Char_U:
682 case BuiltinType::Char_S:
684 case BuiltinType::SChar:
686 case BuiltinType::WChar_S:
687 case BuiltinType::WChar_U:
689 case BuiltinType::Short:
691 case BuiltinType::Int:
693 case BuiltinType::Long:
695 case BuiltinType::LongLong:
697 case BuiltinType::Int128:
699 case BuiltinType::Float16:
700 case BuiltinType::Half:
702 case BuiltinType::Float:
704 case BuiltinType::Double:
706 case BuiltinType::LongDouble:
708 case BuiltinType::Float128:
710 case BuiltinType::NullPtr:
712 #define BUILTIN_TYPE(Id, SingletonId) 713 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: 714 #include "clang/AST/BuiltinTypes.def" 715 case BuiltinType::Dependent:
716 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 717 case BuiltinType::Id: 718 #include "clang/Basic/OpenCLImageTypes.def" 719 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 720 case BuiltinType::Id: 721 #include "clang/Basic/OpenCLExtensionTypes.def" 722 case BuiltinType::OCLEvent:
723 case BuiltinType::OCLClkEvent:
724 case BuiltinType::OCLQueue:
725 case BuiltinType::OCLReserveID:
726 case BuiltinType::OCLSampler:
727 case BuiltinType::ShortAccum:
728 case BuiltinType::Accum:
729 case BuiltinType::LongAccum:
730 case BuiltinType::UShortAccum:
731 case BuiltinType::UAccum:
732 case BuiltinType::ULongAccum:
733 case BuiltinType::ShortFract:
734 case BuiltinType::Fract:
735 case BuiltinType::LongFract:
736 case BuiltinType::UShortFract:
737 case BuiltinType::UFract:
738 case BuiltinType::ULongFract:
739 case BuiltinType::SatShortAccum:
740 case BuiltinType::SatAccum:
741 case BuiltinType::SatLongAccum:
742 case BuiltinType::SatUShortAccum:
743 case BuiltinType::SatUAccum:
744 case BuiltinType::SatULongAccum:
745 case BuiltinType::SatShortFract:
746 case BuiltinType::SatFract:
747 case BuiltinType::SatLongFract:
748 case BuiltinType::SatUShortFract:
749 case BuiltinType::SatUFract:
750 case BuiltinType::SatULongFract:
751 IgnoreResults =
true;
753 case BuiltinType::ObjCId:
755 case BuiltinType::ObjCClass:
757 case BuiltinType::ObjCSel:
766 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
768 if (Substitution != TypeSubstitutions.end()) {
769 Out <<
'S' << Substitution->second <<
'_';
773 unsigned Number = TypeSubstitutions.size();
799 VisitType(FT->getReturnType());
801 for (
const auto &I : FT->param_types()) {
806 if (FT->isVariadic())
817 T = CT->getElementType();
822 VisitTagDecl(TT->getDecl());
827 VisitObjCInterfaceDecl(OIT->getDecl());
832 VisitType(OIT->getBaseType());
833 for (
auto *Prot : OIT->getProtocols())
834 VisitObjCProtocolDecl(Prot);
838 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
844 VisitTemplateName(Spec->getTemplateName()); 845 Out << Spec->getNumArgs(); 846 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I) 847 VisitTemplateArgument(Spec->getArg(I)); 850 if (const DependentNameType *DNT = T->getAs<DependentNameType>()) { 852 printQualifier(Out, Ctx, DNT->getQualifier()); 853 Out << ':
' << DNT->getIdentifier()->getName(); 856 if (const InjectedClassNameType *InjT = T->getAs<InjectedClassNameType>()) { 857 T = InjT->getInjectedSpecializationType(); 860 if (const auto *VT = T->getAs<VectorType>()) { 861 Out << (T->isExtVectorType() ? ']
' : '[
'); 862 Out << VT->getNumElements(); 863 T = VT->getElementType(); 866 if (const auto *const AT = dyn_cast<ArrayType>(T)) { 868 switch (AT->getSizeModifier()) { 869 case ArrayType::Static: 872 case ArrayType::Star: 875 case ArrayType::Normal: 879 if (const auto *const CAT = dyn_cast<ConstantArrayType>(T)) 880 Out << CAT->getSize(); 882 T = AT->getElementType(); 892 void USRGenerator::VisitTemplateParameterList( 893 const TemplateParameterList *Params) { 896 Out << '>
' << Params->size(); 897 for (TemplateParameterList::const_iterator P = Params->begin(), 898 PEnd = Params->end(); 901 if (isa<TemplateTypeParmDecl>(*P)) { 902 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack()) 908 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) { 909 if (NTTP->isParameterPack()) 912 VisitType(NTTP->getType()); 916 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P); 917 if (TTP->isParameterPack()) 920 VisitTemplateParameterList(TTP->getTemplateParameters()); 924 void USRGenerator::VisitTemplateName(TemplateName Name) { 925 if (TemplateDecl *Template = Name.getAsTemplateDecl()) { 926 if (TemplateTemplateParmDecl *TTP 927 = dyn_cast<TemplateTemplateParmDecl>(Template)) { 928 Out << 't' << TTP->getDepth() << '.
' << TTP->getIndex(); 936 // FIXME: Visit dependent template names. 939 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { 940 switch (Arg.getKind()) { 941 case TemplateArgument::Null: 944 case TemplateArgument::Declaration: 945 Visit(Arg.getAsDecl()); 948 case TemplateArgument::NullPtr: 951 case TemplateArgument::TemplateExpansion: 952 Out << 'P
'; // pack expansion of... 954 case TemplateArgument::Template: 955 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); 958 case TemplateArgument::Expression: 959 // FIXME: Visit expressions. 962 case TemplateArgument::Pack: 963 Out << 'p' << Arg.pack_size(); 964 for (const auto &P : Arg.pack_elements()) 965 VisitTemplateArgument(P); 968 case TemplateArgument::Type: 969 VisitType(Arg.getAsType()); 972 case TemplateArgument::Integral: 974 VisitType(Arg.getIntegralType()); 975 Out << Arg.getAsIntegral(); 980 void USRGenerator::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { 981 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 983 VisitDeclContext(D->getDeclContext()); 985 printQualifier(Out, D->getASTContext(), D->getQualifier()); 989 void USRGenerator::VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { 990 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 992 VisitDeclContext(D->getDeclContext()); 994 printQualifier(Out, D->getASTContext(), D->getQualifier()); 995 Out << D->getName(); // Simple name. 1000 //===----------------------------------------------------------------------===// 1001 // USR generation functions. 1002 //===----------------------------------------------------------------------===// 1004 static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn, 1005 StringRef CatSymDefinedIn, 1007 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty()) 1009 if (CatSymDefinedIn.empty()) { 1010 OS << "@M@" << ClsSymDefinedIn << '@
'; 1013 OS << "@CM@" << CatSymDefinedIn << '@
'; 1014 if (ClsSymDefinedIn != CatSymDefinedIn) { 1015 OS << ClsSymDefinedIn << '@
'; 1019 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, 1020 StringRef ExtSymDefinedIn, 1021 StringRef CategoryContextExtSymbolDefinedIn) { 1022 combineClassAndCategoryExtContainers(ExtSymDefinedIn, 1023 CategoryContextExtSymbolDefinedIn, OS); 1024 OS << "objc(cs)" << Cls; 1027 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat, 1029 StringRef ClsSymDefinedIn, 1030 StringRef CatSymDefinedIn) { 1031 combineClassAndCategoryExtContainers(ClsSymDefinedIn, CatSymDefinedIn, OS); 1032 OS << "objc(cy)" << Cls << '@
' << Cat; 1035 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) { 1039 void clang::index::generateUSRForObjCMethod(StringRef Sel, 1040 bool IsInstanceMethod, 1042 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel; 1045 void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp, 1047 OS << (isClassProp ? "(cpy)" : "(py)") << Prop; 1050 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, 1051 StringRef ExtSymDefinedIn) { 1052 if (!ExtSymDefinedIn.empty()) 1053 OS << "@M@" << ExtSymDefinedIn << '@
'; 1054 OS << "objc(pl)" << Prot; 1057 void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, 1058 StringRef ExtSymDefinedIn) { 1059 if (!ExtSymDefinedIn.empty()) 1060 OS << "@M@" << ExtSymDefinedIn; 1061 OS << "@E@" << EnumName; 1064 void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName, 1066 OS << '@
' << EnumConstantName; 1069 bool clang::index::generateUSRForDecl(const Decl *D, 1070 SmallVectorImpl<char> &Buf) { 1073 // We don't ignore decls with invalid source locations.
Implicit decls, like
1079 return UG.ignoreResults();
1096 if (MacroName.empty() || Loc.
isInvalid())
1099 llvm::raw_svector_ostream Out(Buf);
1106 if (ShouldGenerateLocation)
1119 USRGenerator UG(&Ctx, Buf);
1121 return UG.ignoreResults();
1146 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.