mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Simplify MAKE_REFLECT_TYPE_PROXY
This commit is contained in:
parent
a392301be3
commit
7579d71b85
@ -41,8 +41,7 @@ enum class ClangSymbolKind : uint8_t {
|
||||
Parameter = 25,
|
||||
Using,
|
||||
};
|
||||
MAKE_REFLECT_TYPE_PROXY(ClangSymbolKind,
|
||||
std::underlying_type<ClangSymbolKind>::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<StorageClass>::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<SymbolRole>::type);
|
||||
MAKE_REFLECT_TYPE_PROXY(SymbolRole);
|
||||
|
||||
inline uint8_t operator&(SymbolRole lhs, SymbolRole rhs) {
|
||||
return uint8_t(lhs) & uint8_t(rhs);
|
||||
|
@ -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 <typename T>
|
||||
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<LanguageId>::type);
|
||||
MAKE_REFLECT_TYPE_PROXY(LanguageId);
|
||||
|
||||
struct IndexFile {
|
||||
IdCache id_cache;
|
||||
|
@ -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 {
|
||||
|
@ -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<Out_Error> {
|
||||
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;
|
||||
|
@ -39,7 +39,7 @@ struct Out_CqueryCallTree : public lsOutMessage<Out_CqueryCallTree> {
|
||||
lsRequestId id;
|
||||
std::vector<CallEntry> result;
|
||||
};
|
||||
MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int);
|
||||
MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType);
|
||||
MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
|
||||
name,
|
||||
usr,
|
||||
|
@ -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.
|
||||
|
@ -22,8 +22,7 @@ enum class lsCompletionTriggerKind {
|
||||
// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
|
||||
TriggerCharacter = 2
|
||||
};
|
||||
MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind,
|
||||
std::underlying_type<lsCompletionTriggerKind>::type);
|
||||
MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind);
|
||||
|
||||
// Contains additional information about the context in which a completion
|
||||
// request is triggered.
|
||||
|
@ -12,8 +12,7 @@ enum class lsFileChangeType {
|
||||
Changed = 2,
|
||||
Deleted = 3,
|
||||
};
|
||||
MAKE_REFLECT_TYPE_PROXY(lsFileChangeType,
|
||||
std::underlying_type<lsFileChangeType>::type);
|
||||
MAKE_REFLECT_TYPE_PROXY(lsFileChangeType);
|
||||
|
||||
struct lsFileEvent {
|
||||
lsDocumentUri uri;
|
||||
|
@ -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_name>::type)
|
||||
#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \
|
||||
ATTRIBUTE_UNUSED inline void Reflect(Reader& visitor, type& value) { \
|
||||
as_type value0; \
|
||||
::Reflect(visitor, value0); \
|
||||
|
Loading…
Reference in New Issue
Block a user