summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/cpp11-migrate
Commit message (Collapse)AuthorAgeFilesLines
...
* cpp11-migrate: Fix parsing of '.' for header include/excludesEdwin Vane2013-06-191-3/+11
| | | | | | | sys::fs::make_absolute was turning '.' into '<path>/.' which broke prefix comparison logic. Stripping these extra chars fixes the problem. llvm-svn: 184322
* Prune "\param InitialState" since it has not been introduced. [-Wdocumentation]NAKAMURA Takumi2013-06-191-1/+0
| | | | llvm-svn: 184285
* cpp11-migrate: Transforms honour header modification flagEdwin Vane2013-06-1815-54/+82
| | | | | | | | | | Transforms will now make changes to headers if header modifications have been enabled. FIXME: Only UseNullptr contains a cursory header modification test. Other transforms should have them too. llvm-svn: 184197
* cpp11-migrate: Transform now responsible for applying replacementsEdwin Vane2013-06-1814-191/+197
| | | | | | | | | | | | | | | | | | | | | | | | To make it possible for replacements made to headers as part of transforming one translation unit to not be visible to the transform of other translation units, Transform now handles replacement application as part of its end-of-source handling. Several things were simplified as a result: - The duplicated code in every transform for applying replacements is now gone and replaced with one location in Transform. - RefactoringTool is no longer used since Transform houses the Replacements structure. - RewriterContainer is now a private implementation detail of Transform (also renamed to RewriterManager since its behaviour is slightly different now with respect to lifetime of objects). - There's now no distinction between input and output file state. Misc notes: - Interface changes reflected in unit tests. - Replacements for files other than the main file are assumed to be for headers and stored as such. llvm-svn: 184194
* cpp11-migrate: Transform now responsible for file content overridingEdwin Vane2013-06-176-65/+75
| | | | | | | | | | | To better support per-translation unit replacements, any real work is being moved out of ActionFactory and into Transform. In this revision, that means file override application. For simplification, Transform no longer inherits from SourceFileCallbacks. TransformTest required updating as a result. llvm-svn: 184098
* Add a dependency on LLVM's option library for clang-tools-extraReid Kleckner2013-06-141-1/+1
| | | | | | r183989 added a dependency on LLVMOption in clangFrontend. llvm-svn: 183990
* Also install cpp11-migrate when built with cmake. Fixes bug #16296Sylvestre Ledru2013-06-141-0/+3
| | | | llvm-svn: 183976
* cpp11-migrate: const-correcting IncludeExcludeInfoEdwin Vane2013-06-132-6/+6
| | | | | | isFileIncluded() needed to be marked const. llvm-svn: 183918
* cpp11-migrate: Add headers to file override informationEdwin Vane2013-06-133-0/+28
| | | | | | | | | | | File override structures now contain per-source overrides for headers. For now, modified headers are written to disk when the Migrator is done. This is only temporary behaviour since we can expect headers to be changed by migrating multiple source files. The changes need to be merged after all migrations are complete. llvm-svn: 183917
* cpp11-migrate: Replace file override containerEdwin Vane2013-06-1316-84/+209
| | | | | | | | | | | | A more flexible container for storing overrides is required for headers. Before a source goes through the transform pipeline, any headers it references will be in their original state and unaffected by transforms applied to other sources. Therefore overrides for headers need to be kept separate for each source file. This patch doesn't introduce support for storing header overrides yet. It only replaces the existing structure and makes any necessary changes to support it. llvm-svn: 183910
* cpp11-migrate: Decluttering Transform.hEdwin Vane2013-06-122-17/+19
| | | | | | | Moving RewriteContainer's constructor impl to Transform.cpp to reduce clutter. More things will soon be added to this header. llvm-svn: 183856
* cpp11-migrate: New mechanism for overriding file contentsEdwin Vane2013-06-126-31/+90
| | | | | | | | | | | Next step toward supporting migrating headers. Instead of using ClangTool's ability to override all files at once, use a custom FrontendAction and override only the source (and eventually headers) the action is about to parse. Use of newFrontendActionFactory() is replaced with a new factory maker provided by Transform. llvm-svn: 183855
* Fix build after clang change r183781.Rafael Espindola2013-06-111-0/+1
| | | | llvm-svn: 183784
* cpp11-migrate: Add EnableHeaderModification flagEdwin Vane2013-06-062-0/+27
| | | | | | | | First step toward supporting header modifications: adding a flag that turns on such modifications. Eventually header modifications will be on by default but until all the kinks can be worked out, they must be explicitly enabled. llvm-svn: 183444
* cpp11-migrate: Refactor how global options are passed to TransformsEdwin Vane2013-06-0613-48/+56
| | | | | | | | | Refactored how global options are passed to Transforms to avoid widespread changes every time a new global option is added. Tests updated to reflect new interface. llvm-svn: 183443
* cpp11-migrate: Eliminate windows line endingsEdwin Vane2013-06-056-649/+649
| | | | | | | r183274 accidentally added windows line endings to changed lines. Changing them back. llvm-svn: 183322
* cpp11-migrate: collect performance timers per source fileEdwin Vane2013-06-046-536/+649
| | | | | | | | Performance timers captured in each transform for all files they process are now collected and arranged per source file in preparation for writing to disk. This revision is the last piece of the initial implementation of performance timer capturing. llvm-svn: 183274
* cpp11-migrate: turn off PID-based perf data filenamesEdwin Vane2013-06-031-2/+6
| | | | | | | Getting PIDs on Windows is broken. Proper fix is simple but requires testing so just disabling PID-based file names for now. llvm-svn: 183154
* Add support for report execution timesAriel J. Bernal2013-06-031-1/+78
| | | | | | | | -Added command line option -report-times to enable or disable the output. The same option can be used to specify the output directory. -Write timing data to a unique file in disk using json format. llvm-svn: 183142
* cpp11-migrate: Add option to detect and use macros that expand to 'override'Edwin Vane2013-05-314-4/+43
| | | | | | | | Added a new option -override-macros which causes the, the add-override transform to detect macros that expand to 'override' (like LLVM_OVERRIDE) and use these macros instead of the override keyword directly. llvm-svn: 183001
* Tweak autoconf link params to fix migrator buildEdwin Vane2013-05-301-4/+3
| | | | llvm-svn: 182957
* cpp11-migrate: Transforms collect timing data.Edwin Vane2013-05-3013-17/+82
| | | | | | | | | | Using updated form of newFrontendActionFactory(), Transforms now automatically measure, if requested, how long it takes to apply a MatchFinder to a source file. Other per-transform overhead, e.g. applying replacements, is not currently measured. This behaviour is disabled for now and soon will be connected to a new command line arg. llvm-svn: 182942
* Fix UseAuto replacing declaration lists with new expressionsAriel J. Bernal2013-05-273-59/+81
| | | | | | | | | | | UseAuto used to replace declarion lists with new expressons where some variable were not initialized with new. This fix checks that every DeclStmt has a VarDecl with an initializer and it also ensures that all declarations have the same type. Added tests for multiple declarations and for typedefs. llvm-svn: 182736
* Unbreak the build.Benjamin Kramer2013-05-171-3/+4
| | | | | | UseAutoActions.cpp:48:17: error: redefinition of 'E' with a different type. llvm-svn: 182119
* Fix UseAuto replacing variable declaration lists containing non-initializedAriel J. Bernal2013-05-173-53/+69
| | | | | | | | | | | variables. UseAuto used to match initialized variable declarations independently of whether they were defined in a declaration list or as a single declaration. Now it matches declaration statements where every variable declaration is initialized. llvm-svn: 182114
* cpp11-migrate: Check for valid NULL macros from macro arg expansionsEdwin Vane2013-05-161-2/+8
| | | | | | | | | | The recent improvement to the Use Nullptr Transform for macro arg expansions wasn't testing that only allowed NULL macros used in macro args can be transformed. This revision replaces a TODO to that effect. Fixes PR15955. llvm-svn: 182014
* cpp11-migrate: Refactor NullptrActionsEdwin Vane2013-05-161-181/+179
| | | | | | | Several free functions related to macro arg testing are being moved into CastSequenceVisitor to facilitate upcoming fix. llvm-svn: 182013
* cpp11-migrate: Add override specifier before comments on inline methodsEdwin Vane2013-05-141-16/+31
| | | | | | | | | | | | This commit fixes a "FIXME" in the add-override transform. ' override' was misplaced when a comment was between the function body and the end of the 'prototype'. It also remove duplicated check for the main file from the last commit (and fixes the typo in the comment above). Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 181806
* cpp11-migrate: Fix crash in AddOverride due to template instantiationsEdwin Vane2013-05-101-22/+34
| | | | | | | | | | | | | | | This patch fixes different issues: - override is not added in template 'contexts' (this will be further improved to handle safe situations, a test for this has been written already) - the main file is now checked before the modifications are applied - override is not applied now when dealing with pure methods since it was misplaced (ignoring it isn't the perfect solution but it seems difficult to find the location just before the pure-specifier) Fixes PR15827 Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 181596
* Transform for loops over pseudo-arrays only if begin/end members existEdwin Vane2013-05-091-1/+48
| | | | | | | | | | | | For loops using pseudo-arrays, classes that can be used like arrays from the Loop Convert Transform's point of view, should only get transformed if the pseudo-array class has begin()/end() members for the range-based for-loop to call. Free versions of begin()/end() should also be allowed but this is an enhancement for another revision. llvm-svn: 181539
* Use 'auto const&' for iterators whose deref operator return a const varAriel J. Bernal2013-05-095-13/+97
| | | | | | | | | This patch fixes PR15601. - Added check for whether the loop variable and the initializer have the same type. - Added tests. llvm-svn: 181528
* Stop LoopConvert removing DeclStmts from selection/iteration condition clausesEdwin Vane2013-05-062-10/+78
| | | | | | | | | | | If the LoopConvert Transform detects an alias for the loop variable, it attempts to use that name in the resulting range-based for loop while removing the original DeclStmt for the variable. That removal produced bad code when the declaration was in the condition of an if, switch, while, or for stmt. This revision fixes the problem by simply replacing the declaration with a use of the alias variable. llvm-svn: 181242
* Added comprehensive macro arg usage logic to Use-Nullptr TransformEdwin Vane2013-05-061-44/+304
| | | | | | | | | | If a NullTo(Member)Pointer cast results from a macro arg expansion, all uses of the arg must result in such casts or else the macro arg cannot be replaced with 'nullptr' safely. This revision adds logic and tests to ensure the safety of replacing macro args in the Use-Nullptr Transform. Fixes: PR15816 llvm-svn: 181221
* Add support to read include/exclude paths from fileEdwin Vane2013-05-023-14/+70
| | | | | | | | | | | | | | Files containing the list of paths to be included and excluded can now be specified through -include-from=<filename> and -exclude-from=<filename> command line options in cpp11-migrate. Added support for data files for cpp11-migrate unittests. The Cpp11MigrateTests executable just requires a DATADIR environment variable to be set which specifies the directory where data files are stored. This is handled automatically when using LIT. Author: Jack Yang <jack.yang@intel.com>, Edwin Vane <edwin.vane@intel.com> llvm-svn: 180939
* Allow autotools to build and install cpp11-migrateAriel J. Bernal2013-04-291-1/+0
| | | | | | | | This patch fixes bug15793 cpp11-migrate was built but not installed (make install) in the autotools build. llvm-svn: 180721
* Adding support for -include/-exclude to cpp11-migrateEdwin Vane2013-04-154-0/+143
| | | | | | | | | | | This commit adds initial support for the -include/-exclude options which are both currently marked as hidden. This support is the first step toward supporting transformations in headers included from source files. Added unittests to test include/exclude support. Author: Jack Yang <jack.yang@intel.com> llvm-svn: 179528
* Adding the AddOverride transform for cpp11-migrateEdwin Vane2013-04-099-0/+261
| | | | | | | | This transform adds the override specifier to methods that overrides virtual methods from a base class that don't already have this specifier. Author: Philip Dunstan <phil@phildunstan.com> llvm-svn: 179127
* Fix UseNullptr fails to replace c-style explicit cast in a return statementAriel J. Bernal2013-04-091-10/+10
| | | | | | | | | | | | This happens whenever there is a c-style explicit cast to nullptr not surrounded by parentheses following a return statement. - Added a white space before nullptr if the character before is alphanumeric when replacing the null pointer expression. - Simplified visitor - Addes tests llvm-svn: 179103
* Fix UseNullptr fails to replace explict casts surrounded by another implicitAriel J. Bernal2013-04-051-4/+6
| | | | | | | | | | | | cast UseNullptr previously matched the implicit cast to const pointer as well as the explicit cast within that has an implicit cast to nullptr as a descendant. -Refactored UseNullptr to avoid special-casing certain kinds of cast sequences -Added test cases. llvm-svn: 178907
* Fix symbol dependency errors introduced with libmigrateCoreEdwin Vane2013-04-053-32/+29
| | | | | | | | | | With cpp11-migrate core functionality moved to a separate library (for enabling unit tests) this library contained code that referenced symbols that are still in the main binary. On some platforms, the shared library build broke as a result. This revision fixes the dependency problem and is safe for the eventual lib-ification of the transforms as well. llvm-svn: 178901
* lib-ified core cpp11-migrate functionality to support unit testsEdwin Vane2013-04-0417-74/+120
| | | | | | | | | | | | | | | | | | Summary: Transform.* and Transforms.* moved to form a new library: libmigrateCore. #includes updated to point to new header locations. To support autoconf build, Cpp11Migrate.cpp moved to new subdirectory 'tool' which also contains build files for creating final binary. CMake and autoconf updated to build the new library and link it with cpp11-migrate and with cpp11-migrate unit tests. Dummy unit tests replaced with simple, but real, tests for Transform's public interface. TODO: Lib-ifying the transforms to further simplify build of cpp11-migrate. llvm-svn: 178785
* Use 'auto' with 'new' expressionsEdwin Vane2013-04-025-17/+123
| | | | | | | | | | | | | | | | | | | | | For variable declarations initialized with new expressions, use 'auto' for the type specifier. The 'auto' replacement happens only when the type of the VarDecl exactly matches the type of the initializer and the VarDecl is *not* CV-qualified. The only case that is currently handled is if the pointer type of the VarDecl is itself CV qualified. Some improvements need to be made to Clang's TypeLoc information in order for other CV qualifier cases to be successfully handled. See the new test suite new_cv_failing.cpp for examples of usages that could be handled with such an improvement. Function pointers are, for now, not transformed until the identifier info can be extracted. Reviewer: klimek llvm-svn: 178575
* Refactor Usenullptr matcher to avoid duplicationAriel J. Bernal2013-04-015-93/+76
| | | | | | | | | | | Previously UseNullptr matched separately implicit and explicit casts to nullptr, now it matches casts that either are implict casts to nullptr or have an implicit cast to nullptr within. Also fixes PR15572 since the same macro replacement logic is applied to implicit and explicit casts. llvm-svn: 178494
* Improve loop convert's variable aliasingEdwin Vane2013-04-011-8/+17
| | | | | | | | | | | | | | | Loop convert's variable name aliasing may cause issues if the variable is declared as a value (copy). The converted loop will declare the variable as a reference which may inadvertently cause modifications to the container if it were used and modified as a temporary copy. This is fixed by preserving the reference or value qualifiers of the aliased variable. That is, if the variable was declared as a value the loop variable will also be declared as a value and similarly for references. Fixes: PR15600 Author: Jack Yang <jack.yang@intel.com> llvm-svn: 178485
* Allow users to specify NULL like macros to be replacedTareq A. Siraj2013-03-283-15/+49
| | | | | | | | | | | | | | | | -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
* Test commit: Remove whitespace.Tareq A. Siraj2013-03-281-1/+1
| | | | llvm-svn: 178241
* cpp11-migrate segfaults transforming map<string,int>::iterator Ariel J. Bernal2013-03-271-1/+8
| | | | | | | | | | | | 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
* Adding clang-headers as dependency of cpp11-migrateEdwin Vane2013-03-251-0/+4
| | | | | | | | 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
* 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
OpenPOWER on IntegriCloud