Commit Graph

96 Commits

Author SHA1 Message Date
Edwin Vane 4b80752550 Don't use 'exit' in lit script
Some buildbots use a shell that doesn't know 'exit'. So instead of using XFAIL
for UseAuto/iterator.cpp (since this problem doesn't exist for cmake) leave the
'grep' command and turn off the others.

llvm-svn: 176295
2013-02-28 20:11:25 +00:00
Edwin Vane ca5a85fad4 Turning off UseAuto/iterator.cpp test until recursive make issue fixed
The way 'make check-all' causes configuration files to be generated results in
the cpp11-migrate/Makefile not being triggered to generated any files. These
files are necessary for UseAuto/iterator.cpp to run. Turning off this test
until the problem is fixed properly.

llvm-svn: 176293
2013-02-28 19:55:53 +00:00
Dmitri Gribenko f38da0dc75 Add doxygen support for the tools in clang-tools-extra
Patch by Ariel Bernal.

llvm-svn: 176267
2013-02-28 16:46:40 +00:00
Edwin Vane 266b625ca9 Introducing Use-Auto transform for cpp11-migrate
The new Use-Auto transform replaces the type specifier for variable
declarations with the special C++11 'auto' type specifier. For now, the
replacement is done only for variables that are iterators of any of the
std containers and only if the type used is one of those explicitly
allowed by the standard (i.e. not an implementation-specific type).

Reviewers: gribozavr, silvas, klimek
llvm-svn: 176266
2013-02-28 16:29:24 +00:00
Dmitri Gribenko 620cb4a459 Fix documentation comment in LoopConvert
Patch by Ariel Bernal

llvm-svn: 176191
2013-02-27 17:34:57 +00:00
Edwin Vane 24b4bb06ed Custom lit.site.cfg configuration for cpp11-migrate
To afford hand-written tests access to any auto-generated headers, a
lit.site.cfg is now created for cpp11-migrate's test directory providing a new
config.substition. Tests can refer to %gen_root in the LIT script.

Removed use of --param clang_site_config. Not necessary when running
tests using the build system.

llvm-svn: 176184
2013-02-27 13:09:24 +00:00
Edwin Vane 30f7004d7c Add user documentation for cpp11-migrate
Adding an RST document for cpp11-migrate. This user documentation explains
command line options, transformations, risk level and how it applies to
loop convert, and code examples of transformations.

There is a TODO task under "Risk" for "Loop Convert" to find code examples
that produce incorrect transformations that change semantics. The definition
of risk in loop convert and instances where the confidence level is lowered
will need to be looked at more carefully.

Information for all new features (including verbose output, auto transform)
will be added in a later change.

Author: Jack Yang <jack.wang@intel.com>
Reviewer: grigozavr
llvm-svn: 176046
2013-02-25 20:37:03 +00:00
Daniel Dunbar 5752aa26f9 [docs] Rename Makefile.
llvm-svn: 175930
2013-02-22 23:44:49 +00:00
Edwin Vane 12db04f820 Fixing a "multiple rules generate X" warning from ninja
CMake's Ninja generator was not detecting that test/lit.site.cfg.in and
test/subdir/../lit.site.cfg.in were really the same file. Ninja noticed this
and complained as both appeared as targets (for the missing file rule). Now
canonicalizing the path to ensure the paths presented to CMake are identical
and the duplication is now fixed.

llvm-svn: 175744
2013-02-21 15:12:01 +00:00
Edwin Vane ea8b062a56 Tweaks and fixes to cpp11-migrate generated tests
* Fixed a comment typo
* Changed 'autogen' to 'generated-tests'
* Made the clean target not fail if the 'generated-tests' directory
  doesn't already exist.

llvm-svn: 175624
2013-02-20 14:35:53 +00:00
Edwin Vane 963a7b411e Adding files left out of commit r175544.
llvm-svn: 175545
2013-02-19 19:14:45 +00:00
Edwin Vane 8b526f22c6 Add support for auto-generating LIT tests by the build
autoconf and CMake flavours both updated to auto-generate files for use
in cpp11-migrate's LIT tests.

Auto-generated files are placed in the build directory under
test/cpp11-migrate/autogen. The directory structure past this point
mirrors the structure in the source directory under test/cpp11-migrate.
A lit.site.cfg is generated in test/cpp11-migrate/autogen to describe
the new test suite. When LIT runs, it runs the standard testsuite and
now also the auto-generated testsuite.

llvm-svn: 175544
2013-02-19 19:08:10 +00:00
Edwin Vane 4ad00b46fb Fix -use-nullptr problems with assert()
If a cast expression (NullToPointer) is detected in a function-like macro
parameter, we should use the spelling location instead of the expansion
location. Using SourceManager::getFileLoc() fixes this problem.

Also added testcases for this bug.

Fixes: PR15279
Author: Tareq A Siraj <tareq.a.siraj@intel.com>
Reviewer: klimek
llvm-svn: 175399
2013-02-17 16:45:54 +00:00
Edwin Vane dd4743d18a Propagate changes through no-op transforms
Currently, changes made by previous transforms are not kept if a transform
doesn't make any changes itself to a given file. Now file states are propagated
properly through transforms that don't make changes.

Fixes: PR15281
Author: Jack Yang <jack.yang@intel.com>
Reviewer: klimek
llvm-svn: 175288
2013-02-15 19:38:28 +00:00
Edwin Vane 7f999078bf Initial docs directory
Adding a new docs directory, with files auto-generated by sphinx-quickstart,
for user documentation for the various tools in the clang-tools-extra
repository.

Author: Jack Yang <jack.yang@intel.com>
Reviewers: gribozavr, silvas
llvm-svn: 175118
2013-02-14 01:34:59 +00:00
Manuel Klimek f92b666da9 Adapt test to new clang-format behavior.
llvm-svn: 174738
2013-02-08 20:04:33 +00:00
Edwin Vane 37fea69391 Fix for combined loop and nullptr convert tests
The rewriter was previously reading the content buffer from the file itself.
Since we are now keeping the content in memory and writing to the file only
once, the rewriter's buffer (from the file) was not in sync with the
RefactoringTool's buffer. Adding an overrideFileContents call (similar to how
Clang-format handles for this) will resolve this issue.

Author: Jack Yang <jack.yang@intel.com>
Reviewers: gribozavr, klimek
llvm-svn: 174643
2013-02-07 18:49:23 +00:00
Daniel Jasper d1a6659263 Remove superseeded option.
The -invert-pointer-binding option will be superseeded by my next
cfe-commit. Instead of explicitly overwriting this flag, clang-format
can then be configured to auto-detect certain style-options based on the
input file.

llvm-svn: 174503
2013-02-06 14:22:17 +00:00
Manuel Klimek 5e5e1c3b80 Add xml:space='preserve' in order to correctly preserve whitespace.
llvm-svn: 174502
2013-02-06 12:40:01 +00:00
Manuel Klimek 1882ad9905 Kick JSON output for XML output.
Apparently the owners of the tools we want to integrate with (eclipse in
this case) don't have JSON parsers.

The output now is:
<replacements>
<replacement offset='2' length='3'>  </replacement>
...
</replacements>

Kicking JSON for now - it's easy enough to get back in when we need it.

FIXME: once we find this useful enough, we might want to add it as
free-standing functions to tooling.

llvm-svn: 174497
2013-02-06 09:42:05 +00:00
Manuel Klimek 65bdeae121 Adds JSON output for replacements, to simplify tools integration.
Using -output-replacements will now output the replacements instead
of the changed code. This allows easier integration with tools that
need full control over what changed.

The format is an array of objects with the members "offset" (number),
"length" (number) and "replacement_text" (string), for example:

[
  {
    "offset": 42,
    "length": 5,
    "replacement_text": "  "
  },
  {
    "offset": 105,
    "length": 4,
    "replacement_text": ""
  }
]

llvm-svn: 174382
2013-02-05 15:52:21 +00:00
Manuel Klimek 8c651f0974 Implements support for specifying multiple ranges.
This is backwards compatible with earlier integrations.
Also adds a basic test and a test for the ranges integration.

You can now run:
clang-format -offset=42 -length=15 -offset=150 -length=22
To re-format the ranges (42, +15) and (150, +22).

llvm-svn: 174378
2013-02-05 15:25:34 +00:00
Daniel Jasper 21cdc848f4 Don't touch unchanged file for in-place edit.
This fixes llvm.org/PR15087.

llvm-svn: 173919
2013-01-30 09:52:38 +00:00
NAKAMURA Takumi 6fb75e08e5 test/remove-cstr-calls/basic.cpp: Disable again on mingw. It behaves unstable.
llvm-svn: 173562
2013-01-26 06:39:48 +00:00
NAKAMURA Takumi fc37344916 Drop "REQUIRES:shell" in tests. They can run on win32.
llvm-svn: 173415
2013-01-25 04:33:40 +00:00
Edwin Vane 44c3145938 Add use-nullptr transform to cpp11-migrate
This transform converts the usage of null pointer constants (e.g. NULL, 0,
etc.) in legacy C++ code and converts them to use the new C++11 nullptr
keyword.
- Added use-nullptr transform.
- Added C++11 support to the final syntax check. Used ArgumentAdjuster class to
  add -std=c++11 option to the command line options.
- Added tests for use-nullptr transform.
- Added tests that exercises both loop-convert and use-nullptr in the source
  file.

TODO: There's a known bug when using both -loop-convert and -use-nullptr at the
      same time.

Author: Tareq A Siraj <tareq.a.siraj@intel.com>
Reviewers: klimek, gribozavr
llvm-svn: 173178
2013-01-22 18:31:49 +00:00
Chris Lattner 28b00bffd2 these need the bitcode reader as well.
llvm-svn: 172908
2013-01-19 18:45:35 +00:00
Chandler Carruth 06e24e34a9 Re-sort the #include lines which have gotten out of order.
llvm-svn: 172895
2013-01-19 09:10:38 +00:00
NAKAMURA Takumi 40ac112c91 Introduce llvm::sys::PrintStackTraceOnErrorSignal()
llvm-svn: 172821
2013-01-18 14:31:00 +00:00
Dmitri Gribenko 3de75d7c7c Fix a -Wdocumentation warning (empty paragraph passed to '\brief' command)
llvm-svn: 172661
2013-01-16 22:10:09 +00:00
Edwin Vane 862fec8835 Write transform results to disk only once
Instead of writing the result of each transform to disk for every
transform, write the results to buffers in memory and pass those buffers
to the next transform as input. Only write the buffers to disk if the
final syntax check passes.

Reviewers: klimek
llvm-svn: 172657
2013-01-16 21:11:50 +00:00
Daniel Jasper 9f4a1c6184 Add temporary option to invert the */& binding in a specific style.
This is temporarily necessary until styles are configurable through files
as it seems to be a contentious issue.

llvm-svn: 172546
2013-01-15 18:56:19 +00:00
Alexander Kornienko 02fd3ad24b Test source file name in diagnostics
llvm-svn: 172434
2013-01-14 17:01:57 +00:00
Daniel Jasper 51ce63cd98 Add support for Chromium style.
llvm-svn: 172432
2013-01-14 16:26:38 +00:00
Edwin Vane d44cbf7d09 Adding a .gitignore to tools-extra
Reviewers: klimek

llvm-svn: 172414
2013-01-14 14:20:19 +00:00
Alexander Kornienko 92bb086fba Added a test for clang-format diagnostics.
llvm-svn: 172407
2013-01-14 13:57:05 +00:00
Alexander Kornienko 79f49456fa Fix: correct file name in diagnostics.
llvm-svn: 172405
2013-01-14 13:40:44 +00:00
Edwin Vane bfbd10b329 Update users of RefactoringTool
RefactoringTool::run() no longer writes changes to disk automatically. Updating users of RefactoringTool to explicitly perform the write.
    
Reviewers: klimek

llvm-svn: 172218
2013-01-11 17:04:09 +00:00
Nico Weber e5d643d21c Remove FIXME fixed by djasper in r172066.
llvm-svn: 172097
2013-01-10 19:48:53 +00:00
Alexander Kornienko 92465285ab Format what you can when errors are found
llvm-svn: 172075
2013-01-10 15:19:44 +00:00
Edwin Vane 86c63d94bb Removing loop-convert tool
cpp11-migrate now contains the loop convert transform code and tests.
Cleaning up the old code/tests and updating build system files as
necessary.

Reviewers: klimek
llvm-svn: 172074
2013-01-10 15:19:11 +00:00
Alexander Kornienko 5b64279192 Improved clang-format integration support for diagnostic messages output
llvm-svn: 172072
2013-01-10 15:06:57 +00:00
Daniel Jasper 494394d817 Let clang-format binary use same LangOpts as test.
llvm-svn: 172066
2013-01-10 13:09:09 +00:00
Alex Rosenberg eb8360003b Add .arcconfig for Arcanist support for Phabricator
llvm-svn: 172043
2013-01-10 04:12:08 +00:00
Alex Rosenberg 0b18a095cf Fix comment
llvm-svn: 172042
2013-01-10 04:12:06 +00:00
Daniel Jasper abf4cce40f Simplify reversed for-loop.
llvm-svn: 171998
2013-01-09 20:46:42 +00:00
Daniel Jasper 46e432fb8a Initial version of diff/patch-reformat tool.
Use at your own risk :-).

llvm-svn: 171994
2013-01-09 20:20:11 +00:00
Manuel Klimek 3a449891ba Implements the features requested in PR14679.
- adds '-h' as an alias for '-help'.
- adds an optional <file> argument
- adds an option -i to in-place edit the given file
- adds a help text to explain what the tool does

llvm-svn: 171858
2013-01-08 15:19:57 +00:00
Edwin Vane 31896624da Transferred loop-convert tests to cpp11-migrate
- Turned off -count-only tests as they aren't supported in cpp11-migrate
  yet.
- Updated tests to use new binary name and options to access
  loop-convert transform.
- Fixed header guards to not use restricted names.

Reviewers: klimek, gribozavr
llvm-svn: 171852
2013-01-08 14:36:29 +00:00
Nico Weber 48e75f7e48 Enabled ObjC2 in clang-format for @package. Matches r171766.
llvm-svn: 171767
2013-01-07 19:08:19 +00:00