diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-16 15:39:12 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-16 16:48:33 +0100 |
commit | ab8fc2603c647754d7954b77c1347123402c8b7b (patch) | |
tree | 929e19528972c858728c24d62cf95f0a2a39c1cc | |
parent | d0ee281680711117099ac892acf84996af4af9e6 (diff) |
Fix loplugin::Entry ODR violation
(caused crashes with CLANGDEBUG=1 in compilerplugins/Makefile-clang.mk)
Change-Id: I43ba276f03c87c97b624a59f2b368422fd5b0a7b
Reviewed-on: https://gerrit.libreoffice.org/82982
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | compilerplugins/clang/duplicate-defines.cxx | 10 | ||||
-rw-r--r-- | compilerplugins/clang/readability-redundant-pp.cxx | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/compilerplugins/clang/duplicate-defines.cxx b/compilerplugins/clang/duplicate-defines.cxx index 0209d0893a36..21caf90a96dd 100644 --- a/compilerplugins/clang/duplicate-defines.cxx +++ b/compilerplugins/clang/duplicate-defines.cxx @@ -23,17 +23,17 @@ /// Finds duplicated preprocessor defines, which generally indicate that some definition /// needs to be centralised somewhere. -namespace loplugin +namespace { struct Entry { clang::SourceLocation m_aLoc; }; -class DuplicateDefines : public clang::PPCallbacks, public Plugin +class DuplicateDefines : public clang::PPCallbacks, public loplugin::Plugin { public: - explicit DuplicateDefines(const InstantiationData& data); + explicit DuplicateDefines(const loplugin::InstantiationData& data); virtual void run() override; void MacroDefined(const Token& MacroNameTok, const MacroDirective* MD) override; void MacroUndefined(const Token& MacroNameTok, const MacroDefinition& MD, @@ -48,7 +48,7 @@ private: std::unordered_map<std::string, Entry> m_aDefMap; }; -DuplicateDefines::DuplicateDefines(const InstantiationData& data) +DuplicateDefines::DuplicateDefines(const loplugin::InstantiationData& data) : Plugin(data) , m_rPP(compiler.getPreprocessor()) { @@ -99,7 +99,7 @@ void DuplicateDefines::MacroUndefined(const Token& rMacroNameTok, const MacroDef m_aDefMap.erase(aMacroName); } -static Plugin::Registration<DuplicateDefines> X("duplicatedefines", false); +loplugin::Plugin::Registration<DuplicateDefines> X("duplicatedefines", false); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/readability-redundant-pp.cxx b/compilerplugins/clang/readability-redundant-pp.cxx index 2411dfb75f62..e1c284b99c63 100644 --- a/compilerplugins/clang/readability-redundant-pp.cxx +++ b/compilerplugins/clang/readability-redundant-pp.cxx @@ -22,7 +22,7 @@ /// Finds preprocessor usage which is redundant (only #ifndef for now). -namespace loplugin +namespace { struct Entry { @@ -30,10 +30,10 @@ struct Entry std::string m_aMacroName; }; -class RedundantPreprocessor : public clang::PPCallbacks, public Plugin +class RedundantPreprocessor : public clang::PPCallbacks, public loplugin::Plugin { public: - explicit RedundantPreprocessor(const InstantiationData& data); + explicit RedundantPreprocessor(const loplugin::InstantiationData& data); virtual void run() override; void Ifndef(clang::SourceLocation aLoc, const clang::Token& rMacroNameTok, const clang::MacroDefinition& rMacroDefinition) override; @@ -51,7 +51,7 @@ private: std::vector<Entry> m_aNotDefStack; }; -RedundantPreprocessor::RedundantPreprocessor(const InstantiationData& data) +RedundantPreprocessor::RedundantPreprocessor(const loplugin::InstantiationData& data) : Plugin(data) , m_rPP(compiler.getPreprocessor()) { @@ -127,7 +127,7 @@ void RedundantPreprocessor::Endif(clang::SourceLocation /*aLoc*/, clang::SourceL } } -static Plugin::Registration<RedundantPreprocessor> X("redundantpreprocessor"); +loplugin::Plugin::Registration<RedundantPreprocessor> X("redundantpreprocessor"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |