[cfe-commits] r152649 - /cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Anna Zaks ganna at apple.com
Tue Mar 13 12:31:54 PDT 2012


Author: zaks
Date: Tue Mar 13 14:31:54 2012
New Revision: 152649

URL: http://llvm.org/viewvc/llvm-project?rev=152649&view=rev
Log:
[analyzer] Minor: factor out logic for determining if we should skip a
function.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=152649&r1=152648&r2=152649&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Tue Mar 13 14:31:54 2012
@@ -191,6 +191,7 @@
   void HandleDeclContextDeclFunction(ASTContext &C, Decl *D);
 
   void HandleCode(Decl *D, SetOfDecls *VisitedCallees = 0);
+  bool skipFunction(Decl *D);
   void RunPathSensitiveChecks(Decl *D, SetOfDecls *VisitedCallees);
   void ActionExprEngine(Decl *D, bool ObjCGCEnabled, SetOfDecls *VisitedCallees);
 };
@@ -384,20 +385,28 @@
   return "";
 }
 
-void AnalysisConsumer::HandleCode(Decl *D, SetOfDecls *VisitedCallees) {
+bool AnalysisConsumer::skipFunction(Decl *D) {
   if (!Opts.AnalyzeSpecificFunction.empty() &&
       getFunctionName(D) != Opts.AnalyzeSpecificFunction)
-    return;
-
-  DisplayFunction(D);
+    return true;
 
   // Don't run the actions on declarations in header files unless
   // otherwise specified.
   SourceManager &SM = Ctx->getSourceManager();
   SourceLocation SL = SM.getExpansionLoc(D->getLocation());
   if (!Opts.AnalyzeAll && !SM.isFromMainFile(SL))
+    return true;
+
+  return false;
+}
+
+void AnalysisConsumer::HandleCode(Decl *D, SetOfDecls *VisitedCallees) {
+
+  if (skipFunction(D))
     return;
 
+  DisplayFunction(D);
+
   // Clear the AnalysisManager of old AnalysisDeclContexts.
   Mgr->ClearContexts();
 





More information about the cfe-commits mailing list