diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-17 22:44:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-17 22:44:56 +0000 |
commit | c69c42e939e6bdaa56d162cc36da4f6b6c53e8db (patch) | |
tree | c34353c898a16ca6f878224209e502ad45729ab5 /lib/Lex/HeaderSearch.cpp | |
parent | a865405e4155e8ea83d7ff1a1d8316907c300897 (diff) |
When making a suggestion regarding which module to load rather than
preprocess/parse a header, report back with an actual module (which
may be a submodule) rather than just the name of the module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index cc9c8c16f7..4deba60b9d 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -219,7 +219,7 @@ const FileEntry *DirectoryLookup::LookupFile( SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, StringRef BuildingModule, - StringRef *SuggestedModule) const { + ModuleMap::Module **SuggestedModule) const { llvm::SmallString<1024> TmpDir; if (isNormalDir()) { // Concatenate the requested file onto the directory. @@ -245,8 +245,8 @@ const FileEntry *DirectoryLookup::LookupFile( // If there is a module that corresponds to this header, // suggest it. - StringRef Module = HS.findModuleForHeader(File); - if (!Module.empty() && Module != BuildingModule) + ModuleMap::Module *Module = HS.findModuleForHeader(File); + if (Module && Module->getTopLevelModuleName() != BuildingModule) *SuggestedModule = Module; return File; @@ -285,7 +285,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, StringRef BuildingModule, - StringRef *SuggestedModule) const + ModuleMap::Module **SuggestedModule) const { FileManager &FileMgr = HS.getFileMgr(); @@ -370,7 +370,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( if (const FileEntry *FE = FileMgr.getFile(FrameworkName.str(), /*openFile=*/!AutomaticImport)) { if (AutomaticImport) - *SuggestedModule = Module->Name; + *SuggestedModule = Module; return FE; } @@ -385,7 +385,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( const FileEntry *FE = FileMgr.getFile(FrameworkName.str(), /*openFile=*/!AutomaticImport); if (FE && AutomaticImport) - *SuggestedModule = Module->Name; + *SuggestedModule = Module; return FE; } @@ -408,10 +408,10 @@ const FileEntry *HeaderSearch::LookupFile( const FileEntry *CurFileEnt, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, - StringRef *SuggestedModule) + ModuleMap::Module **SuggestedModule) { if (SuggestedModule) - *SuggestedModule = StringRef(); + *SuggestedModule = 0; // If 'Filename' is absolute, check to see if it exists and no searching. if (llvm::sys::path::is_absolute(Filename)) { @@ -806,11 +806,11 @@ bool HeaderSearch::hasModuleMap(StringRef FileName, return false; } -StringRef HeaderSearch::findModuleForHeader(const FileEntry *File) { +ModuleMap::Module *HeaderSearch::findModuleForHeader(const FileEntry *File) { if (ModuleMap::Module *Module = ModMap.findModuleForHeader(File)) - return Module->getTopLevelModuleName(); + return Module; - return StringRef(); + return 0; } bool HeaderSearch::loadModuleMapFile(const FileEntry *File) { |