Commit Graph

290 Commits

Author SHA1 Message Date
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