r181615 - [analyzer] Do not check if sys/queue.h file is a system header.

Anna Zaks ganna at apple.com
Fri May 10 11:04:43 PDT 2013


Author: zaks
Date: Fri May 10 13:04:43 2013
New Revision: 181615

URL: http://llvm.org/viewvc/llvm-project?rev=181615&view=rev
Log:
[analyzer] Do not check if sys/queue.h file is a system header.

In most cases it is, by just looking at the name. Also, this check prevents the heuristic from working in strange user settings.
radar://13839692

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
    cfe/trunk/test/Analysis/diagnostics/Inputs/include/sys/queue.h

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=181615&r1=181614&r2=181615&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Fri May 10 13:04:43 2013
@@ -1539,12 +1539,11 @@ LikelyFalsePositiveSuppressionBRVisitor:
   SourceManager &SM = BRC.getSourceManager();
   FullSourceLoc Loc = BR.getLocation(SM).asLocation();
   while (Loc.isMacroID()) {
-    if (SM.isInSystemMacro(Loc) &&
-       (SM.getFilename(SM.getSpellingLoc(Loc)).endswith("sys/queue.h"))) {
+    Loc = Loc.getSpellingLoc();
+    if (SM.getFilename(Loc).endswith("sys/queue.h")) {
       BR.markInvalid(getTag(), 0);
       return 0;
     }
-    Loc = Loc.getSpellingLoc();
   }
 
   return 0;

Modified: cfe/trunk/test/Analysis/diagnostics/Inputs/include/sys/queue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/include/sys/queue.h?rev=181615&r1=181614&r2=181615&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/Inputs/include/sys/queue.h (original)
+++ cfe/trunk/test/Analysis/diagnostics/Inputs/include/sys/queue.h Fri May 10 13:04:43 2013
@@ -1,4 +1,3 @@
-#pragma clang system_header
 
 void free(void *);
 #define FREE_POINTER(x) free(x)





More information about the cfe-commits mailing list