Author: Cyndy Ishida
Date: 2026-11-09T12:04:36-08:00
New Revision: ecb2a0bcb8c8c958c8749fff2fb4bf959e00497b

URL: 
https://github.com/llvm/llvm-project/commit/ecb2a0bcb8c8c958c8749fff2fb4bf959e00497b
DIFF: 
https://github.com/llvm/llvm-project/commit/ecb2a0bcb8c8c958c8749fff2fb4bf959e00497b.diff

LOG: [clang][DepScan] Use explicit module cache in SubdirectorySearch test 
(#240488)

This unit test previously built a module without passing an explicit
`-fmodules-cache-path`. That could otherwise default to an unwriteable
location on some envs. Create & pass an writable temp directory instead.

Added: 
    

Modified: 
    clang/unittests/Tooling/DependencyScannerTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Tooling/DependencyScannerTest.cpp 
b/clang/unittests/Tooling/DependencyScannerTest.cpp
index 8e2f0455288fd8..528982054f47e9 100644
--- a/clang/unittests/Tooling/DependencyScannerTest.cpp
+++ b/clang/unittests/Tooling/DependencyScannerTest.cpp
@@ -541,6 +541,10 @@ TEST_F(GetModuleMapsForModulesTest, SubdirectorySearch) {
   addFile("/root/a/Sub/module.modulemap", "module A { header \"a.h\" }\n");
   addFile("/root/a/Sub/a.h", "\n");
 
+  SmallString<128> CacheDir;
+  ASSERT_FALSE(
+      llvm::sys::fs::createUniqueDirectory("subdirectory-search", CacheDir));
+
   std::pair<StringRef, StringRef> Cases[] = {
       {"-fmodulemap-allow-subdirectory-search", 
"/root/a/Sub/module.modulemap"},
       {"-fno-modulemap-allow-subdirectory-search", ""}};
@@ -550,6 +554,7 @@ TEST_F(GetModuleMapsForModulesTest, SubdirectorySearch) {
         "clang",     "-target", "x86_64-apple-macosx10.7",
         "-c",        "test.m",  "-fmodules",
         "-I/root/a", Flag.str()};
+    CommandLine.push_back(("-fmodules-cache-path=" + CacheDir).str());
 
     TextDiagnosticBuffer ScanDiags;
     EXPECT_EQ(llvm::sys::path::convert_to_slash(


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to