[PATCH] D65889: [analyzer] CastValueChecker: Model castAs(), getAs()
    Artem Dergachev via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Aug  7 10:39:41 PDT 2019
    
    
  
NoQ added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:111
+    QualType Ty = CE->getCallReturnType(C.getASTContext());
+    V = C.getSValBuilder().makeTruthVal(true, Ty);
+  }
----------------
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`.
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