diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /include/clang/Index/IndexSymbol.h | |
parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
download | src-2b6b257f4e5503a7a2675bdb8735693db769f75c.tar.gz src-2b6b257f4e5503a7a2675bdb8735693db769f75c.zip |
Vendor import of clang release_39 branch r276489:vendor/clang/clang-release_39-r276489
Notes
Notes:
svn path=/vendor/clang/dist/; revision=303233
svn path=/vendor/clang/clang-release_39-r276489/; revision=303234; tag=vendor/clang/clang-release_39-r276489
Diffstat (limited to 'include/clang/Index/IndexSymbol.h')
-rw-r--r-- | include/clang/Index/IndexSymbol.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/include/clang/Index/IndexSymbol.h b/include/clang/Index/IndexSymbol.h new file mode 100644 index 000000000000..b0bc93e464b4 --- /dev/null +++ b/include/clang/Index/IndexSymbol.h @@ -0,0 +1,129 @@ +//===--- IndexSymbol.h - Types and functions for indexing symbols ---------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_INDEX_INDEXSYMBOL_H +#define LLVM_CLANG_INDEX_INDEXSYMBOL_H + +#include "clang/Basic/LLVM.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/DataTypes.h" + +namespace clang { + class Decl; + class LangOptions; + +namespace index { + +enum class SymbolKind : uint8_t { + 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, +}; + +enum class SymbolLanguage { + C, + ObjC, + CXX, +}; + +enum class SymbolSubKind : uint8_t { + Generic = 1 << 0, + TemplatePartialSpecialization = 1 << 1, + TemplateSpecialization = 1 << 2, + UnitTest = 1 << 3, + IBAnnotated = 1 << 4, + IBOutletCollection = 1 << 5, +}; +static const unsigned SymbolSubKindBitNum = 6; +typedef unsigned SymbolSubKindSet; + +/// Set of roles that are attributed to symbol occurrences. +enum class SymbolRole : uint16_t { + Declaration = 1 << 0, + Definition = 1 << 1, + Reference = 1 << 2, + Read = 1 << 3, + Write = 1 << 4, + Call = 1 << 5, + Dynamic = 1 << 6, + AddressOf = 1 << 7, + Implicit = 1 << 8, + + // Relation roles. + RelationChildOf = 1 << 9, + RelationBaseOf = 1 << 10, + RelationOverrideOf = 1 << 11, + RelationReceivedBy = 1 << 12, + RelationCalledBy = 1 << 13, +}; +static const unsigned SymbolRoleBitNum = 14; +typedef unsigned SymbolRoleSet; + +/// Represents a relation to another symbol for a symbol occurrence. +struct SymbolRelation { + SymbolRoleSet Roles; + const Decl *RelatedSymbol; + + SymbolRelation(SymbolRoleSet Roles, const Decl *Sym) + : Roles(Roles), RelatedSymbol(Sym) {} +}; + +struct SymbolInfo { + SymbolKind Kind; + SymbolSubKindSet SubKinds; + SymbolLanguage Lang; +}; + +SymbolInfo getSymbolInfo(const Decl *D); + +void applyForEachSymbolRole(SymbolRoleSet Roles, + llvm::function_ref<void(SymbolRole)> Fn); +void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS); + +/// \returns true if no name was printed, false otherwise. +bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS); + +StringRef getSymbolKindString(SymbolKind K); +StringRef getSymbolLanguageString(SymbolLanguage K); + +void applyForEachSymbolSubKind(SymbolSubKindSet SubKinds, + llvm::function_ref<void(SymbolSubKind)> Fn); +void printSymbolSubKinds(SymbolSubKindSet SubKinds, raw_ostream &OS); + +} // namespace index +} // namespace clang + +#endif |