[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

Deep Majumder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 05:55:19 PDT 2021


RedDocMD added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:381
+    const MemRegion *ThisRegion = DC->getCXXThisVal().getAsRegion();
+    assert(ThisRegion && "We do not support explicit calls to destructor");
+    const auto *InnerPtrVal = State->get<TrackedRegionMap>(ThisRegion);
----------------
vsavchenko wrote:
> RedDocMD wrote:
> > vsavchenko wrote:
> > > And if it happens we are going to crash with assertion failure?
> > Assuming assertions are enabled, that is.
> We should never crash or fail on valid C++ code.  We can abandon everything, forbid checker to report anything on a function that has something that we don't know how to handle properly, but never fail the overall analysis process because of that. 
Ah right, I should have put in a TODO. This assert was put to see how often I run into this (none so far). It must be removed before this patch is accepted.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105821/new/

https://reviews.llvm.org/D105821



More information about the cfe-commits mailing list