Move src/messages/*.cc to anonymous namespace

This commit is contained in:
Jacob Dufault 2017-12-05 21:03:38 -08:00
parent b65a30c3f7
commit 7a5eb3c4d5
29 changed files with 62 additions and 11 deletions

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryBase : public IpcMessage<Ipc_CqueryBase> { struct Ipc_CqueryBase : public IpcMessage<Ipc_CqueryBase> {
const static IpcId kIpcId = IpcId::CqueryBase; const static IpcId kIpcId = IpcId::CqueryBase;
lsRequestId id; lsRequestId id;
@ -48,3 +49,4 @@ struct CqueryBaseHandler : BaseMessageHandler<Ipc_CqueryBase> {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryBaseHandler); REGISTER_MESSAGE_HANDLER(CqueryBaseHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryCallTreeInitial struct Ipc_CqueryCallTreeInitial
: public IpcMessage<Ipc_CqueryCallTreeInitial> { : public IpcMessage<Ipc_CqueryCallTreeInitial> {
const static IpcId kIpcId = IpcId::CqueryCallTreeInitial; const static IpcId kIpcId = IpcId::CqueryCallTreeInitial;
@ -215,3 +216,4 @@ struct CqueryCallTreeExpandHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryCallTreeExpandHandler); REGISTER_MESSAGE_HANDLER(CqueryCallTreeExpandHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryCallers : public IpcMessage<Ipc_CqueryCallers> { struct Ipc_CqueryCallers : public IpcMessage<Ipc_CqueryCallers> {
const static IpcId kIpcId = IpcId::CqueryCallers; const static IpcId kIpcId = IpcId::CqueryCallers;
lsRequestId id; lsRequestId id;
@ -40,3 +41,4 @@ struct CqueryCallersHandler : BaseMessageHandler<Ipc_CqueryCallers> {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryCallersHandler); REGISTER_MESSAGE_HANDLER(CqueryCallersHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryDerived : public IpcMessage<Ipc_CqueryDerived> { struct Ipc_CqueryDerived : public IpcMessage<Ipc_CqueryDerived> {
const static IpcId kIpcId = IpcId::CqueryDerived; const static IpcId kIpcId = IpcId::CqueryDerived;
lsRequestId id; lsRequestId id;
@ -40,3 +41,4 @@ struct CqueryDerivedHandler : BaseMessageHandler<Ipc_CqueryDerived> {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler); REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h" #include "message_handler.h"
namespace {
struct Ipc_CqueryTextDocumentDidView struct Ipc_CqueryTextDocumentDidView
: public IpcMessage<Ipc_CqueryTextDocumentDidView> { : public IpcMessage<Ipc_CqueryTextDocumentDidView> {
struct Params { struct Params {
@ -33,3 +34,4 @@ struct CqueryDidViewHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryDidViewHandler); REGISTER_MESSAGE_HANDLER(CqueryDidViewHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_CqueryExitWhenIdle : public IpcMessage<Ipc_CqueryExitWhenIdle> { struct Ipc_CqueryExitWhenIdle : public IpcMessage<Ipc_CqueryExitWhenIdle> {
static constexpr IpcId kIpcId = IpcId::CqueryExitWhenIdle; static constexpr IpcId kIpcId = IpcId::CqueryExitWhenIdle;
}; };
@ -17,3 +18,4 @@ struct CqueryExitWhenIdleHandler : MessageHandler {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler); REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_CqueryFreshenIndex : public IpcMessage<Ipc_CqueryFreshenIndex> { struct Ipc_CqueryFreshenIndex : public IpcMessage<Ipc_CqueryFreshenIndex> {
const static IpcId kIpcId = IpcId::CqueryFreshenIndex; const static IpcId kIpcId = IpcId::CqueryFreshenIndex;
lsRequestId id; lsRequestId id;
@ -49,3 +50,4 @@ struct CqueryFreshenIndexHandler : MessageHandler {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryFreshenIndexHandler); REGISTER_MESSAGE_HANDLER(CqueryFreshenIndexHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "platform.h" #include "platform.h"
namespace {
struct Ipc_CqueryIndexFile : public IpcMessage<Ipc_CqueryIndexFile> { struct Ipc_CqueryIndexFile : public IpcMessage<Ipc_CqueryIndexFile> {
static constexpr IpcId kIpcId = IpcId::CqueryIndexFile; static constexpr IpcId kIpcId = IpcId::CqueryIndexFile;
@ -28,3 +29,4 @@ struct CqueryIndexFileHandler : BaseMessageHandler<Ipc_CqueryIndexFile> {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryIndexFileHandler); REGISTER_MESSAGE_HANDLER(CqueryIndexFileHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_CqueryQueryDbWaitForIdleIndexer struct Ipc_CqueryQueryDbWaitForIdleIndexer
: public IpcMessage<Ipc_CqueryQueryDbWaitForIdleIndexer> { : public IpcMessage<Ipc_CqueryQueryDbWaitForIdleIndexer> {
static constexpr IpcId kIpcId = IpcId::CqueryQueryDbWaitForIdleIndexer; static constexpr IpcId kIpcId = IpcId::CqueryQueryDbWaitForIdleIndexer;
@ -37,3 +38,4 @@ struct CqueryQueryDbWaitForIdleIndexerHandler : MessageHandler {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler); REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryTypeHierarchyTree struct Ipc_CqueryTypeHierarchyTree
: public IpcMessage<Ipc_CqueryTypeHierarchyTree> { : public IpcMessage<Ipc_CqueryTypeHierarchyTree> {
const static IpcId kIpcId = IpcId::CqueryTypeHierarchyTree; const static IpcId kIpcId = IpcId::CqueryTypeHierarchyTree;
@ -189,3 +190,4 @@ struct CqueryTypeHierarchyTreeHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler); REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_CqueryVars : public IpcMessage<Ipc_CqueryVars> { struct Ipc_CqueryVars : public IpcMessage<Ipc_CqueryVars> {
const static IpcId kIpcId = IpcId::CqueryVars; const static IpcId kIpcId = IpcId::CqueryVars;
lsRequestId id; lsRequestId id;
@ -35,3 +36,4 @@ struct CqueryVarsHandler : BaseMessageHandler<Ipc_CqueryVars> {
} }
}; };
REGISTER_MESSAGE_HANDLER(CqueryVarsHandler); REGISTER_MESSAGE_HANDLER(CqueryVarsHandler);
} // namespace

View File

@ -2,6 +2,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_Exit : public IpcMessage<Ipc_Exit> { struct Ipc_Exit : public IpcMessage<Ipc_Exit> {
static const IpcId kIpcId = IpcId::Exit; static const IpcId kIpcId = IpcId::Exit;
}; };
@ -17,3 +18,4 @@ struct ExitHandler : MessageHandler {
} }
}; };
REGISTER_MESSAGE_HANDLER(ExitHandler); REGISTER_MESSAGE_HANDLER(ExitHandler);
} // namespace

View File

@ -5,6 +5,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_InitializeRequest : public IpcMessage<Ipc_InitializeRequest> { struct Ipc_InitializeRequest : public IpcMessage<Ipc_InitializeRequest> {
const static IpcId kIpcId = IpcId::Initialize; const static IpcId kIpcId = IpcId::Initialize;
@ -202,3 +203,4 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
} }
}; };
REGISTER_MESSAGE_HANDLER(InitializeHandler); REGISTER_MESSAGE_HANDLER(InitializeHandler);
} // namespace

View File

@ -247,8 +247,6 @@ optional<lsTextEdit> BuildAutoImplementForFunction(QueryDatabase* db,
return nullopt; return nullopt;
} }
} // namespace
struct Ipc_TextDocumentCodeAction struct Ipc_TextDocumentCodeAction
: public IpcMessage<Ipc_TextDocumentCodeAction> { : public IpcMessage<Ipc_TextDocumentCodeAction> {
const static IpcId kIpcId = IpcId::TextDocumentCodeAction; const static IpcId kIpcId = IpcId::TextDocumentCodeAction;
@ -593,3 +591,4 @@ TEST_SUITE("FindIncludeLine") {
REQUIRE(FindIncludeLine(lines, "#include <e>") == 7); REQUIRE(FindIncludeLine(lines, "#include <e>") == 7);
} }
} }
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct lsDocumentCodeLensParams { struct lsDocumentCodeLensParams {
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
}; };
@ -252,3 +253,4 @@ struct TextDocumentCodeLensHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentCodeLensHandler); REGISTER_MESSAGE_HANDLER(TextDocumentCodeLensHandler);
} // namespace

View File

@ -7,7 +7,6 @@ void PushBack(NonElidedVector<lsLocation>* result,
if (location) if (location)
result->push_back(*location); result->push_back(*location);
} }
} // namespace
struct Ipc_TextDocumentDefinition struct Ipc_TextDocumentDefinition
: public IpcMessage<Ipc_TextDocumentDefinition> { : public IpcMessage<Ipc_TextDocumentDefinition> {
@ -112,3 +111,4 @@ struct TextDocumentDefinitionHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDefinitionHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDefinitionHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h" #include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidChange struct Ipc_TextDocumentDidChange
: public IpcMessage<Ipc_TextDocumentDidChange> { : public IpcMessage<Ipc_TextDocumentDidChange> {
const static IpcId kIpcId = IpcId::TextDocumentDidChange; const static IpcId kIpcId = IpcId::TextDocumentDidChange;
@ -20,3 +21,4 @@ struct TextDocumentDidChangeHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDidChangeHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDidChangeHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h" #include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidClose : public IpcMessage<Ipc_TextDocumentDidClose> { struct Ipc_TextDocumentDidClose : public IpcMessage<Ipc_TextDocumentDidClose> {
struct Params { struct Params {
lsTextDocumentItem textDocument; lsTextDocumentItem textDocument;
@ -28,3 +29,4 @@ struct TextDocumentDidCloseHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDidCloseHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDidCloseHandler);
} // namespace

View File

@ -2,6 +2,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "timer.h" #include "timer.h"
namespace {
// Open, view, change, close file // Open, view, change, close file
struct Ipc_TextDocumentDidOpen : public IpcMessage<Ipc_TextDocumentDidOpen> { struct Ipc_TextDocumentDidOpen : public IpcMessage<Ipc_TextDocumentDidOpen> {
struct Params { struct Params {
@ -53,3 +54,4 @@ struct TextDocumentDidOpenHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDidOpenHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDidOpenHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h" #include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> { struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> {
struct Params { struct Params {
// The document that was saved. // The document that was saved.
@ -42,3 +43,4 @@ struct TextDocumentDidSaveHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDidSaveHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDidSaveHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_TextDocumentDocumentLink struct Ipc_TextDocumentDocumentLink
: public IpcMessage<Ipc_TextDocumentDocumentLink> { : public IpcMessage<Ipc_TextDocumentDocumentLink> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentLink; const static IpcId kIpcId = IpcId::TextDocumentDocumentLink;
@ -83,3 +84,4 @@ struct TextDocumentDocumentLinkHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentLinkHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDocumentLinkHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct lsDocumentSymbolParams { struct lsDocumentSymbolParams {
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
}; };
@ -52,3 +53,4 @@ struct TextDocumentDocumentSymbolHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentSymbolHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDocumentSymbolHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_TextDocumentDocumentHighlight struct Ipc_TextDocumentDocumentHighlight
: public IpcMessage<Ipc_TextDocumentDocumentHighlight> { : public IpcMessage<Ipc_TextDocumentDocumentHighlight> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight; const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight;
@ -61,3 +62,4 @@ struct TextDocumentDocumentHighlightHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentHighlightHandler); REGISTER_MESSAGE_HANDLER(TextDocumentDocumentHighlightHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_TextDocumentHover : public IpcMessage<Ipc_TextDocumentHover> { struct Ipc_TextDocumentHover : public IpcMessage<Ipc_TextDocumentHover> {
const static IpcId kIpcId = IpcId::TextDocumentHover; const static IpcId kIpcId = IpcId::TextDocumentHover;
@ -55,3 +56,4 @@ struct TextDocumentHoverHandler : BaseMessageHandler<Ipc_TextDocumentHover> {
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentHoverHandler); REGISTER_MESSAGE_HANDLER(TextDocumentHoverHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct Ipc_TextDocumentReferences struct Ipc_TextDocumentReferences
: public IpcMessage<Ipc_TextDocumentReferences> { : public IpcMessage<Ipc_TextDocumentReferences> {
struct lsReferenceContext { struct lsReferenceContext {
@ -78,3 +79,4 @@ struct TextDocumentReferencesHandler
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentReferencesHandler); REGISTER_MESSAGE_HANDLER(TextDocumentReferencesHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "query_utils.h" #include "query_utils.h"
namespace {
struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> { struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> {
struct Params { struct Params {
// The document to format. // The document to format.
@ -61,3 +62,4 @@ struct TextDocumentRenameHandler : BaseMessageHandler<Ipc_TextDocumentRename> {
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentRenameHandler); REGISTER_MESSAGE_HANDLER(TextDocumentRenameHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h" #include "message_handler.h"
#include "timer.h" #include "timer.h"
namespace {
struct Ipc_TextDocumentSignatureHelp struct Ipc_TextDocumentSignatureHelp
: public IpcMessage<Ipc_TextDocumentSignatureHelp> { : public IpcMessage<Ipc_TextDocumentSignatureHelp> {
const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp; const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp;
@ -161,3 +162,4 @@ struct TextDocumentSignatureHelpHandler : MessageHandler {
} }
}; };
REGISTER_MESSAGE_HANDLER(TextDocumentSignatureHelpHandler); REGISTER_MESSAGE_HANDLER(TextDocumentSignatureHelpHandler);
} // namespace

View File

@ -4,6 +4,7 @@
#include <loguru.hpp> #include <loguru.hpp>
namespace {
struct lsWorkspaceSymbolParams { struct lsWorkspaceSymbolParams {
std::string query; std::string query;
}; };
@ -73,3 +74,4 @@ struct WorkspaceSymbolHandler : BaseMessageHandler<Ipc_WorkspaceSymbol> {
} }
}; };
REGISTER_MESSAGE_HANDLER(WorkspaceSymbolHandler); REGISTER_MESSAGE_HANDLER(WorkspaceSymbolHandler);
} // namespace

View File

@ -31,7 +31,7 @@ struct IndexFile;
template <typename TVisitor> \ template <typename TVisitor> \
void Reflect(TVisitor& visitor, type& value) { \ void Reflect(TVisitor& visitor, type& value) { \
auto value0 = static_cast<as_type>(value); \ auto value0 = static_cast<as_type>(value); \
Reflect(visitor, value0); \ ::Reflect(visitor, value0); \
value = static_cast<type>(value0); \ value = static_cast<type>(value0); \
} }