]> granicus.if.org Git - clang/commitdiff
[analyzer] Minor: factor out logic for determining if we should skip a
authorAnna Zaks <ganna@apple.com>
Tue, 13 Mar 2012 19:31:54 +0000 (19:31 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 13 Mar 2012 19:31:54 +0000 (19:31 +0000)
function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152649 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

index 54be4f7bcffefb426fbd6c2a83e82ec461fa0a62..d4d59117405230af3a46b015b8598df467bb983d 100644 (file)
@@ -191,6 +191,7 @@ public:
   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 @@ static std::string getFunctionName(const Decl *D) {
   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();