diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-31 04:05:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-31 04:05:44 +0000 |
commit | 51f564f80d9f71e175635b452ffeeeff899e9bf1 (patch) | |
tree | ada57bc51cc68158361f5d1a49d8de00b6a1e564 /lib/Lex/PPLexerChange.cpp | |
parent | 868f65c6bf904591f62a0d69866825d2d3dfd16f (diff) | |
download | clang-51f564f80d9f71e175635b452ffeeeff899e9bf1.tar.gz clang-51f564f80d9f71e175635b452ffeeeff899e9bf1.tar.bz2 clang-51f564f80d9f71e175635b452ffeeeff899e9bf1.tar.xz |
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index e3cc2003ce..11c78703a4 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/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; + } } } } |