takuto.ikuta created this revision.
https://reviews.llvm.org/D32903
Files:
clang/lib/Lex/HeaderSearch.cpp
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -234,9 +234,9 @@
break;
}
}
-
+
// FIXME: Figure out how header maps and module maps will work together.
-
+
// Only deal with normal search directories.
if (!SearchDirs[Idx].isNormalDir())
continue;
@@ -251,7 +251,7 @@
if (Module)
break;
}
-
+
// Search for a module map in a subdirectory with the same name as the
// module.
SmallString<128> NestedModuleMapDirName;
@@ -399,11 +399,8 @@
///
/// \param FileMgr The file manager to use for directory lookups.
/// \param DirName The name of the framework directory.
-/// \param SubmodulePath Will be populated with the submodule path from the
-/// returned top-level module to the originally named framework.
static const DirectoryEntry *
-getTopFrameworkDir(FileManager &FileMgr, StringRef DirName,
- SmallVectorImpl<std::string> &SubmodulePath) {
+getTopFrameworkDir(FileManager &FileMgr, StringRef DirName) {
assert(llvm::sys::path::extension(DirName) == ".framework" &&
"Not a framework directory");
@@ -437,7 +434,6 @@
// If this is a framework directory, then we're a subframework of this
// framework.
if (llvm::sys::path::extension(DirName) == ".framework") {
- SubmodulePath.push_back(llvm::sys::path::stem(DirName));
TopFrameworkDir = Dir;
}
} while (true);
@@ -518,7 +514,7 @@
RelativePath->clear();
RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
}
-
+
// Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h"
unsigned OrigSize = FrameworkName.size();
@@ -630,7 +626,7 @@
if (SuggestedModule)
*SuggestedModule = ModuleMap::KnownHeader();
-
+
// If 'Filename' is absolute, check to see if it exists and no searching.
if (llvm::sys::path::is_absolute(Filename)) {
CurDir = nullptr;
@@ -815,7 +811,7 @@
size_t SlashPos = Filename.find('/');
if (SlashPos != StringRef::npos) {
HFI.IndexHeaderMapHeader = 1;
- HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(),
+ HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(),
SlashPos));
}
}
@@ -991,7 +987,7 @@
/// \brief Merge the header file info provided by \p OtherHFI into the current
/// header file info (\p HFI)
-static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
+static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
const HeaderFileInfo &OtherHFI) {
assert(OtherHFI.External && "expected to merge external HFI");
@@ -1013,7 +1009,7 @@
if (HFI.Framework.empty())
HFI.Framework = OtherHFI.Framework;
}
-
+
/// getFileInfo - Return the HeaderFileInfo structure for the specified
/// FileEntry.
HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) {
@@ -1195,14 +1191,14 @@
return FrameworkNames.insert(Framework).first->first();
}
-bool HeaderSearch::hasModuleMap(StringRef FileName,
+bool HeaderSearch::hasModuleMap(StringRef FileName,
const DirectoryEntry *Root,
bool IsSystem) {
if (!HSOpts->ImplicitModuleMaps)
return false;
SmallVector<const DirectoryEntry *, 2> FixUpDirectories;
-
+
StringRef DirName = FileName;
do {
// Get the parent directory name.
@@ -1235,7 +1231,7 @@
// If we hit the top of our search, we're done.
if (Dir == Root)
return false;
-
+
// Keep track of all of the directories we checked, so we can mark them as
// having module maps if we eventually do find a module map.
FixUpDirectories.push_back(Dir);
@@ -1292,10 +1288,9 @@
// If we're supposed to suggest a module, look for one now.
if (needModuleLookup(RequestingModule, SuggestedModule)) {
// Find the top-level framework based on this framework.
- SmallVector<std::string, 4> SubmodulePath;
- const DirectoryEntry *TopFrameworkDir
- = ::getTopFrameworkDir(FileMgr, FrameworkName, SubmodulePath);
-
+ const DirectoryEntry *TopFrameworkDir =
+ ::getTopFrameworkDir(FileMgr, FrameworkName);
+
// Determine the name of the top-level framework.
StringRef ModuleName = llvm::sys::path::stem(TopFrameworkDir->getName());
@@ -1428,16 +1423,16 @@
}
-HeaderSearch::LoadModuleMapResult
+HeaderSearch::LoadModuleMapResult
HeaderSearch::loadModuleMapFile(StringRef DirName, bool IsSystem,
bool IsFramework) {
if (const DirectoryEntry *Dir = FileMgr.getDirectory(DirName))
return loadModuleMapFile(Dir, IsSystem, IsFramework);
-
+
return LMM_NoDirectory;
}
-HeaderSearch::LoadModuleMapResult
+HeaderSearch::LoadModuleMapResult
HeaderSearch::loadModuleMapFile(const DirectoryEntry *Dir, bool IsSystem,
bool IsFramework) {
auto KnownDir = DirectoryHasModuleMap.find(Dir);
@@ -1506,7 +1501,7 @@
}
// Populate the list of modules.
- for (ModuleMap::module_iterator M = ModMap.module_begin(),
+ for (ModuleMap::module_iterator M = ModMap.module_begin(),
MEnd = ModMap.module_end();
M != MEnd; ++M) {
Modules.push_back(M->getValue());
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits