Commit Graph

13 Commits

Author SHA1 Message Date
Stephan Bergmann
9c346feb33 Don't try to evaluate value of value-dependent Expr
...which causes asserts to fire since <https://github.com/llvm/llvm-project/
commit/04323c24a1ac9464471331d9f6499d3cb95d1ccd> "Added an assertion to constant
evaluation enty points that prohibits …"

Change-Id: Iafbf1cea85d15a38a71275d4cea8303bab500f6a
Reviewed-on: https://gerrit.libreoffice.org/72723
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-05-22 14:46:34 +02:00
Noel Grandin
cc26cfd379 use more hasPathnamePrefix
Change-Id: I539e6aedad61d80b6ebe80104b77d720072395bd
2019-02-11 12:37:50 +02:00
Noel Grandin
75dd5d2e73 add EvaluateAsInt compat function for latest clang
the old EvaluateAsInt method has been dropped as from current clang

Change-Id: Ie30d1547ad8de777badff4b380d2fc9fb261e8fe
Reviewed-on: https://gerrit.libreoffice.org/64107
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-27 17:16:05 +01:00
Stephan Bergmann
8b1501d80d Always disable loplugin:expressionalwayszero, to avoid false positives
bdade7e3fc "tdf#105444 DOCX import: don't put
extra paragraphs in comments" caused

> /home/sbergman/lo2/core/writerfilter/source/dmapper/DomainMapper_Impl.cxx:441:22: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                     (sizeof(SAL_NEWLINE_STRING)-1 == 2 && xCursor->getString() == "\n"))
>                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

now with sufficiently new Clang, and the code looks reasonable, and there's no
apparent way to avoid such false positives in the plugin.  (It could check for a
sub-expression of the problematic expression being an object-like macro, but
SAL_NEWLINE_STRING could just as well be a variable instead of a macro.  That
variable would need to be defined in some #if to have different values on
different platforms, so the plugin could theoretically check for such
conditional inclusion, but it's not clear whether that's worth it and would even
be a useful heuristic to not produce neither too many false positives nor too
many false negatives.)  So just disable the plugin for good.

Change-Id: I85dc8573735ccac4e19be20ab7443cbaa85a3164
Reviewed-on: https://gerrit.libreoffice.org/60907
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-22 23:59:53 +02:00
Noel Grandin
1fd27a7931 filter out AST in more plugins
I seem to have missed quite a few in

    commit 9f4d23c151
    filter out some of the AST in the plugins

This nets me another 14% improvement

Change-Id: I39b980b49ced560f768045dbedd3ddfef29306c1
Reviewed-on: https://gerrit.libreoffice.org/59501
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-23 16:34:48 +02:00
Stephan Bergmann
3cc5149a84 Avoid -Werror=deprecated-declarations with recent Clang trunk
...which first added alternative names to and then deprecated getLocBegin/End

Change-Id: Iaefb8ce259057abfa6cd20f0b63c0ef2949a96b2
Reviewed-on: https://gerrit.libreoffice.org/58820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-10 15:14:03 +02:00
Michael Stahl
ff002524c1 compilerplugins: try to make these work with icecream
There are some problems here, this should fix one of them: the
getFilename function returns "<stdin>" for spelling locations, because
the input to clang is sort of preprocessed via -frewrite-includes if
icecream is used and the file is built on a remote host (whereas it's
apparently not preprocessed if the file is compiled locally by icecream).

Using getPresumedLoc() uses the #line directives in the preprocessed
input, which avoids the problem but is more expensive, so try to use it
only when necessary.

The getFileEntry(getMainFileID())->getName() pattern will also result
in "<stdin>", but fortunately icecream passes -main-file-name,
which oddly enough isn't used by the SourceManager's spelling locations,
but is available separately via CodeGenOptions.

This builds everything successfully with clang version 6.0.0:
ICECC_PREFERRED_HOST=myremote make check gb_SUPPRESS_TESTS=t

Change-Id: Ic121511683e5302d7b9d85186c8b9c4a5443fa1b
Reviewed-on: https://gerrit.libreoffice.org/54993
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-07-06 14:12:58 +02:00
Stephan Bergmann
14184060bd Don't warn about multiplication by zero in loplugin:expressionalwayszero
That specific warning (added with 862dc17e43
"loplugin:expressionalwayszero improvements", together with other improvements)
already looked somewhat unhelpful to me in
4cb78942f2 "loplugin:expressionalwayszero
(clang-cl)", but now started to generate

> [CXX] vcl/source/bitmap/BitmapSobelGreyFilter.cxx
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:92:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum1 += nMask121 * nGrey12;
>                                  ^~~~~~~~~~~~~~~~~~
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:99:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum2 += nMask212 * nGrey21;
>                                  ^~~~~~~~~~~~~~~~~~
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:101:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum1 += nMask221 * nGrey22;
>                                  ^~~~~~~~~~~~~~~~~~
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:102:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum2 += nMask222 * nGrey22;
>                                  ^~~~~~~~~~~~~~~~~~
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:105:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum2 += nMask232 * nGrey23;
>                                  ^~~~~~~~~~~~~~~~~~
> /data/sbergman/lo-clang2/core/vcl/source/bitmap/BitmapSobelGreyFilter.cxx:110:34: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero]
>                         nSum1 += nMask321 * nGrey32;
>                                  ^~~~~~~~~~~~~~~~~~
> 6 errors generated.

(where all those nMask* are zero constants; and which even passed Gerrit/Jenkins
as loplugin:expressionalwayszero is only active for Clang >= 3.9).  Lets just
remove that specific check again.

Change-Id: Ia8710f83b16d6e6949439d3941e17b8a0959aa8b
2018-04-23 09:24:53 +02:00
Noel Grandin
c6bc9f71fb disable expressionalwayszero loplugin on clang-3.8
can generate OOM

Change-Id: Ie9fbed147687c06727a702616764a18d91b38e9c
Reviewed-on: https://gerrit.libreoffice.org/52052
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-29 09:31:42 +02:00
Noel Grandin
862dc17e43 loplugin:expressionalwayszero improvements
Change-Id: I00bdbc58d2295a0be30b47c85eae6b9abfec17b2
Reviewed-on: https://gerrit.libreoffice.org/51868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-27 08:22:09 +02:00
Stephan Bergmann
b35bb38f18 Clean away temporarily added using declarations
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-07 11:50:47 +01:00
Noel Grandin
84c0687f09 don't use boost in compilerplugins
Change-Id: Ic1610e99cd2d11d1a536a6f3e66b44417ee59793
2017-08-18 15:08:33 +02:00
Noel Grandin
256c28ae33 new loplugin:expressionalwayszero
The code in SvXMLExportItemMapper::exportXML was broken as far back as
its introduction in

    commit 0c28e3c480
    "Move SvXMLAttrContainerItem to SVX, moved writer only code to sw"

Change-Id: I90043ce8b7263aa56fd0883d350e29b97eeaf99b
Reviewed-on: https://gerrit.libreoffice.org/41282
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-18 14:19:20 +02:00