[PATCH] D24792: [analyzer] Fix crash in RetainCountChecker::checkEndFunction

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 14:34:28 PDT 2016


zaks.anna added a comment.

One approach would be to skip analyzing the functions which we model as top level.

- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -688,6 +688,9 @@ void AnalysisConsumer::ActionExprEngine(Decl *D, bool ObjCGCEnabled,

  if (!Mgr->getAnalysisDeclContext(D)->getAnalysis<RelaxedLiveVariables>())
    return;
   

+  if (Mgr->getAnalysisDeclContext(D)->isBodyAutosynthesized())
+    return;
+

  ExprEngine Eng(*Mgr, ObjCGCEnabled, VisitedCallees, &FunctionSummaries,IMode);

The main downside is that we will not be analyzing the bodies of functions that are being modeled at all, so we won't find bugs in them. On the other hand, those definitions should be coming from system headers anyway.

Another approach is along the lines of changing the AnalysisDeclContext::getBody() so that it does not choose model over a real body depending on context. It might be less clean and maintainable.


Repository:
  rL LLVM

https://reviews.llvm.org/D24792





More information about the cfe-commits mailing list