aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp19
-rw-r--r--clang/lib/Frontend/ModuleDependencyCollector.cpp11
2 files changed, 17 insertions, 13 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 7424958..d7d56b8 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -971,14 +971,17 @@ void DumpModuleInfoAction::ExecuteAction() {
// Emit the macro definitions in the module file so that we can know how
// much definitions in the module file quickly.
// TODO: Emit the macro definition bodies completely.
- if (auto FilteredMacros = llvm::make_filter_range(
- R->getPreprocessor().macros(),
- [](const auto &Macro) { return Macro.first->isFromAST(); });
- !FilteredMacros.empty()) {
- Out << " Macro Definitions:\n";
- for (/*<IdentifierInfo *, MacroState> pair*/ const auto &Macro :
- FilteredMacros)
- Out << " " << Macro.first->getName() << "\n";
+ {
+ std::vector<StringRef> MacroNames;
+ for (const auto &M : R->getPreprocessor().macros()) {
+ if (M.first->isFromAST())
+ MacroNames.push_back(M.first->getName());
+ }
+ llvm::sort(MacroNames);
+ if (!MacroNames.empty())
+ Out << " Macro Definitions:\n";
+ for (StringRef Name : MacroNames)
+ Out << " " << Name << "\n";
}
// Now let's print out any modules we did not see as part of the Primary.
diff --git a/clang/lib/Frontend/ModuleDependencyCollector.cpp b/clang/lib/Frontend/ModuleDependencyCollector.cpp
index 3b363f9..ff37065 100644
--- a/clang/lib/Frontend/ModuleDependencyCollector.cpp
+++ b/clang/lib/Frontend/ModuleDependencyCollector.cpp
@@ -91,10 +91,10 @@ void ModuleDependencyCollector::attachToPreprocessor(Preprocessor &PP) {
std::make_unique<ModuleDependencyMMCallbacks>(*this));
}
-static bool isCaseSensitivePath(StringRef Path) {
+static bool isCaseSensitivePath(llvm::vfs::FileSystem &VFS, StringRef Path) {
SmallString<256> TmpDest = Path, UpperDest, RealDest;
// Remove component traversals, links, etc.
- if (llvm::sys::fs::real_path(Path, TmpDest))
+ if (VFS.getRealPath(Path, TmpDest))
return true; // Current default value in vfs.yaml
Path = TmpDest;
@@ -104,7 +104,7 @@ static bool isCaseSensitivePath(StringRef Path) {
// already expects when sensitivity isn't setup.
for (auto &C : Path)
UpperDest.push_back(toUppercase(C));
- if (!llvm::sys::fs::real_path(UpperDest, RealDest) && Path == RealDest)
+ if (!VFS.getRealPath(UpperDest, RealDest) && Path == RealDest)
return false;
return true;
}
@@ -121,7 +121,8 @@ void ModuleDependencyCollector::writeFileMap() {
// Explicitly set case sensitivity for the YAML writer. For that, find out
// the sensitivity at the path where the headers all collected to.
- VFSWriter.setCaseSensitivity(isCaseSensitivePath(VFSDir));
+ VFSWriter.setCaseSensitivity(
+ isCaseSensitivePath(Canonicalizer.getFileSystem(), VFSDir));
// Do not rely on real path names when executing the crash reproducer scripts
// since we only want to actually use the files we have on the VFS cache.
@@ -153,7 +154,7 @@ std::error_code ModuleDependencyCollector::copyToRoot(StringRef Src,
} else {
// When collecting entries from input vfsoverlays, copy the external
// contents into the cache but still map from the source.
- if (!fs::exists(Dst))
+ if (!Canonicalizer.getFileSystem().exists(Dst))
return std::error_code();
path::append(CacheDst, Dst);
Paths.CopyFrom = Dst;