This revision was automatically updated to reflect the committed changes.
Closed by commit rL322790: [analyzer] NFC: operator new: Fix new(nothrow) 
definition in tests. (authored by dergachev, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D41408?vs=127580&id=130307#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41408

Files:
  cfe/trunk/test/Analysis/NewDelete-custom.cpp


Index: cfe/trunk/test/Analysis/NewDelete-custom.cpp
===================================================================
--- cfe/trunk/test/Analysis/NewDelete-custom.cpp
+++ cfe/trunk/test/Analysis/NewDelete-custom.cpp
@@ -4,16 +4,16 @@
 // RUN: %clang_analyze_cc1 
-analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc 
-std=c++11 -analyzer-config c++-allocator-inlining=true -DLEAKS=1 
-DALLOCATOR_INLINING=1 -fblocks -verify %s
 #include "Inputs/system-header-simulator-cxx.h"
 
-#if !LEAKS
+#if !(LEAKS && !ALLOCATOR_INLINING)
 // expected-no-diagnostics
 #endif
 
 
 void *allocator(std::size_t size);
 
 void *operator new[](std::size_t size) throw() { return allocator(size); }
 void *operator new(std::size_t size) throw() { return allocator(size); }
-void *operator new(std::size_t size, std::nothrow_t& nothrow) throw() { return 
allocator(size); }
+void *operator new(std::size_t size, const std::nothrow_t &nothrow) throw() { 
return allocator(size); }
 void *operator new(std::size_t, double d);
 
 class C {
@@ -59,16 +59,13 @@
 
 //----- Custom NoThrow placement operators
 void testOpNewNoThrow() {
-  void *p = operator new(0, std::nothrow);
+  void *p = operator new(0, std::nothrow); // call is inlined, no warn
 }
-#if LEAKS
-// expected-warning@-2{{Potential leak of memory pointed to by 'p'}}
-#endif
 
 void testNewExprNoThrow() {
   int *p = new(std::nothrow) int;
 }
-#if LEAKS
+#if LEAKS && !ALLOCATOR_INLINING
 // expected-warning@-2{{Potential leak of memory pointed to by 'p'}}
 #endif
 


Index: cfe/trunk/test/Analysis/NewDelete-custom.cpp
===================================================================
--- cfe/trunk/test/Analysis/NewDelete-custom.cpp
+++ cfe/trunk/test/Analysis/NewDelete-custom.cpp
@@ -4,16 +4,16 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -analyzer-config c++-allocator-inlining=true -DLEAKS=1 -DALLOCATOR_INLINING=1 -fblocks -verify %s
 #include "Inputs/system-header-simulator-cxx.h"
 
-#if !LEAKS
+#if !(LEAKS && !ALLOCATOR_INLINING)
 // expected-no-diagnostics
 #endif
 
 
 void *allocator(std::size_t size);
 
 void *operator new[](std::size_t size) throw() { return allocator(size); }
 void *operator new(std::size_t size) throw() { return allocator(size); }
-void *operator new(std::size_t size, std::nothrow_t& nothrow) throw() { return allocator(size); }
+void *operator new(std::size_t size, const std::nothrow_t &nothrow) throw() { return allocator(size); }
 void *operator new(std::size_t, double d);
 
 class C {
@@ -59,16 +59,13 @@
 
 //----- Custom NoThrow placement operators
 void testOpNewNoThrow() {
-  void *p = operator new(0, std::nothrow);
+  void *p = operator new(0, std::nothrow); // call is inlined, no warn
 }
-#if LEAKS
-// expected-warning@-2{{Potential leak of memory pointed to by 'p'}}
-#endif
 
 void testNewExprNoThrow() {
   int *p = new(std::nothrow) int;
 }
-#if LEAKS
+#if LEAKS && !ALLOCATOR_INLINING
 // expected-warning@-2{{Potential leak of memory pointed to by 'p'}}
 #endif
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to