Commit Graph

119 Commits

Author SHA1 Message Date
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
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 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
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
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
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
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
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
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
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
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 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 ba6c662669 Expanded modularize tests.
llvm-svn: 187943
2013-08-08 00:01:09 +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
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
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 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
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
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
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
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
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
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
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
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 99f8042e74 cpp11-migrate: Add option to detect and use macros that expand to 'override'
Added a new option -override-macros which causes the, the add-override
transform to detect macros that expand to 'override' (like LLVM_OVERRIDE) and
use these macros instead of the override keyword directly.

llvm-svn: 183001
2013-05-31 13:20:24 +00:00
Ariel J. Bernal 1d66e366e9 Fix UseAuto replacing declaration lists with new expressions
UseAuto used to replace declarion lists with new expressons where some
variable were not initialized with new.
This fix checks that every DeclStmt has a VarDecl with an initializer and it
also ensures that all declarations have the same type.

Added tests for multiple declarations and for typedefs.

llvm-svn: 182736
2013-05-27 14:30:23 +00:00
Ariel J. Bernal eba5189f9a Fix UseAuto replacing variable declaration lists containing non-initialized
variables.

UseAuto used to match initialized variable declarations independently of
whether they were defined in a declaration list or as a single declaration.
Now it matches declaration statements where every variable declaration is
initialized.

llvm-svn: 182114
2013-05-17 15:30:17 +00:00
Edwin Vane 799ad8e212 cpp11-migrate: Check for valid NULL macros from macro arg expansions
The recent improvement to the Use Nullptr Transform for macro arg
expansions wasn't testing that only allowed NULL macros used in macro
args can be transformed. This revision replaces a TODO to that effect.

Fixes PR15955.

llvm-svn: 182014
2013-05-16 14:55:05 +00:00