diff options
author | Stefanus Du Toit <stefanus.du.toit@intel.com> | 2013-03-06 15:32:20 +0000 |
---|---|---|
committer | Stefanus Du Toit <stefanus.du.toit@intel.com> | 2013-03-06 15:32:20 +0000 |
commit | 49fe6388b65eda76f89d6a95f0593d0a1d19a15b (patch) | |
tree | deec58b7a3d62e8b257960b003d98296bf08e3a3 /clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp | |
parent | 66c26e5e9621e4e07f92898c6d988b46b89df00c (diff) | |
download | bcm5719-llvm-49fe6388b65eda76f89d6a95f0593d0a1d19a15b.tar.gz bcm5719-llvm-49fe6388b65eda76f89d6a95f0593d0a1d19a15b.zip |
Test case for PR-15414 - nullptr_t functions
The use-null-ptr transform will transform calls to functions that return a
nullptr_t. Even if the function were to only return a null pointer and do
nothing else, this replacement would still be undesired as the behavior and
signature of the function could change in the future.
This adds an XFAILed test case to demonstrate the issue.
Reviewed by: Edwin Vane, Tareq Siraj
llvm-svn: 176553
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp')
-rw-r--r-- | clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp b/clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp new file mode 100644 index 00000000000..84ca100482e --- /dev/null +++ b/clang-tools-extra/test/cpp11-migrate/UseNullptr/nullptr_t.cpp @@ -0,0 +1,17 @@ +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: cpp11-migrate -final-syntax-check -use-nullptr %t.cpp -- --std=c++11 -I %S +// RUN: FileCheck -input-file=%t.cpp %s +// XFAIL: * + +namespace std { typedef decltype(nullptr) nullptr_t; } + +// Just to make sure make_null() could have side effects. +void external(); + +std::nullptr_t make_null() { external(); return nullptr; } + +void *call_make_null() +{ + return make_null(); + // CHECK: return make_null(); +} |