]> granicus.if.org Git - clang/commit
[analyzer] Handle destructors for the argument to C++ 'delete'.
authorJordan Rose <jordan_rose@apple.com>
Wed, 25 Sep 2013 16:06:17 +0000 (16:06 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 25 Sep 2013 16:06:17 +0000 (16:06 +0000)
commit81557223ba8d7ef8b0468a6e1dc8fc79f2de46f2
tree832289319f7bc34f41d1d0063f2bc1fe537ec215
parent4ab39dec0864706d1e69840b5d4c028f02f0b38f
[analyzer] Handle destructors for the argument to C++ 'delete'.

Now that the CFG includes nodes for the destructors in a delete-expression,
process them in the analyzer using the same common destructor interface
currently used for local, member, and base destructors. Also, check for when
the value is known to be null, in which case no destructor is actually run.

This does not yet handle destructors for deleted /arrays/, which may need
more CFG work. It also causes a slight regression in the location of
double delete warnings; the double delete is detected at the destructor
call, which is implicit, and so is reported on the first access within the
destructor instead of at the 'delete' statement. This will be fixed soon.

Patch by Karthik Bhat!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191381 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/CFG.h
lib/StaticAnalyzer/Checkers/MallocChecker.cpp
lib/StaticAnalyzer/Core/CallEvent.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
test/Analysis/NewDelete-checker-test.cpp
test/Analysis/new.cpp