From: Anna Zaks Date: Fri, 10 May 2013 18:04:43 +0000 (+0000) Subject: [analyzer] Do not check if sys/queue.h file is a system header. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=265448963a856bebdd0ae5abf67210054f44c64b;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index a397f33c99..00c92d8153 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -1539,12 +1539,11 @@ LikelyFalsePositiveSuppressionBRVisitor::getEndPath(BugReporterContext &BRC, 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; diff --git a/test/Analysis/diagnostics/Inputs/include/sys/queue.h b/test/Analysis/diagnostics/Inputs/include/sys/queue.h index e5698ed443..2740e174f2 100644 --- a/test/Analysis/diagnostics/Inputs/include/sys/queue.h +++ b/test/Analysis/diagnostics/Inputs/include/sys/queue.h @@ -1,4 +1,3 @@ -#pragma clang system_header void free(void *); #define FREE_POINTER(x) free(x)