summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-01-18 00:03:43 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-01-18 00:03:43 +0000
commit868e9a1144b3aeebb69955f2e07b5be76721b674 (patch)
tree42dd4a336725648010291ae6108bfae55e28b095
parent729e68693f3618a219f9737d056046ea0b55ff11 (diff)
downloadbcm5719-llvm-868e9a1144b3aeebb69955f2e07b5be76721b674.tar.gz
bcm5719-llvm-868e9a1144b3aeebb69955f2e07b5be76721b674.zip
[analyzer] NFC: operator new: Fix new(nothrow) definition in tests.
Fix the const qualifier so that the operator defined in the tests indeed does override the default global nothrow version of new. Differential Revision: https://reviews.llvm.org/D41408 llvm-svn: 322790
-rw-r--r--clang/test/Analysis/NewDelete-custom.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/test/Analysis/NewDelete-custom.cpp b/clang/test/Analysis/NewDelete-custom.cpp
index 4600f80576b..845beb33743 100644
--- a/clang/test/Analysis/NewDelete-custom.cpp
+++ b/clang/test/Analysis/NewDelete-custom.cpp
@@ -4,7 +4,7 @@
// 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
@@ -13,7 +13,7 @@ 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 @@ void testNewExpr() {
//----- 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
OpenPOWER on IntegriCloud