3 Commits

Author SHA1 Message Date
Discookie
564e0165ab
[clang][analyzer] Do not analyze opaque types in CXXDeleteChecker (#70638)
While inheritance can only be expressed if the class has a definition,
in this case one of the types might be opaque to the analyzer.

Fixes a crash encountered while analyzing LLVM.
2023-10-30 14:03:33 +00:00
Viktor Cseh
0e246bb675 [clang][analyzer] Add C++ array delete checker
This checker reports cases where an array of polymorphic objects are
deleted as their base class. Deleting an array where the array's static
type is different from its dynamic type is undefined.

Since the checker is similar to DeleteWithNonVirtualDtorChecker, I
refactored that checker to support more detection types.

This checker corresponds to the SEI Cert rule EXP51-CPP: Do not delete
an array through a pointer of the incorrect type.

Differential Revision: https://reviews.llvm.org/D158156
2023-10-10 09:37:02 +01:00
Viktor Cseh
71ae858c07 [clang][analyzer] Rename DeleteWithNonVirtualDtorChecker to CXXDeleteChecker
This rename is done in a separate commit to preserve `git blame`,
before implementing CXXArrayDeleteChecker and refactoring the file.

Differential Revision: https://reviews.llvm.org/D158156
2023-10-10 09:37:02 +01:00