[cfe-commits] r95870 - /cfe/trunk/lib/Basic/Diagnostic.cpp

John McCall rjmccall at apple.com
Thu Feb 11 02:04:37 PST 2010


Author: rjmccall
Date: Thu Feb 11 04:04:29 2010
New Revision: 95870

URL: http://llvm.org/viewvc/llvm-project?rev=95870&view=rev
Log:
Suppress warnings if their instantiation location is in a system header, not
their spelling location.  This prevents warnings from being swallowed just
because the caret is on the first parenthesis in, say, NULL.

This is an experiment;  the risk is that there might be a substantial number
of system headers which #define symbols to expressions which inherently cause
warnings.  My theory is that that's rare enough that it can be worked
around case-by-case, and that producing useful warnings around NULL is worth 
it.  But I'm willing to accept that I might be empirically wrong.


Modified:
    cfe/trunk/lib/Basic/Diagnostic.cpp

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=95870&r1=95869&r2=95870&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Feb 11 04:04:29 2010
@@ -629,7 +629,7 @@
   // it.
   if (SuppressSystemWarnings && !ShouldEmitInSystemHeader &&
       Info.getLocation().isValid() &&
-      Info.getLocation().getSpellingLoc().isInSystemHeader() &&
+      Info.getLocation().getInstantiationLoc().isInSystemHeader() &&
       (DiagLevel != Diagnostic::Note || LastDiagLevel == Diagnostic::Ignored)) {
     LastDiagLevel = Diagnostic::Ignored;
     return false;





More information about the cfe-commits mailing list