diff --git a/src/clang_symbol_kind.h b/src/clang_symbol_kind.h index eb3df27a..c168ae79 100644 --- a/src/clang_symbol_kind.h +++ b/src/clang_symbol_kind.h @@ -41,8 +41,7 @@ enum class ClangSymbolKind : uint8_t { Parameter = 25, Using, }; -MAKE_REFLECT_TYPE_PROXY(ClangSymbolKind, - std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(ClangSymbolKind); // clang/Basic/Specifiers.h clang::StorageClass enum class StorageClass : uint8_t { @@ -63,7 +62,7 @@ enum class StorageClass : uint8_t { Auto, Register }; -MAKE_REFLECT_TYPE_PROXY(StorageClass, std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(StorageClass); enum class SymbolRole : uint8_t { Declaration = 1 << 0, @@ -75,7 +74,7 @@ enum class SymbolRole : uint8_t { BaseOf = 1 << 5, CalledBy = 1 << 6, }; -MAKE_REFLECT_TYPE_PROXY(SymbolRole, std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(SymbolRole); inline uint8_t operator&(SymbolRole lhs, SymbolRole rhs) { return uint8_t(lhs) & uint8_t(rhs); diff --git a/src/indexer.h b/src/indexer.h index 7ded5c13..3b963201 100644 --- a/src/indexer.h +++ b/src/indexer.h @@ -34,7 +34,7 @@ using namespace std::experimental; // The order matters. In FindSymbolsAtLocation, we want Var/Func ordered in // front of others. enum class SymbolKind : uint8_t { Invalid, File, Type, Func, Var }; -MAKE_REFLECT_TYPE_PROXY(SymbolKind, uint8_t); +MAKE_REFLECT_TYPE_PROXY(SymbolKind); template struct Id { @@ -480,7 +480,7 @@ struct IndexInclude { // a file previously identified as `C`, will be changed to `Cpp` if it // encounters a c++ declaration. enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3 }; -MAKE_REFLECT_TYPE_PROXY(LanguageId, std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(LanguageId); struct IndexFile { IdCache id_cache; diff --git a/src/ipc.h b/src/ipc.h index 91e20957..aaab0055 100644 --- a/src/ipc.h +++ b/src/ipc.h @@ -67,7 +67,7 @@ enum class IpcId : int { CqueryWait, }; MAKE_ENUM_HASHABLE(IpcId) -MAKE_REFLECT_TYPE_PROXY(IpcId, int) +MAKE_REFLECT_TYPE_PROXY(IpcId) const char* IpcIdToString(IpcId id); struct BaseIpcMessage { diff --git a/src/language_server_api.h b/src/language_server_api.h index a0b99f9f..6eb5046f 100644 --- a/src/language_server_api.h +++ b/src/language_server_api.h @@ -199,7 +199,7 @@ enum class lsSymbolKind : int { Boolean = 17, Array = 18 }; -MAKE_REFLECT_TYPE_PROXY(lsSymbolKind, int); +MAKE_REFLECT_TYPE_PROXY(lsSymbolKind); struct lsSymbolInformation { std::string name; @@ -301,7 +301,7 @@ enum class lsInsertTextFormat { // https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md Snippet = 2 }; -MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat, int); +MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat); // The kind of a completion entry. enum class lsCompletionItemKind { @@ -331,7 +331,7 @@ enum class lsCompletionItemKind { Operator = 24, TypeParameter = 25, }; -MAKE_REFLECT_TYPE_PROXY(lsCompletionItemKind, int); +MAKE_REFLECT_TYPE_PROXY(lsCompletionItemKind); struct lsCompletionItem { // A set of function parameters. Used internally for signature help. Not sent @@ -455,7 +455,7 @@ enum class lsDocumentHighlightKind { // Write-access of a symbol, like writing to a variable. Write = 3 }; -MAKE_REFLECT_TYPE_PROXY(lsDocumentHighlightKind, int); +MAKE_REFLECT_TYPE_PROXY(lsDocumentHighlightKind); struct lsFormattingOptions { // Size of a tab in spaces. @@ -487,7 +487,7 @@ enum class lsDiagnosticSeverity { // Reports a hint. Hint = 4 }; -MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity, int); +MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity); struct lsDiagnostic { // The range at which the message applies. @@ -527,7 +527,7 @@ enum class lsErrorCodes { // Defined by the protocol. RequestCancelled = -32800, }; -MAKE_REFLECT_TYPE_PROXY(lsErrorCodes, int); +MAKE_REFLECT_TYPE_PROXY(lsErrorCodes); struct Out_Error : public lsOutMessage { struct lsResponseError { // A number indicating the error type that occurred. @@ -621,7 +621,7 @@ MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, // Show a message to the user. enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 }; -MAKE_REFLECT_TYPE_PROXY(lsMessageType, int) +MAKE_REFLECT_TYPE_PROXY(lsMessageType) struct Out_ShowLogMessageParams { lsMessageType type = lsMessageType::Error; std::string message; diff --git a/src/messages/cquery_call_tree.cc b/src/messages/cquery_call_tree.cc index 06b245c2..fb71005e 100644 --- a/src/messages/cquery_call_tree.cc +++ b/src/messages/cquery_call_tree.cc @@ -39,7 +39,7 @@ struct Out_CqueryCallTree : public lsOutMessage { lsRequestId id; std::vector result; }; -MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int); +MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType); MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry, name, usr, diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 1be67519..6c2c57d3 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -98,7 +98,7 @@ enum class lsTextDocumentSyncKind { // send. Incremental = 2 }; -MAKE_REFLECT_TYPE_PROXY(lsTextDocumentSyncKind, int) +MAKE_REFLECT_TYPE_PROXY(lsTextDocumentSyncKind) struct lsTextDocumentSyncOptions { // Open and close notifications are sent to the server. diff --git a/src/messages/text_document_completion.cc b/src/messages/text_document_completion.cc index 681d4b54..1286e511 100644 --- a/src/messages/text_document_completion.cc +++ b/src/messages/text_document_completion.cc @@ -22,8 +22,7 @@ enum class lsCompletionTriggerKind { // the `triggerCharacters` properties of the `CompletionRegistrationOptions`. TriggerCharacter = 2 }; -MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind, - std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind); // Contains additional information about the context in which a completion // request is triggered. diff --git a/src/messages/workspace_did_change_watched_files.cc b/src/messages/workspace_did_change_watched_files.cc index 80003af4..671676e2 100644 --- a/src/messages/workspace_did_change_watched_files.cc +++ b/src/messages/workspace_did_change_watched_files.cc @@ -12,8 +12,7 @@ enum class lsFileChangeType { Changed = 2, Deleted = 3, }; -MAKE_REFLECT_TYPE_PROXY(lsFileChangeType, - std::underlying_type::type); +MAKE_REFLECT_TYPE_PROXY(lsFileChangeType); struct lsFileEvent { lsDocumentUri uri; diff --git a/src/serializer.h b/src/serializer.h index d81e4f18..92f9c8ee 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -78,8 +78,9 @@ struct IndexFile; #define REFLECT_MEMBER(name) ReflectMember(visitor, #name, value.name) #define REFLECT_MEMBER2(name, value) ReflectMember(visitor, name, value) -// TODO Make it inline because this macro can be used in header files. -#define MAKE_REFLECT_TYPE_PROXY(type, as_type) \ +#define MAKE_REFLECT_TYPE_PROXY(type_name) \ + MAKE_REFLECT_TYPE_PROXY2(type_name, std::underlying_type::type) +#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \ ATTRIBUTE_UNUSED inline void Reflect(Reader& visitor, type& value) { \ as_type value0; \ ::Reflect(visitor, value0); \