[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Thu Jan 12 14:19:46 UTC 2017


 compilerplugins/clang/overrideparam.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 38d1c303e12d7f67e8e5eef78e912a4be879de74
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 12 15:19:22 2017 +0100

    Adapt loplugin:overrideparam to recent Clang trunk change
    
    Change-Id: Ia372e39bc7e51f290a6d631bf0b81fd75f4fdc1d

diff --git a/compilerplugins/clang/overrideparam.cxx b/compilerplugins/clang/overrideparam.cxx
index c9d836c..3febe4d 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)


More information about the Libreoffice-commits mailing list