[PATCH] D36441: Add Support for Reference Counting of Parameters on the Callee Side in RetainCountChecker

Devin Coughlin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 22:26:25 PDT 2017


dcoughlin added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp:3960-3971
+  for (unsigned idx = 0, e = FD->getNumParams(); idx != e; ++idx) {
+    const ParmVarDecl *Param = FD->getParamDecl(idx);
+    SymbolRef Sym = state->getSVal(state->getRegion(Param, LCtx)).getAsSymbol();
+
+    QualType Ty = Param->getType();
+    if (hasRCAnnotation(Param, "rc_ownership_consumed"))
+      state = setRefBinding(state, Sym,
----------------
malhar1995 wrote:
> Getting function summary and checking for `ArgEffects` doesn't seem like an option to me as currently there is no way to differentiate between Core Foundation and Generalized objects just by looking at their ArgEffects.
> 
> However, this loop results in `check-clang-analysis` failure in `retain-release.m` on lines `1140` and `2237`.
You can differentiate based on the Type of the parameter and use ArgEffects to determine what the initial ref binding should be. I'd like there to be a single point of truth about what it means for a parameter to annotated. 


Repository:
  rL LLVM

https://reviews.llvm.org/D36441





More information about the cfe-commits mailing list