diff options
author | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-04-09 16:54:56 +0000 |
---|---|---|
committer | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-04-09 16:54:56 +0000 |
commit | 464957e2d6ee20ab3f836bfc7d08a75e992cdf08 (patch) | |
tree | fcbef3b9d5c6f473173425a5892906b9eaafdcea /clang-tools-extra/test/cpp11-migrate | |
parent | 1cc814a8e6f4595e6ccfb1c102db2054e98e4311 (diff) | |
download | bcm5719-llvm-464957e2d6ee20ab3f836bfc7d08a75e992cdf08.tar.gz bcm5719-llvm-464957e2d6ee20ab3f836bfc7d08a75e992cdf08.zip |
Fix UseNullptr fails to replace c-style explicit cast in a return statement
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
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate')
-rw-r--r-- | clang-tools-extra/test/cpp11-migrate/UseNullptr/basic.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/UseNullptr/basic.cpp b/clang-tools-extra/test/cpp11-migrate/UseNullptr/basic.cpp index b7c5d5e3516..e2c63ba6a1a 100644 --- a/clang-tools-extra/test/cpp11-migrate/UseNullptr/basic.cpp +++ b/clang-tools-extra/test/cpp11-migrate/UseNullptr/basic.cpp @@ -180,6 +180,18 @@ int test_function_return6() { // CHECK: return g_null; } +int *test_function_return_cast1() { + return(int)0; + // CHECK: return nullptr; +} + +int *test_function_return_cast2() { + #define RET return + RET(int)0; + // CHECK: RET nullptr; + #undef RET +} + // Test parentheses expressions resulting in a nullptr. int *test_parentheses_expression1() { return(0); |