From 7a5eb3c4d51fba053c96d7a3ea24df778fb00303 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Tue, 5 Dec 2017 21:03:38 -0800 Subject: [PATCH] Move src/messages/*.cc to anonymous namespace --- src/messages/cquery_base.cc | 4 +++- src/messages/cquery_call_tree.cc | 2 ++ src/messages/cquery_callers.cc | 4 +++- src/messages/cquery_derived.cc | 4 +++- src/messages/cquery_did_view.cc | 2 ++ src/messages/cquery_exit_when_idle.cc | 4 +++- src/messages/cquery_freshen_index.cc | 2 ++ src/messages/cquery_index_file.cc | 2 ++ src/messages/cquery_querydb_wait_for_idle_indexer.cc | 4 +++- src/messages/cquery_type_hierarchy_tree.cc | 4 +++- src/messages/cquery_vars.cc | 4 +++- src/messages/exit.cc | 2 ++ src/messages/initialize.cc | 2 ++ src/messages/text_document_code_action.cc | 3 +-- src/messages/text_document_code_lens.cc | 2 ++ src/messages/text_document_definition.cc | 2 +- src/messages/text_document_did_change.cc | 2 ++ src/messages/text_document_did_close.cc | 2 ++ src/messages/text_document_did_open.cc | 2 ++ src/messages/text_document_did_save.cc | 2 ++ src/messages/text_document_document_link.cc | 2 ++ src/messages/text_document_document_symbol.cc | 2 ++ src/messages/text_document_highlight.cc | 2 ++ src/messages/text_document_hover.cc | 2 ++ src/messages/text_document_references.cc | 2 ++ src/messages/text_document_rename.cc | 2 ++ src/messages/text_document_signature_help.cc | 2 ++ src/messages/workspace_symbol.cc | 2 ++ src/serializer.h | 2 +- 29 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/messages/cquery_base.cc b/src/messages/cquery_base.cc index 2a363685..7f566127 100644 --- a/src/messages/cquery_base.cc +++ b/src/messages/cquery_base.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryBase : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryBase; lsRequestId id; @@ -47,4 +48,5 @@ struct CqueryBaseHandler : BaseMessageHandler { IpcManager::WriteStdout(IpcId::CqueryBase, out); } }; -REGISTER_MESSAGE_HANDLER(CqueryBaseHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryBaseHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_call_tree.cc b/src/messages/cquery_call_tree.cc index d513dc3d..abf2f920 100644 --- a/src/messages/cquery_call_tree.cc +++ b/src/messages/cquery_call_tree.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryCallTreeInitial : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryCallTreeInitial; @@ -215,3 +216,4 @@ struct CqueryCallTreeExpandHandler } }; REGISTER_MESSAGE_HANDLER(CqueryCallTreeExpandHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_callers.cc b/src/messages/cquery_callers.cc index 5cfed4ae..219e54a9 100644 --- a/src/messages/cquery_callers.cc +++ b/src/messages/cquery_callers.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryCallers : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryCallers; lsRequestId id; @@ -39,4 +40,5 @@ struct CqueryCallersHandler : BaseMessageHandler { IpcManager::WriteStdout(IpcId::CqueryCallers, out); } }; -REGISTER_MESSAGE_HANDLER(CqueryCallersHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryCallersHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_derived.cc b/src/messages/cquery_derived.cc index 3fcbc3c3..3c1976df 100644 --- a/src/messages/cquery_derived.cc +++ b/src/messages/cquery_derived.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryDerived : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryDerived; lsRequestId id; @@ -39,4 +40,5 @@ struct CqueryDerivedHandler : BaseMessageHandler { IpcManager::WriteStdout(IpcId::CqueryDerived, out); } }; -REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_did_view.cc b/src/messages/cquery_did_view.cc index 4b275d55..f0f1f185 100644 --- a/src/messages/cquery_did_view.cc +++ b/src/messages/cquery_did_view.cc @@ -1,5 +1,6 @@ #include "message_handler.h" +namespace { struct Ipc_CqueryTextDocumentDidView : public IpcMessage { struct Params { @@ -33,3 +34,4 @@ struct CqueryDidViewHandler } }; REGISTER_MESSAGE_HANDLER(CqueryDidViewHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_exit_when_idle.cc b/src/messages/cquery_exit_when_idle.cc index 83c0ddc3..cc207ff6 100644 --- a/src/messages/cquery_exit_when_idle.cc +++ b/src/messages/cquery_exit_when_idle.cc @@ -3,6 +3,7 @@ #include +namespace { struct Ipc_CqueryExitWhenIdle : public IpcMessage { static constexpr IpcId kIpcId = IpcId::CqueryExitWhenIdle; }; @@ -16,4 +17,5 @@ struct CqueryExitWhenIdleHandler : MessageHandler { WorkThread::request_exit_on_idle = true; } }; -REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_freshen_index.cc b/src/messages/cquery_freshen_index.cc index 15012256..8c8308e8 100644 --- a/src/messages/cquery_freshen_index.cc +++ b/src/messages/cquery_freshen_index.cc @@ -3,6 +3,7 @@ #include +namespace { struct Ipc_CqueryFreshenIndex : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryFreshenIndex; lsRequestId id; @@ -49,3 +50,4 @@ struct CqueryFreshenIndexHandler : MessageHandler { } }; REGISTER_MESSAGE_HANDLER(CqueryFreshenIndexHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_index_file.cc b/src/messages/cquery_index_file.cc index ed5743b9..fa86b67a 100644 --- a/src/messages/cquery_index_file.cc +++ b/src/messages/cquery_index_file.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "platform.h" +namespace { struct Ipc_CqueryIndexFile : public IpcMessage { static constexpr IpcId kIpcId = IpcId::CqueryIndexFile; @@ -28,3 +29,4 @@ struct CqueryIndexFileHandler : BaseMessageHandler { } }; REGISTER_MESSAGE_HANDLER(CqueryIndexFileHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_querydb_wait_for_idle_indexer.cc b/src/messages/cquery_querydb_wait_for_idle_indexer.cc index 58b79995..9ede93b7 100644 --- a/src/messages/cquery_querydb_wait_for_idle_indexer.cc +++ b/src/messages/cquery_querydb_wait_for_idle_indexer.cc @@ -3,6 +3,7 @@ #include +namespace { struct Ipc_CqueryQueryDbWaitForIdleIndexer : public IpcMessage { static constexpr IpcId kIpcId = IpcId::CqueryQueryDbWaitForIdleIndexer; @@ -36,4 +37,5 @@ struct CqueryQueryDbWaitForIdleIndexerHandler : MessageHandler { LOG_S(INFO) << "Done waiting for idle"; } }; -REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_type_hierarchy_tree.cc b/src/messages/cquery_type_hierarchy_tree.cc index 2707ce2f..43e632a2 100644 --- a/src/messages/cquery_type_hierarchy_tree.cc +++ b/src/messages/cquery_type_hierarchy_tree.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryTypeHierarchyTree : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryTypeHierarchyTree; @@ -188,4 +189,5 @@ struct CqueryTypeHierarchyTreeHandler IpcManager::WriteStdout(IpcId::CqueryTypeHierarchyTree, out); } }; -REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/cquery_vars.cc b/src/messages/cquery_vars.cc index 6d72bce3..08490c1a 100644 --- a/src/messages/cquery_vars.cc +++ b/src/messages/cquery_vars.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_CqueryVars : public IpcMessage { const static IpcId kIpcId = IpcId::CqueryVars; lsRequestId id; @@ -34,4 +35,5 @@ struct CqueryVarsHandler : BaseMessageHandler { IpcManager::WriteStdout(IpcId::CqueryVars, out); } }; -REGISTER_MESSAGE_HANDLER(CqueryVarsHandler); \ No newline at end of file +REGISTER_MESSAGE_HANDLER(CqueryVarsHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/exit.cc b/src/messages/exit.cc index 64eb65a5..603c8f2c 100644 --- a/src/messages/exit.cc +++ b/src/messages/exit.cc @@ -2,6 +2,7 @@ #include +namespace { struct Ipc_Exit : public IpcMessage { static const IpcId kIpcId = IpcId::Exit; }; @@ -17,3 +18,4 @@ struct ExitHandler : MessageHandler { } }; REGISTER_MESSAGE_HANDLER(ExitHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 2f53fcc9..74db461f 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -5,6 +5,7 @@ #include +namespace { struct Ipc_InitializeRequest : public IpcMessage { const static IpcId kIpcId = IpcId::Initialize; @@ -202,3 +203,4 @@ struct InitializeHandler : BaseMessageHandler { } }; REGISTER_MESSAGE_HANDLER(InitializeHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_code_action.cc b/src/messages/text_document_code_action.cc index b31ddf09..c1ce2274 100644 --- a/src/messages/text_document_code_action.cc +++ b/src/messages/text_document_code_action.cc @@ -247,8 +247,6 @@ optional BuildAutoImplementForFunction(QueryDatabase* db, return nullopt; } -} // namespace - struct Ipc_TextDocumentCodeAction : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentCodeAction; @@ -593,3 +591,4 @@ TEST_SUITE("FindIncludeLine") { REQUIRE(FindIncludeLine(lines, "#include ") == 7); } } +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_code_lens.cc b/src/messages/text_document_code_lens.cc index 4ba17009..89b80c5c 100644 --- a/src/messages/text_document_code_lens.cc +++ b/src/messages/text_document_code_lens.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct lsDocumentCodeLensParams { lsTextDocumentIdentifier textDocument; }; @@ -252,3 +253,4 @@ struct TextDocumentCodeLensHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentCodeLensHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_definition.cc b/src/messages/text_document_definition.cc index 27b7baee..d2303eda 100644 --- a/src/messages/text_document_definition.cc +++ b/src/messages/text_document_definition.cc @@ -7,7 +7,6 @@ void PushBack(NonElidedVector* result, if (location) result->push_back(*location); } -} // namespace struct Ipc_TextDocumentDefinition : public IpcMessage { @@ -112,3 +111,4 @@ struct TextDocumentDefinitionHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDefinitionHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_did_change.cc b/src/messages/text_document_did_change.cc index ad39e427..b792a54a 100644 --- a/src/messages/text_document_did_change.cc +++ b/src/messages/text_document_did_change.cc @@ -1,5 +1,6 @@ #include "message_handler.h" +namespace { struct Ipc_TextDocumentDidChange : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentDidChange; @@ -20,3 +21,4 @@ struct TextDocumentDidChangeHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDidChangeHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_did_close.cc b/src/messages/text_document_did_close.cc index 9e63e9d3..5ec49df4 100644 --- a/src/messages/text_document_did_close.cc +++ b/src/messages/text_document_did_close.cc @@ -1,5 +1,6 @@ #include "message_handler.h" +namespace { struct Ipc_TextDocumentDidClose : public IpcMessage { struct Params { lsTextDocumentItem textDocument; @@ -28,3 +29,4 @@ struct TextDocumentDidCloseHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDidCloseHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_did_open.cc b/src/messages/text_document_did_open.cc index d5c28ca3..9ef63f2f 100644 --- a/src/messages/text_document_did_open.cc +++ b/src/messages/text_document_did_open.cc @@ -2,6 +2,7 @@ #include "message_handler.h" #include "timer.h" +namespace { // Open, view, change, close file struct Ipc_TextDocumentDidOpen : public IpcMessage { struct Params { @@ -53,3 +54,4 @@ struct TextDocumentDidOpenHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDidOpenHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_did_save.cc b/src/messages/text_document_did_save.cc index 92d752f4..466c8d63 100644 --- a/src/messages/text_document_did_save.cc +++ b/src/messages/text_document_did_save.cc @@ -1,5 +1,6 @@ #include "message_handler.h" +namespace { struct Ipc_TextDocumentDidSave : public IpcMessage { struct Params { // The document that was saved. @@ -42,3 +43,4 @@ struct TextDocumentDidSaveHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDidSaveHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_document_link.cc b/src/messages/text_document_document_link.cc index 763c458c..73467bbe 100644 --- a/src/messages/text_document_document_link.cc +++ b/src/messages/text_document_document_link.cc @@ -3,6 +3,7 @@ #include +namespace { struct Ipc_TextDocumentDocumentLink : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentDocumentLink; @@ -83,3 +84,4 @@ struct TextDocumentDocumentLinkHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDocumentLinkHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_document_symbol.cc b/src/messages/text_document_document_symbol.cc index a526e828..5aaad4f9 100644 --- a/src/messages/text_document_document_symbol.cc +++ b/src/messages/text_document_document_symbol.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct lsDocumentSymbolParams { lsTextDocumentIdentifier textDocument; }; @@ -52,3 +53,4 @@ struct TextDocumentDocumentSymbolHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDocumentSymbolHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_highlight.cc b/src/messages/text_document_highlight.cc index 263f0dcd..db435ff6 100644 --- a/src/messages/text_document_highlight.cc +++ b/src/messages/text_document_highlight.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_TextDocumentDocumentHighlight : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight; @@ -61,3 +62,4 @@ struct TextDocumentDocumentHighlightHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentDocumentHighlightHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_hover.cc b/src/messages/text_document_hover.cc index b7e4e629..30414079 100644 --- a/src/messages/text_document_hover.cc +++ b/src/messages/text_document_hover.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_TextDocumentHover : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentHover; @@ -55,3 +56,4 @@ struct TextDocumentHoverHandler : BaseMessageHandler { } }; REGISTER_MESSAGE_HANDLER(TextDocumentHoverHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_references.cc b/src/messages/text_document_references.cc index c9804940..9cc5e158 100644 --- a/src/messages/text_document_references.cc +++ b/src/messages/text_document_references.cc @@ -3,6 +3,7 @@ #include +namespace { struct Ipc_TextDocumentReferences : public IpcMessage { struct lsReferenceContext { @@ -78,3 +79,4 @@ struct TextDocumentReferencesHandler } }; REGISTER_MESSAGE_HANDLER(TextDocumentReferencesHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_rename.cc b/src/messages/text_document_rename.cc index 577b623a..4f41ba1c 100644 --- a/src/messages/text_document_rename.cc +++ b/src/messages/text_document_rename.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "query_utils.h" +namespace { struct Ipc_TextDocumentRename : public IpcMessage { struct Params { // The document to format. @@ -61,3 +62,4 @@ struct TextDocumentRenameHandler : BaseMessageHandler { } }; REGISTER_MESSAGE_HANDLER(TextDocumentRenameHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/text_document_signature_help.cc b/src/messages/text_document_signature_help.cc index c4e7df7c..4945544b 100644 --- a/src/messages/text_document_signature_help.cc +++ b/src/messages/text_document_signature_help.cc @@ -1,6 +1,7 @@ #include "message_handler.h" #include "timer.h" +namespace { struct Ipc_TextDocumentSignatureHelp : public IpcMessage { const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp; @@ -161,3 +162,4 @@ struct TextDocumentSignatureHelpHandler : MessageHandler { } }; REGISTER_MESSAGE_HANDLER(TextDocumentSignatureHelpHandler); +} // namespace \ No newline at end of file diff --git a/src/messages/workspace_symbol.cc b/src/messages/workspace_symbol.cc index 6b17065f..7290e3d1 100644 --- a/src/messages/workspace_symbol.cc +++ b/src/messages/workspace_symbol.cc @@ -4,6 +4,7 @@ #include +namespace { struct lsWorkspaceSymbolParams { std::string query; }; @@ -73,3 +74,4 @@ struct WorkspaceSymbolHandler : BaseMessageHandler { } }; REGISTER_MESSAGE_HANDLER(WorkspaceSymbolHandler); +} // namespace \ No newline at end of file diff --git a/src/serializer.h b/src/serializer.h index 342e0bc1..9406f8cf 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -31,7 +31,7 @@ struct IndexFile; template \ void Reflect(TVisitor& visitor, type& value) { \ auto value0 = static_cast(value); \ - Reflect(visitor, value0); \ + ::Reflect(visitor, value0); \ value = static_cast(value0); \ }