diff options
author | Anna Zaks <ganna@apple.com> | 2012-03-13 19:31:54 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-03-13 19:31:54 +0000 |
commit | 98520835eb1aa091429afa06e9f4f7ebe3864d34 (patch) | |
tree | 951e02c9951a1c1bc43bd22ad21c6682f992d4a8 /lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | |
parent | b6ee44dd2923fb7dac699c4bbfeded34a8604d3a (diff) |
[analyzer] Minor: factor out logic for determining if we should skip a
function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152649 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 54be4f7bcf..d4d5911740 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -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(); |