32 Commits

Author SHA1 Message Date
Stephan Bergmann
38da1ed919 Make plugin rewriting work on Windows too
...in a somewhat hacked-up way for now (see the TODO comment)

Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703
2017-01-27 10:46:15 +01:00
Stephan Bergmann
54aab71ff7 On Windows, #include <process.h> for getpid
Change-Id: Ibfb52800cdde99298431dab9da1cb8109658c425
2016-12-18 22:43:30 +01:00
Stephan Bergmann
35d9cd4969 clang::FileEntry::getName now returns StringRef on Clang master
Change-Id: I94c9676e52a3c60ad70567396a8484e844176c6e
2016-10-16 19:43:15 +02:00
Stephan Bergmann
2ac66f5a36 Enable Clang plugin warnings in Bison source code
-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
2016-04-26 17:49:11 +02:00
Stephan Bergmann
01f3b95884 These version checks are about the Clang the plugins are built /against/
...not the (Clang) compiler they are being built /with/.  (Also simplifies the
checking #if code.)

Change-Id: I416321be4ef4478785be40571f81500fd3b6feb8
2016-02-26 14:34:29 +01:00
Benjamin Ni
be729e7721 tdf#94269: Replace "n" prefix for bool variables with "b"
Change-Id: I178545792c7354a362658ac7ef8b1d4cf0865797
Signed-off-by: Michael Stahl <mstahl@redhat.com>
2015-11-02 23:40:57 +01:00
Michael Stahl
048d47d54d compilerplugins: check that we're not building ccache preprocessed
... 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>
2015-10-30 16:31:13 +00:00
Stephan Bergmann
e710170d90 Avoid ambiguity with C++14 std::make_unique
Change-Id: I81b8bed175527bab02ffdd2fa17fa6a66c243d95
2015-09-29 15:04:21 +02:00
Stephan Bergmann
311fb9d5e6 Adapt compilerplugins to Clang trunk towards 3.6
Change-Id: I0b7be1616a3e4206982f9f925de141ed9d53b96e
2014-08-11 15:16:08 +02:00
Alexander Wilms
15e0b08ab5 Remove visual noise from compilerplugins
Change-Id: Ibfed0b64bd60804fa377b5e25e5f197a7772d605
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-02-27 11:10:28 +01:00
Stephan Bergmann
6f2774b209 ...but Flags parameter was plain unsigned int prior to Clang 3.4
Change-Id: Ife39abda6b5274ae196dcbf591d02fa3f36f6072
2014-02-25 10:15:28 +01:00
Stephan Bergmann
35f28b706e raw_fd_ostream Flags parameter no longer defaulted
...at least on trunk r202077.

Change-Id: Ieb59cc7ac70e2a57ac13eefdfcbb6bfa42e25218
2014-02-25 08:48:21 +01:00
Stephan Bergmann
5dcb634dcb Don't attempt to actually do double code removals
...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
2014-02-20 19:51:43 +01:00
Stephan Bergmann
6f69fb5d7d Run the non-rewriter plugins even when rewriters are specified
Change-Id: I8262091c52522c54f84c0fac5fd180871d4a3a9f
2014-02-17 17:55:16 +01:00
Stephan Bergmann
11235e8649 clang::DiagnosticsEnginge::getCustomDiagID now needs a literal FormatString
...at least in trunk 200400 towards Clang 3.5.

Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5
2014-01-31 09:50:21 +01:00
Stephan Bergmann
1f078fcadd Prepare dual-mode compiler plugin feature
...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
2014-01-27 13:12:33 +01:00
Michael Stahl
5d8f48c81e solver doesn't solve anything...
... 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>
2013-10-31 15:42:24 +00:00
Caolán McNamara
3656a57e88 add mode lines to new files (and idls) since last run
Change-Id: Id1e74f18c90e69d1a781c8f02e30dc3c005ed4fd
2013-09-22 12:21:34 +01:00
Luboš Luňák
21c795488c prevent crash when rewriting source
Change-Id: I97519c2fb08efa2c694c9fb91a4cc402a6347c2c
2013-08-21 15:08:16 +02:00
Stephan Bergmann
653cdcf50c error: cannot use dynamic_cast with -fno-rtti
...with recent Clang trunk towards 3.4

Change-Id: Ie0991c7bd560c30551aeaada426382a889b46391
2013-08-06 17:59:09 +02:00
Stephan Bergmann
3d963884cb Adapt UPDATE_FILES=<module> to headers being moved to include/
Change-Id: I6af5236358a51a51514d646c809147db56b2464b
2013-06-05 23:32:16 +02:00
Luboš Luňák
996b6fc92b don't explicitly delete PPCallbacks-based compiler plugin actions
If the class is based on PPCallbacks too, Clang internals will delete
the instance.

Change-Id: I6dd83d800e6cca17eb0b5de23c8994f11c087fd5
2013-04-04 13:05:02 +02:00
Luboš Luňák
153a69cad2 pass around CompilerInstance rather than ASTContext
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
2013-03-28 18:01:00 +01:00
Luboš Luňák
9ab15ecc4f -Wextra for compiler plugins
Change-Id: I246dcf1d2c099c510435d21f0dd47e3c098456f2
2013-03-28 18:01:00 +01:00
Luboš Luňák
857a392654 make it possible to limit what files will be modified by a compiler plugin
Change-Id: I4e3e8f5ca5e5b5b59b1bd067281f90940dd893b1
2013-02-09 18:48:31 +01:00
Luboš Luňák
8f1a01ad00 fix check whether a file is in a directory
Make sure / is appended, otherwise /foo might match /foobar/file .

Change-Id: I36469916b72b407c8f0c9c255099ee671039cf17
2013-02-09 18:48:31 +01:00
Luboš Luňák
276953ef21 remove not needed #include
Change-Id: I0fa791733407199db5be2cc9606ac9be1da64188
2013-02-02 22:59:45 +01:00
Luboš Luňák
f5ee30c3ee append [loplugin] automatically in report() rathen than manually everywhere
Change-Id: I2f98622f152ae0c7ac8d1113d6380f686ac7234c
2013-02-02 22:59:45 +01:00
Luboš Luňák
b4392c575e always use the report() helper
Change-Id: I2966fdb5bd98b1ddf718079584acf90a3e3a3700
2013-02-02 22:59:45 +01:00
Luboš Luňák
a1c61eb112 move documentation of plugins to the .cxx files
It's mostly there already anyway, no need to duplicate it.

Change-Id: I5b066f90725a064fb0746e1411900e835e3f66c3
2013-02-02 22:59:44 +01:00
Luboš Luňák
a7c3adb773 avoid having to manuall modify sources when adding a new clang plugin
Now each one registers in its .cxx file.

Change-Id: I811c0d4400c2bdccc1c287269378d7e8ad8743ce
2013-02-02 22:59:44 +01:00
Luboš Luňák
b8f932b6a5 move plugin handling to separate source files
Change-Id: Ifa1af34121bda9ca3250d09a3b8a46ea226795ed
2013-02-02 22:59:44 +01:00