diff options
author | Anna Zaks <ganna@apple.com> | 2013-01-30 19:12:34 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-01-30 19:12:34 +0000 |
commit | 86ff12c8a8a356ca284ca7687749216fbfd74519 (patch) | |
tree | e7750fafa3d45c915e5d0c0e87dd010c1d424e14 /lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | |
parent | ce32890df08387b50a960f785da79ac5582b7f74 (diff) |
[analyzer] Move report false positive suppression to report visitors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporterVisitors.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 7cd1319af2..3aa351527f 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -1157,6 +1157,33 @@ ConditionBRVisitor::VisitTrueTest(const Expr *Cond, } PathDiagnosticPiece * +LikelyFalsePositiveSuppressionBRVisitor::getEndPath(BugReporterContext &BRC, + const ExplodedNode *N, + BugReport &BR) { + const Stmt *S = BR.getStmt(); + if (!S) + return 0; + + // Here we suppress false positives coming from system macros. This list is + // based on known issues. + + // Skip reports within the sys/queue.h macros as we do not have the ability to + // reason about data structure shapes. + SourceManager &SM = BRC.getSourceManager(); + SourceLocation Loc = S->getLocStart(); + while (Loc.isMacroID()) { + if (SM.isInSystemMacro(Loc) && + (SM.getFilename(SM.getSpellingLoc(Loc)).endswith("sys/queue.h"))) { + BR.markInvalid(getTag(), 0); + return 0; + } + Loc = SM.getSpellingLoc(Loc); + } + + return 0; +} + +PathDiagnosticPiece * UndefOrNullArgVisitor::VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, |