summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-01-12 15:19:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-01-12 15:19:22 +0100
commit38d1c303e12d7f67e8e5eef78e912a4be879de74 (patch)
treee1f5e2568bdc038a128d945e3c1f9fcf14824489 /compilerplugins
parentff30d20c1ae3a30717123c267d52eb2b3105a1b7 (diff)
Adapt loplugin:overrideparam to recent Clang trunk change
Change-Id: Ia372e39bc7e51f290a6d631bf0b81fd75f4fdc1d
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/overrideparam.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/compilerplugins/clang/overrideparam.cxx b/compilerplugins/clang/overrideparam.cxx
index c9d836c91b4e..3febe4d5686a 100644
--- a/compilerplugins/clang/overrideparam.cxx
+++ b/compilerplugins/clang/overrideparam.cxx
@@ -179,11 +179,20 @@ bool OverrideParam::hasSameDefaultParams(const ParmVarDecl * parmVarDecl, const
{
return true;
}
-#if CLANG_VERSION >= 30900
- return false;
-#else
- return true; // clang3-8 doesn't have EvaluateAsFloat, so we can't be as precise
-#endif
+ return true;
+ // for one, Clang 3.8 doesn't have EvaluateAsFloat; for another, since
+ // <http://llvm.org/viewvc/llvm-project?view=revision&revision=291318>
+ // "PR23135: Don't instantiate constexpr functions referenced in
+ // unevaluated operands where possible", default args are not
+ // necessarily evaluated, so the above calls to EvaluateAsInt etc. may
+ // fail (as they do e.g. for SfxViewShell::SetPrinter and derived
+ // classes' 'SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL' arg,
+ // include/sfx2/viewsh.hxx; what appears would help is to call
+ // 'compiler.getSema().MarkDeclarationsReferencedInExpr()' on
+ // defaultArgExpr and superDefaultArgExpr before any of the calls to
+ // EvaluateAsInt etc., cf. the implementation of
+ // Sema::CheckCXXDefaultArgExpr in Clang's lib/Sema/SemaExpr.cpp, but
+ // that would probably have unwanted side-effects)
}
bool OverrideParam::evaluate(const Expr* expr, APSInt& x)