| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
sys::fs::make_absolute was turning '.' into '<path>/.' which broke prefix
comparison logic. Stripping these extra chars fixes the problem.
llvm-svn: 184322
|
|
|
|
| |
llvm-svn: 184285
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
r183989 added a dependency on LLVMOption in clangFrontend.
llvm-svn: 183990
|
|
|
|
| |
llvm-svn: 183976
|
|
|
|
|
|
| |
isFileIncluded() needed to be marked const.
llvm-svn: 183918
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Moving RewriteContainer's constructor impl to Transform.cpp to reduce clutter.
More things will soon be added to this header.
llvm-svn: 183856
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 183784
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
r183274 accidentally added windows line endings to changed lines. Changing them
back.
llvm-svn: 183322
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
-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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 182957
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
UseAutoActions.cpp:48:17: error: redefinition of 'E' with a different type.
llvm-svn: 182119
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Several free functions related to macro arg testing are being moved into
CastSequenceVisitor to facilitate upcoming fix.
llvm-svn: 182013
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
This patch fixes PR15601.
- Added check for whether the loop variable and the initializer have the same
type.
- Added tests.
llvm-svn: 181528
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
This patch fixes bug15793
cpp11-migrate was built but not installed (make install)
in the autotools build.
llvm-svn: 180721
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-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
|
|
|
|
| |
llvm-svn: 178241
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|