15 #include "llvm/Support/Path.h"
16 #include "llvm/Support/raw_ostream.h"
18 using namespace clang;
19 using namespace clang::index;
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);
104 IgnoreResults =
true;
108 IgnoreResults =
true;
111 void VisitUsingDecl(
const UsingDecl *D) {
112 IgnoreResults =
true;
116 IgnoreResults =
true;
120 IgnoreResults =
true;
123 bool ShouldGenerateLocation(
const NamedDecl *D);
129 void GenExtSymbolContainer(
const NamedDecl *D);
133 bool GenLoc(
const Decl *D,
bool IncludeOffset);
142 void GenObjCClass(StringRef cls, StringRef ExtSymDefinedIn,
143 StringRef CategoryContextExtSymbolDefinedIn) {
145 CategoryContextExtSymbolDefinedIn);
149 void GenObjCCategory(StringRef cls, StringRef cat,
150 StringRef clsExt, StringRef catExt) {
155 void GenObjCProperty(StringRef prop,
bool isClassProp) {
160 void GenObjCProtocol(StringRef prot, StringRef ext) {
179 bool USRGenerator::EmitDeclName(
const NamedDecl *D) {
180 const unsigned startSize = Buf.size();
182 const unsigned endSize = Buf.size();
183 return startSize == endSize;
186 bool USRGenerator::ShouldGenerateLocation(
const NamedDecl *D) {
198 void USRGenerator::VisitDeclContext(
const DeclContext *DC) {
199 if (
const NamedDecl *D = dyn_cast<NamedDecl>(DC))
203 void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
210 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
211 if (EmitDeclName(D)) {
213 IgnoreResults =
true;
218 void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
219 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
222 const unsigned StartSize = Buf.size();
224 if (Buf.size() == StartSize)
225 GenExtSymbolContainer(D);
227 bool IsTemplate =
false;
231 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
243 !D->
hasAttr<OverloadableAttr>())
249 for (
unsigned I = 0, N = SpecArgs->size();
I != N; ++
I) {
251 VisitTemplateArgument(SpecArgs->get(
I));
256 // Mangle in type information for the arguments.
257 for (auto PD : D->parameters()) {
259 VisitType(PD->getType());
264 // Function templates can be overloaded by return type, for example:
266 // template <class T> typename T::A foo() {}
267 // template <class T> typename T::B foo() {}
270 VisitType(D->getReturnType());
273 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
276 if (unsigned quals = MD->getTypeQualifiers())
277 Out << (char)('0
' + quals);
278 switch (MD->getRefQualifier()) {
280 case RQ_LValue: Out << '&
'; break;
281 case RQ_RValue: Out << "&&"; break;
286 void USRGenerator::VisitNamedDecl(const NamedDecl *D) {
287 VisitDeclContext(D->getDeclContext());
290 if (EmitDeclName(D)) {
291 // The string can be empty if the declaration has no name; e.g., it is
292 // the ParmDecl with no name for declaration of a function pointer type,
293 // e.g.: void (*f)(void *);
294 // In this case, don't generate a USR.
295 IgnoreResults =
true;
299 void USRGenerator::VisitVarDecl(
const VarDecl *D) {
303 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
310 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
312 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
314 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
325 IgnoreResults =
true;
331 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
334 for (unsigned I = 0, N = Args.size(); I != N; ++I) {
336 VisitTemplateArgument(Args.get(I));
341 void USRGenerator::VisitNonTypeTemplateParmDecl(
342 const NonTypeTemplateParmDecl *D) {
343 GenLoc(D, /*IncludeOffset=*/true);
346 void USRGenerator::VisitTemplateTemplateParmDecl(
347 const TemplateTemplateParmDecl *D) {
348 GenLoc(D, /*IncludeOffset=*/true);
351 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) {
352 if (D->isAnonymousNamespace()) {
357 VisitDeclContext(D->getDeclContext());
359 Out << "@N@" << D->getName();
362 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
363 VisitFunctionDecl(D->getTemplatedDecl());
366 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
367 VisitTagDecl(D->getTemplatedDecl());
370 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
371 VisitDeclContext(D->getDeclContext());
373 Out << "@NA@" << D->getName();
376 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
377 const DeclContext *container = D->getDeclContext();
378 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) {
382 // The USR for a method declared in a class extension or category is based on
383 // the ObjCInterfaceDecl, not the ObjCCategoryDecl.
384 const ObjCInterfaceDecl *ID = D->getClassInterface();
386 IgnoreResults = true;
389 auto getCategoryContext = [](const ObjCMethodDecl *D) ->
390 const ObjCCategoryDecl * {
391 if (auto *CD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext()))
393 if (auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext()))
394 return ICD->getCategoryDecl();
397 auto *CD = getCategoryContext(D);
398 VisitObjCContainerDecl(ID, CD);
400 // Ideally we would use 'GenObjCMethod
', but this is such a hot path
401 // for Objective-C code that we don't want to use
403 Out << (D->isInstanceMethod() ?
"(im)" :
"(cm)")
411 llvm_unreachable(
"Invalid ObjC container.");
412 case Decl::ObjCInterface:
413 case Decl::ObjCImplementation:
417 case Decl::ObjCCategory: {
425 IgnoreResults =
true;
431 Out <<
"objc(ext)" << ID->
getName() <<
'@';
435 GenObjCCategory(ID->getName(), CD->
getName(),
441 case Decl::ObjCCategoryImpl: {
449 IgnoreResults =
true;
452 GenObjCCategory(ID->getName(), CD->
getName(),
457 case Decl::ObjCProtocol: {
477 VisitObjCPropertyDecl(PD);
481 IgnoreResults =
true;
484 void USRGenerator::VisitTagDecl(
const TagDecl *D) {
487 if (!isa<EnumDecl>(D) &&
488 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
491 GenExtSymbolContainer(D);
496 bool AlreadyStarted =
false;
497 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
499 AlreadyStarted =
true;
506 case TTK_Enum: llvm_unreachable(
"enum template");
508 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
510 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
511 AlreadyStarted =
true;
518 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
520 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
524 if (!AlreadyStarted) {
535 assert(Buf.size() > 0);
536 const unsigned off = Buf.size() - 1;
538 if (EmitDeclName(D)) {
548 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
550 auto enum_range = ED->enumerators();
551 if (enum_range.begin() != enum_range.end()) {
552 Out <<
'@' << **enum_range.begin();
561 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
564 for (unsigned I = 0, N = Args.size(); I != N; ++I) {
566 VisitTemplateArgument(Args.get(I));
571 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) {
572 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
574 const DeclContext *DC = D->getDeclContext();
575 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC))
581 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
582 GenLoc(D, /*IncludeOffset=*/true);
585 void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) {
586 StringRef Container = GetExternalSourceContainer(D);
587 if (!Container.empty())
588 Out << "@M@" << Container;
591 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) {
593 return IgnoreResults;
596 // Guard against null declarations in invalid code.
598 IgnoreResults = true;
602 // Use the location of canonical decl.
603 D = D->getCanonicalDecl();
606 IgnoreResults || printLoc(Out, D->getLocStart(),
607 Context->getSourceManager(), IncludeOffset);
609 return IgnoreResults;
612 void USRGenerator::VisitType(QualType T) {
613 // This method mangles in USR information for types. It can possibly
614 // just reuse the naming-mangling logic used by codegen, although the
615 // requirements for USRs might not be the same.
616 ASTContext &Ctx = *Context;
619 T = Ctx.getCanonicalType(T);
620 Qualifiers Q = T.getQualifiers();
629 Out << ((char) ('0
' + qVal));
631 // Mangle in ObjC GC qualifiers?
633 if (const PackExpansionType *Expansion = T->getAs<PackExpansionType>()) {
635 T = Expansion->getPattern();
638 if (const BuiltinType *BT = T->getAs<BuiltinType>()) {
639 unsigned char c = '\0
';
640 switch (BT->getKind()) {
641 case BuiltinType::Void:
643 case BuiltinType::Bool:
645 case BuiltinType::UChar:
647 case BuiltinType::Char16:
649 case BuiltinType::Char32:
651 case BuiltinType::UShort:
653 case BuiltinType::UInt:
655 case BuiltinType::ULong:
657 case BuiltinType::ULongLong:
659 case BuiltinType::UInt128:
661 case BuiltinType::Char_U:
662 case BuiltinType::Char_S:
664 case BuiltinType::SChar:
666 case BuiltinType::WChar_S:
667 case BuiltinType::WChar_U:
669 case BuiltinType::Short:
671 case BuiltinType::Int:
673 case BuiltinType::Long:
675 case BuiltinType::LongLong:
677 case BuiltinType::Int128:
679 case BuiltinType::Half:
681 case BuiltinType::Float:
683 case BuiltinType::Double:
685 case BuiltinType::LongDouble:
687 case BuiltinType::Float128:
689 case BuiltinType::NullPtr:
691 #define BUILTIN_TYPE(Id, SingletonId)
692 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
693 #include "clang/AST/BuiltinTypes.def"
694 case BuiltinType::Dependent:
695 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
696 case BuiltinType::Id:
697 #include "clang/Basic/OpenCLImageTypes.def"
698 case BuiltinType::OCLEvent:
699 case BuiltinType::OCLClkEvent:
700 case BuiltinType::OCLQueue:
701 case BuiltinType::OCLReserveID:
702 case BuiltinType::OCLSampler:
703 IgnoreResults = true;
705 case BuiltinType::ObjCId:
707 case BuiltinType::ObjCClass:
709 case BuiltinType::ObjCSel:
716 // If we have already seen this (non-built-in) type, use a substitution
718 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
719 = TypeSubstitutions.find(T.getTypePtr());
720 if (Substitution != TypeSubstitutions.end()) {
721 Out << 'S' << Substitution->second << '_
';
724 // Record this as a substitution.
725 unsigned Number = TypeSubstitutions.size();
726 TypeSubstitutions[T.getTypePtr()] = Number;
729 if (const PointerType *PT = T->getAs<PointerType>()) {
731 T = PT->getPointeeType();
734 if (const ObjCObjectPointerType *OPT = T->getAs<ObjCObjectPointerType>()) {
736 T = OPT->getPointeeType();
739 if (const RValueReferenceType *RT = T->getAs<RValueReferenceType>()) {
741 T = RT->getPointeeType();
744 if (const ReferenceType *RT = T->getAs<ReferenceType>()) {
746 T = RT->getPointeeType();
749 if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) {
751 VisitType(FT->getReturnType());
752 for (const auto &I : FT->param_types())
754 if (FT->isVariadic())
758 if (const BlockPointerType *BT = T->getAs<BlockPointerType>()) {
760 T = BT->getPointeeType();
763 if (const ComplexType *CT = T->getAs<ComplexType>()) {
765 T = CT->getElementType();
768 if (const TagType *TT = T->getAs<TagType>()) {
770 VisitTagDecl(TT->getDecl());
773 if (const ObjCInterfaceType *OIT = T->getAs<ObjCInterfaceType>()) {
775 VisitObjCInterfaceDecl(OIT->getDecl());
778 if (const ObjCObjectType *OIT = T->getAs<ObjCObjectType>()) {
780 VisitType(OIT->getBaseType());
781 for (auto *Prot : OIT->getProtocols())
782 VisitObjCProtocolDecl(Prot);
785 if (const TemplateTypeParmType *TTP = T->getAs<TemplateTypeParmType>()) {
786 Out << 't
' << TTP->getDepth() << '.
' << TTP->getIndex();
789 if (const TemplateSpecializationType *Spec
790 = T->getAs<TemplateSpecializationType>()) {
792 VisitTemplateName(Spec->getTemplateName());
793 Out << Spec->getNumArgs();
794 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I)
795 VisitTemplateArgument(Spec->getArg(I));
798 if (const DependentNameType *DNT = T->getAs<DependentNameType>()) {
800 // FIXME: Encode the qualifier, don't just print it.
803 PO.SuppressUnwrittenScope =
true;
804 PO.ConstantArraySizeAsWritten =
false;
805 PO.AnonymousTagLocations =
false;
806 DNT->getQualifier()->print(Out, PO);
807 Out <<
':' << DNT->getIdentifier()->getName();
811 T = InjT->getInjectedSpecializationType();
814 if (
const auto *VT = T->getAs<
VectorType>()) {
815 Out << (T->isExtVectorType() ?
']' :
'[');
816 Out << VT->getNumElements();
817 T = VT->getElementType();
827 void USRGenerator::VisitTemplateParameterList(
831 Out << '>
' << Params->size();
832 for (TemplateParameterList::const_iterator P = Params->begin(),
833 PEnd = Params->end();
836 if (isa<TemplateTypeParmDecl>(*P)) {
837 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack())
843 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
844 if (NTTP->isParameterPack())
847 VisitType(NTTP->getType());
851 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P);
852 if (TTP->isParameterPack())
855 VisitTemplateParameterList(TTP->getTemplateParameters());
859 void USRGenerator::VisitTemplateName(TemplateName Name) {
860 if (TemplateDecl *Template = Name.getAsTemplateDecl()) {
861 if (TemplateTemplateParmDecl *TTP
862 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
863 Out << 't
' << TTP->getDepth() << '.
' << TTP->getIndex();
871 // FIXME: Visit dependent template names.
874 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) {
875 switch (Arg.getKind()) {
876 case TemplateArgument::Null:
879 case TemplateArgument::Declaration:
880 Visit(Arg.getAsDecl());
883 case TemplateArgument::NullPtr:
886 case TemplateArgument::TemplateExpansion:
887 Out << 'P
'; // pack expansion of...
889 case TemplateArgument::Template:
890 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
893 case TemplateArgument::Expression:
894 // FIXME: Visit expressions.
897 case TemplateArgument::Pack:
898 Out << 'p
' << Arg.pack_size();
899 for (const auto &P : Arg.pack_elements())
900 VisitTemplateArgument(P);
903 case TemplateArgument::Type:
904 VisitType(Arg.getAsType());
907 case TemplateArgument::Integral:
909 VisitType(Arg.getIntegralType());
910 Out << Arg.getAsIntegral();
915 //===----------------------------------------------------------------------===//
916 // USR generation functions.
917 //===----------------------------------------------------------------------===//
919 static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn,
920 StringRef CatSymDefinedIn,
922 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty())
924 if (CatSymDefinedIn.empty()) {
925 OS << "@M@" << ClsSymDefinedIn << '@
';
928 OS << "@CM@" << CatSymDefinedIn << '@
';
929 if (ClsSymDefinedIn != CatSymDefinedIn) {
930 OS << ClsSymDefinedIn << '@
';
934 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
935 StringRef ExtSymDefinedIn,
936 StringRef CategoryContextExtSymbolDefinedIn) {
937 combineClassAndCategoryExtContainers(ExtSymDefinedIn,
938 CategoryContextExtSymbolDefinedIn, OS);
939 OS << "objc(cs)" << Cls;
942 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat,
944 StringRef ClsSymDefinedIn,
945 StringRef CatSymDefinedIn) {
946 combineClassAndCategoryExtContainers(ClsSymDefinedIn, CatSymDefinedIn, OS);
947 OS << "objc(cy)" << Cls << '@
' << Cat;
950 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) {
954 void clang::index::generateUSRForObjCMethod(StringRef Sel,
955 bool IsInstanceMethod,
957 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel;
960 void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp,
962 OS << (isClassProp ? "(cpy)" : "(py)") << Prop;
965 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
966 StringRef ExtSymDefinedIn) {
967 if (!ExtSymDefinedIn.empty())
968 OS << "@M@" << ExtSymDefinedIn << '@
';
969 OS << "objc(pl)" << Prot;
972 void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
973 StringRef ExtSymDefinedIn) {
974 if (!ExtSymDefinedIn.empty())
975 OS << "@M@" << ExtSymDefinedIn;
976 OS << "@E@" << EnumName;
979 void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName,
981 OS << '@
' << EnumConstantName;
984 bool clang::index::generateUSRForDecl(const Decl *D,
985 SmallVectorImpl<char> &Buf) {
988 // We don't ignore decls with invalid source locations.
Implicit decls, like
994 return UG.ignoreResults();
1011 if (MacroName.empty() || Loc.
isInvalid())
1014 llvm::raw_svector_ostream Out(Buf);
1021 if (ShouldGenerateLocation)
Defines the clang::ASTContext interface.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
bool generateUSRForMacro(const MacroDefinitionRecord *MD, const SourceManager &SM, SmallVectorImpl< char > &Buf)
Generate a USR for a macro, including the USR prefix.
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 isClassProperty() const
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
Declaration of a variable template.
NamespaceDecl - Represent a C++ namespace.
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, StringRef ExtSymbolDefinedIn="", StringRef CategoryContextExtSymbolDefinedIn="")
Generate a USR fragment for an Objective-C class.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
ExternalSourceSymbolAttr * getExternalSourceSymbolAttr() const
Looks on this and related declarations for an applicable external source symbol attribute.
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.
Describes how types, statements, expressions, and declarations should be printed. ...
bool isExternC() const
Determines whether this function is a function with external, C linkage.
Represents a class template specialization, which refers to a class template with a given set of temp...
static StringRef getUSRSpacePrefix()
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
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)
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void print(raw_ostream &OS, const PrintingPolicy &Policy)
TagKind getTagKind() const
bool IsClassExtension() const
Represents a C++ using-declaration.
ObjCContainerDecl - Represents a container for method declarations.
const LangOptions & getLangOpts() const
virtual void printName(raw_ostream &os) const
StringRef getName() const
Represents an Objective-C protocol declaration.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Represents an ObjC class declaration.
Represents a linkage specification.
detail::InMemoryDirectory::const_iterator I
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...
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
StringRef getName() const
Return the actual identifier string.
Declaration of a template type parameter.
DeclContext * getDeclContext()
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
bool isExternallyVisible() const
Represents a GCC generic vector type.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
TypedefNameDecl * getTypedefNameForAnonDecl() const
static StringRef GetExternalSourceContainer(const NamedDecl *D)
bool isEmbeddedInDeclarator() const
Encodes a location in the source.
TagDecl - 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 ObjCInterfaceDecl * getClassInterface() const
Represents one property declaration in an Objective-C interface.
bool SuppressTagKeyword
Whether type printing should skip printing the tag keyword.
const IdentifierInfo * getName() const
Retrieve the name of the macro being defined.
The injected class name of a C++ class template or class template partial specialization.
Base class for declarations which introduce a typedef-name.
Represents a template argument.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isFreeStanding() 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.
const T * getAs() const
Member-template getAs<specific type>'.
SourceManager & getSourceManager()
A template argument list.
ObjCPropertyDecl * getPropertyDecl() 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.
Declaration of a class template.
SourceLocation getLocation() const
Retrieve the location of the macro name in the definition.
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...
SourceLocation getLocation() const
NamedDecl - This represents a decl with a name.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Represents a C++ namespace alias.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
Represents C++ using-directive.
A simple visitor class that helps create declaration visitors.
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.