Commit Graph

535 Commits

Author SHA1 Message Date
John Thompson 0bc443b5c8 [extra] pp-trace - Add test for conditional callbacks.
llvm-svn: 194440
2013-11-12 02:04:53 +00:00
John Thompson da0b753035 [extra] pp-trace - Test for moduleImport.
llvm-svn: 194422
2013-11-11 21:20:02 +00:00
Peter Collingbourne c7ae6101a4 Revert r194247 conditional on non-MSVC.
These definitions are required by the standard.  MSVC rejecting them
appears to be a bug.

llvm-svn: 194252
2013-11-08 08:54:53 +00:00
NAKAMURA Takumi 55380c4e54 clang-query: Unbreak msvc.
llvm-svn: 194247
2013-11-08 06:29:09 +00:00
Peter Collingbourne 0dc0e6d32c Silence GCC warning.
llvm-svn: 194230
2013-11-08 01:08:12 +00:00
Peter Collingbourne 8b1265b353 Introduce clang-query tool.
This tool is for interactive exploration of the Clang AST using AST matchers.
It currently allows the user to enter a matcher at an interactive prompt
and view the resulting bindings as diagnostics, AST pretty prints or AST
dumps. Example session:

$ cat foo.c
void foo(void) {}
$ clang-query foo.c --
clang-query> match functionDecl()

Match #1:

foo.c:1:1: note: "root" binds here
void foo(void) {}
^~~~~~~~~~~~~~~~~
1 match.

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

llvm-svn: 194227
2013-11-08 00:08:23 +00:00
John Thompson 41778fd28f pp-trace user documentation - beginnings
llvm-svn: 194081
2013-11-05 14:41:29 +00:00
John Thompson 5252325990 [extra] pp-trace - Fixed problems found while writing docs.
llvm-svn: 194079
2013-11-05 14:16:11 +00:00
John Thompson 1da6792242 pp-trace user documentation - beginnings
llvm-svn: 193842
2013-11-01 00:39:54 +00:00
John Thompson 5052eb7394 pp-trace user documentation - beginnings
llvm-svn: 193841
2013-11-01 00:38:04 +00:00
Dan Gohman cc30af0cef Rename Input to Inputs, for consistency with other tests.
llvm-svn: 193805
2013-10-31 21:29:44 +00:00
Alexey Samsonov fe74ba6b7b Delete unused private field to fix -Werror build
llvm-svn: 193763
2013-10-31 17:03:07 +00:00
John Thompson 17c4f7d1db Fix comment. pp-trace can only handle source file at a time.
llvm-svn: 193746
2013-10-31 12:53:42 +00:00
NAKAMURA Takumi 125a4171b2 check-clang-tools: Add pp-trace for deps.
llvm-svn: 193745
2013-10-31 12:46:16 +00:00
NAKAMURA Takumi a256eb4038 check-clang-tools: Reorder CLANG_TOOLS_TEST_DEPS.
llvm-svn: 193744
2013-10-31 12:46:10 +00:00
John Thompson 9979454e72 pp-trace - preprocessor tacing and PPCallbacks testing tool
llvm-svn: 193743
2013-10-31 12:23:32 +00:00
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
Bob Wilson f5999bda8c Revert svn 189837 "Added header dependencies support."
The NoProblemsDependencies.modularize test is failing on many buildbots.
I have also reverted the change in 189904 to disable that test for MSVC.

llvm-svn: 189957
2013-09-04 16:48:28 +00:00
NAKAMURA Takumi 3b6ef78954 Suppress test/modularize/NoProblemsDependencies.modularize on msvc, for now. Investigating.
llvm-svn: 189904
2013-09-04 02:03:03 +00:00
John Thompson 7475180f9b Added header dependencies support.
llvm-svn: 189837
2013-09-03 18:48:43 +00:00
John Thompson cc2e291dac Ran clang-format for a base-line.
llvm-svn: 189836
2013-09-03 18:44:11 +00:00
John Thompson 0b7fc15e70 Undo r189834 - broke test.
llvm-svn: 189835
2013-09-03 18:38:32 +00:00
John Thompson a486a6f211 Ran clang-format.
llvm-svn: 189834
2013-09-03 18:21:22 +00:00
Edwin Vane b225be2729 Rename clang-replace -> clang-apply-replacements
Made changes throughout clang-tools-extra for the renaming of
clang-replace to clang-apply-replacements as per feedback from
community.

llvm-svn: 189832
2013-09-03 17:58:19 +00:00
Edwin Vane 147984a8ad cpp11-migrate: Refactor for driver model of operation
Re-commit of r189691 and r189689 now with a proper autoconf fix.

Massive simplification of how replacements and file overrides are
handled by the migrator:
* Sources and headers are all treated the same.
* All replacements for a given translation unit are stored in the same
  TranslationUnitReplacements structure.
* Change tracking is updated only from main file; no need for
  propagating "is tracking" flag around.
* Transform base class no longer responsible for applying replacements.
  They are simply stored and main() looks after deduplication and
  application.
* Renamed -yaml-only to -serialize-replacements. Same restrictions apply:
  Can only request one transform. New restriction: formatting cannot also
  be turned on since it's basically a transform.
* If -serialize-replacements is requested, changes to files will not be
  applied on disk.
* Changed behaviour of function generating names for serialized
  replacements: Only the main source file goes into the name of the file
  since a file may contain changes for multiple different files.
* Updated HeaderReplacements LIT test for new serialization behaviour.
  * Replaced old test that ensures replacements are not serialized if
    -serialize-replacements is not provided. New version ensures changes
    are made directly to all files in the translation unit.
* Updated unit tests.
  * Due to major simplification of structures in FileOverrides.h, the
    FileOverridesTest is quite a bit simpler now.

llvm-svn: 189798
2013-09-03 13:16:02 +00:00
Chandler Carruth 9051d41a74 Update tests to reflect clang r189769 which changes the printing of
'auto const' to 'const auto'.

llvm-svn: 189770
2013-09-02 19:21:12 +00:00
Michael Gottesman 92d9cb4dd1 Revert "cpp11-migrate: Fixing autoconf build after adding libclangReplace dependency"
Revert "cpp11-migrate: Refactor for driver model of operation"

This reverts commit r189691.
This reverts commit r189689.

This was breaking the phase 1 OS X build for ~2 hours.

https://smooshbase.apple.com/buildbot-internal/builders/phase1%20-%20sanity/builds/9559

I reverted the latter commit since I think the latter depended on the former.

llvm-svn: 189700
2013-08-30 22:09:03 +00:00
Edwin Vane 848c5dc7aa cpp11-migrate: Fixing autoconf build after adding libclangReplace dependency
llvm-svn: 189691
2013-08-30 19:45:49 +00:00
Edwin Vane 0acd502afe cpp11-migrate: Refactor for driver model of operation
Massive simplification of how replacements and file overrides are handled by
the migrator:
* Sources and headers are all treated the same.
* All replacements for a given translation unit are stored in the same
  TranslationUnitReplacements structure.
* Change tracking is updated only from main file; no need for
  propagating "is tracking" flag around.
* Transform base class no longer responsible for applying replacements.
  They are simply stored and main() looks after deduplication and
  application.
* Renamed -yaml-only to -serialize-replacements. Same restrictions apply:
  Can only request one transform. New restriction: formatting cannot also
  be turned on since it's basically a transform.
* If -serialize-replacements is requested, changes to files will not be
  applied on disk.
* Changed behaviour of function generating names for serialized
  replacements: Only the main source file goes into the name of the file
  since a file may contain changes for multiple different files.
* Updated HeaderReplacements LIT test for new serialization behaviour.
  * Replaced old test that ensures replacements are not serialized if
    -serialize-replacements is not provided. New version ensures changes
    are made directly to all files in the translation unit.
* Updated unit tests.
  * Due to major simplification of structures in FileOverrides.h, the
    FileOverridesTest is quite a bit simpler now.

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

llvm-svn: 189689
2013-08-30 19:28:59 +00:00
Edwin Vane f5b5f1f7f6 clang-replace: Fix autoconf build failures
Updating autoconf files to reflect changes to directory structure

llvm-svn: 189681
2013-08-30 15:40:26 +00:00
Edwin Vane 1790ea000b clang-replace: Re-org of file structure
clang-replace is likely to move to clang proper one day soon. To facilitate
that move, renaming files and directory structure layout to ease transition for
users of clang-replace and libclangReplace.

For now, functionality still exists in clang::replace namespace. Header guards
and file comments updated.

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

llvm-svn: 189671
2013-08-30 14:33:56 +00:00
Guillaume Papin 81332632b1 cpp11-migrate: Add Pass-By-Value Transform
Currently only constructor parameters stored in class-local storage are modified
to make use of the pass-by-value idiom but this is a base that can be be further
improved to handle more situations.

This commit is the same as r189363 with additionnal fixes for the build issues.

llvm-svn: 189584
2013-08-29 13:42:13 +00:00
Edwin Vane f18633c3d5 clang-replace: Afford applying replacements in memory
For users of libclangReplace, this patch affords the ability to apply
replacements in memory instead of writing to disk.

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

llvm-svn: 189493
2013-08-28 17:19:10 +00:00
Eric Christopher 35c6b614ea Temporarily revert r189363 as it seems to be failing to build.
llvm-svn: 189387
2013-08-27 17:26:07 +00:00
Guillaume Papin dcdae946f3 cpp11-migrate: Add Pass-By-Value Transform
Currently only constructor parameters stored in class-local storage are modified
to make use of the pass-by-value idiom but this is a base that can be be further
improved to handle more situations.

llvm-svn: 189363
2013-08-27 16:11:26 +00:00
Guillaume Papin 64feb39b1b cpp11-migrate: Add a class to support include directives modifications
The IncludeDirectives class helps with detecting and modifying #include
directives. For now it allows the users to add angled-includes in a source file.
This is a start for this class that will evolve in the future to add more
functionality.

This should fix the reverted commit r189037 (buildbot failures on Windows).

llvm-svn: 189354
2013-08-27 14:50:26 +00:00
Tareq A. Siraj 1175552853 clang-replace: Delete change description files
Added a command line option "-remove-change-desc-files" that triggers
the deletion of the change description files after merging and applying
regardless of success.

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

llvm-svn: 189268
2013-08-26 19:58:59 +00:00
John Thompson 9e8d672206 Updated the main comment with respect to problems and future directions.
llvm-svn: 189229
2013-08-26 15:55:47 +00:00
John Thompson 8e01c069c9 Fixed some issues that resulted in erroneous duplicate symbol error messages.
llvm-svn: 189228
2013-08-26 15:17:23 +00:00
Edwin Vane 9f7a1c10ea clang-replace: Layout of test directory now more standard
Test-time dependencies now live within test/clang-replace/Inputs which is more
in line with llvm and clang test suites.

Added 'Inputs' to the lit config's 'exclude' list as with llvm's lit.cfg since
test-time dependencies should not have any lit scripts within.

llvm-svn: 189047
2013-08-22 19:44:07 +00:00
Guillaume Papin 883a2b2427 Revert "cpp11-migrate: Add a class to support include directives modifications"
This reverts commit r189017.

It broke the windows bots:
- http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/4176
- http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/3837

llvm-svn: 189037
2013-08-22 18:20:03 +00:00
Edwin Vane 69948e4155 clang-replace: Exclude test-time deps from LIT test suite
Subdirectories of test/clang-replace contain test-time dependencies and not
more LIT tests. Tell LIT to ignore these directories from the test suite.

llvm-svn: 189019
2013-08-22 15:04:34 +00:00
Guillaume Papin effabf9691 cpp11-migrate: Add a class to support include directives modifications
The IncludeDirectives class helps with detecting and modifying #include
directives. For now it allows the users to add angled-includes in a source file.
This is a start for this class that will evolve in the future to add more
functionality.

This should fix the reverted commit r188791 (buildbot failures on Windows).

llvm-svn: 189017
2013-08-22 14:49:07 +00:00
Edwin Vane 1106ef2a69 clang-replace: Write merged changes to disk
Functionality for clang-replace completed with the addition of the ability to
write merged replacements to disk.

Test added.

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

llvm-svn: 189014
2013-08-22 13:40:32 +00:00
Edwin Vane 3bf14cebee Introducing new tool clang-replace
Introducing new tool 'clang-replace' that finds files containing
serialized Replacements and applies those changes after deduplication
and detecting conflicts.

Currently the tool does not apply changes. It stops just after the
deduplication and conflict report phase. Forthcoming patches will
complete functionality.

Both build systems updated for new tool.

Includes a conflict test case.

clang-replace added to Doxygen build.

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

llvm-svn: 189008
2013-08-22 13:07:14 +00:00
Eli Friedman a4ff59a7f8 Adjust for r188968.
llvm-svn: 188970
2013-08-22 00:48:18 +00:00
Edwin Vane d2cd2a4e1e cpp11-migrate: Use Replacement serialization from clang::tooling
Serialization of replacements has been moved to clang::tooling.

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

llvm-svn: 188820
2013-08-20 19:20:52 +00:00
NAKAMURA Takumi 166b874696 UniqueHeaderNameTest.cpp: Appease valgrind.
llvm::sys::path::native(dst, dst) might be overridden-safe in most cases, though.

llvm-svn: 188800
2013-08-20 14:02:38 +00:00
Guillaume Papin 1593c7b20a Revert "cpp11-migrate: Add a class to support include directives modifications"
This reverts commit r188791.

The Windows bots are still broken.

llvm-svn: 188795
2013-08-20 13:05:57 +00:00
Guillaume Papin f240481b99 cpp11-migrate: Add a class to support include directives modifications
The IncludeDirectives class helps with detecting and modifying #include
directives. For now it allows the users to add angled-includes in a source file.
This is a start for this class that will evolve in the future to add more
functionality.

This should fix the reverted commit r188610 (buildbot failures on Windows).

llvm-svn: 188791
2013-08-20 12:30:26 +00:00
Alexey Samsonov f656e1783b Add dependencies on TransformUtils library in preparation for re-applying r188666
llvm-svn: 188674
2013-08-19 13:58:56 +00:00
Guillaume Papin 8d951fbc18 Revert "cpp11-migrate: Add a class to support include directives modifications"
This reverts commit r188610.

Issue with the absolute include paths not found in the unit tests on the Windows
bots. Needs investigation.

llvm-svn: 188611
2013-08-17 19:04:56 +00:00
Guillaume Papin 114d035521 cpp11-migrate: Add a class to support include directives modifications
The IncludeDirectives class helps with detecting and modifying #include
directives. For now it allows the users to add angled-includes in a source file.
This is a start for this class that will evolve in the future to add more
functionality.

llvm-svn: 188610
2013-08-17 18:48:31 +00:00
Ariel J. Bernal 2203559c3e Use -std=c++11 when no compilation database is provided
Allow the migrator to be used without specifing --. If neither -- nor -p is
provided and no compilation database can be detecteded from the first source
file path then -std=c++11 is added as the only compiler argument.

llvm-svn: 188533
2013-08-16 04:40:44 +00:00
Edwin Vane 169eec3620 cpp11-migrate: Remove mention of 'headers' from serialization code
* HeaderChangeDocument -> MigratorDocument
* HeaderFileName -> TargetFile
* SourceFileName -> MainSourceFile
* Removed TransformID
* Comments updated, at least with respect to serialization
* Unit tests updated.

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

llvm-svn: 188404
2013-08-14 19:02:28 +00:00
Tareq A. Siraj e5b3eb70e5 cpp11-migrate: Fixing doxygen warnings
For some reason doxygen doesn't seem to like the using namespace
clang::tooling in the source file and complaints about missing class
members.

Also fixed missing parameter documentation for TransformName in
SourceOverrides::applyReplacements().

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

llvm-svn: 188394
2013-08-14 17:47:39 +00:00
Edwin Vane bc7dc8d51f cpp11-migrate: Fix silly logic error preventing multiple transforms
A missed clause in an error test added in r188371 caused any use of the
migrator requesting multiple transforms to fail.

llvm-svn: 188374
2013-08-14 15:09:44 +00:00
Edwin Vane 4b68a0d5a0 cpp11-migrate: Adding -yaml-only option
For use with -headers, -yaml-only will cause cpp11-migrate to not write header
changes to disk and instead write them as header change description files. This
option facilitiates upcoming functionality to properly support changing headers
as part of migration.

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

llvm-svn: 188371
2013-08-14 14:52:45 +00:00
Benjamin Kramer 262b338519 \param is not for referring to arguments.
Found by -Wdocumentation.

llvm-svn: 188368
2013-08-14 10:21:47 +00:00
NAKAMURA Takumi db2162903e clang-tools-extra/test/cpp11-migrate/HeaderReplacements/main.cpp: Use "%/t" instead of "%t" on sed(1) to avoid \'s expanded to control chars.
The feature, "%/t", has been introduced in llvm/lit since r188348.

llvm-svn: 188349
2013-08-14 02:28:25 +00:00
NAKAMURA Takumi 7a8317fff5 clang-tools-extra/test/cpp11-migrate/HeaderReplacements/main.cpp: Use FileCheck instead of grep(1).
llvm-svn: 188347
2013-08-14 02:26:03 +00:00
NAKAMURA Takumi b31493d60c clang-tools-extra/test/cpp11-migrate/HeaderReplacements/main.cpp: Suppress this on win32, for now. Investigating.
llvm-svn: 188345
2013-08-14 01:20:33 +00:00
John Thompson 922734c661 Enhanced test for header guards.
llvm-svn: 188308
2013-08-13 18:26:40 +00:00
John Thompson c8d710cc82 Avoid errors on header guards using #if defined(NAME).
llvm-svn: 188306
2013-08-13 18:11:36 +00:00
Tareq A. Siraj 8e1c269a61 Fixes test failure on darwin introduced by r188274
Reworked how the tests dealt with paths. Instead of removing the full path name,
put a marker in the expected file and replace the marker with the full path
before running diff.

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

llvm-svn: 188299
2013-08-13 17:53:00 +00:00
Tareq A. Siraj 3baabf3968 cpp11-migrate: Write header replacements to disk
Another attempt to commit r187204 after windows related problems has
been fixed. Note that changes to this patch reflect the current behavior
of cpp11-migrate.

Header replacements are now written to disk in YAML format for an external tool
to merge. A unique file will be created in the same directory as the header
with all replacements that came from a source file that included the header
file. The YAML file will have:
- Name of the header file
- Name of the source file that included the header file
- Transform ID that generated the replacement
- Offset
- Length
- Replacement text

Any tool reading these replacements should read them using the
HeaderChangeDocument struct.

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

llvm-svn: 188274
2013-08-13 14:58:50 +00:00
Nico Weber 8e20be2aea Remove CRs added in r187370.
llvm-svn: 188168
2013-08-12 11:43:36 +00:00
Tareq A. Siraj 9111258ad7 cpp11-migrate: Fixed path problem with include/exclude paths
This fixes a problem when the path separator in the include/exclude
directory is different (e.g. "\" vs. "/") from the path separator in
the file path we are modifying.

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

llvm-svn: 188094
2013-08-09 19:24:05 +00:00
Daniel Dunbar 4d0a3ef6a3 [tests] Update to use lit_config and lit package, as appropriate.
llvm-svn: 188092
2013-08-09 18:49:22 +00:00
John Thompson bb0a3b0668 Fixed coding convention naming issue - variable names start with uppercase.
llvm-svn: 188070
2013-08-09 13:52:09 +00:00
John Thompson 91555bde88 Fix false error message for function-style macro instance used as arguments in other function-style macros instances, and add test for it.
llvm-svn: 188036
2013-08-09 00:22:20 +00:00
John Thompson 4fa9c2cbc6 Extend comments for problems and future directions.
llvm-svn: 188035
2013-08-09 00:19:03 +00:00
David Blaikie 001ba2ec0b Fix speling.
Patch by Richard (legalize@xmission.com)

llvm-svn: 187990
2013-08-08 16:49:52 +00:00
John Thompson ba6c662669 Expanded modularize tests.
llvm-svn: 187943
2013-08-08 00:01:09 +00:00
John Thompson 181ea2e957 Comment changes. Added current problems comment.
llvm-svn: 187942
2013-08-08 00:00:10 +00:00
John Thompson 4ed963a0ba Fixed incorrect header guard/nested header mechanism.
llvm-svn: 187898
2013-08-07 18:49:47 +00:00
John Thompson d2a0600279 Fix comment typo.
llvm-svn: 187796
2013-08-06 14:05:43 +00:00
John Thompson 428ad10623 Add test for header guard work-around.
llvm-svn: 187759
2013-08-06 00:17:40 +00:00
John Thompson 48df096c3f Fixed uninitialized member, plus recommit of 187736.
llvm-svn: 187757
2013-08-05 23:55:14 +00:00
Arnold Schwaighofer 30448e607e Reverting r187736. It broke some public bots:
http://lab.llvm.org:8011/builders/clang-native-arm-cortex-a9/builds/10248
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/3327

llvm-svn: 187746
2013-08-05 22:03:41 +00:00
John Thompson ea8e668516 Fixed incorrect include file exit detection. Added work-around to avoid error on header guard in nested include. Fixed a couple of coding standard issues on variable names.
llvm-svn: 187736
2013-08-05 19:15:50 +00:00
Benjamin Kramer d989ef4373 clang-tidy's modules depend on it.
Fixes shared cmake build.

llvm-svn: 187708
2013-08-04 16:06:43 +00:00
Daniel Jasper 89bbab09dd Fix clang-tidy dependencies and bad file comment.
This addresses comments in post-commit review of r187345.

llvm-svn: 187707
2013-08-04 15:56:30 +00:00
Hans Wennborg 97dd3d207a Remove dead #includes.
llvm-svn: 187536
2013-07-31 22:28:46 +00:00
Ariel J. Bernal dec84e1139 Fixed path differences when using include/exclude headers
Added function for removing relative operators from input paths.

llvm-svn: 187481
2013-07-31 04:00:28 +00:00
Rafael Espindola 0ff671b3be Revert "cpp11-migrate: Write header replacements to disk"
This reverts commit 187428. It broke the windows bots.
http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/3450

llvm-svn: 187447
2013-07-30 21:05:56 +00:00
Tareq A. Siraj 67fa4114a6 cpp11-migrate: Write header replacements to disk
Committing r187204 with fixes for darwin. Note that one of the lit tests are
disabled on windows due to a bug in writing header replacements to file.

Header replacements are now written to disk in YAML format for an external tool
to merge. A unique file will be created in the same directory as the header
with all replacements that came from a source file that included the header
file. The YAML file will have:
 - Name of the file
 - Transform ID that generated the replacement
 - Offset
 - Length
 - Replacement text

Any tool reading these replacements should read them using the
TransformDocument struct.

llvm-svn: 187428
2013-07-30 18:18:02 +00:00
John Thompson dc118270ac Fixed comment typo.
llvm-svn: 187384
2013-07-29 21:59:41 +00:00
John Thompson 7c6e79f395 Fixed comment issues (non-ASCII chars, typos) per review, expanded some comments.
llvm-svn: 187370
2013-07-29 19:07:00 +00:00
Guillaume Papin a3eede2cc2 cpp11-migrate: Add -for-compilers command line switch.
This change add a new option command line option -for-compilers that allows the
user to enable multiple transforms automatically.

Another difference is that now all transforms are enabled by default.

llvm-svn: 187360
2013-07-29 15:58:47 +00:00
Daniel Jasper 03524b774a Fix build error caused by r187345.
llvm-svn: 187346
2013-07-29 08:43:57 +00:00
Daniel Jasper d07c840e6a Initial architecture for clang-tidy.
This is the first version of a possible clang-tidy architecture. The
purpose of clang-tidy is to detect errors in adhering to common coding
patterns, e.g. described in the LLVM Coding Standards.

This is still heavily in flux.

Review: http://llvm-reviews.chandlerc.com/D884
llvm-svn: 187345
2013-07-29 08:19:24 +00:00
Benjamin Kramer f25768103a modularize: Remove default case from fully covered switch.
llvm-svn: 187306
2013-07-27 15:57:46 +00:00
John Thompson 3e4ff3f0e4 Fixed checkin of wrong old files. Hopefully this is the end of the test failure.
llvm-svn: 187287
2013-07-27 02:06:36 +00:00
John Thompson ce117b07c5 Fixed missing checkin.
llvm-svn: 187282
2013-07-27 00:54:17 +00:00
John Thompson 94faa4d0d4 Fixed case change that caused the test failure. Incorporarated Sean's review changes, consisting only of renaming and comment changes.
llvm-svn: 187277
2013-07-26 23:56:42 +00:00
Rafael Espindola 17b15cfbe3 Revert "Added new feature for checking macro and preprocessor conditional consistency."
This reverts commit r187228. It broke some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32

llvm-svn: 187235
2013-07-26 19:23:33 +00:00
John Thompson 1e0101461e Added new feature for checking macro and preprocessor conditional consistency.
llvm-svn: 187228
2013-07-26 18:16:22 +00:00
Rafael Espindola 318f09fda7 Revert "cpp11-migrate: Write header replacements to disk"
This reverts commit 187204. It broke the freebsd bots:

http://lab.llvm.org:8011/builders/clang-X86_64-freebsd/builds/9561

llvm-svn: 187227
2013-07-26 18:11:49 +00:00
Tareq A. Siraj 3a2476a342 cpp11-migrate: Write header replacements to disk
Header replacements are now written to disk in YAML format for an external tool
to merge. A unique file will be created in the same directory as the header
with all replacements that came from a source file that included the header
file. The YAML file will have:
 - Name of the file
 - Transform ID that generated the replacement
 - Offset
 - Length
 - Replacement text

Any tool reading these replacements should read them using the TransformDocument
struct.

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

llvm-svn: 187204
2013-07-26 14:11:45 +00:00
Edwin Vane 5466b7cbbb cpp11-migrate: Tweak lit tests to avoid false negatives
Recent failures on a freebsd buildbot indicated a weakness in the
Reformatting.cpp lit test. Tweaking the test to avoid false negatives and
hopefully make the buildbot happy.

llvm-svn: 187153
2013-07-25 20:20:20 +00:00
Ariel J. Bernal a9df759af6 Fix doxygen warnings
Doxygen doesn't recognize <blockquote> html tags. Added support for <blockquote>
and Markdown was introduce with doxygen 1.8.0. This patch replaces blockquote
with \par for compatibility with previous versions.

llvm-svn: 187067
2013-07-24 19:14:57 +00:00
Guillaume Papin 91b568a31f cpp11-migrate: Fix build break on Windows introduced in r187041.
r187041 changed the way the transform are created and the order the transformed
are applied "may" have changed as well (no specific constraints exist on the
order). This produced a test failure on the Windows buildbot.

Now the test use -std=c++11, so 'nullptr' is defined and the test is not anymore
dependent on the order the transforms are applied.

llvm-svn: 187048
2013-07-24 15:35:24 +00:00
Guillaume Papin ebde78c4c6 cpp11-migrate: Register the transforms automatically using llvm::Registry
With this change each transform now register a factory. The factories are
registered using an llvm::Registry which makes them available globally.

llvm-svn: 187041
2013-07-24 14:24:33 +00:00
Guillaume Papin 78bfe2b12e test commit
llvm-svn: 187038
2013-07-24 13:58:28 +00:00
Ariel J. Bernal 3beac8b322 Fix doxygen warnings
It seems that doxygen fails to find overloaded methods when the parameters are
not in sync with the method declaration.
Added the fully-qualifed type to the parameters method definition although it's
not necessary since the using directive is in effect.

llvm-svn: 186948
2013-07-23 15:52:07 +00:00
Edwin Vane 571a64159b cp11-migrate: Integration with LibFormat
Adding a feature to optionally reformat code changed by the migrator. Like
LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium)
or use a YAML-format config file.

Now with no dependency on iostream by the Reformatting.cpp LIT test.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186938
2013-07-23 12:50:03 +00:00
Michael Gottesman 29e449f222 Revert "cp11-migrate: Integration with LibFormat"
This reverts commit r186866.

This breaks the build and the original author Guillaume Papin
<guillaume.papin@epitech.eu> asked me to revert so he could look at it more with
revane.

llvm-svn: 186873
2013-07-22 21:03:56 +00:00
Edwin Vane 55b0be72d1 cp11-migrate: Integration with LibFormat
Adding a feature to optionally reformat code changed by the migrator. Like
LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium)
or use a YAML-format config file.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186866
2013-07-22 20:26:29 +00:00
Edwin Vane 40be0dc261 cpp11-migrate: Make a VirtualFilesHelper class for the unit tests.
This change makes it easier for new unit tests to create virtual files.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186842
2013-07-22 16:36:58 +00:00
John Thompson b809dfcf3a Fixed some formatting issues with clang-format to get a baseline.
llvm-svn: 186675
2013-07-19 14:19:31 +00:00
Edwin Vane 0ffd0a9e54 cpp11-migrate: Use test fixture in preparation for more tests
Existing tests are not changed but the set-up work is moved into a fixture
to simplify forthcoming new tests.

llvm-svn: 186575
2013-07-18 11:59:08 +00:00
Rafael Espindola 93c49dcf42 Update for llvm API change.
llvm-svn: 186449
2013-07-16 19:44:28 +00:00
Ariel J. Bernal 601858aed7 Fix UseAuto not transforming iterator when non-fully qualifiers are used and
using inline namespaces is specified.

UseAuto used to fail to transform iterators when using inline namespaces and
non-fully qualified types, relying on a using directive previously declared.
- This fix uses the already define isFromStdNamespace matcher.
- Fixed tests and added a new test using inline namespaces.
- Added CustomMatchers to reuse common matchers among transforms.

llvm-svn: 186327
2013-07-15 15:37:05 +00:00
Tareq A. Siraj e0a03c3c64 cpp11-migrate: FileOverrides/Transform refactoring.
This commit include the following changes:
 - SourceOverrides is now a class
   - it simplifies the usage for the Transform class, since now the
     replacements can be applied directly to the file overrides with
     SourceOverrides::applyReplacements().
   - it contains a method applyRewrites() which was previously named
     collectResults() in Transform.cpp. The method has been "optimized"
     a bit to re-use the allocated buffer (std::string::clear() is called).
   - since the class has some logic it's now unit tested
 - Now FileOverrides is a class (not a std::map typedef) and store pointers
   to the SourceOverrides. The reason is that the SourceOverrides can't be
   copied anymore (which was already something to avoid since it's can be a
   quite large object).

Author: Guillaume Papin <guillaume.papin@epitech.eu>

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

llvm-svn: 186161
2013-07-12 14:36:20 +00:00
Edwin Vane af1e77eec3 cpp11-migrate: Add missing file headers in unit tests
Differential: http://llvm-reviews.chandlerc.com/D1124
Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186093
2013-07-11 15:54:06 +00:00
Tareq A. Siraj 9c7750eeae Generate a unique filename for a given header
This patch is in preparation for writing the header replacement to disk.
Added getUniqueHeaderName() that generates a unique header filename in
the same directory as the header file.

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

llvm-svn: 186007
2013-07-10 16:09:36 +00:00
Edwin Vane 86142e02df cpp11-migrate: Fixes for r185811
Some changes to r185811 broke certain build configurations. These changes should
fix them.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185814
2013-07-08 12:49:04 +00:00
Edwin Vane aae33677f5 cpp11-migrate: Tidying up
* Some file headers were missing for files in Core/
* Some headers were included but not necessary
* CMakeLists.txt was linking in LLVMSupport even though CMakeLists in subdirs
  were linking it in too.
* StringRefisation of constructors of types in FileOverrides.h
* Other misc cleanups

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185811
2013-07-08 12:17:37 +00:00
Rafael Espindola 43318aa17c Use llvm::sys::fs::createTemporaryFile.
llvm-svn: 185718
2013-07-05 20:01:03 +00:00
Edwin Vane 17b31f3d43 cpp11-migrate: Minor command-line fixes and improvements
* all transforms are in the same category
* all transforms' options are in the same category
* display the CommonOptionParser extra-help (which describe in more details the
  compilation database stuff)
* add EXAMPLES section

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185660
2013-07-04 17:49:59 +00:00
Rafael Espindola b55bb2fccf Add 'not' to commands that are expected to fail.
llvm-svn: 185654
2013-07-04 16:28:28 +00:00
Edwin Vane 5ee6110817 cpp11-migrate: Add Replace-AutoPtr Transform
Add a new transform to replace uses of 'std::auto_ptr' by 'std::unique_ptr'.
Copy-ctor and assign-operator are wrapped with a call to 'std::move()'.

Note that until header modification is ready it is not that useful, that's why
it's marked as (EXPERIMENTAL) in the command line description and a "Known
Limitations" section is present in the transform documentation.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185535
2013-07-03 13:21:24 +00:00
John Thompson 161381e120 Ran clang-format on Modularize.cpp to get a baseline for future changes.
llvm-svn: 185092
2013-06-27 18:52:23 +00:00
Rafael Espindola b6d9c0001a Don't use PathV1.h in IncludeExcludeTest.cpp.
llvm-svn: 184959
2013-06-26 16:20:55 +00:00
Rafael Espindola b8db1cd13e Don't use PathV1.h in TransformTest.cpp.
llvm-svn: 184958
2013-06-26 15:48:36 +00:00
Rafael Espindola a3d1c02356 Don't use PathV1.h in PerfSupport.cpp.
llvm-svn: 184956
2013-06-26 15:22:42 +00:00
Edwin Vane 51a55d9964 cpp11-migrate: Really fixing doxygen warning
Last attempt at this fix was bogus.

llvm-svn: 184869
2013-06-25 19:01:18 +00:00
John Thompson 26b567ae6a Fixed typo.
llvm-svn: 184347
2013-06-19 20:35:50 +00:00
Edwin Vane e85ba57d6a cpp11-migrate: Fixing doxygen warning
llvm-svn: 184326
2013-06-19 17:38:56 +00:00
Edwin Vane b31df59109 cpp11-migrate: Fix parsing of '.' for header include/excludes
sys::fs::make_absolute was turning '.' into '<path>/.' which broke prefix
comparison logic. Stripping these extra chars fixes the problem.

llvm-svn: 184322
2013-06-19 17:17:31 +00:00
Manuel Klimek 1a3dc8576e Fix a remove-cstr-calls test that fails checking of the produced code.
llvm-svn: 184314
2013-06-19 15:43:40 +00:00
NAKAMURA Takumi cb873b1fc9 Prune "\param InitialState" since it has not been introduced. [-Wdocumentation]
llvm-svn: 184285
2013-06-19 06:58:29 +00:00
John Thompson 54c83695f7 Fixed a typo and naming convention.
llvm-svn: 184221
2013-06-18 19:56:05 +00:00
Edwin Vane ba6b32d1ce cpp11-migrate: Transforms honour header modification flag
Transforms will now make changes to headers if header modifications have been
enabled.

FIXME: Only UseNullptr contains a cursory header modification test. Other
transforms should have them too.

llvm-svn: 184197
2013-06-18 15:44:58 +00:00
Edwin Vane 62c013db6c cpp11-migrate: Transform now responsible for applying replacements
To make it possible for replacements made to headers as part of transforming
one translation unit to not be visible to the transform of other translation
units, Transform now handles replacement application as part of its
end-of-source handling. Several things were simplified as a result:

- The duplicated code in every transform for applying replacements is now gone
  and replaced with one location in Transform.
- RefactoringTool is no longer used since Transform houses the Replacements
  structure.
- RewriterContainer is now a private implementation detail of Transform (also
  renamed to RewriterManager since its behaviour is slightly different now with
  respect to lifetime of objects).
- There's now no distinction between input and output file state.

Misc notes:

- Interface changes reflected in unit tests.
- Replacements for files other than the main file are assumed to be for headers
  and stored as such.

llvm-svn: 184194
2013-06-18 15:31:01 +00:00
Edwin Vane 4e11abb59b cpp11-migrate: Transform now responsible for file content overriding
To better support per-translation unit replacements, any real work is being
moved out of ActionFactory and into Transform. In this revision, that means
file override application.

For simplification, Transform no longer inherits from SourceFileCallbacks.
TransformTest required updating as a result.

llvm-svn: 184098
2013-06-17 18:18:15 +00:00
Rafael Espindola f7d00ba592 Revert "sys::Path::GetCurrentDirectory has been removed. Use sys::fs::current_path."
This reverts commit r184004.

This test has some dependency on the behavior of the old function on windows. I
added it back to llvm for now.

llvm-svn: 184010
2013-06-14 21:44:06 +00:00
Rafael Espindola 584b0706b2 sys::Path::GetCurrentDirectory has been removed. Use sys::fs::current_path.
llvm-svn: 184004
2013-06-14 20:48:30 +00:00
Reid Kleckner e34930bf6f Add a dependency on LLVM's option library for clang-tools-extra
r183989 added a dependency on LLVMOption in clangFrontend.

llvm-svn: 183990
2013-06-14 17:34:04 +00:00
Rafael Espindola 5492d613f5 Force c++98 so this works on windows where c++11 is the default.
llvm-svn: 183983
2013-06-14 16:09:37 +00:00
Edwin Vane 8d28646db6 cpp11-migrate: Fixing section markup
Adhering to LLVM's ReST style for section markup.

llvm-svn: 183981
2013-06-14 15:14:20 +00:00
Sylvestre Ledru cda552b1ba Also install cpp11-migrate when built with cmake. Fixes bug #16296
llvm-svn: 183976
2013-06-14 11:25:50 +00:00
Edwin Vane 230ecb2422 cpp11-migrate: const-correcting IncludeExcludeInfo
isFileIncluded() needed to be marked const.

llvm-svn: 183918
2013-06-13 17:19:37 +00:00
Edwin Vane 90706dd424 cpp11-migrate: Add headers to file override information
File override structures now contain per-source overrides for headers.

For now, modified headers are written to disk when the Migrator is done.
This is only temporary behaviour since we can expect headers to be
changed by migrating multiple source files. The changes need to be
merged after all migrations are complete.

llvm-svn: 183917
2013-06-13 17:17:32 +00:00
Edwin Vane e0a7d9ceff cpp11-migrate: Replace file override container
A more flexible container for storing overrides is required for headers. Before
a source goes through the transform pipeline, any headers it references will be
in their original state and unaffected by transforms applied to other sources.
Therefore overrides for headers need to be kept separate for each source file.

This patch doesn't introduce support for storing header overrides yet. It only
replaces the existing structure and makes any necessary changes to support it.

llvm-svn: 183910
2013-06-13 16:00:46 +00:00
Edwin Vane 59175a1523 cpp11-migrate: Decluttering Transform.h
Moving RewriteContainer's constructor impl to Transform.cpp to reduce clutter.
More things will soon be added to this header.

llvm-svn: 183856
2013-06-12 19:58:21 +00:00
Edwin Vane a6bbcdd707 cpp11-migrate: New mechanism for overriding file contents
Next step toward supporting migrating headers. Instead of using ClangTool's
ability to override all files at once, use a custom FrontendAction and override
only the source (and eventually headers) the action is about to parse.

Use of newFrontendActionFactory() is replaced with a new factory maker provided
by Transform.

llvm-svn: 183855
2013-06-12 19:52:13 +00:00
Rafael Espindola 9c0a584c35 More build fixes.
llvm-svn: 183785
2013-06-11 20:24:32 +00:00
Rafael Espindola f5efb087d3 Fix build after clang change r183781.
llvm-svn: 183784
2013-06-11 20:12:07 +00:00
Edwin Vane 622dacd669 cpp11-migrate: Add EnableHeaderModification flag
First step toward supporting header modifications: adding a flag that turns on
such modifications. Eventually header modifications will be on by default but
until all the kinks can be worked out, they must be explicitly enabled.

llvm-svn: 183444
2013-06-06 20:32:29 +00:00