Commit Graph

369 Commits

Author SHA1 Message Date
Edwin Vane dd8cc29ce5 Refactoring transform-specific options
Making the user null macros command-line option visible to the
UseNullptrTransform class instead of being visible only to the match callback.

llvm-svn: 192905
2013-10-17 17:57:36 +00:00
John Thompson 26ecaf95a2 Added module map generation docs and some clean-up.
llvm-svn: 192792
2013-10-16 13:44:21 +00:00
NAKAMURA Takumi bf5391d2ef clang-tools-extra/modularize: Compare Paths to Prefix as natively-canonicalized form.
On Win32, paths are not expected to be canonicalized.

llvm-svn: 192763
2013-10-16 01:42:33 +00:00
Rui Ueyama dfa171034c Add missing dependency for clang-modernize.
Clang-modernize uses clang-apply-replacements internally but its CMakefile.txt
lacked the dependency.

llvm-svn: 192723
2013-10-15 18:01:06 +00:00
Will Dietz 0f3b4aaf34 ModuleAssistant: Fix warning, don't return bool as a pointer.
No functionality change intended.

llvm-svn: 192713
2013-10-15 15:45:00 +00:00
John Thompson 5ab4f11152 Added module map generation option.
llvm-svn: 192703
2013-10-15 13:52:33 +00:00
Ismail Pazarbasi ebcc0a004b Reverted Test commit; added new line to the end of README.txt
llvm-svn: 192541
2013-10-12 20:43:36 +00:00
Ismail Pazarbasi cdc244bcd8 Test commit; added new line to the end of README.txt
llvm-svn: 192540
2013-10-12 20:42:31 +00:00
Edwin Vane f6a34b5665 clang-modernize: Clean up help output
Now hiding options clang-modernize doesn't use and didn't create. Version
printer specialized for clang-modernize. EXAMPLES text fixed and brought
up-to-date.

Differential Revision: http://llvm-reviews.chandlerc.com/D1849

llvm-svn: 192253
2013-10-08 23:31:05 +00:00
Edwin Vane ea9d124fd4 Switching code owner email address.
llvm-svn: 192189
2013-10-08 16:28:05 +00:00
Edwin Vane c76c0dd952 Update clang-modernizer docs
Summary: Docs updated to reflect new behaviour and new options.

Differential Revision: http://llvm-reviews.chandlerc.com/D1841

llvm-svn: 192105
2013-10-07 15:56:25 +00:00
Edwin Vane c669a8ea7c clang-modernize: Fixing doxygen warnings
llvm-svn: 192100
2013-10-07 13:40:19 +00:00
Edwin Vane 9e5b0da062 clang-modernize: Fix clang-apply-replacements invocation bug
The command-line for clang-apply-replacements was being mangled due to an
uninitialized variable. gasp! Now fixed.

llvm-svn: 192033
2013-10-05 13:31:31 +00:00
Edwin Vane c0f00b79f7 clang-modernize: Apply replacements using clang-apply-replacements
Summary:
The clang-apply-replacements process is now invoked to apply
replacements between applying transforms. This resulted in a massive
simplification of the tool:
- FileOverrides class no longer needed.
- Change tracking and code formatting no longer needed.
- No more dependency on libclangApplyReplacements.
- Final syntax check is easier to do directly now than with a separate
  header/source pair.

Replacement handling stuff abstracted into a new header/source pair to
de-clutter ClangModernize.cpp somewhat.

Tests updated.

Differential Revision: http://llvm-reviews.chandlerc.com/D1836

llvm-svn: 192032
2013-10-05 12:15:58 +00:00
Edwin Vane 2fb10d1889 clang-apply-replacements: Fixing doxygen warning
llvm-svn: 191754
2013-10-01 13:21:39 +00:00
Edwin Vane 6afb68408d Fix build by adding dep on TransformUtils
clang-apply-replacements unittest Makefile wasn't linking in TransformUtils.

llvm-svn: 191669
2013-09-30 14:29:28 +00:00
Edwin Vane 59d93af4a5 clang-apply-replacements: Add code formatting functionality
The tool now supports a collection of arguments to turn on and provide settings
for the formatting of code affected by applying replacements:
* --format turns on formatting (default style is LLVM)
* --style controls code style settings
* --style-config allows one to explicitly indicate where a style config file
  lives.

The libclangApplyReplacements interface has a new function to turn Replacements
into Ranges to be used with tooling::reformat().

llvm-svn: 191667
2013-09-30 13:59:21 +00:00
Edwin Vane bdd8561dea clang-modernize: Fixing a few left over cpp11-migrate references
Build files for unit tests hadn't been updated yet.

llvm-svn: 191451
2013-09-26 19:26:58 +00:00
Edwin Vane e228d10709 clang-modernize: Reset LoopConvert's TU tracking info per TU
The LoopConvert transform makes use of data structures it builds up over
the course of transforming a TU. Until now, these data structures
weren't being cleared out before the next TU was being processed.

Fixes PR17253.

Differential Revision: http://llvm-reviews.chandlerc.com/D175

llvm-svn: 191448
2013-09-26 19:10:04 +00:00
Edwin Vane 6d5350cb76 clang-apply-replacements: Clean up -help and -version
Options that leak from other parts of LLVM are now pruned out of -help.

-version output is specific to clang-apply-replacements now.

Differential Revision: http://llvm-reviews.chandlerc.com/D1747

llvm-svn: 191322
2013-09-24 18:14:54 +00:00
Ariel J. Bernal e5ba87b6bb Clean up timing command line option.
Use getNumOccurrences instead of usina a default constant string.

llvm-svn: 191308
2013-09-24 15:41:30 +00:00
Ariel J. Bernal faa2b3a101 Fixed test for compilation databases.
Fixed test that was previously failing due to concurrency.

llvm-svn: 191215
2013-09-23 19:02:25 +00:00
Ariel J. Bernal f50eb0c73c Added tests for testing migration of files in a compilation database.
This patch also fixes the case where a compilation database is autodetected from
source but the file itself cannot be found in the compilation database, it then
ignores the compilation database and transforms the file with c++11 support.

llvm-svn: 191213
2013-09-23 18:37:32 +00:00
John Thompson 02bad9fbc3 Fix headers, use source quoting.
llvm-svn: 191211
2013-09-23 17:57:00 +00:00
John Thompson 8925d4622b Changed error messages to use source quoting.
llvm-svn: 191201
2013-09-23 14:17:27 +00:00
John Thompson 587f6db9e1 Added list of checks made.
llvm-svn: 191093
2013-09-20 16:47:33 +00:00
John Thompson a2b66875d3 Added colon to make proper error message prefix.
llvm-svn: 191092
2013-09-20 14:44:20 +00:00
John Thompson 2d2d45e330 Added modularize documentation.
llvm-svn: 191091
2013-09-20 14:40:52 +00:00
Alexey Samsonov 2a8fcee302 Don't use default label in fully covered switch
llvm-svn: 190992
2013-09-19 07:35:47 +00:00
John Thompson 740839260b Check for #include in extern and namespace blocks.
llvm-svn: 190950
2013-09-18 18:19:43 +00:00
Ariel J. Bernal defd1a93c9 Fix for removing not included files from a compilation database.
remove_if doesn't alter the container properties. Need to use erase to remove
the elements past the new end.

llvm-svn: 190803
2013-09-16 20:12:22 +00:00
Ariel J. Bernal 583d095fa4 Transform files in a compilation database if no sources are provided.
Compile all files in a compilation database or a subset determined by a
sub-directory so you  don't have to specify them manually.

llvm-svn: 190630
2013-09-12 20:10:59 +00:00
Ariel J. Bernal dfa4c7548b Point doxygen link to somthing useful.
llvm-svn: 190607
2013-09-12 15:26:44 +00:00
NAKAMURA Takumi 4814eaa9ba clang-tools-extra/test/clang-modernize/HeaderReplacements/main.cpp: Tweak sed(1) to let paths with a driveletter quoted in *_expected.yaml.
llvm-svn: 190517
2013-09-11 11:55:59 +00:00
Benjamin Kramer 3353a10339 Modularize: Use in-place version of sys::path::native.
llvm-svn: 190511
2013-09-11 10:45:25 +00:00
Rui Ueyama 9b866c2312 Fix YAML tests again.
llvm-svn: 190489
2013-09-11 04:51:09 +00:00
Rui Ueyama a53cbc5821 Fix YAML tests.
llvm-svn: 190487
2013-09-11 04:40:12 +00:00
Guillaume Papin 65ec930557 clang-modernize: Fix bugs in Pass-By-Value transform
- Limit the transform to const-ref and non-const value parameters only.
- Do not generate a replacement when the type is already a value.

See CM-139 for the bugs corresponding to this issue.

llvm-svn: 190212
2013-09-06 22:28:53 +00:00
Edwin Vane 5a816f044c clang-modernize: Tweak docs after rename
* Removing sphinx warnings about docs not in a toctree.
* Adding more links to cpp11-migrate redirect docs.

llvm-svn: 190195
2013-09-06 19:27:19 +00:00
Edwin Vane 684daa90f2 clang-modernize: Update docs with -include/-exclude
-include/-exclude and friends have been marked as hidden options until this
point. This is no longer necessary. Update the docs to describe their effect.

Differential Revision: http://llvm-reviews.chandlerc.com/D1621

llvm-svn: 190194
2013-09-06 19:26:25 +00:00
Edwin Vane 5f002639e4 clang-modernize: Remove -headers option
clang-modernize can now transform headers properly and the experimental
-headers option is no longer necessary.

Remember, at least -include is necessary for indicating which headers
are allowed to be changed.

Differential Revision: http://llvm-reviews.chandlerc.com/D1610

llvm-svn: 190158
2013-09-06 14:23:56 +00:00
Manuel Klimek bfbc8c8412 Fix writing of reformatted files.
If transformations lead to changes that do not need reformatting, the
current strategy will not write those files. With this patch, we just
update the overall state with the changes due to reformatting, and then
write out everything.

llvm-svn: 190050
2013-09-05 13:55:39 +00:00
John Thompson 7d0213c581 modularize - Fix of header dependencies - this time with the source.
llvm-svn: 189984
2013-09-04 20:46:24 +00:00
John Thompson 99e12d41d8 modularize - Fix of header dependencies.
llvm-svn: 189983
2013-09-04 20:45:43 +00:00
Chandler Carruth 8e8db654be Update the header guards for clang-modernize's unittests.
llvm-svn: 189974
2013-09-04 19:15:54 +00:00
Chandler Carruth 35c0361783 Update the header guards for clang-modernize.
llvm-svn: 189973
2013-09-04 19:13:50 +00:00
John Thompson 53a9d2da49 modularize - Update main comment.
llvm-svn: 189968
2013-09-04 18:29:36 +00:00
Chandler Carruth e160627d7b Fix up a few straggling bits of the build system. This should fix the
build of the clang-modernize unittest which is for some reason not being
built by default on my system (sorry about that).

llvm-svn: 189966
2013-09-04 18:03:44 +00:00
Chandler Carruth b0b51b36d5 This is apparantely the one makefile that actually has file names in it.
;] Update them. Sorry for the breakage.

llvm-svn: 189963
2013-09-04 17:47:21 +00:00
Chandler Carruth d9063c46f5 Rename cpp11-migrate to clang-modernize.
There is no reason to expect this tool to be limited to C++11, it seems
very likely to be of on-going interest. It seems likely to be useful for
modernizing even as new libraries come out in TSes and other formats
than a complete standard. Fundamentally, we need something a bit more
general. After some discussion on the list, going with
'clang-modernize'.

I've tried to do a reasonably comprehensive job of fixing up the names,
but I may still have missed some. Feel free to poke me if you spot any
fallout here. Things I've tried reasonably hard to find and fix:

- cpp11-migrate -> clang-modernize
- Migrator -> Modernizer
- Clean up the introductory documentation that was C++11 specific.

I'll also point out that this tool continues to delight me. =] Also,
a huge thanks to those who have so carefully, thoroughly documented the
tool. The docs here are simply phenomenal. Every tool should be this
well documented. I hope I have updated the documentation reasonably
well, but I'm not very good at documentation, so review much
appreciated.

llvm-svn: 189960
2013-09-04 17:35:07 +00:00