[clang] [clang module] Current Working Directory Pruning (PR #124786)
Qiongsi Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 18:21:54 PST 2025
================
@@ -397,9 +397,91 @@ void ModuleDepCollector::applyDiscoveredDependencies(CompilerInvocation &CI) {
}
}
+static bool isSafeToIgnoreCWD(const CowCompilerInvocation &CI) {
+ // Check if the command line input uses relative paths.
+ // It is not safe to ignore the current working directory if any of the
+ // command line inputs use relative paths.
+#define IF_RELATIVE_RETURN_FALSE(PATH) \
+ do { \
+ if (!PATH.empty() && !llvm::sys::path::is_absolute(PATH)) \
+ return false; \
+ } while (0)
+
+#define IF_ANY_RELATIVE_RETURN_FALSE(PATHS) \
+ do { \
+ if (std::any_of(PATHS.begin(), PATHS.end(), [](const auto &P) { \
----------------
qiongsiwu wrote:
Fixed! Thanks!
https://github.com/llvm/llvm-project/pull/124786
More information about the cfe-commits
mailing list