diff options
author | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-04-01 20:09:29 +0000 |
---|---|---|
committer | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-04-01 20:09:29 +0000 |
commit | f78debd7d2f91b59c8554d5bd7839eb54ed2b665 (patch) | |
tree | d0078a47948a4f4cbc5834b3b1acea9f1075e3f6 /clang-tools-extra/test/cpp11-migrate | |
parent | 335bf6fb763424351d35213ff64967b0f8f20aa6 (diff) | |
download | bcm5719-llvm-f78debd7d2f91b59c8554d5bd7839eb54ed2b665.tar.gz bcm5719-llvm-f78debd7d2f91b59c8554d5bd7839eb54ed2b665.zip |
Refactor Usenullptr matcher to avoid duplication
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
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate')
-rw-r--r-- | clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp b/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp index 28de7458c60..8e19e4ab6dc 100644 --- a/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp +++ b/clang-tools-extra/test/cpp11-migrate/UseNullptr/macros.cpp @@ -39,8 +39,22 @@ void test_macro_expansion1() { #undef MACRO_EXPANSION_HAS_NULL } +// Test macro expansion with cast sequence, PR15572 void test_macro_expansion2() { #define MACRO_EXPANSION_HAS_NULL \ + dummy((int*)0); \ + side_effect(); + // CHECK: dummy((int*)0); \ + // CHECK-NEXT: side_effect(); + + MACRO_EXPANSION_HAS_NULL; + // CHECK: MACRO_EXPANSION_HAS_NULL; + +#undef MACRO_EXPANSION_HAS_NULL +} + +void test_macro_expansion3() { +#define MACRO_EXPANSION_HAS_NULL \ dummy(NULL); \ side_effect(); // CHECK: dummy(NULL); \ @@ -57,7 +71,7 @@ void test_macro_expansion2() { #undef MACRO_EXPANSION_HAS_NULL } -void test_macro_expansion3() { +void test_macro_expansion4() { #define MY_NULL NULL int *p = MY_NULL; // CHECK: int *p = MY_NULL; @@ -91,5 +105,3 @@ void test_function_like_macro2() { // CHECK: my_macro(p != nullptr); #undef my_macro } - - |