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);
106 IgnoreResults =
true;
110 IgnoreResults =
true;
113 void VisitUsingDecl(
const UsingDecl *D) {
114 IgnoreResults =
true;
117 bool ShouldGenerateLocation(
const NamedDecl *D);
123 void GenExtSymbolContainer(
const NamedDecl *D);
127 bool GenLoc(
const Decl *D,
bool IncludeOffset);
136 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
137 StringRef CategoryContextExtSymbolDefinedIn) {
139 CategoryContextExtSymbolDefinedIn);
143 void GenObjCCategory(StringRef cls, StringRef cat,
144 StringRef clsExt, StringRef catExt) {
149 void GenObjCProperty(StringRef prop,
bool isClassProp) {
154 void GenObjCProtocol(StringRef prot, StringRef ext) {
173 bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
174 const unsigned startSize = Buf.size();
176 const unsigned endSize = Buf.size();
177 return startSize == endSize;
180 bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
192 void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
193 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
195 else if (isa<LinkageSpecDecl>(DC))
199 void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
206 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
207 if (EmitDeclName(D)) {
209 IgnoreResults =
true;
214 void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
215 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
218 const unsigned StartSize = Buf.size();
220 if (Buf.size() == StartSize)
221 GenExtSymbolContainer(D);
223 bool IsTemplate =
false;
227 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
239 !D->
hasAttr<OverloadableAttr>())
245 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
247 VisitTemplateArgument(SpecArgs->get(I));
252 // Mangle in type information for the arguments. 253 for (auto PD : D->parameters()) { 255 VisitType(PD->getType()); 260 // Function templates can be overloaded by return type, for example: 262 // template <class T> typename T::A foo() {} 263 // template <class T> typename T::B foo() {} 266 VisitType(D->getReturnType()); 269 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { 272 if (unsigned quals = MD->getTypeQualifiers()) 273 Out << (char)('0
' + quals); 274 switch (MD->getRefQualifier()) { 276 case RQ_LValue: Out << '&
'; break; 277 case RQ_RValue: Out << "&&"; break; 282 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { 283 VisitDeclContext(D->getDeclContext()); 286 if (EmitDeclName(D)) { 287 // The string can be empty if the declaration has no name; e.g., it is 288 // the ParmDecl with no name for declaration of a function pointer type, 289 // e.g.: void (*f)(void *); 290 // In this case, don't generate a USR.
291 IgnoreResults =
true;
295 void USRGenerator::VisitVarDecl(
const VarDecl *D) {
299 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
306 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
308 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
310 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
321 IgnoreResults =
true;
327 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
330 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 332 VisitTemplateArgument(Args.get(I)); 337 void USRGenerator::VisitNonTypeTemplateParmDecl( 338 const NonTypeTemplateParmDecl *D) { 339 GenLoc(D, /*IncludeOffset=*/true); 342 void USRGenerator::VisitTemplateTemplateParmDecl( 343 const TemplateTemplateParmDecl *D) { 344 GenLoc(D, /*IncludeOffset=*/true); 347 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { 348 if (D->isAnonymousNamespace()) { 353 VisitDeclContext(D->getDeclContext()); 355 Out << "@N@" << D->getName(); 358 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { 359 VisitFunctionDecl(D->getTemplatedDecl()); 362 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { 363 VisitTagDecl(D->getTemplatedDecl()); 366 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { 367 VisitDeclContext(D->getDeclContext()); 369 Out << "@NA@" << D->getName(); 372 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { 373 const DeclContext *container = D->getDeclContext(); 374 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) { 378 // The USR for a method declared in a class extension or category is based on 379 // the ObjCInterfaceDecl, not the ObjCCategoryDecl. 380 const ObjCInterfaceDecl *ID = D->getClassInterface(); 382 IgnoreResults = true; 385 auto getCategoryContext = [](const ObjCMethodDecl *D) -> 386 const ObjCCategoryDecl * { 387 if (auto *CD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext())) 389 if (auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext())) 390 return ICD->getCategoryDecl(); 393 auto *CD = getCategoryContext(D); 394 VisitObjCContainerDecl(ID, CD); 396 // Ideally we would use 'GenObjCMethod
', but this is such a hot path 397 // for Objective-C code that we don't want to use
399 Out << (D->isInstanceMethod() ?
"(im)" :
"(cm)")
407 llvm_unreachable(
"Invalid ObjC container.");
408 case Decl::ObjCInterface:
409 case Decl::ObjCImplementation:
413 case Decl::ObjCCategory: {
421 IgnoreResults =
true;
427 Out <<
"objc(ext)" << ID->
getName() <<
'@';
431 GenObjCCategory(ID->getName(), CD->
getName(),
437 case Decl::ObjCCategoryImpl: {
445 IgnoreResults =
true;
448 GenObjCCategory(ID->getName(), CD->
getName(),
453 case Decl::ObjCProtocol: {
473 VisitObjCPropertyDecl(PD);
477 IgnoreResults =
true;
480 void USRGenerator::VisitTagDecl(
const TagDecl *D) {
483 if (!isa<EnumDecl>(D) &&
484 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
487 GenExtSymbolContainer(D);
492 bool AlreadyStarted =
false;
493 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
495 AlreadyStarted =
true;
502 case TTK_Enum: llvm_unreachable(
"enum template");
504 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
506 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
507 AlreadyStarted =
true;
514 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
516 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
520 if (!AlreadyStarted) {
531 assert(Buf.size() > 0);
532 const unsigned off = Buf.size() - 1;
534 if (EmitDeclName(D)) {
544 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
546 auto enum_range = ED->enumerators();
547 if (enum_range.begin() != enum_range.end()) {
548 Out <<
'@' << **enum_range.begin();
557 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
560 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 562 VisitTemplateArgument(Args.get(I)); 567 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { 568 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 570 const DeclContext *DC = D->getDeclContext(); 571 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC)) 577 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { 578 GenLoc(D, /*IncludeOffset=*/true); 581 void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) { 582 StringRef Container = GetExternalSourceContainer(D); 583 if (!Container.empty()) 584 Out << "@M@" << Container; 587 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { 589 return IgnoreResults; 592 // Guard against null declarations in invalid code. 594 IgnoreResults = true; 598 // Use the location of canonical decl. 599 D = D->getCanonicalDecl(); 602 IgnoreResults || printLoc(Out, D->getLocStart(), 603 Context->getSourceManager(), IncludeOffset); 605 return IgnoreResults; 608 static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS) { 609 // FIXME: Encode the qualifier, don't just print it.
612 PO.SuppressUnwrittenScope =
true;
613 PO.ConstantArraySizeAsWritten =
false;
614 PO.AnonymousTagLocations =
false;
618 void USRGenerator::VisitType(
QualType T) {
635 Out << ((char) (
'0' + qVal));
641 T = Expansion->getPattern();
645 unsigned char c =
'\0';
646 switch (BT->getKind()) {
647 case BuiltinType::Void:
649 case BuiltinType::Bool:
651 case BuiltinType::UChar:
653 case BuiltinType::Char8:
655 case BuiltinType::Char16:
657 case BuiltinType::Char32:
659 case BuiltinType::UShort:
661 case BuiltinType::UInt:
663 case BuiltinType::ULong:
665 case BuiltinType::ULongLong:
667 case BuiltinType::UInt128:
669 case BuiltinType::Char_U:
670 case BuiltinType::Char_S:
672 case BuiltinType::SChar:
674 case BuiltinType::WChar_S:
675 case BuiltinType::WChar_U:
677 case BuiltinType::Short:
679 case BuiltinType::Int:
681 case BuiltinType::Long:
683 case BuiltinType::LongLong:
685 case BuiltinType::Int128:
687 case BuiltinType::Float16:
688 case BuiltinType::Half:
690 case BuiltinType::Float:
692 case BuiltinType::Double:
694 case BuiltinType::LongDouble:
696 case BuiltinType::Float128:
698 case BuiltinType::NullPtr:
700 #define BUILTIN_TYPE(Id, SingletonId) 701 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: 702 #include "clang/AST/BuiltinTypes.def" 703 case BuiltinType::Dependent:
704 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 705 case BuiltinType::Id: 706 #include "clang/Basic/OpenCLImageTypes.def" 707 case BuiltinType::OCLEvent:
708 case BuiltinType::OCLClkEvent:
709 case BuiltinType::OCLQueue:
710 case BuiltinType::OCLReserveID:
711 case BuiltinType::OCLSampler:
712 case BuiltinType::ShortAccum:
713 case BuiltinType::Accum:
714 case BuiltinType::LongAccum:
715 case BuiltinType::UShortAccum:
716 case BuiltinType::UAccum:
717 case BuiltinType::ULongAccum:
718 case BuiltinType::ShortFract:
719 case BuiltinType::Fract:
720 case BuiltinType::LongFract:
721 case BuiltinType::UShortFract:
722 case BuiltinType::UFract:
723 case BuiltinType::ULongFract:
724 case BuiltinType::SatShortAccum:
725 case BuiltinType::SatAccum:
726 case BuiltinType::SatLongAccum:
727 case BuiltinType::SatUShortAccum:
728 case BuiltinType::SatUAccum:
729 case BuiltinType::SatULongAccum:
730 case BuiltinType::SatShortFract:
731 case BuiltinType::SatFract:
732 case BuiltinType::SatLongFract:
733 case BuiltinType::SatUShortFract:
734 case BuiltinType::SatUFract:
735 case BuiltinType::SatULongFract:
736 IgnoreResults =
true;
738 case BuiltinType::ObjCId:
740 case BuiltinType::ObjCClass:
742 case BuiltinType::ObjCSel:
751 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
753 if (Substitution != TypeSubstitutions.end()) {
754 Out <<
'S' << Substitution->second <<
'_';
758 unsigned Number = TypeSubstitutions.size();
784 VisitType(FT->getReturnType());
786 for (
const auto &I : FT->param_types()) {
791 if (FT->isVariadic())
802 T = CT->getElementType();
807 VisitTagDecl(TT->getDecl());
812 VisitObjCInterfaceDecl(OIT->getDecl());
817 VisitType(OIT->getBaseType());
818 for (
auto *Prot : OIT->getProtocols())
819 VisitObjCProtocolDecl(Prot);
823 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
829 VisitTemplateName(Spec->getTemplateName()); 830 Out << Spec->getNumArgs(); 831 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I) 832 VisitTemplateArgument(Spec->getArg(I)); 835 if (const DependentNameType *DNT = T->getAs<DependentNameType>()) { 837 printQualifier(Out, Ctx, DNT->getQualifier()); 838 Out << ':
' << DNT->getIdentifier()->getName(); 841 if (const InjectedClassNameType *InjT = T->getAs<InjectedClassNameType>()) { 842 T = InjT->getInjectedSpecializationType(); 845 if (const auto *VT = T->getAs<VectorType>()) { 846 Out << (T->isExtVectorType() ? ']
' : '[
'); 847 Out << VT->getNumElements(); 848 T = VT->getElementType(); 851 if (const auto *const AT = dyn_cast<ArrayType>(T)) { 853 switch (AT->getSizeModifier()) { 854 case ArrayType::Static: 857 case ArrayType::Star: 860 case ArrayType::Normal: 864 if (const auto *const CAT = dyn_cast<ConstantArrayType>(T)) 865 Out << CAT->getSize(); 867 T = AT->getElementType(); 877 void USRGenerator::VisitTemplateParameterList( 878 const TemplateParameterList *Params) { 881 Out << '>
' << Params->size(); 882 for (TemplateParameterList::const_iterator P = Params->begin(), 883 PEnd = Params->end(); 886 if (isa<TemplateTypeParmDecl>(*P)) { 887 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack()) 893 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) { 894 if (NTTP->isParameterPack()) 897 VisitType(NTTP->getType()); 901 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P); 902 if (TTP->isParameterPack()) 905 VisitTemplateParameterList(TTP->getTemplateParameters()); 909 void USRGenerator::VisitTemplateName(TemplateName Name) { 910 if (TemplateDecl *Template = Name.getAsTemplateDecl()) { 911 if (TemplateTemplateParmDecl *TTP 912 = dyn_cast<TemplateTemplateParmDecl>(Template)) { 913 Out << 't
' << TTP->getDepth() << '.
' << TTP->getIndex(); 921 // FIXME: Visit dependent template names. 924 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { 925 switch (Arg.getKind()) { 926 case TemplateArgument::Null: 929 case TemplateArgument::Declaration: 930 Visit(Arg.getAsDecl()); 933 case TemplateArgument::NullPtr: 936 case TemplateArgument::TemplateExpansion: 937 Out << 'P
'; // pack expansion of... 939 case TemplateArgument::Template: 940 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); 943 case TemplateArgument::Expression: 944 // FIXME: Visit expressions. 947 case TemplateArgument::Pack: 948 Out << 'p
' << Arg.pack_size(); 949 for (const auto &P : Arg.pack_elements()) 950 VisitTemplateArgument(P); 953 case TemplateArgument::Type: 954 VisitType(Arg.getAsType()); 957 case TemplateArgument::Integral: 959 VisitType(Arg.getIntegralType()); 960 Out << Arg.getAsIntegral(); 965 void USRGenerator::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { 966 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 968 VisitDeclContext(D->getDeclContext()); 970 printQualifier(Out, D->getASTContext(), D->getQualifier()); 974 void USRGenerator::VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { 975 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 977 VisitDeclContext(D->getDeclContext()); 979 printQualifier(Out, D->getASTContext(), D->getQualifier()); 980 Out << D->getName(); // Simple name. 985 //===----------------------------------------------------------------------===// 986 // USR generation functions. 987 //===----------------------------------------------------------------------===// 989 static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn, 990 StringRef CatSymDefinedIn, 992 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty()) 994 if (CatSymDefinedIn.empty()) { 995 OS << "@M@" << ClsSymDefinedIn << '@
'; 998 OS << "@CM@" << CatSymDefinedIn << '@
'; 999 if (ClsSymDefinedIn != CatSymDefinedIn) { 1000 OS << ClsSymDefinedIn << '@
'; 1004 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, 1005 StringRef ExtSymDefinedIn, 1006 StringRef CategoryContextExtSymbolDefinedIn) { 1007 combineClassAndCategoryExtContainers(ExtSymDefinedIn, 1008 CategoryContextExtSymbolDefinedIn, OS); 1009 OS << "objc(cs)" << Cls; 1012 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat, 1014 StringRef ClsSymDefinedIn, 1015 StringRef CatSymDefinedIn) { 1016 combineClassAndCategoryExtContainers(ClsSymDefinedIn, CatSymDefinedIn, OS); 1017 OS << "objc(cy)" << Cls << '@
' << Cat; 1020 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) { 1024 void clang::index::generateUSRForObjCMethod(StringRef Sel, 1025 bool IsInstanceMethod, 1027 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel; 1030 void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp, 1032 OS << (isClassProp ? "(cpy)" : "(py)") << Prop; 1035 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, 1036 StringRef ExtSymDefinedIn) { 1037 if (!ExtSymDefinedIn.empty()) 1038 OS << "@M@" << ExtSymDefinedIn << '@
'; 1039 OS << "objc(pl)" << Prot; 1042 void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, 1043 StringRef ExtSymDefinedIn) { 1044 if (!ExtSymDefinedIn.empty()) 1045 OS << "@M@" << ExtSymDefinedIn; 1046 OS << "@E@" << EnumName; 1049 void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName, 1051 OS << '@
' << EnumConstantName; 1054 bool clang::index::generateUSRForDecl(const Decl *D, 1055 SmallVectorImpl<char> &Buf) { 1058 // We don't ignore decls with invalid source locations.
Implicit decls, like
1064 return UG.ignoreResults();
1081 if (MacroName.empty() || Loc.
isInvalid())
1084 llvm::raw_svector_ostream Out(Buf);
1091 if (ShouldGenerateLocation)
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.
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.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Decl - This represents one declaration (or definition), e.g.
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.
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...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Represents an Objective-C protocol declaration.
Represents an ObjC class declaration.
Represents a linkage specification.
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.
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.
static StringRef GetExternalSourceContainer(const NamedDecl *D)
virtual void printName(raw_ostream &os) 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.
bool SuppressTagKeyword
Whether type printing should skip printing the tag keyword.
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
Represents a dependent using declaration which was marked with typename.
DeclarationName - 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
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.