Kaydet (Commit) acd8ee10 authored tarafından Luboš Luňák's avatar Luboš Luňák

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: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 1334c2bf
...@@ -25,6 +25,22 @@ public: ...@@ -25,6 +25,22 @@ public:
private: private:
void run() override {} 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 *) void MacroDefined(Token const & MacroNameTok, MacroDirective const *)
override override
{ {
...@@ -107,6 +123,7 @@ private: ...@@ -107,6 +123,7 @@ private:
SourceLocation definedBig_; SourceLocation definedBig_;
SourceLocation definedLit_; SourceLocation definedLit_;
bool startChecked = false;
}; };
loplugin::Plugin::Registration<OslEndian> X("oslendian"); loplugin::Plugin::Registration<OslEndian> X("oslendian");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment