[PATCH] D30593: Add correct "-isystem" warning handling to static analysis' BugReporter.

2017-03-03 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall created this revision.

The Clang static analyzer doesn't follow the warning suppression semantics of 
the "-isystem" command line flag. This patch adds a check to BugReporter which 
causes it to drop any BugReports which originated from a system header 
(descendant of an -isystem path).


Repository:
  rL LLVM

https://reviews.llvm.org/D30593

Files:
  lib/StaticAnalyzer/Core/BugReporter.cpp


Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -3251,6 +3251,12 @@
   return;
   }

+  // Suppress BugReports which originate from system headers (located beneath
+  // an -isystem include path).
+  if (getSourceManager().isInSystemHeader(
+  R->getLocation(getSourceManager()).asLocation()))
+return;
+
   bool ValidSourceLoc = R->getLocation(getSourceManager()).isValid();
   assert(ValidSourceLoc);
   // If we mess up in a release build, we'd still prefer to just drop the bug


Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -3251,6 +3251,12 @@
   return;
   }

+  // Suppress BugReports which originate from system headers (located beneath
+  // an -isystem include path).
+  if (getSourceManager().isInSystemHeader(
+  R->getLocation(getSourceManager()).asLocation()))
+return;
+
   bool ValidSourceLoc = R->getLocation(getSourceManager()).isValid();
   assert(ValidSourceLoc);
   // If we mess up in a release build, we'd still prefer to just drop the bug
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30593: Add correct "-isystem" warning handling to static analysis' BugReporter.

2017-03-03 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall added a comment.

Note to reviewers:  this diff is relative to "llvm/cfe" - I couldn't find a way 
to specify a repository subpath to use for this diff.


Repository:
  rL LLVM

https://reviews.llvm.org/D30593



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits