[cfe-commits] [PATCH] Added use-nullptr transform into cpp11-migrate tool

David Blaikie dblaikie at gmail.com
Mon Jan 14 11:46:47 PST 2013


On Mon, Jan 14, 2013 at 8:50 AM, Tareq A. Siraj <tareq.a.siraj at intel.com> wrote:
> Hi klimek,
>
> 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.

There are probably good reasons not to do this, but I'm still curious:

Why not just build this in as a warning in clang with a FixIt? (&, if
necessary, have a Clang Tool designed for applying a particular fixit
to a codebase) GCC 4.8 already intends to have a
-Wzero-as-null-pointer warning which we could match.

>
>
> http://llvm-reviews.chandlerc.com/D295
>
> Files:
>   cpp11-migrate/CMakeLists.txt
>   cpp11-migrate/Makefile
>   cpp11-migrate/UseNullptr/NullptrActions.h
>   cpp11-migrate/UseNullptr/NullptrMatchers.cpp
>   cpp11-migrate/UseNullptr/NullptrMatchers.h
>   cpp11-migrate/UseNullptr/UseNullptr.cpp
>   cpp11-migrate/UseNullptr/NullptrActions.cpp
>   cpp11-migrate/UseNullptr/UseNullptr.h
>   cpp11-migrate/Cpp11Migrate.cpp
>   cpp11-migrate/Transforms.cpp
>   test/cpp11-migrate/UseNullptr/basic_failing.cpp
>   test/cpp11-migrate/UseNullptr/Inputs/basic.h
>   test/cpp11-migrate/UseNullptr/basic.cpp
>   test/cpp11-migrate/Combined/combined.cpp
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list