]> granicus.if.org Git - clang/commit
Detect uses of mismatching forms of 'new' and 'delete'
authorIsmail Pazarbasi <ismail.pazarbasi@gmail.com>
Mon, 18 May 2015 19:59:11 +0000 (19:59 +0000)
committerIsmail Pazarbasi <ismail.pazarbasi@gmail.com>
Mon, 18 May 2015 19:59:11 +0000 (19:59 +0000)
commit069e07e6ff2669eae470e31bca23cbfa4ec984de
tree500882fdbd0d4db35c5fcbdb38500d0d68618434
parent546816fb4dd0b7df8b6fc72f87e07da74dc48ef1
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237608 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/ExternalSemaSource.h
include/clang/Sema/MultiplexExternalSemaSource.h
include/clang/Sema/Sema.h
include/clang/Serialization/ASTBitCodes.h
include/clang/Serialization/ASTReader.h
lib/Sema/MultiplexExternalSemaSource.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaExprCXX.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/Analysis/Malloc+MismatchedDeallocator+NewDelete.cpp
test/Analysis/MismatchedDeallocator-checker-test.mm
test/Analysis/MismatchedDeallocator-path-notes.cpp
test/CodeGenCXX/new.cpp
test/SemaCXX/delete-mismatch.h [new file with mode: 0644]
test/SemaCXX/delete.cpp