[PATCH] D65889: [analyzer] CastValueChecker: Model castAs(), getAs()

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 10:47:59 PDT 2019


Charusso added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:111
+    QualType Ty = CE->getCallReturnType(C.getASTContext());
+    V = C.getSValBuilder().makeTruthVal(true, Ty);
+  }
----------------
NoQ wrote:
> Charusso wrote:
> > That is a very lame way to conjure a symbol, but with a cool wrapper I believe this would be okay. Do we have a better way to create a non-null symbol?
> This creates a concrete `1` rather than a symbol. That's the right behavior for `isa`, but it's not the right behavior for `getAs`. In case of `getAs` we need to return our `this`.
Could you explain what is `this`, please? At this case we are working with a `CXXMemberCallExpr`. Do you mean its `getImplicitObjectArgument()`?


Repository:
  rC Clang

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

https://reviews.llvm.org/D65889





More information about the cfe-commits mailing list