[clang-tools-extra] r176553 - Test case for PR-15414 - nullptr_t functions

Stefanus Du Toit stefanus.du.toit at intel.com
Wed Mar 6 07:32:20 PST 2013


Author: sdt
Date: Wed Mar  6 09:32:20 2013
New Revision: 176553

URL: http://llvm.org/viewvc/llvm-project?rev=176553&view=rev
Log:
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


Added:
    clang-tools-extra/trunk/test/cpp11-migrate/UseNullptr/nullptr_t.cpp

Added: clang-tools-extra/trunk/test/cpp11-migrate/UseNullptr/nullptr_t.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/cpp11-migrate/UseNullptr/nullptr_t.cpp?rev=176553&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/cpp11-migrate/UseNullptr/nullptr_t.cpp (added)
+++ clang-tools-extra/trunk/test/cpp11-migrate/UseNullptr/nullptr_t.cpp Wed Mar  6 09:32:20 2013
@@ -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();
+}





More information about the cfe-commits mailing list