summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/cpp11-migrate
Commit message (Collapse)AuthorAgeFilesLines
* Don't replace macro usage if macro body has NULLEdwin Vane2013-03-191-5/+26
| | | | | | | | | | | | | | | | | | | 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
* Don't include outer-most explicit cast in nullptr replacementEdwin Vane2013-03-151-10/+13
| | | | | | | | | | 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
* Prevent nullptr_t-typed exprs from being replacedEdwin Vane2013-03-151-5/+28
| | | | | | | | | | 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
* Fixing Doxygen warnings in cpp11-migrateEdwin Vane2013-03-082-16/+4
| | | | | | Turned on doxygen warnings and fixed the resulting problems. llvm-svn: 176712
* Extend loop variable naming checksEdwin Vane2013-03-085-11/+48
| | | | | | | | | | | | 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
* Have LoopConvert use 'auto &&' where necessaryEdwin Vane2013-03-074-27/+89
| | | | | | | | | | | | | | | | 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
* Fixed Use-Nullptr when replacing return(0)Edwin Vane2013-03-061-2/+4
| | | | | | | | | | | | 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
* Added summary option to cpp11-migrate toolDmitri Gribenko2013-03-058-21/+58
| | | | | | | | | 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
* Properly identify 'this' as range-based for containerEdwin Vane2013-03-041-3/+9
| | | | | | | | | The Loop-Convert transform was mistransforming loops using 'this' implicitly. Fixed and added tests. Fixes PR15411. llvm-svn: 176436
* cpp11-migrate: Reduce the number of parsing passes.Stefanus Du Toit2013-03-011-24/+20
| | | | | | | | | | | | | | | | 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
* cpp11-migrate: Factor out duplicate code in UseNullPtrStefanus Du Toit2013-03-011-20/+25
| | | | | | | | | | | | This moves the actual replacement code into a separate function. There is still a bit of code duplication to go from macros to expansion areas, but that code will need to be fixed anyways to resolve bugs around macro replacement. Reviewed by: Tareq Siraj, Edwin Vane llvm-svn: 176372
* Introducing Use-Auto transform for cpp11-migrateEdwin Vane2013-02-289-0/+485
| | | | | | | | | | | 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
* Fix documentation comment in LoopConvertDmitri Gribenko2013-02-271-1/+1
| | | | | | Patch by Ariel Bernal llvm-svn: 176191
* Fix -use-nullptr problems with assert()Edwin Vane2013-02-171-4/+7
| | | | | | | | | | | | | 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
* Propagate changes through no-op transformsEdwin Vane2013-02-155-15/+15
| | | | | | | | | | | 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
* Fix for combined loop and nullptr convert testsEdwin Vane2013-02-073-4/+14
| | | | | | | | | | | | 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
* Add use-nullptr transform to cpp11-migrateEdwin Vane2013-01-2210-0/+373
| | | | | | | | | | | | | | | | | | | 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
* these need the bitcode reader as well.Chris Lattner2013-01-191-1/+1
| | | | llvm-svn: 172908
* Re-sort the #include lines which have gotten out of order.Chandler Carruth2013-01-193-3/+3
| | | | llvm-svn: 172895
* Introduce llvm::sys::PrintStackTraceOnErrorSignal()NAKAMURA Takumi2013-01-181-0/+2
| | | | llvm-svn: 172821
* Fix a -Wdocumentation warning (empty paragraph passed to '\brief' command)Dmitri Gribenko2013-01-161-1/+1
| | | | llvm-svn: 172661
* Write transform results to disk only onceEdwin Vane2013-01-167-31/+178
| | | | | | | | | | 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
* Update users of RefactoringToolEdwin Vane2013-01-111-1/+1
| | | | | | | | RefactoringTool::run() no longer writes changes to disk automatically. Updating users of RefactoringTool to explicitly perform the write. Reviewers: klimek llvm-svn: 172218
* Add a namespace qualifier to the befriending statement forChandler Carruth2013-01-051-1/+1
| | | | | | | | RecusiveASTVisitor. With Clang and modern GCCs this was found through the injected class name of the base class but older GCCs don't properly implement the injected class name rules. llvm-svn: 171593
* Port loop-convert into cpp11-migrateEdwin Vane2013-01-0416-7/+2189
| | | | | | | | | | | | | | Took existing code from loop-convert tool and made it into a cpp11-migrate transform. Pattern now set for having transform code in subdirectories. Related changes: - Makefile and CMakeLists.txt updated to support source files in subdirectories. - At least one transform must be specified. syntax-only tests removed to reflect this. - TODO: port over loop-convert tests. Reviewers: klimek, silvas llvm-svn: 171481
* Fix the sorting of the #include lines in these tools.Chandler Carruth2013-01-021-1/+1
| | | | | | This is done with the script in llvm/utils/sort_includes.py llvm-svn: 171365
* Use renamed CommonOptionsParser member functionsEdwin Vane2012-12-141-2/+2
| | | | | | | | GetCompilations() and GetSourcePathLists() were renamed to match LLVM style. Reviewed By: Alexander Kornienko llvm-svn: 170230
* Initial commit for cpp11-migrate toolEdwin Vane2012-12-123-0/+95
- Added directory structures and build system files for the new tool. - Extremely basic implementation of tool performs only an initial syntax check. - Basic tests ensure syntax test works as expected. llvm-svn: 169983
OpenPOWER on IntegriCloud