summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorTaewook Oh <twoh@fb.com>2016-06-13 20:40:21 +0000
committerTaewook Oh <twoh@fb.com>2016-06-13 20:40:21 +0000
commitf42103ce8b38a1a534ae08a5f44ec28a8df034fe (patch)
treeb3648d39a13b48498873a65e81ab754b3b81d90c /clang/lib/Lex/HeaderSearch.cpp
parent92375f55ed9341cd6ecf8f34f6c1975a1b892a72 (diff)
downloadbcm5719-llvm-f42103ce8b38a1a534ae08a5f44ec28a8df034fe.tar.gz
bcm5719-llvm-f42103ce8b38a1a534ae08a5f44ec28a8df034fe.zip
Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
Differential Revision: http://reviews.llvm.org/D19843 Corresponding LLVM change: http://reviews.llvm.org/D19842 Re-commit of r272562 after addressing clang-x86-win2008-selfhost failure. llvm-svn: 272584
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index f7fc0b0f65f..e5cc30e41c5 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -250,8 +250,9 @@ const char *DirectoryLookup::getName() const {
}
const FileEntry *HeaderSearch::getFileAndSuggestModule(
- StringRef FileName, const DirectoryEntry *Dir, bool IsSystemHeaderDir,
- Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule) {
+ StringRef FileName, SourceLocation IncludeLoc, const DirectoryEntry *Dir,
+ bool IsSystemHeaderDir, Module *RequestingModule,
+ ModuleMap::KnownHeader *SuggestedModule) {
// If we have a module map that might map this header, load it and
// check whether we'll have a suggestion for a module.
const FileEntry *File = getFileMgr().getFile(FileName, /*OpenFile=*/true);
@@ -272,6 +273,7 @@ const FileEntry *HeaderSearch::getFileAndSuggestModule(
const FileEntry *DirectoryLookup::LookupFile(
StringRef &Filename,
HeaderSearch &HS,
+ SourceLocation IncludeLoc,
SmallVectorImpl<char> *SearchPath,
SmallVectorImpl<char> *RelativePath,
Module *RequestingModule,
@@ -297,7 +299,7 @@ const FileEntry *DirectoryLookup::LookupFile(
RelativePath->append(Filename.begin(), Filename.end());
}
- return HS.getFileAndSuggestModule(TmpDir, getDir(),
+ return HS.getFileAndSuggestModule(TmpDir, IncludeLoc, getDir(),
isSystemHeaderDirectory(),
RequestingModule, SuggestedModule);
}
@@ -585,7 +587,7 @@ const FileEntry *HeaderSearch::LookupFile(
RelativePath->append(Filename.begin(), Filename.end());
}
// Otherwise, just return the file.
- return getFileAndSuggestModule(Filename, nullptr,
+ return getFileAndSuggestModule(Filename, IncludeLoc, nullptr,
/*IsSystemHeaderDir*/false,
RequestingModule, SuggestedModule);
}
@@ -622,7 +624,7 @@ const FileEntry *HeaderSearch::LookupFile(
Includer ? getFileInfo(Includer).DirInfo != SrcMgr::C_User :
BuildSystemModule;
if (const FileEntry *FE = getFileAndSuggestModule(
- TmpDir, IncluderAndDir.second, IncluderIsSystemHeader,
+ TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader,
RequestingModule, SuggestedModule)) {
if (!Includer) {
assert(First && "only first includer can have no file");
@@ -713,7 +715,7 @@ const FileEntry *HeaderSearch::LookupFile(
bool InUserSpecifiedSystemFramework = false;
bool HasBeenMapped = false;
const FileEntry *FE = SearchDirs[i].LookupFile(
- Filename, *this, SearchPath, RelativePath, RequestingModule,
+ Filename, *this, IncludeLoc, SearchPath, RelativePath, RequestingModule,
SuggestedModule, InUserSpecifiedSystemFramework, HasBeenMapped,
MappedName);
if (HasBeenMapped) {
OpenPOWER on IntegriCloud