hanchenye-llvm-project/clang/test/Analysis
Ismail Pazarbasi e5768d1717 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

rev 2 update:
`getNewExprFromInitListOrExpr` should return `dyn_cast_or_null`
instead of `dyn_cast`, since `E` might be null.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D4661

llvm-svn: 237608
2015-05-18 19:59:11 +00:00
..
Inputs [analyzer] Fix pthread lock tests so that the API comes from a system header. 2014-09-10 16:17:42 +00:00
diagnostics [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
engine
inlining Record correct source range for defaulted/deleted members. 2015-03-23 21:43:28 +00:00
objc Correct hyphenations in comments and assert messages 2013-12-05 04:47:09 +00:00
CFContainers-invalid.c
CFContainers.mm
CFDateGC.m
CFNumber.c
CFRetainRelease_NSAssertionHandler.m
CGColorSpace.c
CheckNSError.m
Malloc+MismatchedDeallocator+NewDelete.cpp Detect uses of mismatching forms of 'new' and 'delete' 2015-05-18 19:59:11 +00:00
Malloc+MismatchedDeallocator_intersections.cpp [analyzer] This implements potential undefbehavior.ZeroAllocDereference checker. 2015-04-14 14:18:04 +00:00
Malloc+NewDelete_intersections.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
MismatchedDeallocator-checker-test.mm Detect uses of mismatching forms of 'new' and 'delete' 2015-05-18 19:59:11 +00:00
MismatchedDeallocator-path-notes.cpp Detect uses of mismatching forms of 'new' and 'delete' 2015-05-18 19:59:11 +00:00
MissingDealloc.m
NSContainers.m [Sema]. Warn when logical expression is a pointer 2014-11-14 17:12:50 +00:00
NSPanel.m
NSString.m
NSWindow.m
NewDelete+MismatchedDeallocator_intersections.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
NewDelete-checker-test.cpp [analyzer] This implements potential undefbehavior.ZeroAllocDereference checker. 2015-04-14 14:18:04 +00:00
NewDelete-custom.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
NewDelete-intersections.mm [analyzer] This implements potential undefbehavior.ZeroAllocDereference checker. 2015-04-14 14:18:04 +00:00
NewDelete-path-notes.cpp [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
NewDelete-variadic.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
NewDeleteLeaks-PR18394.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
NewDeleteLeaks-PR19102.cpp [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package. 2014-10-21 12:41:36 +00:00
NoReturn.m Switch this test from needlessly running the clang driver to directly 2014-01-15 09:07:56 +00:00
OSAtomic_mac.cpp
ObjCProperties.m
ObjCRetSigs.m
PR2599.m
PR2978.m
PR3991.m
PR7218.c
PR9741.cpp Remove duplicated -cc1 in tests 2013-12-08 18:06:52 +00:00
PR12905.c
additive-folding-range-constraints.c
additive-folding.cpp
analyzeOneFunction.m
analyze_display_progress.c
analyzer-config.c
analyzer-config.cpp
analyzer-stats.c Revert "Don't require -re suffix on -verify directives with regexes." 2013-12-14 01:07:05 +00:00
array-struct-region.c
array-struct-region.cpp [analyzer] Add IdenticalExprChecker, to find copy-pasted code. 2013-11-08 01:15:39 +00:00
array-struct.c [analyzer] Relax an assertion in VisitLvalArraySubscriptExpr 2015-02-05 01:02:59 +00:00
auto-obj-dtors-cfg-output.cpp Reapply "Pretty Printer: Fix printing of conversion operator decls and calls." 2014-02-25 18:03:55 +00:00
base-init.cpp
bitwise-ops.c [analyzer] Shitfing a constant value by its bit width is undefined. 2014-01-16 18:02:23 +00:00
blocks-no-inline.c
blocks.m [analyzer] Fix an infinite recursion in region invalidation by adding block count to the BlockDataRegion. 2013-11-20 00:11:42 +00:00
bool-assignment.c
bstring.c [analyzer] Make CStringChecker correctly calculate return value of mempcpy 2014-10-03 21:48:54 +00:00
builtin-functions.cpp Teach the analyzer that __builtin_assume_aligned returns its first argument. 2014-09-09 21:42:16 +00:00
call-invalidation.cpp [analyzer] Functions marked __attribute__((const)) don't modify any memory. 2014-05-07 03:29:56 +00:00
casts.c PR16074, implement warnings to catch pointer to boolean true and pointer to 2014-02-26 02:36:06 +00:00
casts.cpp [analyzer] Fix test in previous commit to account for compiler warning. 2013-12-19 23:05:40 +00:00
casts.m
cfg.cpp Fix some cases of incorrect handling of lifetime extended temporaries. 2014-07-30 08:34:42 +00:00
cfref_PR2519.c
cfref_rdar6080742.c
check-deserialization.cpp
checker-plugins.c Add a test for Static Analyzer checker plugins 2014-01-09 00:47:40 +00:00
chroot.c
comparison-implicit-casts.cpp
complex-init-list.cpp
complex.c
concrete-address.c
conditional-operator.cpp Switch %clang -cc1 tests to %clang_cc1 2013-10-28 23:47:09 +00:00
conditional-path-notes.c [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
constant-folding.c
coverage.c
crash-trace.c Fix REQUIRES lines on tests from r228735. Thanks Kristof for pointing out the missing commas 2015-02-11 19:45:13 +00:00
cstring-syntax-cxx.cpp
cstring-syntax.c
ctor.mm [analyzer] Improve test from r207486. 2014-04-29 17:08:17 +00:00
cxx-crashes.cpp
cxx-for-range-cfg.cpp
cxx-for-range.cpp [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
cxx-method-names.cpp
cxx11-crashes.cpp
dead-stores.c Consolidate header inclusion diagnostics 2014-07-11 20:53:51 +00:00
dead-stores.cpp
dead-stores.m Teach DeadStoresChecker about attribute objc_precise_lifetime. 2014-01-15 00:59:23 +00:00
debug-CallGraph.c [CallGraph] Make sure the edges are not missed due to re-declarations 2014-12-17 00:34:07 +00:00
default-analyze.m Objective-C. After providing a fix-it for a 2013-12-18 21:04:43 +00:00
default-diagnostic-visitors.c
delegates.m
derived-to-base.cpp
disable-all-checks.c Fixup for r216763. Add a driver test. 2014-08-29 21:51:22 +00:00
div-zero.cpp
domtest.c
dtor-cxx11.cpp [analyzer] Remove incorrect workaround for unimplemented temporary destructors. 2014-04-01 16:39:59 +00:00
dtor.cpp PR6037 2015-01-19 01:44:02 +00:00
dtors-in-dtor-cfg-output.cpp
dynamic-cast.cpp Fix a tranche of comment, test and doc typos 2013-12-05 16:25:25 +00:00
edges-new.mm [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
elementtype.c
enum.cpp
exceptions.mm
exercise-ps.c Consolidate header inclusion diagnostics 2014-07-11 20:53:51 +00:00
fields.c
free.c [analyzer] Individual configuration options can be specified for checkers. 2015-03-04 17:59:34 +00:00
func.c [analyzer] Add new debug helper clang_analyzer_warnIfReached. 2013-10-03 16:57:03 +00:00
global-region-invalidation.c
global_region_invalidation.mm
html-diags-multifile.c Fix test that wasn't testing anything 2013-11-05 12:45:37 +00:00
html-diags-multifile.h
html-diags.c Remove shell requirements from tests that use 'cd' 2015-03-02 22:42:58 +00:00
identical-expressions.cpp [test] Turn off warnings for test/Analysis/identical-expressions.cpp. 2014-08-20 22:40:57 +00:00
initializer.cpp
initializers-cfg-output.cpp CFG: Properly print delegating initializer CFG elements. 2013-10-22 23:19:47 +00:00
inline-not-supported.c
inline-plist.c [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
inline-unique-reports.c [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
inline.c
inline.cpp [analyzer] Inline C++ operator new when c++-inline-allocators is turned on. 2014-02-11 02:21:06 +00:00
inline2.c
inline3.c
inline4.c
ivars.m
keychainAPI-diagnostic-visitor.m
keychainAPI.m
kmalloc-linux.c [analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs. 2014-03-26 17:05:46 +00:00
lambdas.cpp Per latest drafting, switch to implementing init-captures as if by declaring 2013-09-28 04:02:39 +00:00
lit.local.cfg
live-variables.cpp Revert "[analyzer] Refactor conditional expression evaluating code" 2013-12-06 18:56:29 +00:00
live-variables.m Revert "[analyzer] Refactor conditional expression evaluating code" 2013-12-06 18:56:29 +00:00
logical-ops.c [Sema]. Warn when logical expression is a pointer 2014-11-14 17:12:50 +00:00
lvalue.cpp
malloc-annotations.c [analyzer] Individual configuration options can be specified for checkers. 2015-03-04 17:59:34 +00:00
malloc-interprocedural.c
malloc-overflow.c
malloc-overflow.cpp
malloc-plist.c [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
malloc-protoype.c [analyzer] Don't crash if malloc() has an unexpected function prototype. 2014-09-05 16:33:51 +00:00
malloc-sizeof.c
malloc-sizeof.cpp [analyzer] Tweak MallocSizeOfChecker to not warn when using sizeof(void*) to allocate a bunch of any pointer type. 2014-10-19 07:30:55 +00:00
malloc-three-arg.c [analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs. 2014-03-26 17:05:46 +00:00
malloc.c [analyzer] This implements potential undefbehavior.ZeroAllocDereference checker. 2015-04-14 14:18:04 +00:00
malloc.cpp
malloc.m [analyzer] Pointers escape into +[NSValue valueWithPointer:]... 2014-01-07 21:39:48 +00:00
malloc.mm
member-expr.cpp [analyzer] Don't assert when combining using .* on a temporary. 2014-04-29 17:08:12 +00:00
method-arg-decay.m Change 'method X in protocol not implemented' warning to include the name of the protocol. 2013-12-13 05:58:51 +00:00
method-call-intra-p.cpp
method-call-path-notes.cpp [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
method-call.cpp
misc-ps-64.m
misc-ps-arm.m Add error checking to reject neon_vector_type attribute on targets without NEON. 2013-09-16 18:07:35 +00:00
misc-ps-cxx0x.cpp
misc-ps-eager-assume.m
misc-ps-ranges.m
misc-ps-region-store-i386.m
misc-ps-region-store-x86_64.m
misc-ps-region-store.cpp Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings 2014-06-06 21:39:26 +00:00
misc-ps-region-store.m Fix testcase for case. 2014-05-20 17:15:31 +00:00
misc-ps-region-store.mm
misc-ps.c
misc-ps.m [analyzer] Check for negative values used as the size of a C variable-length array. 2014-08-12 16:44:22 +00:00
model-file.cpp [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
new-with-exceptions.cpp
new.cpp Correct hyphenations in comments and assert messages 2013-12-05 04:47:09 +00:00
nil-receiver-undefined-larger-than-voidptr-ret-region.m
nil-receiver-undefined-larger-than-voidptr-ret.m
no-exit-cfg.c
no-outofbounds.c [analyzer] Teach CastSizeChecker about flexible array members. 2014-02-18 17:06:30 +00:00
nonnull.m [analyzer] Check all 'nonnull' attributes, not just the first one. 2014-10-13 19:38:02 +00:00
null-deref-path-notes.m [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
null-deref-ps-region.c
null-deref-ps.c [analyzer] Remove IdempotentOperations checker. 2014-01-04 05:52:11 +00:00
nullptr.cpp
objc-arc.m [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
objc-bool.m
objc-boxing.m [Sema]. Warn when logical expression is a pointer 2014-11-14 17:12:50 +00:00
objc-for.m Correct hyphenations in comments and assert messages 2013-12-05 04:47:09 +00:00
objc-method-coverage.m
objc-properties.m Correct hyphenations in comments and assert messages 2013-12-05 04:47:09 +00:00
objc-radar17039661.m [analyzer] Look for allocation site in the parent frames as well as the current one. 2015-02-05 01:02:53 +00:00
objc-string.mm A new conversion warning for when an Objective-C object literal is implicitly 2014-01-28 23:40:26 +00:00
objc-subscript.m
objc_invalidation.m Objective-C [qoi]. If property is going to be implemented 2014-08-29 20:29:31 +00:00
operator-calls.cpp
out-of-bounds.c
outofbound-notwork.c
outofbound.c [analyzer] Individual configuration options can be specified for checkers. 2015-03-04 17:59:34 +00:00
override-werror.c
plist-html-macros.c
plist-macros.cpp [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
plist-output-alternate.m [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
plist-output.m [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
pointer-to-member.cpp
pr4209.m
pr_2542_rdar_6793404.m
pr_4164.c
properties.m [analyzer] Add test for previous commit. 2015-03-30 20:18:04 +00:00
properties.mm [analyzer] Tighten up sanity checks on Objective-C property getter synthesis. 2014-01-23 03:59:10 +00:00
pthreadlock.c [analyzer] Fix pthread lock tests so that the API comes from a system header. 2014-09-10 16:17:42 +00:00
ptr-arith.c PR16074, implement warnings to catch pointer to boolean true and pointer to 2014-02-26 02:36:06 +00:00
ptr-arith.cpp
rdar-6442306-1.m
rdar-6540084.m
rdar-6541136-region.c
rdar-6562655.m
rdar-6600344-nil-receiver-undefined-struct-ret.m
rdar-7168531.m
redefined_system.c [analyzer] Do not crash in the KeychainAPI checker on user defined 'free()'. 2015-02-05 01:02:56 +00:00
refcnt_naming.m
reference.cpp Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings 2014-06-06 21:39:26 +00:00
reference.mm
region-1.m Objective-C. Diagose use of undefined protocols 2014-03-11 17:10:51 +00:00
region-store.c
region-store.cpp
reinterpret-cast.cpp
retain-release-cache-out.m [analyzer] Don't create new PostStmt nodes if we don't have to. 2014-06-18 19:23:30 +00:00
retain-release-cf-audited.m
retain-release-gc-only.m
retain-release-inline.m
retain-release-path-notes-gc.m [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
retain-release-path-notes.m [analyzer] Disable all retain count diagnostics on values that come from ivars. 2015-03-30 20:18:00 +00:00
retain-release-region-store.m
retain-release.m [analyzer] Check for NULL passed to CFAutorelease. 2014-06-21 23:50:40 +00:00
retain-release.mm
security-syntax-checks-no-emit.c
security-syntax-checks.m Enable security checks for arc4random() on CloudABI as well. 2015-03-11 08:48:55 +00:00
self-init.m Replace -fobjc-default-synthesize-properties with disable-objc-default-synthesize-properties. 2013-09-27 20:21:48 +00:00
shallow-mode.m
simple-stream-checks.c
sizeofpointer.c
stack-addr-ps.c Register parameters have local storage. 2015-02-04 07:15:12 +00:00
stack-addr-ps.cpp Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings 2014-06-06 21:39:26 +00:00
stack-block-returned.cpp
stackaddrleak.c PR16074, implement warnings to catch pointer to boolean true and pointer to 2014-02-26 02:36:06 +00:00
static_local.m
stats.c
stream.c
string-fail.c
string.c
superclass.m [analyzer] Move checker alpha.osx.cocoa.MissingSuperCall out of alpha category. 2014-02-19 05:28:39 +00:00
svalbuilder-logic.c
taint-generic.c
taint-tester.c
taint-tester.cpp
taint-tester.m
temp-obj-dtors-cfg-output.cpp Re-applying r214962. 2014-08-07 10:42:17 +00:00
templates.cpp
temporaries.cpp Work around missing handling of temporaries bound to default arguments. 2014-08-13 15:25:55 +00:00
test-after-div-zero.c [analyzer] Check for code testing a variable for 0 after using it as a denominator. 2014-07-10 16:10:52 +00:00
test-objc-non-nil-return-value-checker.m
test-variably-modified-types.c
traversal-algorithm.mm
traversal-path-unification.c
undef-buffers.c [analyzer] Individual configuration options can be specified for checkers. 2015-03-04 17:59:34 +00:00
uninit-const.c [analyzer] Warn when passing pointers to const but uninitialized memory. 2014-03-13 17:55:39 +00:00
uninit-const.cpp [analyzer] Warn when passing pointers to const but uninitialized memory. 2014-03-13 17:55:39 +00:00
uninit-msg-expr.m
uninit-ps-rdar6145427.m
uninit-sometimes.cpp PR16054: Slight strengthening for -Wsometimes-uninitialized: if we use a 2013-09-12 18:49:10 +00:00
uninit-vals-ps-region.m [analyzer] Remove IdempotentOperations checker. 2014-01-04 05:52:11 +00:00
uninit-vals-ps.c
uninit-vals.m
unions-region.m
unions.cpp [analyzer] Generate a LazyCompoundVal when loading from a union-typed region. 2013-10-23 20:08:55 +00:00
unix-api.c [analyzer] UnixAPI: Check that the third argument to open(2) (if present) is an integer. 2014-08-20 16:58:09 +00:00
unix-fns.c [Static Analyzer] The name of the checker that reports a bug is added 2015-02-09 22:52:26 +00:00
unreachable-code-path.c
unused-ivars.m
variadic-method-types.m
virtualcall.cpp [analyzer] Don't warn on virtual calls in ctors to final methods. 2014-08-21 10:25:03 +00:00
virtualcall.h
vla.c [analyzer] Check for negative values used as the size of a C variable-length array. 2014-08-12 16:44:22 +00:00
weak-functions.c PR16074, implement warnings to catch pointer to boolean true and pointer to 2014-02-26 02:36:06 +00:00