Skip to content

Commit 1c1c3cb

Browse files
committed
Remove notes
1 parent 834eac8 commit 1c1c3cb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Support/LockFileManager.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Expected<bool> LockFileManager::tryLock() {
169169
SmallString<128> AbsoluteFileName(FileName);
170170
if (std::error_code EC = sys::fs::make_absolute(AbsoluteFileName))
171171
return createStringError(EC, "failed to obtain absolute path for " +
172-
AbsoluteFileName); // We don't even know the LockFileName yet.
172+
AbsoluteFileName);
173173
LockFileName = AbsoluteFileName;
174174
LockFileName += ".lock";
175175

@@ -180,22 +180,20 @@ Expected<bool> LockFileManager::tryLock() {
180180
return false;
181181
}
182182

183-
// LockFileName either does not exist or we could not read it and removed it in readLockFile().
184-
185183
// Create a lock file that is unique to this instance.
186184
UniqueLockFileName = LockFileName;
187185
UniqueLockFileName += "-%%%%%%%%";
188186
int UniqueLockFileID;
189187
if (std::error_code EC = sys::fs::createUniqueFile(
190188
UniqueLockFileName, UniqueLockFileID, UniqueLockFileName))
191189
return createStringError(EC, "failed to create unique file " +
192-
UniqueLockFileName); // LockFileName still does not exist.
190+
UniqueLockFileName);
193191

194192
// Write our process ID to our unique lock file.
195193
{
196194
SmallString<256> HostID;
197195
if (auto EC = getHostID(HostID))
198-
return createStringError(EC, "failed to get host id"); // LockFileName still does not exist. We may leave behind UniqueLockFileName though, this that in a follow-up.
196+
return createStringError(EC, "failed to get host id");
199197

200198
raw_fd_ostream Out(UniqueLockFileID, /*shouldClose=*/true);
201199
Out << HostID << ' ' << sys::Process::getProcessId();
@@ -209,7 +207,7 @@ Expected<bool> LockFileManager::tryLock() {
209207
sys::fs::remove(UniqueLockFileName);
210208
// Don't call report_fatal_error.
211209
Out.clear_error();
212-
return std::move(Err); // LockFileName still does not exist.
210+
return std::move(Err);
213211
}
214212
}
215213

@@ -229,7 +227,7 @@ Expected<bool> LockFileManager::tryLock() {
229227

230228
if (EC != errc::file_exists)
231229
return createStringError(EC, "failed to create link " + LockFileName +
232-
" to " + UniqueLockFileName); // We failed to create LockFileName for a weird reason.
230+
" to " + UniqueLockFileName);
233231

234232
// Someone else managed to create the lock file first. Read the process ID
235233
// from the lock file.
@@ -250,7 +248,7 @@ Expected<bool> LockFileManager::tryLock() {
250248
// ownership.
251249
if ((EC = sys::fs::remove(LockFileName)))
252250
return createStringError(EC, "failed to remove lockfile " +
253-
UniqueLockFileName); // Failed to remove LockFileName. Why try to do it again?
251+
UniqueLockFileName);
254252
}
255253
}
256254

0 commit comments

Comments
 (0)