summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPLexerChange.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-31 04:05:44 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-31 04:05:44 +0000
commit1fb5c3a63a88e4758b196f1bda64eecce9b29d3f (patch)
tree0da4770b525e3b6a77a4b54bd828262d2bda7dfa /clang/lib/Lex/PPLexerChange.cpp
parent84a5dfdf727df09432aaa40ac72aa94e500326e4 (diff)
downloadbcm5719-llvm-1fb5c3a63a88e4758b196f1bda64eecce9b29d3f.tar.gz
bcm5719-llvm-1fb5c3a63a88e4758b196f1bda64eecce9b29d3f.zip
Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows mixed-language modules, where certain headers only work under some language variants (e.g., in C++, std.tuple might only be available in C++11 mode). llvm-svn: 147387
Diffstat (limited to 'clang/lib/Lex/PPLexerChange.cpp')
-rw-r--r--clang/lib/Lex/PPLexerChange.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp
index e3cc2003ce1..11c78703a44 100644
--- a/clang/lib/Lex/PPLexerChange.cpp
+++ b/clang/lib/Lex/PPLexerChange.cpp
@@ -355,6 +355,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
if (getDiagnostics().getDiagnosticLevel(
diag::warn_uncovered_module_header,
StartLoc) != DiagnosticsEngine::Ignored) {
+ ModuleMap &ModMap = getHeaderSearchInfo().getModuleMap();
typedef llvm::sys::fs::recursive_directory_iterator
recursive_directory_iterator;
const DirectoryEntry *Dir = Mod->getUmbrellaDir();
@@ -363,20 +364,22 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
Entry != End && !EC; Entry.increment(EC)) {
using llvm::StringSwitch;
- // Check whether this entry has an extension typically associated with
+ // Check whether this entry has an extension typically associated with
// headers.
if (!StringSwitch<bool>(llvm::sys::path::extension(Entry->path()))
- .Cases(".h", ".H", ".hh", ".hpp", true)
- .Default(false))
+ .Cases(".h", ".H", ".hh", ".hpp", true)
+ .Default(false))
continue;
if (const FileEntry *Header = getFileManager().getFile(Entry->path()))
if (!getSourceManager().hasFileInfo(Header)) {
- // Find the
- llvm::SmallString<128> RelativePath;
- computeRelativePath(FileMgr, Dir, Header, RelativePath);
- Diag(StartLoc, diag::warn_uncovered_module_header)
- << RelativePath;
+ if (!ModMap.isHeaderInUnavailableModule(Header)) {
+ // Find the relative path that would access this header.
+ llvm::SmallString<128> RelativePath;
+ computeRelativePath(FileMgr, Dir, Header, RelativePath);
+ Diag(StartLoc, diag::warn_uncovered_module_header)
+ << RelativePath;
+ }
}
}
}
OpenPOWER on IntegriCloud