diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-13 20:27:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-13 20:27:03 +0000 |
commit | f122a138e39dbb29162abfa9a3d44091d8efa7af (patch) | |
tree | 08459273e5a9442d2471a8f499d76c58341011bd /lib/Lex/HeaderSearch.cpp | |
parent | 8ab09da1faaa33b9fa78de59cc4e191bfe9907b5 (diff) |
Add -isystem-prefix and -ino-system-prefix arguments, which can be used to
override whether headers are system headers by checking for prefixes of the
header name specified in the #include directive.
This allows warnings to be disabled for third-party code which is found in
specific subdirectories of include paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index d688e23fa4..4531335b75 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -510,6 +510,16 @@ const FileEntry *HeaderSearch::LookupFile( if (HFI.DirInfo == SrcMgr::C_User && InUserSpecifiedSystemFramework) HFI.DirInfo = SrcMgr::C_System; + // If the filename matches a known system header prefix, override + // whether the file is a system header. + for (unsigned i = SystemHeaderPrefixes.size(); i; --i) { + if (Filename.startswith(SystemHeaderPrefixes[i-1].first)) { + HFI.DirInfo = SystemHeaderPrefixes[i-1].second ? SrcMgr::C_System + : SrcMgr::C_User; + break; + } + } + // If this file is found in a header map and uses the framework style of // includes, then this header is part of a framework we're building. if (CurDir->isIndexHeaderMap()) { |