From c2aa348dd0ab28df2974f9c94c750277d04a5e8a Mon Sep 17 00:00:00 2001 From: "Tareq A. Siraj" Date: Thu, 28 Mar 2013 16:06:59 +0000 Subject: 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 --- clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp') 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 } -- cgit v1.2.3