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) {
118 bool EmittedDeclName = !EmitDeclName(D);
119 assert(EmittedDeclName &&
"EmitDeclName can not fail for UsingDecls");
120 (void)EmittedDeclName;
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))
201 else if (isa<LinkageSpecDecl>(DC))
205 void USRGenerator::VisitFieldDecl(
const FieldDecl *D) {
212 Out << (isa<ObjCIvarDecl>(D) ?
"@" :
"@FI@");
213 if (EmitDeclName(D)) {
215 IgnoreResults =
true;
220 void USRGenerator::VisitFunctionDecl(
const FunctionDecl *D) {
221 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
224 const unsigned StartSize = Buf.size();
226 if (Buf.size() == StartSize)
227 GenExtSymbolContainer(D);
229 bool IsTemplate =
false;
233 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
245 !D->
hasAttr<OverloadableAttr>())
251 for (
unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
253 VisitTemplateArgument(SpecArgs->get(I));
258 // Mangle in type information for the arguments. 259 for (auto PD : D->parameters()) { 261 VisitType(PD->getType()); 266 // Function templates can be overloaded by return type, for example: 268 // template <class T> typename T::A foo() {} 269 // template <class T> typename T::B foo() {} 272 VisitType(D->getReturnType()); 275 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { 278 // FIXME: OpenCL: Need to consider address spaces 279 if (unsigned quals = MD->getMethodQualifiers().getCVRUQualifiers()) 280 Out << (char)('0
' + quals); 281 switch (MD->getRefQualifier()) { 283 case RQ_LValue: Out << '&
'; break; 284 case RQ_RValue: Out << "&&"; break; 289 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { 290 VisitDeclContext(D->getDeclContext()); 293 if (EmitDeclName(D)) { 294 // The string can be empty if the declaration has no name; e.g., it is 295 // the ParmDecl with no name for declaration of a function pointer type, 296 // e.g.: void (*f)(void *); 297 // In this case, don't generate a USR.
298 IgnoreResults =
true;
302 void USRGenerator::VisitVarDecl(
const VarDecl *D) {
306 if (ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
313 VisitTemplateParameterList(VarTmpl->getTemplateParameters());
315 = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
317 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
328 IgnoreResults =
true;
334 = dyn_cast<VarTemplateSpecializationDecl>(D)) {
337 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 339 VisitTemplateArgument(Args.get(I)); 344 void USRGenerator::VisitBindingDecl(const BindingDecl *D) { 345 if (isLocal(D) && GenLoc(D, /*IncludeOffset=*/true)) 350 void USRGenerator::VisitNonTypeTemplateParmDecl( 351 const NonTypeTemplateParmDecl *D) { 352 GenLoc(D, /*IncludeOffset=*/true); 355 void USRGenerator::VisitTemplateTemplateParmDecl( 356 const TemplateTemplateParmDecl *D) { 357 GenLoc(D, /*IncludeOffset=*/true); 360 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { 361 if (D->isAnonymousNamespace()) { 366 VisitDeclContext(D->getDeclContext()); 368 Out << "@N@" << D->getName(); 371 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { 372 VisitFunctionDecl(D->getTemplatedDecl()); 375 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { 376 VisitTagDecl(D->getTemplatedDecl()); 379 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { 380 VisitDeclContext(D->getDeclContext()); 382 Out << "@NA@" << D->getName(); 385 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { 386 const DeclContext *container = D->getDeclContext(); 387 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) { 391 // The USR for a method declared in a class extension or category is based on 392 // the ObjCInterfaceDecl, not the ObjCCategoryDecl. 393 const ObjCInterfaceDecl *ID = D->getClassInterface(); 395 IgnoreResults = true; 398 auto getCategoryContext = [](const ObjCMethodDecl *D) -> 399 const ObjCCategoryDecl * { 400 if (auto *CD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext())) 402 if (auto *ICD = dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext())) 403 return ICD->getCategoryDecl(); 406 auto *CD = getCategoryContext(D); 407 VisitObjCContainerDecl(ID, CD); 409 // Ideally we would use 'GenObjCMethod
', but this is such a hot path 410 // for Objective-C code that we don't want to use
412 Out << (D->isInstanceMethod() ?
"(im)" :
"(cm)")
420 llvm_unreachable(
"Invalid ObjC container.");
421 case Decl::ObjCInterface:
422 case Decl::ObjCImplementation:
426 case Decl::ObjCCategory: {
434 IgnoreResults =
true;
440 Out <<
"objc(ext)" << ID->
getName() <<
'@';
444 GenObjCCategory(ID->getName(), CD->
getName(),
450 case Decl::ObjCCategoryImpl: {
458 IgnoreResults =
true;
461 GenObjCCategory(ID->getName(), CD->
getName(),
466 case Decl::ObjCProtocol: {
486 VisitObjCPropertyDecl(PD);
490 IgnoreResults =
true;
493 void USRGenerator::VisitTagDecl(
const TagDecl *D) {
496 if (!isa<EnumDecl>(D) &&
497 ShouldGenerateLocation(D) && GenLoc(D, isLocal(D)))
500 GenExtSymbolContainer(D);
505 bool AlreadyStarted =
false;
506 if (
const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
508 AlreadyStarted =
true;
515 case TTK_Enum: llvm_unreachable(
"enum template");
517 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
519 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
520 AlreadyStarted =
true;
527 case TTK_Enum: llvm_unreachable(
"enum partial specialization");
529 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
533 if (!AlreadyStarted) {
544 assert(Buf.size() > 0);
545 const unsigned off = Buf.size() - 1;
547 if (EmitDeclName(D)) {
557 if (
auto *ED = dyn_cast<EnumDecl>(D)) {
559 auto enum_range = ED->enumerators();
560 if (enum_range.begin() != enum_range.end()) {
561 Out <<
'@' << **enum_range.begin();
570 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
573 for (unsigned I = 0, N = Args.size(); I != N; ++I) { 575 VisitTemplateArgument(Args.get(I)); 580 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { 581 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 583 const DeclContext *DC = D->getDeclContext(); 584 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC)) 590 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { 591 GenLoc(D, /*IncludeOffset=*/true); 594 void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) { 595 StringRef Container = GetExternalSourceContainer(D); 596 if (!Container.empty()) 597 Out << "@M@" << Container; 600 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { 602 return IgnoreResults; 605 // Guard against null declarations in invalid code. 607 IgnoreResults = true; 611 // Use the location of canonical decl. 612 D = D->getCanonicalDecl(); 615 IgnoreResults || printLoc(Out, D->getBeginLoc(), 616 Context->getSourceManager(), IncludeOffset); 618 return IgnoreResults; 621 static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS) { 622 // FIXME: Encode the qualifier, don't just
print it.
625 PO.SuppressUnwrittenScope =
true;
626 PO.ConstantArraySizeAsWritten =
false;
627 PO.AnonymousTagLocations =
false;
631 void USRGenerator::VisitType(
QualType T) {
648 Out << ((char) (
'0' + qVal));
654 T = Expansion->getPattern();
658 unsigned char c =
'\0';
659 switch (BT->getKind()) {
660 case BuiltinType::Void:
662 case BuiltinType::Bool:
664 case BuiltinType::UChar:
666 case BuiltinType::Char8:
668 case BuiltinType::Char16:
670 case BuiltinType::Char32:
672 case BuiltinType::UShort:
674 case BuiltinType::UInt:
676 case BuiltinType::ULong:
678 case BuiltinType::ULongLong:
680 case BuiltinType::UInt128:
682 case BuiltinType::Char_U:
683 case BuiltinType::Char_S:
685 case BuiltinType::SChar:
687 case BuiltinType::WChar_S:
688 case BuiltinType::WChar_U:
690 case BuiltinType::Short:
692 case BuiltinType::Int:
694 case BuiltinType::Long:
696 case BuiltinType::LongLong:
698 case BuiltinType::Int128:
700 case BuiltinType::Float16:
701 case BuiltinType::Half:
703 case BuiltinType::Float:
705 case BuiltinType::Double:
707 case BuiltinType::LongDouble:
709 case BuiltinType::Float128:
711 case BuiltinType::NullPtr:
713 #define BUILTIN_TYPE(Id, SingletonId) 714 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: 715 #include "clang/AST/BuiltinTypes.def" 716 case BuiltinType::Dependent:
717 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 718 case BuiltinType::Id: 719 #include "clang/Basic/OpenCLImageTypes.def" 720 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 721 case BuiltinType::Id: 722 #include "clang/Basic/OpenCLExtensionTypes.def" 723 case BuiltinType::OCLEvent:
724 case BuiltinType::OCLClkEvent:
725 case BuiltinType::OCLQueue:
726 case BuiltinType::OCLReserveID:
727 case BuiltinType::OCLSampler:
728 #define SVE_TYPE(Name, Id, SingletonId) \ 729 case BuiltinType::Id: 730 #include "clang/Basic/AArch64SVEACLETypes.def" 731 case BuiltinType::ShortAccum:
732 case BuiltinType::Accum:
733 case BuiltinType::LongAccum:
734 case BuiltinType::UShortAccum:
735 case BuiltinType::UAccum:
736 case BuiltinType::ULongAccum:
737 case BuiltinType::ShortFract:
738 case BuiltinType::Fract:
739 case BuiltinType::LongFract:
740 case BuiltinType::UShortFract:
741 case BuiltinType::UFract:
742 case BuiltinType::ULongFract:
743 case BuiltinType::SatShortAccum:
744 case BuiltinType::SatAccum:
745 case BuiltinType::SatLongAccum:
746 case BuiltinType::SatUShortAccum:
747 case BuiltinType::SatUAccum:
748 case BuiltinType::SatULongAccum:
749 case BuiltinType::SatShortFract:
750 case BuiltinType::SatFract:
751 case BuiltinType::SatLongFract:
752 case BuiltinType::SatUShortFract:
753 case BuiltinType::SatUFract:
754 case BuiltinType::SatULongFract:
755 IgnoreResults =
true;
757 case BuiltinType::ObjCId:
759 case BuiltinType::ObjCClass:
761 case BuiltinType::ObjCSel:
770 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
772 if (Substitution != TypeSubstitutions.end()) {
773 Out <<
'S' << Substitution->second <<
'_';
777 unsigned Number = TypeSubstitutions.size();
803 VisitType(FT->getReturnType());
805 for (
const auto &I : FT->param_types()) {
810 if (FT->isVariadic())
821 T = CT->getElementType();
826 VisitTagDecl(TT->getDecl());
831 VisitObjCInterfaceDecl(OIT->getDecl());
836 VisitType(OIT->getBaseType());
837 for (
auto *Prot : OIT->getProtocols())
838 VisitObjCProtocolDecl(Prot);
842 Out <<
't' << TTP->getDepth() <<
'.' << TTP->getIndex();
848 VisitTemplateName(Spec->getTemplateName()); 849 Out << Spec->getNumArgs(); 850 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I) 851 VisitTemplateArgument(Spec->getArg(I)); 854 if (const DependentNameType *DNT = T->getAs<DependentNameType>()) { 856 printQualifier(Out, Ctx, DNT->getQualifier()); 857 Out << ':
' << DNT->getIdentifier()->getName(); 860 if (const InjectedClassNameType *InjT = T->getAs<InjectedClassNameType>()) { 861 T = InjT->getInjectedSpecializationType(); 864 if (const auto *VT = T->getAs<VectorType>()) { 865 Out << (T->isExtVectorType() ? ']
' : '[
'); 866 Out << VT->getNumElements(); 867 T = VT->getElementType(); 870 if (const auto *const AT = dyn_cast<ArrayType>(T)) { 872 switch (AT->getSizeModifier()) { 873 case ArrayType::Static: 876 case ArrayType::Star: 879 case ArrayType::Normal: 883 if (const auto *const CAT = dyn_cast<ConstantArrayType>(T)) 884 Out << CAT->getSize(); 886 T = AT->getElementType(); 896 void USRGenerator::VisitTemplateParameterList( 897 const TemplateParameterList *Params) { 900 Out << '>
' << Params->size(); 901 for (TemplateParameterList::const_iterator P = Params->begin(), 902 PEnd = Params->end(); 905 if (isa<TemplateTypeParmDecl>(*P)) { 906 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack()) 912 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) { 913 if (NTTP->isParameterPack()) 916 VisitType(NTTP->getType()); 920 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P); 921 if (TTP->isParameterPack()) 924 VisitTemplateParameterList(TTP->getTemplateParameters()); 928 void USRGenerator::VisitTemplateName(TemplateName Name) { 929 if (TemplateDecl *Template = Name.getAsTemplateDecl()) { 930 if (TemplateTemplateParmDecl *TTP 931 = dyn_cast<TemplateTemplateParmDecl>(Template)) { 932 Out << 't
' << TTP->getDepth() << '.
' << TTP->getIndex(); 940 // FIXME: Visit dependent template names. 943 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { 944 switch (Arg.getKind()) { 945 case TemplateArgument::Null: 948 case TemplateArgument::Declaration: 949 Visit(Arg.getAsDecl()); 952 case TemplateArgument::NullPtr: 955 case TemplateArgument::TemplateExpansion: 956 Out << 'P
'; // pack expansion of... 958 case TemplateArgument::Template: 959 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); 962 case TemplateArgument::Expression: 963 // FIXME: Visit expressions. 966 case TemplateArgument::Pack: 967 Out << 'p
' << Arg.pack_size(); 968 for (const auto &P : Arg.pack_elements()) 969 VisitTemplateArgument(P); 972 case TemplateArgument::Type: 973 VisitType(Arg.getAsType()); 976 case TemplateArgument::Integral: 978 VisitType(Arg.getIntegralType()); 979 Out << Arg.getAsIntegral(); 984 void USRGenerator::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { 985 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 987 VisitDeclContext(D->getDeclContext()); 989 printQualifier(Out, D->getASTContext(), D->getQualifier()); 993 void USRGenerator::VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { 994 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) 996 VisitDeclContext(D->getDeclContext()); 998 printQualifier(Out, D->getASTContext(), D->getQualifier()); 999 Out << D->getName(); // Simple name. 1004 //===----------------------------------------------------------------------===// 1005 // USR generation functions. 1006 //===----------------------------------------------------------------------===// 1008 static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn, 1009 StringRef CatSymDefinedIn, 1011 if (ClsSymDefinedIn.empty() && CatSymDefinedIn.empty()) 1013 if (CatSymDefinedIn.empty()) { 1014 OS << "@M@" << ClsSymDefinedIn << '@
'; 1017 OS << "@CM@" << CatSymDefinedIn << '@
'; 1018 if (ClsSymDefinedIn != CatSymDefinedIn) { 1019 OS << ClsSymDefinedIn << '@
'; 1023 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, 1024 StringRef ExtSymDefinedIn, 1025 StringRef CategoryContextExtSymbolDefinedIn) { 1026 combineClassAndCategoryExtContainers(ExtSymDefinedIn, 1027 CategoryContextExtSymbolDefinedIn, OS); 1028 OS << "objc(cs)" << Cls; 1031 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat, 1033 StringRef ClsSymDefinedIn, 1034 StringRef CatSymDefinedIn) { 1035 combineClassAndCategoryExtContainers(ClsSymDefinedIn, CatSymDefinedIn, OS); 1036 OS << "objc(cy)" << Cls << '@
' << Cat; 1039 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) { 1043 void clang::index::generateUSRForObjCMethod(StringRef Sel, 1044 bool IsInstanceMethod, 1046 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel; 1049 void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp, 1051 OS << (isClassProp ? "(cpy)" : "(py)") << Prop; 1054 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, 1055 StringRef ExtSymDefinedIn) { 1056 if (!ExtSymDefinedIn.empty()) 1057 OS << "@M@" << ExtSymDefinedIn << '@
'; 1058 OS << "objc(pl)" << Prot; 1061 void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, 1062 StringRef ExtSymDefinedIn) { 1063 if (!ExtSymDefinedIn.empty()) 1064 OS << "@M@" << ExtSymDefinedIn; 1065 OS << "@E@" << EnumName; 1068 void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName, 1070 OS << '@
' << EnumConstantName; 1073 bool clang::index::generateUSRForDecl(const Decl *D, 1074 SmallVectorImpl<char> &Buf) { 1077 // We don't ignore decls with invalid source locations.
Implicit decls, like
1083 return UG.ignoreResults();
1100 if (MacroName.empty() || Loc.
isInvalid())
1103 llvm::raw_svector_ostream Out(Buf);
1110 if (ShouldGenerateLocation)
1123 USRGenerator UG(&Ctx, Buf);
1125 return UG.ignoreResults();
1150 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.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
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. ...
void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, QualType Ty)
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'.
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.