Add mnemonic constants to ClangSymbolKind

This commit is contained in:
Fangrui Song 2018-01-07 16:06:01 -08:00
parent d49679d885
commit 4e6c585e59
3 changed files with 20 additions and 10 deletions

View File

@ -77,17 +77,17 @@ using IndexVarId = Id<IndexVar>;
struct IdCache;
// TODO Rename query.h:SymbolKind to another name; change int16_t to uint8_t
// TODO Rename query.h:SymbolKind to another name
// clang/Index/IndexSymbol.h clang::index::SymbolKind
enum class ClangSymbolKind : int16_t {
enum class ClangSymbolKind : uint8_t {
Unknown,
Module,
Module = 1,
Namespace,
NamespaceAlias,
Macro,
Enum,
Enum = 5,
Struct,
Class,
Protocol,
@ -95,23 +95,23 @@ enum class ClangSymbolKind : int16_t {
Union,
TypeAlias,
Function,
Function = 12,
Variable,
Field,
EnumConstant,
InstanceMethod,
InstanceMethod = 16,
ClassMethod,
StaticMethod,
InstanceProperty,
ClassProperty,
StaticProperty,
Constructor,
Constructor = 22,
Destructor,
ConversionFunction,
Parameter,
Parameter = 25,
Using,
};
MAKE_REFLECT_TYPE_PROXY(ClangSymbolKind, std::underlying_type<ClangSymbolKind>::type);

View File

@ -20,10 +20,17 @@ std::string GetBaseName(const std::string& path) {
} // namespace
// uint8_t
void Reflect(Reader& visitor, uint8_t& value) {
value = (uint8_t)visitor.GetInt();
}
void Reflect(Writer& visitor, uint8_t& value) {
visitor.Int(value);
}
// int16_t
void Reflect(Reader& visitor, int16_t& value) {
if (visitor.IsInt())
value = (int16_t)visitor.GetInt();
value = (int16_t)visitor.GetInt();
}
void Reflect(Writer& visitor, int16_t& value) {
visitor.Int(value);

View File

@ -131,6 +131,9 @@ void ReflectMemberEnd(TVisitor& visitor, T& value) {
}
*/
// uint8_t
void Reflect(Reader& visitor, uint8_t& value);
void Reflect(Writer& visitor, uint8_t& value);
// int16_t
void Reflect(Reader& visitor, int16_t& value);
void Reflect(Writer& visitor, int16_t& value);