compilerplugins/clang/oslendian.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
New commits: commit acd8ee107f336d629782956350ed3981ca302024 Author: Luboš Luňák <[email protected]> AuthorDate: Mon Apr 29 22:39:00 2019 +0200 Commit: Luboš Luňák <[email protected]> CommitDate: Sun May 5 17:44:48 2019 +0200 avoid false warnings from oslendian clang plugin if PCH is used Change-Id: I3ab8371b14068601995616dc9979a3297313d761 Reviewed-on: https://gerrit.libreoffice.org/71563 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> diff --git a/compilerplugins/clang/oslendian.cxx b/compilerplugins/clang/oslendian.cxx index 3cb1adbe3da0..13296330baf6 100644 --- a/compilerplugins/clang/oslendian.cxx +++ b/compilerplugins/clang/oslendian.cxx @@ -25,6 +25,22 @@ public: private: void run() override {} + virtual void FileChanged(SourceLocation, FileChangeReason, SrcMgr::CharacteristicKind, FileID) override { + if(!startChecked) { + // With precompiled headers MacroDefined() would not be called, so check already at the very + // start whether the macros exist. + startChecked = true; + if(const MacroInfo* macroBig = compiler.getPreprocessor().getMacroInfo( + &compiler.getPreprocessor().getIdentifierTable().get("OSL_BIGENDIAN"))) { + definedBig_ = macroBig->getDefinitionLoc(); + } + if(const MacroInfo* macroLit = compiler.getPreprocessor().getMacroInfo( + &compiler.getPreprocessor().getIdentifierTable().get("OSL_LITENDIAN"))) { + definedLit_ = macroLit->getDefinitionLoc(); + } + } + } + void MacroDefined(Token const & MacroNameTok, MacroDirective const *) override { @@ -107,6 +123,7 @@ private: SourceLocation definedBig_; SourceLocation definedLit_; + bool startChecked = false; }; loplugin::Plugin::Registration<OslEndian> X("oslendian"); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
