diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-14 02:06:01 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-14 02:06:01 +0000 |
commit | ae6df27ef40e128faa1ce33ab25076a53be584a4 (patch) | |
tree | 8577b4c63dbaca0f431038a2ab0645ea5f72886a /clang/lib/Lex/ModuleMap.cpp | |
parent | 3bdfc1cd0ccd2e9421e67ebcded5d467eee2bfbf (diff) | |
download | llvm-ae6df27ef40e128faa1ce33ab25076a53be584a4.zip llvm-ae6df27ef40e128faa1ce33ab25076a53be584a4.tar.gz llvm-ae6df27ef40e128faa1ce33ab25076a53be584a4.tar.bz2 |
[modules] When diagnosing errors in module map files found by 'extern module' declarations, show how we got to that module map file.
llvm-svn: 242105
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 6faae81..96d3e4b 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -1528,7 +1528,7 @@ void ModuleMapParser::parseModuleDecl() { /// 'extern' 'module' module-id string-literal void ModuleMapParser::parseExternModuleDecl() { assert(Tok.is(MMToken::ExternKeyword)); - consumeToken(); // 'extern' keyword + SourceLocation ExternLoc = consumeToken(); // 'extern' keyword // Parse 'module' keyword. if (!Tok.is(MMToken::ModuleKeyword)) { @@ -1567,7 +1567,7 @@ void ModuleMapParser::parseExternModuleDecl() { File, /*IsSystem=*/false, Map.HeaderInfo.getHeaderSearchOpts().ModuleMapFileHomeIsCwd ? Directory - : File->getDir()); + : File->getDir(), ExternLoc); } /// \brief Parse a requires declaration. @@ -2319,7 +2319,8 @@ bool ModuleMapParser::parseModuleMapFile() { } bool ModuleMap::parseModuleMapFile(const FileEntry *File, bool IsSystem, - const DirectoryEntry *Dir) { + const DirectoryEntry *Dir, + SourceLocation ExternModuleLoc) { llvm::DenseMap<const FileEntry *, bool>::iterator Known = ParsedModuleMap.find(File); if (Known != ParsedModuleMap.end()) @@ -2327,7 +2328,7 @@ bool ModuleMap::parseModuleMapFile(const FileEntry *File, bool IsSystem, assert(Target && "Missing target information"); auto FileCharacter = IsSystem ? SrcMgr::C_System : SrcMgr::C_User; - FileID ID = SourceMgr.createFileID(File, SourceLocation(), FileCharacter); + FileID ID = SourceMgr.createFileID(File, ExternModuleLoc, FileCharacter); const llvm::MemoryBuffer *Buffer = SourceMgr.getBuffer(ID); if (!Buffer) return ParsedModuleMap[File] = true; |