浏览代码

[Support] [NFC] change comment about retries in createUniqueEntity

Rewording as requested on D50126 after the change was pushed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338755 91177308-0d34-0410-b5e6-96231b3b80d8
Bob Haarman 7 年之前
父节点
当前提交
710aab8e4f
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lib/Support/Path.cpp

+ 4 - 2
lib/Support/Path.cpp

@@ -190,8 +190,10 @@ createUniqueEntity(const Twine &Model, int &ResultFD,
   ResultPath.push_back(0);
   ResultPath.pop_back();
 
-  // Limit the number of attempts we make, so that we don't infinite loop when
-  // we run out of filenames that fit the model.
+  // Limit the number of attempts we make, so that we don't infinite loop. E.g.
+  // "permission denied" could be for a specific file (so we retry with a
+  // different name) or for the whole directory (retry would always fail).
+  // Checking which is racy, so we try a number of times, then give up.
   std::error_code EC;
   for (int Retries = 128; Retries > 0; --Retries) {
     // Replace '%' with random chars.