Commit Graph

5526 Commits

Author SHA1 Message Date
Ted Kremenek 8f6943c2e6 Update Makefiles to reflect split of clangRewrite.a into two libraries.
llvm-svn: 163056
2012-09-01 07:44:41 +00:00
David Blaikie 50174dc642 Add loop-convert to the Make build.
Hey, now the loop-convert tests pass too.

llvm-svn: 163015
2012-08-31 19:46:47 +00:00
David Blaikie efae14e96c Fix tests to be more robust (to older versions of grep, lesser lit-like test runners, etc)
Seems I had a problem with my version of grep, when run by lit, not supporting
the \s escape. This seems to fix it for me & I'll be getting the buildbots to
run these tests too to keep an eye on them (actually loop-convert tests still
fail when run via a make build, so that'll be addressed in a future commit). I
could use [[:space:]] to generalize over other whitespace but that seemed
unnecessarily verbose when the flexibility wasn't actually required by the
current text of the tests.

Also I just simplified a lot of the loop-convert tests (removing the
unecessary temp file deletion at the start, removing the unnecessary && for
FileCheck, etc).

The remove-cstr-calls/basic.cpp changes were necessitated by an out of tree
lit-like test runner that's a bit less fantastic about escaping. They were
modeled on existing tooling test cases in Clang, with thanks to Manuel Klimek
for the pointers.

llvm-svn: 163009
2012-08-31 17:49:33 +00:00
Sam Panzer 4cf99cfdc7 loop-convert, a C++11 for loop modernizer
A new Clang-based tool which converts for loops to use the range-based
syntax new to C++11. Three kinds of loops can be converted:
 - Loops over statically allocated arrays
 - Loops over containers, using iterators
 - Loops over array-like containers, using operator[] and at()

Each transformation is assigned a confidence level by the tool. The
minimum require confidence level to actually apply the transformation
can be specified on the command line, but the default level should be
fine for most code.

Like other tools based on RefactoringTool, it is easiest to use this
tool with a compilation database.

llvm-svn: 162627
2012-08-24 23:46:42 +00:00
Sam Panzer 8e0df501fa Reverted to correct commit this time.
llvm-svn: 162624
2012-08-24 23:29:33 +00:00
Sam Panzer 6d471a12db Reverted incorect partial commit of loop migrator. git-svn strikes again
llvm-svn: 162618
2012-08-24 23:02:27 +00:00
Sam Panzer 72676f419a Slight refactoring
llvm-svn: 162612
2012-08-24 22:10:18 +00:00
Sam Panzer 78184d9d74 Fixes according to code review comments
llvm-svn: 162611
2012-08-24 22:10:15 +00:00
Sam Panzer 4483b0c56d For Loop Conversion
Loop Converter Skeleton - array-step-1

Added a check to loop increments - array-step-2b

Added a check on the loop's condition expression - array-step-2c

Finished array matcher - array-step-2

Retrieved matched nodes - array-step-3

Analysis for array loop indices - array-step-4

Added checking for naming and variable scope

Added confidence level and count-only command line args

Added aliased variable elision

Added support for iterator-based loops

Added support for single-iterator loops which call end() repeatedly

Added support for converting array-like containers

llvm-svn: 162610
2012-08-24 22:10:10 +00:00
Daniel Jasper 98e00797cd Change AST matcher names to conform with the new naming.
llvm-svn: 162539
2012-08-24 05:39:51 +00:00
Marshall Clow 2a6415ec04 Make Mr. Pedantic happy by fixing banner to be exactly 80 columns
llvm-svn: 162287
2012-08-21 16:29:41 +00:00
Marshall Clow 22626c3d7e Fixed some renaming detritus in the comments, and an unused variable warning. Thanks to David Blaikie and Manuel Klimek for the comments
llvm-svn: 162031
2012-08-16 17:47:06 +00:00
Marshall Clow 2920ef43ef Rename directory from 'toolTemplate' to 'tool-template'
llvm-svn: 161887
2012-08-14 18:59:24 +00:00
Marshall Clow e16a45b3bc Added a tool template to make creating new tools simpler
llvm-svn: 161886
2012-08-14 18:53:39 +00:00
Chandler Carruth 27a6c1ed91 Use parallel dirs here, there shouldn't be cross-tool dependencies
anyways. Also place it after the config makefile inclusion which seems
the more canonical location.

llvm-svn: 161613
2012-08-09 20:47:32 +00:00
Chandler Carruth 6d8bf5bcd2 Fix the order of the link arguments for this tool. I think there is
something fishy with the rest of the order too, but this at least lets
it build for me.

llvm-svn: 161550
2012-08-09 00:12:21 +00:00
Chandler Carruth 4b9cf6d61a Fix up the makefiles in the tools repo, and add a top-level makefile
suitable for building as part of the LLVM/Clang build.

llvm-svn: 161538
2012-08-08 23:34:47 +00:00
Chandler Carruth 33453d06c4 Add a copy of the LLVM license here so that even a stand-alone checkout
includes the proper license text.

llvm-svn: 161514
2012-08-08 18:30:15 +00:00
Chandler Carruth 661d7ff913 Replace the stub README with a proper one based on Clang's.
Also test the commit hooks for the new repository.

llvm-svn: 161506
2012-08-08 18:16:41 +00:00
Marshall Clow d39041f2fc Added code to let the user specify a compilation database on the command line
llvm-svn: 161432
2012-08-07 17:58:49 +00:00
Chandler Carruth 118232f2b4 Add a root CMakeLists.txt and fix up all the test build stuff.
With this we can build and test the remove-cstr-calls tool which should
serve as a good example of how to add tools and their tests to the
repository.

llvm-svn: 161404
2012-08-07 08:33:04 +00:00
Chandler Carruth c5062dc91a Copy some of the testing infrastructure from the primary Clang repository into
the new tools repo to preserve history. I'll subsequently be editting these
down to work w/ the tooling test suites.

llvm-svn: 161402
2012-08-07 07:09:14 +00:00
Chandler Carruth 4bf700f1de Copy the existing regression test for remove-cstr-calls from the tooling branch
to preserve its history. It's not yet functional.

llvm-svn: 161401
2012-08-07 07:07:42 +00:00
Chandler Carruth bb5c56f26c Fix compilation with mainline AST matchers.
llvm-svn: 161399
2012-08-07 06:59:48 +00:00
Chandler Carruth 1d0717443f Put it in the correct place within the repository.
llvm-svn: 161398
2012-08-07 06:17:58 +00:00
Chandler Carruth eb06a2e518 Initial check-in of a skeleton of the future clang-tools-extra repository.
llvm-svn: 161378
2012-08-07 00:36:25 +00:00