diff options
| author | Tareq A. Siraj <tareq.a.sriaj@intel.com> | 2013-03-28 16:06:59 +0000 |
|---|---|---|
| committer | Tareq A. Siraj <tareq.a.sriaj@intel.com> | 2013-03-28 16:06:59 +0000 |
| commit | c2aa348dd0ab28df2974f9c94c750277d04a5e8a (patch) | |
| tree | 05fba4734d27de1d6f337fd23397c65131102cf1 /clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp | |
| parent | 01186359798e9a95b474c05b1e2239ab03b082c0 (diff) | |
| download | bcm5719-llvm-c2aa348dd0ab28df2974f9c94c750277d04a5e8a.tar.gz bcm5719-llvm-c2aa348dd0ab28df2974f9c94c750277d04a5e8a.zip | |
Allow users to specify NULL like macros to be replaced
-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
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp')
| -rw-r--r-- | clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp b/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp index 7b3c2f0c5b9..28de7458c60 100644 --- a/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp +++ b/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp @@ -1,6 +1,9 @@ // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: cpp11-migrate -use-nullptr %t.cpp -- -I %S // RUN: FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t2.cpp +// RUN: cpp11-migrate -use-nullptr -user-null-macros=MY_NULL %t2.cpp -- -I %S +// RUN: FileCheck -check-prefix=USER-SUPPLIED-NULL -input-file=%t2.cpp %s #define NULL 0 // CHECK: #define NULL 0 @@ -56,10 +59,9 @@ void test_macro_expansion2() { void test_macro_expansion3() { #define MY_NULL NULL - // TODO: Eventually we should fix the transform to detect cases like this so - // that we can replace MY_NULL with nullptr. int *p = MY_NULL; // CHECK: int *p = MY_NULL; + // USER-SUPPLIED-NULL: int *p = nullptr; #undef MY_NULL } |

