-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
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
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
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
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
It is preferable for a unit test to be responsible for creating its own input
data instead of relying on checked-in data files. Now the IncludeExcludeTest
for cpp11-migrate does this.
- Removed old data files.
- Updated build system and lit files to remove references to old data files.
llvm-svn: 181029
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 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
With the lib-ification of cpp11-migrate, real unit tests can be written.
Replacing dummy tests with some simple tests for the Transform public
interface.
llvm-svn: 178900
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
Added support to CMake and autoconf for unit tests in clang-tools-extra. A
dummy test exists for now until more meaningful tests can be written.
llvm-svn: 178661
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
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
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