Commit Graph

147 Commits

Author SHA1 Message Date
John Thompson 52d9886500 modularize - Fixed broken array use (asserted in tests). Renamed KindType enum.
llvm-svn: 178259
2013-03-28 18:38:43 +00:00
Tareq A. Siraj c2aa348dd0 Allow users to specify NULL like macros to be replaced
-use-nullptr only replaced macro named NULL and ignored any user defined
macros that behaved like NULL. This patch introduces -user-null-macros
command line option to let users specify their custom NULL like macros.

- Added a -user-null-macros command line option that takes a
  comma-separated list of user-defined macros to be replaced when using
  the -use-nullptr transform.
- Added documentation.
- Updated testcase to reflect current behavior.
- Whitespace fixes.

Reviewers: revane, klimek, gribozavr
llvm-svn: 178243
2013-03-28 16:06:59 +00:00
Tareq A. Siraj c7b27081d9 Test commit: Remove whitespace.
llvm-svn: 178241
2013-03-28 15:48:49 +00:00
Michael Gottesman 4b24921965 Revert "modularize - Fixed poor array usage."
This has broken buildbots for a few hours.

llvm-svn: 178223
2013-03-28 06:07:15 +00:00
John Thompson 3b1ee2b87f modularize - Updated futures comment.
llvm-svn: 178216
2013-03-28 02:46:25 +00:00
John Thompson 9663d8c46d modularize - Fixed poor array usage.
llvm-svn: 178214
2013-03-28 02:44:31 +00:00
David Blaikie c66c07d444 Fix a default on covered switch found by -Wcovered-switch-default
Introduced in r178207

llvm-svn: 178212
2013-03-28 02:30:37 +00:00
John Thompson 4e4d9b3abf modularize - revised to group duplicate symbols together in the error output.
llvm-svn: 178207
2013-03-28 01:20:19 +00:00
John Thompson ea6c8dbf71 Broke out header file list reading into separate function. Moved options to front. Removed some trailing spaces.
llvm-svn: 178182
2013-03-27 21:23:21 +00:00
John Thompson fd8ca38ad5 Added informational comment about using -x c++.
llvm-svn: 178172
2013-03-27 19:31:22 +00:00
Ariel J. Bernal 3f08aae84f cpp11-migrate segfaults transforming map<string,int>::iterator
cpp11-migrate segfaults when -use-auto tries to resolve initializing 
expression resulting in an expression with cleanups.

- Skip expressions with cleanups from the initializer
- Added test case

Fixes PR15550

llvm-svn: 178167
2013-03-27 18:49:31 +00:00
John Thompson d977c1e6c5 Fixed path in file comment. Fixed #include order.
llvm-svn: 178164
2013-03-27 18:34:38 +00:00
John Thompson f5db45bc16 Revised to use MemoryBuffer. Removed redundant llvm:: qualifiers. Removed unnecessary c_str() calls. Reformatted with clang-format.
llvm-svn: 178104
2013-03-27 01:02:46 +00:00
John Thompson 81450dfff9 Revised per review comments to rename test files and rearrange input files.
llvm-svn: 178047
2013-03-26 18:17:28 +00:00
Edwin Vane 3cb833d45b Docs describing limitations of the cpp11-migrate Loop Convert Transform
Sam Panzer, author of loop convert, provided a list of limitations of the tool
to be documented. (Thanks Sam!)

The transform's limitations are now documented in the existing user doc.
Included are examples of the cases where the tool may change semantics.

Author: Jack Yang <jack.yang@intel.com>
llvm-svn: 178034
2013-03-26 16:44:29 +00:00
John Thompson 333ec6ceb7 Added simple regression test for modularize.
llvm-svn: 177960
2013-03-26 01:18:28 +00:00
John Thompson a2de1088b7 Revised to use file list path as reference path, or path provide by new -prefix option. Revised to use LLVM option parser.
llvm-svn: 177959
2013-03-26 01:17:48 +00:00
Edwin Vane a9bf2fd9d1 Adding a failing test case for cpp11-migrate's Loop Convert Transform
Related to PR15589.

llvm-svn: 177891
2013-03-25 19:24:24 +00:00
Edwin Vane 37a5137adc Adding clang-headers as dependency of cpp11-migrate
Fix build dependency. Now can say 'make cpp11-migrate' (with cmake anyway) from
a clean build and result will be usable.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>
llvm-svn: 177871
2013-03-25 15:19:43 +00:00
Daniel Jasper 83c10c9d38 Remove clang-format tests from tools/extra.
These will be re-added to clang/test.

llvm-svn: 177852
2013-03-25 09:14:14 +00:00
Daniel Jasper ff367af17b Fix Makefile.
llvm-svn: 177507
2013-03-20 10:02:35 +00:00
Daniel Jasper 168ee99ffa Remove clang-format from clang-tools-extra.
llvm-svn: 177504
2013-03-20 09:52:50 +00:00
Edwin Vane c383960be9 Don't replace macro usage if macro body has NULL
In case of macro body expansion, check to see if the macro is named NULL and
don't replace inside the macro body. This fixes the case when NULL appears
inside the macro body and the transform replaces the usage of the macro with
nullptr. This is an easy fix for the problem for now and we should analyze the
macro body to see if it expands to only NullToPointer in the future for a more
robust solution that takes care of user defined macros that behaves like NULL.

Other changes:
- Moved complex macro tests to macros.cpp
- Added new test cases.
- Added checks to make sure that the macro bodies are not modified by the tool.

Fixes: PR15396

Author: Tareq A Siraj <tareq.a.siraj@intel.com>
llvm-svn: 177422
2013-03-19 18:47:03 +00:00
Edwin Vane 2032fb973b Don't include outer-most explicit cast in nullptr replacement
The outer-most explicit cast is now left alone by the Use-Nullptr transform to
maintain the type of the expression and avoid introducing ambiguities.

Fixes PR15395.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>
llvm-svn: 177179
2013-03-15 20:18:08 +00:00
Edwin Vane 52c326ec78 Prevent nullptr_t-typed exprs from being replaced
The Use-Nullptr transform was replacing nullptr_t-typed expressions because in
the AST such expressions have an implicit NullToPointer cast around them. Now
the transform ignores these expressions.

Fixes PR15414.

llvm-svn: 177168
2013-03-15 18:10:07 +00:00
Edwin Vane ead1696fa6 Adding a new code owners file for clang-tools-extra.
Populated file with known existing owners.

llvm-svn: 177083
2013-03-14 16:56:31 +00:00
John Thompson ce601e21d0 Added future directions comment and a couple of fixme's.
llvm-svn: 176998
2013-03-14 01:41:29 +00:00
John Thompson 1f67ccb3fd Review feedback change per Edwin: Move non-public members to end of classes.
llvm-svn: 176883
2013-03-12 18:51:47 +00:00
Sean Silva a7aedfa5db [docs] Clarify wording.
"This documentation" could be construed as the entire c-t-e docs
(despite being under a doxygen heading; people read "locally"
sometimes), which gives a bad impression.

llvm-svn: 176849
2013-03-12 02:40:05 +00:00
John Thompson 4f8ba659d9 Initial check in of Doug's modularize tool for checking header readiness for modules, plus some changes per review feedback: Removed system headers, changed to use stream output, added file name in message.
llvm-svn: 176847
2013-03-12 02:07:30 +00:00
Edwin Vane bdcd1350c1 Adding -final-syntax-check to cpp11-migrate user docs
llvm-svn: 176758
2013-03-09 03:38:20 +00:00
Edwin Vane e4e7c24efc Splitting cpp11-migrate transform docs into sub-pages
Each transform belongs in its own sub-page now. Minor refactoring to reflect
new heading levels.

llvm-svn: 176757
2013-03-09 03:33:50 +00:00
Edwin Vane 3b9f08d6d0 Adding user documentation for UseAuto transform
Reviewers: silvas, gribozavr
llvm-svn: 176735
2013-03-08 23:26:00 +00:00
Edwin Vane cadde90983 Removing 'modindex' from clang-tools-extra doc index
There are no python modules in clang-tools-extra so a link to this
auto-generated page, which currently isn't generated anyway, is not necessary.

llvm-svn: 176713
2013-03-08 19:20:07 +00:00
Edwin Vane fac739a357 Fixing Doxygen warnings in cpp11-migrate
Turned on doxygen warnings and fixed the resulting problems.

llvm-svn: 176712
2013-03-08 19:12:12 +00:00
Edwin Vane c016c0da12 Turned no_xform into a pass from expected failure.
Since no_xform is not a bug to be fixed, made the test pass using the 'not'
utility and removed XFAIL.

llvm-svn: 176709
2013-03-08 18:39:07 +00:00
Edwin Vane 3606f5508b Extend loop variable naming checks
The loop convert tests for conflicting names have been extended to check for
macro names, types, and language keywords including language extensions. Tests
have also been added.

Fixes PR15322

Author: Jack Yang <jack.yang@intel.com>
Reviewer: gribozavr, klimek, revane
llvm-svn: 176690
2013-03-08 14:15:18 +00:00
Edwin Vane 4f05d7143f Have LoopConvert use 'auto &&' where necessary
For iterators where the dereference operator returns by value, LoopConvert
should use 'auto &&' in the range-based for loop expression.

If the dereference operator returns an rvalue reference, this is deemed too
strange and the for loop is not converted.

Moved test case from iterator_failing.cpp to iterator.cpp and added extra
tests.

Fixes PR15437.

Reviewer: gribozavr
llvm-svn: 176631
2013-03-07 16:22:05 +00:00
Chandler Carruth 074a3568fc Switch from autogenerating tests to using the preprocessor.
NOTE: You may need to run 'make clean' or 'ninja -t clean' etc!!! This
      is due to really nasty bug/interactions between
      CMake/configure/make/Ninja/LIT...

This commit tries to back out the support for generating test cases as
part of the build system due to the issues I brought up in post-commit
review:

1) It adds a *lot* of complexity and fragility to the build system. See
   the number of commits required to try to get all the bots happy.
2) It isn't really necessary -- we can already run scripts to generate
   things with the RUN lines of a test.
3) It makes the tests somewhat harder to debug as they cross between
   more domains.
4) In almost all cases it isn't really needed or it can be done directly
   using the preprocessor.

I should have been more proactive reviewing this, and I'm really sorry
about the churn here. =/ To help keep track of what commits are going
where, this backs out most of the non-test-changes from these revisions:
  r176397
  r176373
  r176293
  r176184
  r175744
  r175624
  r175545
  r175544

There were several trivial or cleanup changes to the lit files or other
files. Some of these looked ok, but I didn't try to tease them apart...
Edwin, if you know what to look for, please carry on with the cleanups
there, and sorry for hosing stuff here but I'm not much of a Python
person, and so I was erring on the side of cautiously backing out the
change.

I've tried to preserve the test changes everywhere I could, but review
is appreciated here in case I missed some.

I then re-wrote the tests to use the preprocessor rather than python to
expand to the various bits of code. The nicest part of this is that now
all the files are just C++ code. They edit and behave like C++ code,
etc. RUN lines with different -D flags are used to run the same test
over multiple different configurations, and includes bracketed in
special defines are used to flesh out a collection of standard interface
stubs to test interactions between pieces. These probably aren't perfect
yet, but I think its an improvement (at least in terms of build system
complexity) and will hopefully be a useful demonstration of the
technique I prefer for these types of tests.

llvm-svn: 176627
2013-03-07 10:09:47 +00:00
Stefanus Du Toit 49fe6388b6 Test case for PR-15414 - nullptr_t functions
The use-null-ptr transform will transform calls to functions that return a
nullptr_t. Even if the function were to only return a null pointer and do
nothing else, this replacement would still be undesired as the behavior and
signature of the function could change in the future.

This adds an XFAILed test case to demonstrate the issue.

Reviewed by: Edwin Vane, Tareq Siraj

llvm-svn: 176553
2013-03-06 15:32:20 +00:00
Edwin Vane 105963d17c Fixed Use-Nullptr when replacing return(0)
Before fix, the paren expression was being replaced resulting in returnnullptr.
ParenExpr and implicit casts now ignored so we get return(nullptr) instead.

Added new test cases.

Fixes PR15398

Author: Ariel Bernal <ariel.j.bernal@intel.com>
llvm-svn: 176551
2013-03-06 14:51:34 +00:00
Dmitri Gribenko f68a5280cb Added summary option to cpp11-migrate tool
Added a summary option that enables output to stdout counting the number of
changes each transform has accepted, rejected or deferred.

Patch by Ariel Bernal.

llvm-svn: 176465
2013-03-05 00:12:33 +00:00
Edwin Vane 529e3c7c57 Adding failing LoopConvert testcase
LoopConvert isn't properly handling iterators whose dereference operator
returns by value. This test case demonstrates the failure.

See PR15437.

llvm-svn: 176437
2013-03-04 16:56:04 +00:00
Edwin Vane 2f43085b46 Properly identify 'this' as range-based for container
The Loop-Convert transform was mistransforming loops using 'this' implicitly.
Fixed and added tests.

Fixes PR15411.

llvm-svn: 176436
2013-03-04 16:35:04 +00:00
Sean Silva 206bc114f8 .gitignore: ignore docs/_build
That is where the documentation gets built to.

I'm pretty much clueless about SVN; I would appreciate if someone more
knowledgeable about SVN made the equivalent change.

llvm-svn: 176417
2013-03-03 15:15:12 +00:00
Benjamin Kramer 65d2d14f32 Make gen_my_std.h.py compatible with python 2.5 too.
llvm-svn: 176409
2013-03-02 15:52:55 +00:00
Benjamin Kramer 336ec56081 Make the UseAuto test case generator compatible with python 2.5.
llvm-svn: 176406
2013-03-02 09:24:42 +00:00
Edwin Vane a98217a2b6 Avoid parallelism problems generating lit.site.cfgs
extra/test/cpp11-migrate/Makefile was using the same tmp file for generating
lit.site.cfg for two different directories. Parallelism caused conflicts so now
using differently named temp files.

llvm-svn: 176379
2013-03-01 21:21:37 +00:00
Stefanus Du Toit e9779bbef0 cpp11-migrate: Reduce the number of parsing passes.
Previously we would check the syntax of the file before we transform
it, but that's redundant since it'll be checked as part of the
transformation. Remove that check completely.

We also had an unconditional syntax check after transforming. This
is only really useful to debug cpp11-migrate, since users will end
up compiling the transformed source anyways, and the transformations
*should* never introduce a failure. Made this an option, accessible
via "-final-syntax-check".

Resolves PR 15380.

llvm-svn: 176376
2013-03-01 20:53:43 +00:00
Edwin Vane b1bb4c2dbb Fix recursive make in clang-tools-extra
Autoconf make (all) now properly recurses from tools/extra/Makefile into
tools/extra/test/Makefile and tools/extra/test/cpp11-migrate/Makefile. The
'all' target is responsible for creating lit config files and autogenerating
tests. Subsequent 'check-all' targets will properly work.

Re-enabling UseAuto/iterator.cpp test.

General clean-up of clang-tools-extra makefiles; removing dead targets and
removing duplicated pieces of llvm/Makefile.rules.

llvm-svn: 176373
2013-03-01 19:50:52 +00:00