clang  6.0.0svn
Classes | Typedefs | Enumerations | Functions | Variables
clang::index Namespace Reference

Classes

class  CodegenNameGenerator
 
class  CommentToXMLConverter
 
class  IndexDataConsumer
 
class  IndexingContext
 
struct  IndexingOptions
 
class  SimpleFormatContext
 A small class to be used by libclang clients to format a declaration string in memory. More...
 
struct  SymbolInfo
 
struct  SymbolRelation
 Represents a relation to another symbol for a symbol occurrence. More...
 

Typedefs

typedef unsigned SymbolPropertySet
 
typedef unsigned SymbolRoleSet
 

Enumerations

enum  SymbolKind : uint8_t {
  SymbolKind::Unknown, SymbolKind::Module, SymbolKind::Namespace, SymbolKind::NamespaceAlias,
  SymbolKind::Macro, SymbolKind::Enum, SymbolKind::Struct, SymbolKind::Class,
  SymbolKind::Protocol, SymbolKind::Extension, SymbolKind::Union, SymbolKind::TypeAlias,
  SymbolKind::Function, SymbolKind::Variable, SymbolKind::Field, SymbolKind::EnumConstant,
  SymbolKind::InstanceMethod, SymbolKind::ClassMethod, SymbolKind::StaticMethod, SymbolKind::InstanceProperty,
  SymbolKind::ClassProperty, SymbolKind::StaticProperty, SymbolKind::Constructor, SymbolKind::Destructor,
  SymbolKind::ConversionFunction, SymbolKind::Parameter, SymbolKind::Using
}
 
enum  SymbolLanguage { SymbolLanguage::C, SymbolLanguage::ObjC, SymbolLanguage::CXX, SymbolLanguage::Swift }
 
enum  SymbolSubKind {
  SymbolSubKind::None, SymbolSubKind::CXXCopyConstructor, SymbolSubKind::CXXMoveConstructor, SymbolSubKind::AccessorGetter,
  SymbolSubKind::AccessorSetter, SymbolSubKind::UsingTypename, SymbolSubKind::UsingValue
}
 Language specific sub-kinds. More...
 
enum  SymbolProperty : uint8_t {
  SymbolProperty::Generic = 1 << 0, SymbolProperty::TemplatePartialSpecialization = 1 << 1, SymbolProperty::TemplateSpecialization = 1 << 2, SymbolProperty::UnitTest = 1 << 3,
  SymbolProperty::IBAnnotated = 1 << 4, SymbolProperty::IBOutletCollection = 1 << 5, SymbolProperty::GKInspectable = 1 << 6, SymbolProperty::Local = 1 << 7
}
 Set of properties that provide additional info about a symbol. More...
 
enum  SymbolRole : uint32_t {
  SymbolRole::Declaration = 1 << 0, SymbolRole::Definition = 1 << 1, SymbolRole::Reference = 1 << 2, SymbolRole::Read = 1 << 3,
  SymbolRole::Write = 1 << 4, SymbolRole::Call = 1 << 5, SymbolRole::Dynamic = 1 << 6, SymbolRole::AddressOf = 1 << 7,
  SymbolRole::Implicit = 1 << 8, SymbolRole::RelationChildOf = 1 << 9, SymbolRole::RelationBaseOf = 1 << 10, SymbolRole::RelationOverrideOf = 1 << 11,
  SymbolRole::RelationReceivedBy = 1 << 12, SymbolRole::RelationCalledBy = 1 << 13, SymbolRole::RelationExtendedBy = 1 << 14, SymbolRole::RelationAccessorOf = 1 << 15,
  SymbolRole::RelationContainedBy = 1 << 16, SymbolRole::RelationIBTypeOf = 1 << 17, SymbolRole::RelationSpecializationOf = 1 << 18
}
 Set of roles that are attributed to symbol occurrences. More...
 

Functions

std::unique_ptr< FrontendActioncreateIndexingAction (std::shared_ptr< IndexDataConsumer > DataConsumer, IndexingOptions Opts, std::unique_ptr< FrontendAction > WrappedAction)
 
void indexASTUnit (ASTUnit &Unit, std::shared_ptr< IndexDataConsumer > DataConsumer, IndexingOptions Opts)
 
void indexTopLevelDecls (ASTContext &Ctx, ArrayRef< const Decl *> Decls, std::shared_ptr< IndexDataConsumer > DataConsumer, IndexingOptions Opts)
 
void indexModuleFile (serialization::ModuleFile &Mod, ASTReader &Reader, std::shared_ptr< IndexDataConsumer > DataConsumer, IndexingOptions Opts)
 
SymbolInfo getSymbolInfo (const Decl *D)
 
bool isFunctionLocalSymbol (const Decl *D)
 
void applyForEachSymbolRole (SymbolRoleSet Roles, llvm::function_ref< void(SymbolRole)> Fn)
 
bool applyForEachSymbolRoleInterruptible (SymbolRoleSet Roles, llvm::function_ref< bool(SymbolRole)> Fn)
 
void printSymbolRoles (SymbolRoleSet Roles, raw_ostream &OS)
 
bool printSymbolName (const Decl *D, const LangOptions &LO, raw_ostream &OS)
 
StringRef getSymbolKindString (SymbolKind K)
 
StringRef getSymbolSubKindString (SymbolSubKind K)
 
StringRef getSymbolLanguageString (SymbolLanguage K)
 
void applyForEachSymbolProperty (SymbolPropertySet Props, llvm::function_ref< void(SymbolProperty)> Fn)
 
void printSymbolProperties (SymbolPropertySet Props, raw_ostream &OS)
 
static StringRef getUSRSpacePrefix ()
 
bool generateUSRForDecl (const Decl *D, SmallVectorImpl< char > &Buf)
 Generate a USR for a Decl, including the USR prefix. More...
 
void generateUSRForObjCClass (StringRef Cls, raw_ostream &OS, StringRef ExtSymbolDefinedIn="", StringRef CategoryContextExtSymbolDefinedIn="")
 Generate a USR fragment for an Objective-C class. More...
 
void generateUSRForObjCCategory (StringRef Cls, StringRef Cat, raw_ostream &OS, StringRef ClsExtSymbolDefinedIn="", StringRef CatExtSymbolDefinedIn="")
 Generate a USR fragment for an Objective-C class category. More...
 
void generateUSRForObjCIvar (StringRef Ivar, raw_ostream &OS)
 Generate a USR fragment for an Objective-C instance variable. More...
 
void generateUSRForObjCMethod (StringRef Sel, bool IsInstanceMethod, raw_ostream &OS)
 Generate a USR fragment for an Objective-C method. More...
 
void generateUSRForObjCProperty (StringRef Prop, bool isClassProp, raw_ostream &OS)
 Generate a USR fragment for an Objective-C property. More...
 
void generateUSRForObjCProtocol (StringRef Prot, raw_ostream &OS, StringRef ExtSymbolDefinedIn="")
 Generate a USR fragment for an Objective-C protocol. More...
 
void generateUSRForGlobalEnum (StringRef EnumName, raw_ostream &OS, StringRef ExtSymbolDefinedIn="")
 Generate USR fragment for a global (non-nested) enum. More...
 
void generateUSRForEnumConstant (StringRef EnumConstantName, raw_ostream &OS)
 Generate a USR fragment for an enum constant. More...
 
bool generateUSRForMacro (const MacroDefinitionRecord *MD, const SourceManager &SM, SmallVectorImpl< char > &Buf)
 Generate a USR for a macro, including the USR prefix. More...
 
bool generateUSRForMacro (StringRef MacroName, SourceLocation Loc, const SourceManager &SM, SmallVectorImpl< char > &Buf)
 

Variables

static const unsigned SymbolPropertyBitNum = 8
 
static const unsigned SymbolRoleBitNum = 19
 

Typedef Documentation

◆ SymbolPropertySet

Definition at line 89 of file IndexSymbol.h.

◆ SymbolRoleSet

typedef unsigned clang::index::SymbolRoleSet

Definition at line 116 of file IndexSymbol.h.

Enumeration Type Documentation

◆ SymbolKind

enum clang::index::SymbolKind : uint8_t
strong
Enumerator
Unknown 
Module 
Namespace 
NamespaceAlias 
Macro 
Enum 
Struct 
Class 
Protocol 
Extension 
Union 
TypeAlias 
Function 
Variable 
Field 
EnumConstant 
InstanceMethod 
ClassMethod 
StaticMethod 
InstanceProperty 
ClassProperty 
StaticProperty 
Constructor 
Destructor 
ConversionFunction 
Parameter 
Using 

Definition at line 23 of file IndexSymbol.h.

◆ SymbolLanguage

Enumerator
ObjC 
CXX 
Swift 

Definition at line 59 of file IndexSymbol.h.

◆ SymbolProperty

enum clang::index::SymbolProperty : uint8_t
strong

Set of properties that provide additional info about a symbol.

Enumerator
Generic 
TemplatePartialSpecialization 
TemplateSpecialization 
UnitTest 
IBAnnotated 
IBOutletCollection 
GKInspectable 
Local 

Definition at line 78 of file IndexSymbol.h.

◆ SymbolRole

enum clang::index::SymbolRole : uint32_t
strong

Set of roles that are attributed to symbol occurrences.

Enumerator
Declaration 
Definition 
Reference 
Read 
Write 
Call 
Dynamic 
AddressOf 
Implicit 
RelationChildOf 
RelationBaseOf 
RelationOverrideOf 
RelationReceivedBy 
RelationCalledBy 
RelationExtendedBy 
RelationAccessorOf 
RelationContainedBy 
RelationIBTypeOf 
RelationSpecializationOf 

Definition at line 92 of file IndexSymbol.h.

◆ SymbolSubKind

Language specific sub-kinds.

Enumerator
None 
CXXCopyConstructor 
CXXMoveConstructor 
AccessorGetter 
AccessorSetter 
UsingTypename 
UsingValue 

Definition at line 67 of file IndexSymbol.h.

Function Documentation

◆ applyForEachSymbolProperty()

void clang::index::applyForEachSymbolProperty ( SymbolPropertySet  Props,
llvm::function_ref< void(SymbolProperty)>  Fn 
)

◆ applyForEachSymbolRole()

void clang::index::applyForEachSymbolRole ( SymbolRoleSet  Roles,
llvm::function_ref< void(SymbolRole)>  Fn 
)

Definition at line 378 of file IndexSymbol.cpp.

References applyForEachSymbolRoleInterruptible().

Referenced by printSymbolRoles().

◆ applyForEachSymbolRoleInterruptible()

bool clang::index::applyForEachSymbolRoleInterruptible ( SymbolRoleSet  Roles,
llvm::function_ref< bool(SymbolRole)>  Fn 
)

◆ createIndexingAction()

std::unique_ptr< FrontendAction > clang::index::createIndexingAction ( std::shared_ptr< IndexDataConsumer DataConsumer,
IndexingOptions  Opts,
std::unique_ptr< FrontendAction WrappedAction 
)
Parameters
WrappedActionanother frontend action to wrap over or null.

Definition at line 155 of file IndexingAction.cpp.

◆ generateUSRForDecl()

bool clang::index::generateUSRForDecl ( const Decl D,
SmallVectorImpl< char > &  Buf 
)

Generate a USR for a Decl, including the USR prefix.

Returns
true if the results should be ignored, false otherwise.

Definition at line 1026 of file USRGeneration.cpp.

Referenced by clang::cross_tu::CrossTranslationUnitContext::getLookupName(), clang::tooling::getUSRForDecl(), and getUSRSpacePrefix().

◆ generateUSRForEnumConstant()

void clang::index::generateUSRForEnumConstant ( StringRef  EnumConstantName,
raw_ostream &  OS 
)

Generate a USR fragment for an enum constant.

Definition at line 1021 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForGlobalEnum()

void clang::index::generateUSRForGlobalEnum ( StringRef  EnumName,
raw_ostream &  OS,
StringRef  ExtSymbolDefinedIn = "" 
)

Generate USR fragment for a global (non-nested) enum.

Definition at line 1014 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForMacro() [1/2]

bool clang::index::generateUSRForMacro ( const MacroDefinitionRecord MD,
const SourceManager SM,
SmallVectorImpl< char > &  Buf 
)

Generate a USR for a macro, including the USR prefix.

Returns
true on error, false on success.

Definition at line 1039 of file USRGeneration.cpp.

References clang::MacroDefinitionRecord::getLocation(), clang::IdentifierInfo::getName(), clang::MacroDefinitionRecord::getName(), and SM.

Referenced by getUSRSpacePrefix().

◆ generateUSRForMacro() [2/2]

bool clang::index::generateUSRForMacro ( StringRef  MacroName,
SourceLocation  Loc,
const SourceManager SM,
SmallVectorImpl< char > &  Buf 
)

◆ generateUSRForObjCCategory()

void clang::index::generateUSRForObjCCategory ( StringRef  Cls,
StringRef  Cat,
raw_ostream &  OS,
StringRef  ClsExtSymbolDefinedIn = "",
StringRef  CatExtSymbolDefinedIn = "" 
)

Generate a USR fragment for an Objective-C class category.

Definition at line 984 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForObjCClass()

void clang::index::generateUSRForObjCClass ( StringRef  Cls,
raw_ostream &  OS,
StringRef  ExtSymbolDefinedIn = "",
StringRef  CategoryContextExtSymbolDefinedIn = "" 
)

Generate a USR fragment for an Objective-C class.

Definition at line 976 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForObjCIvar()

void clang::index::generateUSRForObjCIvar ( StringRef  Ivar,
raw_ostream &  OS 
)

Generate a USR fragment for an Objective-C instance variable.

The complete USR can be created by concatenating the USR for the encompassing class with this USR fragment.

Definition at line 992 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForObjCMethod()

void clang::index::generateUSRForObjCMethod ( StringRef  Sel,
bool  IsInstanceMethod,
raw_ostream &  OS 
)

Generate a USR fragment for an Objective-C method.

Definition at line 996 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForObjCProperty()

void clang::index::generateUSRForObjCProperty ( StringRef  Prop,
bool  isClassProp,
raw_ostream &  OS 
)

Generate a USR fragment for an Objective-C property.

Definition at line 1002 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ generateUSRForObjCProtocol()

void clang::index::generateUSRForObjCProtocol ( StringRef  Prot,
raw_ostream &  OS,
StringRef  ExtSymbolDefinedIn = "" 
)

Generate a USR fragment for an Objective-C protocol.

Definition at line 1007 of file USRGeneration.cpp.

Referenced by getUSRSpacePrefix().

◆ getSymbolInfo()

SymbolInfo clang::index::getSymbolInfo ( const Decl D)

◆ getSymbolKindString()

StringRef clang::index::getSymbolKindString ( SymbolKind  K)

◆ getSymbolLanguageString()

StringRef clang::index::getSymbolLanguageString ( SymbolLanguage  K)

Definition at line 481 of file IndexSymbol.cpp.

References C, CXX, ObjC, and Swift.

◆ getSymbolSubKindString()

StringRef clang::index::getSymbolSubKindString ( SymbolSubKind  K)

◆ getUSRSpacePrefix()

static StringRef clang::index::getUSRSpacePrefix ( )
inlinestatic

◆ indexASTUnit()

void clang::index::indexASTUnit ( ASTUnit Unit,
std::shared_ptr< IndexDataConsumer DataConsumer,
IndexingOptions  Opts 
)

◆ indexModuleFile()

void clang::index::indexModuleFile ( serialization::ModuleFile Mod,
ASTReader Reader,
std::shared_ptr< IndexDataConsumer DataConsumer,
IndexingOptions  Opts 
)

◆ indexTopLevelDecls()

void clang::index::indexTopLevelDecls ( ASTContext Ctx,
ArrayRef< const Decl *>  Decls,
std::shared_ptr< IndexDataConsumer DataConsumer,
IndexingOptions  Opts 
)

◆ isFunctionLocalSymbol()

bool clang::index::isFunctionLocalSymbol ( const Decl D)

◆ printSymbolName()

bool clang::index::printSymbolName ( const Decl D,
const LangOptions LO,
raw_ostream &  OS 
)
Returns
true if no name was printed, false otherwise.

Definition at line 417 of file IndexSymbol.cpp.

References clang::DeclarationName::isEmpty(), clang::DeclarationName::print(), and clang::PrintingPolicy::SuppressTemplateArgsInCXXConstructors.

◆ printSymbolProperties()

void clang::index::printSymbolProperties ( SymbolPropertySet  Props,
raw_ostream &  OS 
)

◆ printSymbolRoles()

void clang::index::printSymbolRoles ( SymbolRoleSet  Roles,
raw_ostream &  OS 
)

Variable Documentation

◆ SymbolPropertyBitNum

const unsigned clang::index::SymbolPropertyBitNum = 8
static

Definition at line 88 of file IndexSymbol.h.

◆ SymbolRoleBitNum

const unsigned clang::index::SymbolRoleBitNum = 19
static

Definition at line 115 of file IndexSymbol.h.