diff options
author | Anton Yartsev <anton.yartsev@gmail.com> | 2013-03-25 01:35:45 +0000 |
---|---|---|
committer | Anton Yartsev <anton.yartsev@gmail.com> | 2013-03-25 01:35:45 +0000 |
commit | 13df03624bd21878c32e0d84b71b55bc1298cbcc (patch) | |
tree | 510b6a2625e3c59c9958c30ae210cf1a7eb7b74c /clang/test/Analysis/Inputs/system-header-simulator-cxx.h | |
parent | 8ef2419d60dd960f50a72c4cbd0416580ace1c79 (diff) | |
download | bcm5719-llvm-13df03624bd21878c32e0d84b71b55bc1298cbcc.tar.gz bcm5719-llvm-13df03624bd21878c32e0d84b71b55bc1298cbcc.zip |
[analyzer] Adds cplusplus.NewDelete checker that check for memory leaks, double free, and use-after-free problems of memory managed by new/delete.
llvm-svn: 177849
Diffstat (limited to 'clang/test/Analysis/Inputs/system-header-simulator-cxx.h')
-rw-r--r-- | clang/test/Analysis/Inputs/system-header-simulator-cxx.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h index faca0b41aa6..03de527a02d 100644 --- a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h +++ b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h @@ -59,4 +59,28 @@ namespace std { return 0; } }; + + class bad_alloc : public exception { + public: + bad_alloc() throw(); + bad_alloc(const bad_alloc&) throw(); + bad_alloc& operator=(const bad_alloc&) throw(); + virtual const char* what() const throw() { + return 0; + } + }; + + struct nothrow_t {}; + + extern const nothrow_t nothrow; } + +void* operator new(std::size_t, const std::nothrow_t&) throw(); +void* operator new[](std::size_t, const std::nothrow_t&) throw(); +void operator delete(void*, const std::nothrow_t&) throw(); +void operator delete[](void*, const std::nothrow_t&) throw(); + +void* operator new (std::size_t size, void* ptr) throw() { return ptr; }; +void* operator new[] (std::size_t size, void* ptr) throw() { return ptr; }; +void operator delete (void* ptr, void*) throw() {}; +void operator delete[] (void* ptr, void*) throw() {}; |