[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! llvm-svn: 191381
Showing
- clang/include/clang/Analysis/CFG.h 1 addition, 1 deletionclang/include/clang/Analysis/CFG.h
- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 2 additions, 1 deletionclang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
- clang/lib/StaticAnalyzer/Core/CallEvent.cpp 2 additions, 0 deletionsclang/lib/StaticAnalyzer/Core/CallEvent.cpp
- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp 24 additions, 1 deletionclang/lib/StaticAnalyzer/Core/ExprEngine.cpp
- clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp 3 additions, 1 deletionclang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
- clang/test/Analysis/NewDelete-checker-test.cpp 25 additions, 0 deletionsclang/test/Analysis/NewDelete-checker-test.cpp
- clang/test/Analysis/new.cpp 145 additions, 0 deletionsclang/test/Analysis/new.cpp
Loading
Please register or sign in to comment