65 Commits

Author SHA1 Message Date
Luboš Luňák
c63e6c38c9 adjust unused compiler plugins for ASTContext to CompilerInstance change too
Change-Id: I415ed25586408d7e7df9457f7c637a8c6d13d35d
2013-03-28 18:08:05 +01: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
Stephan Bergmann
24387f1c58 A plugin to find suboptimal equalsIgnoreAsciiCaseAscii[L] calls
Change-Id: Id2572982ca899223b89016ee7482ccb960032805
2013-03-19 11:02:28 +01:00
Stephan Bergmann
f9e96c3641 Enable -std=c++11 for compilerplugins/clang
Change-Id: I4849656b16c2a7103217870050b0de3ccb97af56
2013-03-19 11:02:28 +01:00
Tor Lillqvist
616c6924f1 s/the the/the/
Change-Id: Iadacffaad832c6ff06757e8567e24f929f24a4c3
2013-02-22 09:58:19 +02:00
Marc-André Laverdière
847749e975 Fixed compilation error of Clang plugins on Ubuntu/Mint
Change-Id: Ib08c5075034e0e16c5541f05425ef15d2cc3a6f6
Reviewed-on: https://gerrit.libreoffice.org/2045
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
2013-02-11 10:09:17 +00: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
1b535267df treat all source files as not up to date only with FORCE_COMPILE_ALL
So running the compiler plugin can be done either with FORCE_COMPILE_ALL=1
for simplicity, running the plugin on all source files for the target,
or it's possible to use make's -W option (or touch files manually) to
run it only for selected files.

Change-Id: Ifa82bbe91dc1e179af9db8fbf99271bcf03a1d47
2013-02-09 18:48:31 +01:00
Luboš Luňák
c3de6c1a58 create an output dir that's already needed by $(shell ...)
Otherwise there's an error message e.g. during a clean build.

Change-Id: I42efd08e014a4ebe25cfd1a497f622e5ea5c39ad
2013-02-07 17:05:21 +01:00
Luboš Luňák
5535195c63 make sure the default target for compilerplugins is building
CLANGFORCE was the first in the makefile after
c6ffe17631cccf11fbe00479d2169116d494a7da and therefore the default

Change-Id: Id3b86a1ea2c27479067f7f55a977da3e6e8a2dfb
2013-02-07 17:05:18 +01:00
Luboš Luňák
4fd910a096 tutorial examples for writing new Clang plugin actions
http://wiki.documentfoundation.org/Clang_plugins

Change-Id: Ieb4fc186490e81ab961c094ca0a7fcdabc0f348f
2013-02-02 22:59:46 +01:00
Luboš Luňák
18e615189d a bit more reliable detection of removed/added sources
Change-Id: I7fdde46334c648ab6cba54210e31fada87dcfb55
2013-02-02 22:59:46 +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
108a95630d move clang plugin that's no longer needed
But still keep it in case it'd be needed again, or simply
as a starting reference.

Change-Id: If519e1320e1bd6dce7746b57172324b33504051e
2013-02-02 22:59:44 +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
c6ffe17631 automatically link all .cxx files in clang/ into the plugin
This means that just moving sources to the dir will enable the plugin
action in that source, without modifying any sources, so those changes
would not be accidentally committed when using a rewriter to change
LO sources.

Change-Id: Ic5a9c52dbf1939a1e78ad39ed6691ce3a1f399df
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
Luboš Luňák
5ceaa68ca5 one more config/ -> config_host/ fix after the rename
Change-Id: I347790e1ca2ee6a27303d3644aa1459ff76ba4b0
2013-02-01 14:23:46 +01:00
Luboš Luňák
9b11db8486 rewriters no longer create .new files, they modify sources directly
Change-Id: I24bce9dcf46367b5658071ed692d346bb01a83a3
2013-01-31 14:48:43 +01:00
Luboš Luňák
03910bdfd9 point to our wiki page on clang rather than clang homepage
Change-Id: Ia54040c7ed02e6a2d62dd93890a7d1467dd83a40
2013-01-11 14:58:58 +01:00
Luboš Luňák
d9a5c6bdf0 fix detection whether to ignore a source file or not
When compiling using icecream, the whole input is one file fed from stdin,
so getBufferName() is "<stdin>", so get the filename from #line directives.

Change-Id: Ie87937b10b0c7e8ddfa57a405b80fd9bde68dd0a
2013-01-11 14:58:58 +01:00
Luboš Luňák
62532ad485 do not set our clang timestamp to the timestamp of the clang binary
If the clang binary comes from a package which had been built before
any of our clang related sources were changed the last time, the timestamp
would be older and so there would be no rebuild. So do the stamp handling
the usual way, clang upgrades will work fine, downgrades will not, but
that's the same problem like with downgrading a library and its headers.

To somewhat mitigate the problem (Clang plugin doesn't get cleaned by
'make clean'), include the full Clang version (which includes SVN revision)
in config_clang.h and make all Clang plugin code include that, so
at least configure re-run will trigger a rebuild if necessary.

Change-Id: I993197f79e92e36105092c92c33b2e1db343e975
2013-01-06 18:23:04 +01:00
Luboš Luňák
428a815fbc I hate arbitrary integer types
Change-Id: I4c8edfc0ee0390d595c43e384bf6e5f595a7b84f
2013-01-05 22:20:40 +01:00
Luboš Luňák
d5ea81b87b handle case of SRCDIR == BUILDDIR
Change-Id: I9daea65dc28ab13776a7c4319e5d5811515fe160
2013-01-04 15:28:00 +01:00
Luboš Luňák
258aca9924 rewriter plugin for removing forward rtl string declarations
Change-Id: I12bf38985ae62756973c05aacf762ae3c405ac9b
2013-01-04 15:27:29 +01:00
Luboš Luňák
c26e655264 support for removing a statement as a whole
Change-Id: Icb7b017a0c76a6169f0f629bb40bf97449c75837
2013-01-04 15:27:26 +01:00
Luboš Luňák
217e3f2ea1 better handling of which files are processed by clang plugins
Check that only LO's files are processed, as there's no point otherwise.
Also warn about files in workdir/solver/builddir, as those are either
generated or copies. Try to automatically match include files from
solver to srcdir though, as that's where include files are usually
included from :(.

Change-Id: Ie8389e903f623a9d0e75015091acc0da78e76c3a
2013-01-04 15:27:24 +01:00
Lubos Lunak
6ede7ad593 fix build 2012-12-26 15:43:38 +01:00
Lubos Lunak
8b727538e8 better error handling when writing modified source 2012-12-26 13:56:45 +01:00
Lubos Lunak
e1b11cc461 config_clang.h 2012-12-26 13:56:45 +01:00
Luboš Luňák
2ac26dc83f adjust clang plugins for srcdir != builddir
Change-Id: Ie4c934b52c4b010703e91f84b83e1fe590b5d187
2012-12-11 15:45:16 +01:00
Stephan Bergmann
a6d6d1c24b CLANGPLUGIN_CPPFLAGS did not actually work
...it just appeared to work on machines that happen to have /usr/bin/clang.  So
hoist CLANGDIR/CLANGBUILD from compilerplugins/Makefile-clang.mk to configure.ac
instead.

Change-Id: Ie5d9c6bb8e9d0caa1583d78c8693f06b69873095
2012-12-07 16:09:26 +01:00
Stephan Bergmann
f995e0f7bb Adapt to current Clang trunk
Change-Id: I0aadc7019934841d6864258695a17503918b6c20
2012-12-05 17:33:47 +01:00
Stephan Bergmann
149858e94e Adapt to Clang 3.2
Change-Id: I9e51867198d7677c26cbd97f5d9c85ac13dc90c5
2012-12-05 15:30:33 +01:00
Luboš Luňák
1ed9af9a44 skip 'else' from a macro expansion too
Change-Id: I1a6d70d1554dc5bf8f46940ed62b47ab34983aa7
2012-11-20 16:30:02 +01:00
Luboš Luňák
5646906f5b do not warn about missing area in SAL_DEBUG
Change-Id: I99314136cac7f47a5adf8e0e29093ec9fbf4fd90
2012-10-26 19:26:11 +02:00
Stephan Bergmann
9cabab002b CLANGPLUGIN_CPPFLAGS for building plugin for Clang in nonstandard location
(i.e., configure with CLANGPLUGIN_CPPFLAGS=-I.../clang-installation/include
-I.../clang-build/tools/clang/include)

Change-Id: Ic6d2973629103f71c32f44ebba2ac70d137d18e7
2012-10-22 16:25:41 +02:00
Lubos Lunak
1a77b93aec only one warning per one SAL_INFO/SAL_WARN
Change-Id: I5aafe9ed51c86dc31492d205f44fba6b1db137d2
2012-10-19 10:15:42 +02:00
Luboš Luňák
dc3aa430f9 rewriter for postfix->prefix operator++
Change-Id: I59a7490ec76b10fd31033d1ceccd1e3eae0ad398
2012-10-15 23:33:08 +02:00
Luboš Luňák
2e3642e66b convenience functions for source rewriters
Change-Id: I36e2b49bc615db0b12b03ffa755fa51acc6830a0
2012-10-15 23:33:07 +02:00
Luboš Luňák
0349c738da support for compiler rewriters
Change-Id: I12e98ac9fc49ef2007914324006a396d183b778c
2012-10-15 15:40:33 +02:00
Luboš Luňák
41d6a0ea2d some namespacing improvements
Change-Id: I95bd78340519bc1457385561b64c74e938b40bb2
2012-10-15 15:40:33 +02:00
Luboš Luňák
1d5c2d8368 document sallogareas compiler check
Change-Id: I72d25ec9a1acafa2bc451e620d5dc5721d849c42
2012-10-14 11:55:24 +02:00
Luboš Luňák
f1b6058a3b remove debug output
Change-Id: I719ce8870320f3bddd68fe26cf2c2b941e0a9403
2012-10-13 18:27:39 +02:00
Luboš Luňák
1e313e759b compiler check to compare SAL_WARN/LOG areas against sal/inc/sal/log-areas.dox
Some of the areas are guesses I've added after seeing them, whoever feels reponsible
for whichever part of the code feel free to adjust them.

Change-Id: I2192de84d51cc2bc7c28fa84019d38b465985d15
2012-10-13 17:40:45 +02:00