[PATCH] D35613: Add Support for Generic Reference Counting Annotations in RetainCountChecker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 02:29:58 PDT 2017


NoQ added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp:2012
+      } else if (CurrV.getObjKind() == RetEffect::GenericC) {
+        if (Sym->getType().isNull()) {
+          os << " returns an object with a ";
----------------
malhar1995 wrote:
> NoQ wrote:
> > I don't think this can happen. Symbols always have a type, see `isValidTypeForSymbol()`. These branches can be removed from the surrounding code as well.
> So, you're saying `Sym->getType()` can never be NULL?
> If so, do you want me to insert `assert(isValidTypeForSymbol(Sym->getType()))` instead? 
This assertion is already there in Sym's constructor (of the whole `SymExpr` class), and symbols are also immutable, so it's already verified and you can just rely on it and remove the branch in your `if` (and probably nearby `if`s as well).


Repository:
  rL LLVM

https://reviews.llvm.org/D35613





More information about the cfe-commits mailing list