[PATCH] Don't emit diagnostics for system headers.

Alexander Kornienko alexfh at google.com
Wed Jan 8 07:15:53 PST 2014


Hi djasper,

http://llvm-reviews.chandlerc.com/D2519

Files:
  clang-tidy/ClangTidyDiagnosticConsumer.h

Index: clang-tidy/ClangTidyDiagnosticConsumer.h
===================================================================
--- clang-tidy/ClangTidyDiagnosticConsumer.h
+++ clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -116,6 +116,11 @@
   // library.
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info) LLVM_OVERRIDE {
+    // FIXME: Ensure that we don't get notes from user code related to errors
+    // from non-user code.
+    if (Diags->getSourceManager().getFileCharacteristic(Info.getLocation()) !=
+        SrcMgr::C_User)
+      return;
     if (DiagLevel != DiagnosticsEngine::Note) {
       Errors.push_back(ClangTidyError(getMessage(Info)));
     } else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2519.1.patch
Type: text/x-patch
Size: 733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140108/1792a7d6/attachment.bin>


More information about the cfe-commits mailing list