Age | Commit message (Collapse) | Author |
|
In the sharedvisitor.cxx mode all plugins need just one shared
RecursiveASTVisitor template instance, but as long as they use another
instance each as the base class, Clang still instantiates those templates
and then spends a lot of time optimizing each of them, even though they
should never get used.
So when compiling using sharedvisitor.cxx simply use dummy base classes
that do not do anything. As an additional check they abort() if any
of the functions get called, this needed removing vclwidgets and
unusedmember from shared plugins, because they call TraverseStmt(),
maybe this can get handled somehow later.
Change-Id: Ic5a350da2c3ba31521f71077b1776b1ee8f06dea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87561
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: Id9363d8db729883d0f72eb9fcbf6d8bf5b396414
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87662
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
...<https://github.com/llvm/llvm-project/commit/
777180a32b61070a10dd330b4f038bf24e916af1>. This is just a quick fix to get
copmilerplugins buiding again with latest LLVM/Clang trunk. Ideally, we should
get rid of as many of those (potentially expensive) conversions from
llvm::StringRef to std::string as possible.
Change-Id: I18e185e0022a06fd8e3b983a3c4f80e1f3b96746
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87682
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
* See comment at head of compilerplugins/clang/unusedmember.cxx for description.
* Moved isAllRelevantCodeDefined from loplugin:fakebool to PluginHandler for
reuse. (Made it a member function so that it can reuse its two
RecordCompleteMap instances across different loplugins. Probably safer
lifecycle-wise to have them as PluginHandler members than to have them as
static local variables in function isAllRelevantCodeDefined.)
* Need Plugin::ignoreLocation overload for TypeLoc now, thanks to
UnusedMember::VisitElaboratedTypeLoc.
* UETT_PreferredAlignOf was split off UETT_AlignOf with <https://github.com/
llvm/llvm-project/commit/6822bd79ac43f267613f1615bf60407103e24dba> "PR26547:
alignof should return ABI alignment, not preferred alignment".
* RecursiveASTVisitor::TraverseAlignedAttr traverses into the attribute's
argument only since <https://github.com/llvm/llvm-project/commit/
f26d551387f032e05e5e6551605b150f38c3f5b2> "Do not look through pack
expansions when looking for unexpanded parameter packs".
Change-Id: Ic2702b03d4567fa2533333766de7920f3c524a69
Reviewed-on: https://gerrit.libreoffice.org/84416
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
(but when targeting older versions of LLVM/Clang, COMPILER_PLUGINS_CXX can still
specify -std=c++11)
Change-Id: I1b91f2817516d015bc12b6a3faf1874ab938a3ae
Reviewed-on: https://gerrit.libreoffice.org/77866
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Each plugin currently uses its own recursive AST run, which adds up.
This patch adds another shared plugin which internally contains all
(suitable) plugins and dispatches to them from the same one recursive
run. This patch converts ~25 plugins and for starmath's accessibility.cxx
reduces clang build time from 5.43s to 5.14s (and it's 4.39s without any
plugins). As there are almost 50 more plugins to go, this can theoretically
result in 4.56s final time, although probably not all plugins can be
that easily converted, if at all.
This mostly requires very little change in many plugins (see e.g.
BadStatics), some even work without any functionality change (e.g.
CharRightShift). Traverse* calls require some changes but are often
not that difficult. WalkUp* probably can't be supported, although some
plugins can(?) possibly be adjusted to not rely on them. And of course
some plugins can be left as they are, using their own recursive run.
See description at the top of generator.cxx for description of how to
convert a plugin.
The sharedvisitor.cxx source is generated based on scanning relevant
plugin sources using a clang-based scanner/generator. The generated
source is intentionally included instead of getting always generated,
as the generating currently takes some time, so it should get updated
in git whenever a change in a plugin triggers a source change in it.
Change-Id: Ia0d2e3a5a464659503dbb4ed6c20b6cc89b4de01
Reviewed-on: https://gerrit.libreoffice.org/68026
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
For the built-in(?) __int128_t there's apparently no valid presumed location.
Change-Id: I1b2f1a827bc914d2f288dd1e02718bf45a50dd1e
Reviewed-on: https://gerrit.libreoffice.org/68870
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for methods that always return the same value
Change-Id: I5f1c5b58a985ecf5f7765a2d4ebd464eae5ef76f
Reviewed-on: https://gerrit.libreoffice.org/57973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
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>
|
|
...for better precision
Change-Id: I5f273b7c66ba931647805c415622b5ac767ff987
|
|
This reverts commit b39e627be45f847554f11fdac040b6f4da4054ba. The assumed (see
comment at <https://gerrit.libreoffice.org/#/c/46769/4/compilerplugins/clang/
plugin.cxx@633>) performance bottleneck of isSamePathname -> getAbsolutePath
does show up in Flamegraph inspections of LO builds. But changing (non-member
function) isSamePathname to only call getAbsolutePath if (PluginHandlder member
function) isLOOLMode is true would need some code reorg, and Online development
doesn't seem to make too much actual use of the plugin, so conclusion on IRC was
to revert.
Change-Id: I0f04fdcc87087dac516630ed5e48361f5ea332ca
Reviewed-on: https://gerrit.libreoffice.org/51774
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
after
commit 94ab8e4360a2a7a932656e99f718244321d0f923
Date: Fri Feb 9 15:28:41 2018 +0200
improve loplugin rewriter double source modification detection
Change-Id: Ibf0a64fe4cc3dd6bf5ae16672b3d748a842196e4
|
|
because my new rewriter easily generates overlapping rewriting.
Move the code from flatten and salcall up into the pluginhandler, and
drop the simpler detection logic.
Change-Id: I3da51ac510954a5d4276cee0924cc5dc1fc9a734
Reviewed-on: https://gerrit.libreoffice.org/49493
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: I8e45936ef5675d531be71496e8894b90eaf2f6e2
Reviewed-on: https://gerrit.libreoffice.org/46769
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
|
|
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
"Clang baseline bump"
Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
Reviewed-on: https://gerrit.libreoffice.org/46557
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
...to enable debug-only code in the plugins. Some situations in the plugin code
should never happen, yet must not by default report errors or trigger
assertions, as some newly written LO code could trigger them nevertheless (in
which case the plugin code will likely need to be adapted, to cater for these
presumed-impossible situations).
Such code can now be included in the plugins behind an if(isDebugMode()) guard,
and can explicitly be enabled with --enable-compiler-plugins=debug.
I deliberately made this a runtime rather than a compile time option (using
some #ifdef guards in the plugin code, say), as it IMO keeps the code more
readable, and also allows overridding COMPILER_PLUGINS_DEBUG=... on the make
command line.
Change-Id: Iea4f0c2783ad968a0de097fa710b3be1a248de73
Reviewed-on: https://gerrit.libreoffice.org/46096
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
...which, according to callgrind, reduces instruction fetch count spent on
compiling sw/source/core/layout/paintfrm.cxx (randomly selected because it is
rather large) by 5% from 41,992,064,226 to 39,861,989,855 (function main() in
clang-6.0).
This is best done by forwarding ignoreLocation calls from Plugin to the
PluginHandler signleton, but due to the tight mutual coupling between plugin.hxx
and pluginhandler.hxx that unfortunately required some reorganization (and two
outstanding TODO clean-ups of temporarily introduced using declarations in
plugin.hxx).
Change-Id: Ia4270517d194def7db7ed80cb6894e9c473e9499
|
|
...even if they implement PPCallbacks, so filtering them out in
HandleTranslationUnit was ineffective.
Change-Id: I9df8103a50739f3176e6d63accfd0334da7faa9a
Reviewed-on: https://gerrit.libreoffice.org/43575
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
|
|
This works at least with a recent Clang trunk (towards Clang 6.0).
In order for the plugin.dll to find the LLVM/Clang symbols, it needs to be
loaded into clang.exe not clang-cl.exe, so set CC/CXX to 'clang.exe
--driver-mode=cl ...'.
Buidling the plugin requires some linker flags that must go at the very end of
the COMPILER_PLUGINS_CXX command line, after a /link switch, so introduce
another COMPILER_PLUGINS_CXX_LINKFLAGS variable for that. Also, clang.lib is
not installed as part of LLVM's 'cmake --build ... --target install' step, so
is not available under CLANGDIR and needs to be taken from the build tree
instead, so introduce another CLANGLIBDIR variable for that. autogen.input
settings that work for me on Windows 8.1 with Microsoft Visual Studio 14.0 are:
> CLANGDIR=C:/llvm/inst
> CLANGLIBDIR=C:/llvm/build/lib
> COMPILER_PLUGINS_CXX=C:/PROGRA~2/MICROS~3.0/VC/bin/amd64/cl.exe /IC:\PROGRA~2\MICROS~3.0\VC\INCLUDE /IC:\PROGRA~2\MICROS~3.0\VC\ATLMFC\INCLUDE /IC:\PROGRA~2\WI3CF2~1\10\include\100102~1.0\ucrt /IC:\PROGRA~2\WI3CF2~1\NETFXSDK\46D346~1.1\include\um /IC:\PROGRA~2\WI3CF2~1\8.1\include\shared /IC:\PROGRA~2\WI3CF2~1\8.1\include\um /IC:\PROGRA~2\WI3CF2~1\8.1\include\winrt
> COMPILER_PLUGINS_CXX_LINKFLAGS=/LIBPATH:C:/PROGRA~2/MICROS~3.0/VC/LIB/amd64 /LIBPATH:C:/PROGRA~2/MICROS~3.0/VC/ATLMFC/LIB/amd64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/10/lib/100102~1.0/ucrt/x64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/NETFXSDK/46D346~1.1/lib/um/x64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/8.1/lib/winv6.3/um/x64
(The last two are "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/
amd64/cl.exe" and translations of %INCLUDE% and %LIB% as set in the "VS2015 x64
Native Tools Command Prompt" shell.
AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h, ...) in configure.ac wouldn't
like CXX to start with INCLUDE=... LIB=... environment variable settings, so it
wouldn't work to instead pass %INCLUDE% and %LIB% to cl.exe that way. See
<https://wiki.documentfoundation.org/Development/clang-cl> for general
information about building with clang-cl on Windows.)
There's still some room for improvement marked "TODO". (And some of the unused*
plugins, which are not run by default anyway, use Unix-style functionality, so
have been disabled for now.)
Change-Id: I6c28bdeb801af39ce2bae03111f455e2338d66c9
Reviewed-on: https://gerrit.libreoffice.org/42931
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
to match our more normal conventions.
Also drop the 'using std' and some other cruft
Change-Id: I02ef81c5427188bc03a20b157a57a900a9d7bf0d
|
|
When the field in question is read from inside a constructor
initializer.
In the process, create some needed infrastructure in the plugin classes.
Change-Id: I2f440efa6912801a236727c9fe3180404616958c
Reviewed-on: https://gerrit.libreoffice.org/38960
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
tell the plugin code when we are unit-testing it, so we can suppress all
the warnings except for the plugin we are currently testing
Change-Id: I240c8e37eba90c219e53c29531a3a43bc841a1c8
|
|
Change-Id: Ia28e35ae5af4f601e9a586a3deffbcd61702b0ca
Reviewed-on: https://gerrit.libreoffice.org/36896
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
|
|
...in a somewhat hacked-up way for now (see the TODO comment)
Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703
|
|
Change-Id: Ibfb52800cdde99298431dab9da1cb8109658c425
|
|
Change-Id: I94c9676e52a3c60ad70567396a8484e844176c6e
|
|
-Werror is generally suppressed in Bison-generated C/C++ code (as in all other
generated code) to silence warnings from the Bison skeleton code. And the Clang
plugins suppress warnings in generated WORKDIR code based on the presumed source
location (i.e., taking #line directives into account). So introduce a new
PLUGIN_WARNINGS_AS_ERRORS mode where warnings from Clang plugins are reported as
errors even if -Werror is suppressed. That way, any warnings in the Bison
skeleton code still do not lead to compilation errors, while (at least plugin-
emitted) warnings in the genuine source code do.
Unfortunately this cannot also be enabled for Flex source code, as at least
Flex 2.5.39 generates poor code that does not properly prefix all skeleton code
with appropriate #line directives, so that some skeleton code would be mistaken
for genunie source code, and compilation would fail due to errors.
Also, %glr-parser Bison input appears to generate no #line directives at all (at
least with Bison 3.0.4), so all of connectivity/source/parse/sqlbison.y is
considered generated code and plugin warnings are still suppressed throughout.
Change-Id: Id746e81cbfa5f77628b0a34c7b82780948e7db08
|
|
...not the (Clang) compiler they are being built /with/. (Also simplifies the
checking #if code.)
Change-Id: I416321be4ef4478785be40571f81500fd3b6feb8
|
|
Change-Id: I178545792c7354a362658ac7ef8b1d4cf0865797
Signed-off-by: Michael Stahl <mstahl@redhat.com>
|
|
... input, which breaks because a) isInUnoIncludeFile() will not
recognize the paths (which is actually fixable if it used
getPresumedLoc() to get the path), and b) the isMacroBodyExpansion()
check in salbool.cxx (which doesn't look fixable).
So instead of printing lots of spurious warnings just abort.
Change-Id: I77fd77b4986d2b099453309ecdf31be9cf93ceec
Reviewed-on: https://gerrit.libreoffice.org/19693
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I81b8bed175527bab02ffdd2fa17fa6a66c243d95
|
|
Change-Id: I0b7be1616a3e4206982f9f925de141ed9d53b96e
|
|
Change-Id: Ibfed0b64bd60804fa377b5e25e5f197a7772d605
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: Ife39abda6b5274ae196dcbf591d02fa3f36f6072
|
|
...at least on trunk r202077.
Change-Id: Ieb59cc7ac70e2a57ac13eefdfcbb6bfa42e25218
|
|
...that easily works around the problem that in a rewriter rewriting types of
VarDecls like
T x, y;
it would try to replace T twice. Also, keep the list of removals globally with
the (global) rewriter.
Change-Id: I55b8d11986c2a29e09ff40132fd114a0cc48dc90
|
|
Change-Id: I8262091c52522c54f84c0fac5fd180871d4a3a9f
|
|
...at least in trunk 200400 towards Clang 3.5.
Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5
|
|
...which can act as either a rewriter or a non-rewriter that emits warnings.
Also added COMPILER_PLUGIN_WARNINGS_ONLY=X to demote warnings from plugin X from
errors to warnings, even under --enable-werror.
Change-Id: I05361936240a890515c6bba2459565417c1746b7
|
|
... it is an abbreviation of "Solar Version".
Since nobody can remember that:
remove OUTDIR OUTDIR_FOR_BUILD SOLARVER SOLARVERSION solarpath
and any mention thereof.
Change-Id: Idb3031c4f25a76ac05b22ec67e3ca3e1e8e512ad
Reviewed-on: https://gerrit.libreoffice.org/6515
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
|
|
Change-Id: Id1e74f18c90e69d1a781c8f02e30dc3c005ed4fd
|
|
Change-Id: I97519c2fb08efa2c694c9fb91a4cc402a6347c2c
|
|
...with recent Clang trunk towards 3.4
Change-Id: Ie0991c7bd560c30551aeaada426382a889b46391
|
|
Change-Id: I6af5236358a51a51514d646c809147db56b2464b
|
|
If the class is based on PPCallbacks too, Clang internals will delete
the instance.
Change-Id: I6dd83d800e6cca17eb0b5de23c8994f11c087fd5
|
|
It's possible to get the latter from the former, and the former
is useful for other things too (access to the preprocessor, for example).
Change-Id: I708d709129fd3a35bf7c63da4de09c2e696b382d
|
|
Change-Id: I246dcf1d2c099c510435d21f0dd47e3c098456f2
|
|
Change-Id: I4e3e8f5ca5e5b5b59b1bd067281f90940dd893b1
|
|
Make sure / is appended, otherwise /foo might match /foobar/file .
Change-Id: I36469916b72b407c8f0c9c255099ee671039cf17
|
|
Change-Id: I0fa791733407199db5be2cc9606ac9be1da64188
|