[PATCH] D53543: [analyzer] MallocChecker: pr39348: Realize that sized delete isn't a custom delete.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 24 12:02:36 PDT 2018
NoQ added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:727
- // Skip all operator new/delete methods.
- if (isa<CXXMethodDecl>(FD))
- return false;
-
- // Return true if tested operator is a standard placement nothrow operator.
- if (FD->getNumParams() == 2) {
- QualType T = FD->getParamDecl(1)->getType();
- if (const IdentifierInfo *II = T.getBaseTypeIdentifier())
- return II->getName().equals("nothrow_t");
- }
-
- // Skip placement operators.
- if (FD->getNumParams() != 1 || FD->isVariadic())
- return false;
-
- // One of the standard new/new[]/delete/delete[] non-placement operators.
- return true;
+ // This is standard iff it's not defined in a user file.
+ SourceLocation L = FD->getLocation();
----------------
Szelethus wrote:
> typo: if
https://en.wikipedia.org/wiki/If_and_only_if
Thx for pointing out that it's not an entirely common jargon!
================
Comment at: test/Analysis/NewDelete-custom.cpp:3-4
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -analyzer-config c++-allocator-inlining=false -DLEAKS=1 -fblocks -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,unix.Malloc -std=c++11 -DALLOCATOR_INLINING=1 -fblocks -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -DLEAKS=1 -DALLOCATOR_INLINING=1 -fblocks -verify %s
#include "Inputs/system-header-simulator-cxx.h"
----------------
Szelethus wrote:
> Do we still need `-DLEAKS=1` and ` -DALLOCATOR_INLINING=1`?
I guess i'll just remove the no-leaks run-lines because they didn't make sense in the first place.
https://reviews.llvm.org/D53543
More information about the cfe-commits
mailing list