[clang] [llvm] [Support][Modules] Removed prepareForGetLock and its usages. Ensured parent directory exists when creating lock file. (PR #189888)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 08:43:27 PDT 2026


================
@@ -182,13 +183,32 @@ Expected<bool> LockFileManager::tryLock() {
   }
 
   // Create a lock file that is unique to this instance.
-  UniqueLockFileName = LockFileName;
-  UniqueLockFileName += "-%%%%%%%%";
   int UniqueLockFileID;
-  if (std::error_code EC = sys::fs::createUniqueFile(
-          UniqueLockFileName, UniqueLockFileID, UniqueLockFileName))
-    return createStringError(EC, "failed to create unique file " +
-                                     UniqueLockFileName);
+  {
+    SmallString<128> UniqueLockFilePattern = LockFileName;
+    UniqueLockFilePattern += "-%%%%%%%%";
+    SmallString<128> UniquePath = UniqueLockFilePattern;
----------------
jansvoboda11 wrote:

This should be left uninitialized, since `createUniqueFile()` is supposed to fill it in.

https://github.com/llvm/llvm-project/pull/189888


More information about the cfe-commits mailing list