[PATCH] D64374: [analyzer] CastValueChecker: Model casts

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 15:40:11 PDT 2019


Charusso added a comment.

In D64374#1577235 <https://reviews.llvm.org/D64374#1577235>, @NoQ wrote:

> Whoops. I underestimated you (:
>
> Ok, anyway, this was my last comment. Great job! Remember to make sure that it works on the actual LLVM, not only on tests; mocked-up test headers are very easy to get wrong.


The only crash-able code was that:

  #0 Calling llvm::unique_dyn_cast

where:

  ProgramStateRef ExprEngine::createTemporaryRegionIfNeeded():
  Assertion `!InitValWithAdjustments.getAs<Loc>() || Loc::isLocType(Result->getType()) || Result->getType()->isMemberPointerType()'

because of `cast<>`:

  template <class X, class Y>
  LLVM_NODISCARD inline auto unique_dyn_cast(std::unique_ptr<Y> &Val)
      -> decltype(cast<X>(Val)) {
    if (!isa<X>(Val))
      return nullptr;
    return cast<X>(std::move(Val));
  }

(source: https://llvm.org/doxygen/Casting_8h_source.html)

So we bypass every error with that CXXRecordDecl checking from now. Would we like to model that?


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

https://reviews.llvm.org/D64374





More information about the cfe-commits mailing list