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
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
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
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
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
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
* 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
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
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
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
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
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
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
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
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
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
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
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
RefactoringTool::run() no longer writes changes to disk automatically. Updating users of RefactoringTool to explicitly perform the write.
Reviewers: klimek
llvm-svn: 172218
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
- 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
- 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