Skip to content

[NFC][Clang] Use range for loops in ClangDiagnosticsEmitter #115573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

jurahul
Copy link
Contributor

@jurahul jurahul commented Nov 9, 2024

Use range based for loops in Clang diagnostics emitter.

@jurahul jurahul marked this pull request as ready for review November 11, 2024 21:21
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Nov 11, 2024
@jurahul jurahul requested a review from erichkeane November 11, 2024 21:22
@llvmbot
Copy link
Member

llvmbot commented Nov 11, 2024

@llvm/pr-subscribers-clang

Author: Rahul Joshi (jurahul)

Changes

Use range based for loops in Clang diagnostics emitter.


Full diff: https://github.com/llvm/llvm-project/pull/115573.diff

1 Files Affected:

  • (modified) clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (+71-108)
diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
index 34e2e8f47ae71a..889c8d5ac5fbcd 100644
--- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -44,17 +44,12 @@ class DiagGroupParentMap {
 
 public:
   DiagGroupParentMap(const RecordKeeper &records) : Records(records) {
-    ArrayRef<const Record *> DiagGroups =
-        Records.getAllDerivedDefinitions("DiagGroup");
-    for (unsigned i = 0, e = DiagGroups.size(); i != e; ++i) {
-      std::vector<const Record *> SubGroups =
-          DiagGroups[i]->getValueAsListOfDefs("SubGroups");
-      for (unsigned j = 0, e = SubGroups.size(); j != e; ++j)
-        Mapping[SubGroups[j]].push_back(DiagGroups[i]);
-    }
+    for (const Record *Group : Records.getAllDerivedDefinitions("DiagGroup"))
+      for (const Record *SubGroup : Group->getValueAsListOfDefs("SubGroups"))
+        Mapping[SubGroup].push_back(Group);
   }
 
-  const std::vector<const Record *> &getParents(const Record *Group) {
+  ArrayRef<const Record *> getParents(const Record *Group) {
     return Mapping[Group];
   }
 };
@@ -69,10 +64,8 @@ getCategoryFromDiagGroup(const Record *Group,
 
   // The diag group may the subgroup of one or more other diagnostic groups,
   // check these for a category as well.
-  const std::vector<const Record *> &Parents =
-      DiagGroupParents.getParents(Group);
-  for (unsigned i = 0, e = Parents.size(); i != e; ++i) {
-    CatName = getCategoryFromDiagGroup(Parents[i], DiagGroupParents);
+  for (const Record *Parent : DiagGroupParents.getParents(Group)) {
+    CatName = getCategoryFromDiagGroup(Parent, DiagGroupParents);
     if (!CatName.empty()) return CatName;
   }
   return "";
@@ -107,10 +100,9 @@ namespace {
       CategoryStrings.push_back("");
       CategoryIDs[""] = 0;
 
-      ArrayRef<const Record *> Diags =
-          Records.getAllDerivedDefinitions("Diagnostic");
-      for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-        std::string Category = getDiagnosticCategory(Diags[i], ParentInfo);
+      for (const Record *Diag :
+           Records.getAllDerivedDefinitions("Diagnostic")) {
+        std::string Category = getDiagnosticCategory(Diag, ParentInfo);
         if (Category.empty()) continue;  // Skip diags with no category.
 
         unsigned &ID = CategoryIDs[Category];
@@ -158,9 +150,7 @@ static bool diagGroupBeforeByName(const Record *LHS, const Record *RHS) {
 static void groupDiagnostics(ArrayRef<const Record *> Diags,
                              ArrayRef<const Record *> DiagGroups,
                              std::map<std::string, GroupInfo> &DiagsInGroup) {
-
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record *R = Diags[i];
+  for (const Record *R : Diags) {
     const auto *DI = dyn_cast<DefInit>(R->getValueInit("Group"));
     if (!DI)
       continue;
@@ -173,8 +163,7 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
 
   // Add all DiagGroup's to the DiagsInGroup list to make sure we pick up empty
   // groups (these are warnings that GCC supports that clang never produces).
-  for (unsigned i = 0, e = DiagGroups.size(); i != e; ++i) {
-    const Record *Group = DiagGroups[i];
+  for (const Record *Group : DiagGroups) {
     GroupInfo &GI =
         DiagsInGroup[std::string(Group->getValueAsString("GroupName"))];
     GI.GroupName = Group->getName();
@@ -185,10 +174,8 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
   }
 
   // Assign unique ID numbers to the groups.
-  unsigned IDNo = 0;
-  for (std::map<std::string, GroupInfo>::iterator
-       I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I, ++IDNo)
-    I->second.IDNo = IDNo;
+  for (auto [IdNo, Iter] : enumerate(DiagsInGroup))
+    Iter.second.IDNo = IdNo;
 
   // Warn if the same group is defined more than once (including implicitly).
   for (auto &Group : DiagsInGroup) {
@@ -297,10 +284,8 @@ bool InferPedantic::isSubGroupOfGroup(const Record *Group, StringRef GName) {
   if (GName == GroupName)
     return true;
 
-  const std::vector<const Record *> &Parents =
-      DiagGroupParents.getParents(Group);
-  for (unsigned i = 0, e = Parents.size(); i != e; ++i)
-    if (isSubGroupOfGroup(Parents[i], GName))
+  for (const Record *Parent : DiagGroupParents.getParents(Group))
+    if (isSubGroupOfGroup(Parent, GName))
       return true;
 
   return false;
@@ -308,15 +293,12 @@ bool InferPedantic::isSubGroupOfGroup(const Record *Group, StringRef GName) {
 
 /// Determine if the diagnostic is an extension.
 bool InferPedantic::isExtension(const Record *Diag) {
-  const std::string &ClsName =
-      std::string(Diag->getValueAsDef("Class")->getName());
-  return ClsName == "CLASS_EXTENSION";
+  return Diag->getValueAsDef("Class")->getName() == "CLASS_EXTENSION";
 }
 
 bool InferPedantic::isOffByDefault(const Record *Diag) {
-  const std::string &DefSeverity = std::string(
-      Diag->getValueAsDef("DefaultSeverity")->getValueAsString("Name"));
-  return DefSeverity == "Ignored";
+  return Diag->getValueAsDef("DefaultSeverity")->getValueAsString("Name") ==
+         "Ignored";
 }
 
 bool InferPedantic::groupInPedantic(const Record *Group, bool increment) {
@@ -342,12 +324,9 @@ void InferPedantic::markGroup(const Record *Group) {
   // covered by -Wpedantic, increment the count of parent groups.  Once the
   // group's count is equal to the number of subgroups and diagnostics in
   // that group, we can safely add this group to -Wpedantic.
-  if (groupInPedantic(Group, /* increment */ true)) {
-    const std::vector<const Record *> &Parents =
-        DiagGroupParents.getParents(Group);
-    for (unsigned i = 0, e = Parents.size(); i != e; ++i)
-      markGroup(Parents[i]);
-  }
+  if (groupInPedantic(Group, /* increment */ true))
+    for (const Record *Parent : DiagGroupParents.getParents(Group))
+      markGroup(Parent);
 }
 
 void InferPedantic::compute(VecOrSet DiagsInPedantic,
@@ -355,15 +334,14 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
   // All extensions that are not on by default are implicitly in the
   // "pedantic" group.  For those that aren't explicitly included in -Wpedantic,
   // mark them for consideration to be included in -Wpedantic directly.
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record *R = Diags[i];
-    if (isExtension(R) && isOffByDefault(R)) {
-      DiagsSet.insert(R);
-      if (const auto *Group = dyn_cast<DefInit>(R->getValueInit("Group"))) {
-        const Record *GroupRec = Group->getDef();
-        if (!isSubGroupOfGroup(GroupRec, "pedantic")) {
-          markGroup(GroupRec);
-        }
+  for (const Record *R : Diags) {
+    if (!isExtension(R) || !isOffByDefault(R))
+      continue;
+    DiagsSet.insert(R);
+    if (const auto *Group = dyn_cast<DefInit>(R->getValueInit("Group"))) {
+      const Record *GroupRec = Group->getDef();
+      if (!isSubGroupOfGroup(GroupRec, "pedantic")) {
+        markGroup(GroupRec);
       }
     }
   }
@@ -371,8 +349,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
   // Compute the set of diagnostics that are directly in -Wpedantic.  We
   // march through Diags a second time to ensure the results are emitted
   // in deterministic order.
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record *R = Diags[i];
+  for (const Record *R : Diags) {
     if (!DiagsSet.count(R))
       continue;
     // Check if the group is implicitly in -Wpedantic.  If so,
@@ -386,9 +363,8 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
     // -Wpedantic.  Include it in -Wpedantic directly.
     if (auto *V = DiagsInPedantic.dyn_cast<RecordVec *>())
       V->push_back(R);
-    else {
-      DiagsInPedantic.get<RecordSet*>()->insert(R);
-    }
+    else
+      DiagsInPedantic.get<RecordSet *>()->insert(R);
   }
 
   if (!GroupsInPedantic)
@@ -397,8 +373,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
   // Compute the set of groups that are directly in -Wpedantic.  We
   // march through the groups to ensure the results are emitted
   /// in a deterministc order.
-  for (unsigned i = 0, ei = DiagGroups.size(); i != ei; ++i) {
-    const Record *Group = DiagGroups[i];
+  for (const Record *Group : DiagGroups) {
     if (!groupInPedantic(Group))
       continue;
 
@@ -415,9 +390,8 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
 
     if (auto *V = GroupsInPedantic.dyn_cast<RecordVec *>())
       V->push_back(Group);
-    else {
-      GroupsInPedantic.get<RecordSet*>()->insert(Group);
-    }
+    else
+      GroupsInPedantic.get<RecordSet *>()->insert(Group);
   }
 }
 
@@ -468,11 +442,9 @@ static StringRef getModifierName(ModifierType MT) {
     return "objcclass";
   case MT_ObjCInstance:
     return "objcinstance";
-  case MT_Unknown:
+  default:
     llvm_unreachable("invalid modifier type");
   }
-  // Unhandled case
-  llvm_unreachable("invalid modifier type");
 }
 
 struct Piece {
@@ -970,10 +942,11 @@ struct DiagTextPrinter : DiagTextVisitor<DiagTextPrinter> {
   void VisitPlural(PluralPiece *P) {
     Result += "%plural{";
     assert(P->Options.size() == P->OptionPrefixes.size());
-    for (unsigned I = 0, End = P->Options.size(); I < End; ++I) {
-      if (P->OptionPrefixes[I])
-        Visit(P->OptionPrefixes[I]);
-      Visit(P->Options[I]);
+    for (const auto &[Prefix, Option] :
+         zip_equal(P->OptionPrefixes, P->Options)) {
+      if (Prefix)
+        Visit(Prefix);
+      Visit(Option);
       Result += "|";
     }
     if (!P->Options.empty())
@@ -1553,15 +1526,13 @@ static void emitDiagSubGroups(std::map<std::string, GroupInfo> &DiagsInGroup,
                               RecordVec &GroupsInPedantic, raw_ostream &OS) {
   OS << "static const int16_t DiagSubGroups[] = {\n"
      << "  /* Empty */ -1,\n";
-  for (auto const &I : DiagsInGroup) {
-    const bool IsPedantic = I.first == "pedantic";
-
-    const std::vector<std::string> &SubGroups = I.second.SubGroups;
+  for (auto const &[Name, Group] : DiagsInGroup) {
+    const bool IsPedantic = Name == "pedantic";
+    const std::vector<std::string> &SubGroups = Group.SubGroups;
     if (!SubGroups.empty() || (IsPedantic && !GroupsInPedantic.empty())) {
-      OS << "  /* DiagSubGroup" << I.second.IDNo << " */ ";
+      OS << "  /* DiagSubGroup" << Group.IDNo << " */ ";
       for (auto const &SubGroup : SubGroups) {
-        std::map<std::string, GroupInfo>::const_iterator RI =
-            DiagsInGroup.find(SubGroup);
+        auto RI = DiagsInGroup.find(SubGroup);
         assert(RI != DiagsInGroup.end() && "Referenced without existing?");
         OS << RI->second.IDNo << ", ";
       }
@@ -1570,8 +1541,7 @@ static void emitDiagSubGroups(std::map<std::string, GroupInfo> &DiagsInGroup,
         for (auto const &Group : GroupsInPedantic) {
           const std::string &GroupName =
               std::string(Group->getValueAsString("GroupName"));
-          std::map<std::string, GroupInfo>::const_iterator RI =
-              DiagsInGroup.find(GroupName);
+          auto RI = DiagsInGroup.find(GroupName);
           assert(RI != DiagsInGroup.end() && "Referenced without existing?");
           OS << RI->second.IDNo << ", ";
         }
@@ -1605,12 +1575,12 @@ static void emitDiagArrays(std::map<std::string, GroupInfo> &DiagsInGroup,
                            RecordVec &DiagsInPedantic, raw_ostream &OS) {
   OS << "static const int16_t DiagArrays[] = {\n"
      << "  /* Empty */ -1,\n";
-  for (auto const &I : DiagsInGroup) {
-    const bool IsPedantic = I.first == "pedantic";
+  for (auto const &[Name, Group] : DiagsInGroup) {
+    const bool IsPedantic = Name == "pedantic";
 
-    const std::vector<const Record *> &V = I.second.DiagsInGroup;
+    const std::vector<const Record *> &V = Group.DiagsInGroup;
     if (!V.empty() || (IsPedantic && !DiagsInPedantic.empty())) {
-      OS << "  /* DiagArray" << I.second.IDNo << " */ ";
+      OS << "  /* DiagArray" << Group.IDNo << " */ ";
       for (auto *Record : V)
         OS << "diag::" << Record->getName() << ", ";
       // Emit the diagnostics implicitly in "pedantic".
@@ -1692,31 +1662,29 @@ static void emitDiagTable(std::map<std::string, GroupInfo> &DiagsInGroup,
 
   OS << "\n#ifdef DIAG_ENTRY\n";
   unsigned SubGroupIndex = 1, DiagArrayIndex = 1;
-  for (auto const &I: DiagsInGroup) {
+  for (auto const &[Name, GroupInfo] : DiagsInGroup) {
     // Group option string.
     OS << "DIAG_ENTRY(";
-    OS << I.second.GroupName << " /* ";
-
-    if (I.first.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
-                                   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                                   "0123456789!@#$%^*-+=:?") !=
-        std::string::npos)
-      PrintFatalError("Invalid character in diagnostic group '" + I.first +
-                      "'");
-    OS << I.first << " */, ";
+    OS << GroupInfo.GroupName << " /* ";
+
+    if (Name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                               "0123456789!@#$%^*-+=:?") != std::string::npos)
+      PrintFatalError("Invalid character in diagnostic group '" + Name + "'");
+    OS << Name << " */, ";
     // Store a pascal-style length byte at the beginning of the string.
-    std::string Name = char(I.first.size()) + I.first;
-    OS << *GroupNames.GetStringOffset(Name) << ", ";
+    std::string PascalName = char(Name.size()) + Name;
+    OS << *GroupNames.GetStringOffset(PascalName) << ", ";
 
     // Special handling for 'pedantic'.
-    const bool IsPedantic = I.first == "pedantic";
+    const bool IsPedantic = Name == "pedantic";
 
     // Diagnostics in the group.
-    const std::vector<const Record *> &V = I.second.DiagsInGroup;
+    const std::vector<const Record *> &V = GroupInfo.DiagsInGroup;
     const bool hasDiags =
         !V.empty() || (IsPedantic && !DiagsInPedantic.empty());
     if (hasDiags) {
-      OS << "/* DiagArray" << I.second.IDNo << " */ " << DiagArrayIndex
+      OS << "/* DiagArray" << GroupInfo.IDNo << " */ " << DiagArrayIndex
          << ", ";
       if (IsPedantic)
         DiagArrayIndex += DiagsInPedantic.size();
@@ -1726,11 +1694,11 @@ static void emitDiagTable(std::map<std::string, GroupInfo> &DiagsInGroup,
     }
 
     // Subgroups.
-    const std::vector<std::string> &SubGroups = I.second.SubGroups;
+    const std::vector<std::string> &SubGroups = GroupInfo.SubGroups;
     const bool hasSubGroups =
         !SubGroups.empty() || (IsPedantic && !GroupsInPedantic.empty());
     if (hasSubGroups) {
-      OS << "/* DiagSubGroup" << I.second.IDNo << " */ " << SubGroupIndex
+      OS << "/* DiagSubGroup" << GroupInfo.IDNo << " */ " << SubGroupIndex
          << ", ";
       if (IsPedantic)
         SubGroupIndex += GroupsInPedantic.size();
@@ -1739,7 +1707,7 @@ static void emitDiagTable(std::map<std::string, GroupInfo> &DiagsInGroup,
       OS << "0, ";
     }
 
-    std::string Documentation = I.second.Defs.back()
+    std::string Documentation = GroupInfo.Defs.back()
                                     ->getValue("Documentation")
                                     ->getValue()
                                     ->getAsUnquotedString();
@@ -1832,20 +1800,15 @@ void clang::EmitClangDiagsIndexName(const RecordKeeper &Records,
 
   std::vector<RecordIndexElement> Index;
   Index.reserve(Diags.size());
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record &R = *(Diags[i]);
-    Index.push_back(RecordIndexElement(R));
-  }
+  for (const Record *R : Diags)
+    Index.push_back(RecordIndexElement(*R));
 
   sort(Index, [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
     return Lhs.Name < Rhs.Name;
   });
 
-  for (unsigned i = 0, e = Index.size(); i != e; ++i) {
-    const RecordIndexElement &R = Index[i];
-
-    OS << "DIAG_NAME_INDEX(" << R.Name << ")\n";
-  }
+  for (const auto &Elem : Index)
+    OS << "DIAG_NAME_INDEX(" << Elem.Name << ")\n";
 }
 
 //===----------------------------------------------------------------------===//

@jurahul jurahul force-pushed the clang_diag_emitter_range_loops branch 2 times, most recently from 635b24a to c8a991f Compare November 12, 2024 16:20
Use range based for loops in Clang diagnostics emitter.
@jurahul jurahul force-pushed the clang_diag_emitter_range_loops branch from c8a991f to bc2ee79 Compare November 12, 2024 19:32
@jurahul jurahul merged commit 7b5e285 into llvm:main Nov 12, 2024
8 checks passed
@jurahul jurahul deleted the clang_diag_emitter_range_loops branch November 12, 2024 22:39
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 12, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg-asan running on libc-x86_64-debian-fullbuild while building clang at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/10204

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcSysFStatvfsTest.FStatvfsBasic (26 us)
[ RUN      ] LlvmLibcSysFStatvfsTest.FStatvfsInvalidPath
[       OK ] LlvmLibcSysFStatvfsTest.FStatvfsInvalidPath (202 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[962/1095] Running unit test libc.test.src.sys.utsname.uname_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcUnameTest.GetMachineName
[       OK ] LlvmLibcUnameTest.GetMachineName (35 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[963/1095] Running unit test libc.test.src.sys.statvfs.linux.statvfs_test
FAILED: projects/libc/test/src/sys/statvfs/linux/CMakeFiles/libc.test.src.sys.statvfs.linux.statvfs_test /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux/CMakeFiles/libc.test.src.sys.statvfs.linux.statvfs_test 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux/libc.test.src.sys.statvfs.linux.statvfs_test.__build__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcSysStatvfsTest.StatvfsBasic
[       OK ] LlvmLibcSysStatvfsTest.StatvfsBasic (17 us)
[ RUN      ] LlvmLibcSysStatvfsTest.StatvfsInvalidPath
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/sys/statvfs/linux/statvfs_test.cpp:37: FAILURE
Failed to match LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU) against Succeeds(0).
Expected return value to be equal to 0 but got -1.
Expected errno to be equal to "Success" but got "File exists".
[  FAILED  ] LlvmLibcSysStatvfsTest.StatvfsInvalidPath
Ran 2 tests.  PASS: 1  FAIL: 1
[964/1095] Running unit test libc.test.src.sys.wait.wait4_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcwait4Test.NoHangTest
[       OK ] LlvmLibcwait4Test.NoHangTest (4 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[965/1095] Running unit test libc.test.src.sys.epoll.linux.epoll_ctl_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcEpollCtlTest.Basic
[       OK ] LlvmLibcEpollCtlTest.Basic (52 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[966/1095] Running unit test libc.test.src.sys.auxv.linux.getauxval_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcGetauxvalTest.Basic
[       OK ] LlvmLibcGetauxvalTest.Basic (64 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[967/1095] Running unit test libc.test.src.sys.epoll.linux.epoll_create1_test
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcEpollCreate1Test.Basic
[       OK ] LlvmLibcEpollCreate1Test.Basic (19 us)
[ RUN      ] LlvmLibcEpollCreate1Test.CloseOnExecute
[       OK ] LlvmLibcEpollCreate1Test.CloseOnExecute (10 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[968/1095] Running unit test libc.test.src.sys.prctl.linux.prctl_test
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcSysPrctlTest.GetSetName
[       OK ] LlvmLibcSysPrctlTest.GetSetName (26 us)
[ RUN      ] LlvmLibcSysPrctlTest.GetTHPDisable
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[       OK ] LlvmLibcSysFStatvfsTest.FStatvfsBasic (26 us)
[ RUN      ] LlvmLibcSysFStatvfsTest.FStatvfsInvalidPath
[       OK ] LlvmLibcSysFStatvfsTest.FStatvfsInvalidPath (202 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[962/1095] Running unit test libc.test.src.sys.utsname.uname_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcUnameTest.GetMachineName
[       OK ] LlvmLibcUnameTest.GetMachineName (35 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[963/1095] Running unit test libc.test.src.sys.statvfs.linux.statvfs_test
FAILED: projects/libc/test/src/sys/statvfs/linux/CMakeFiles/libc.test.src.sys.statvfs.linux.statvfs_test /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux/CMakeFiles/libc.test.src.sys.statvfs.linux.statvfs_test 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/projects/libc/test/src/sys/statvfs/linux/libc.test.src.sys.statvfs.linux.statvfs_test.__build__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcSysStatvfsTest.StatvfsBasic
[       OK ] LlvmLibcSysStatvfsTest.StatvfsBasic (17 us)
[ RUN      ] LlvmLibcSysStatvfsTest.StatvfsInvalidPath
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/sys/statvfs/linux/statvfs_test.cpp:37: FAILURE
Failed to match LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU) against Succeeds(0).
Expected return value to be equal to 0 but got -1.
Expected errno to be equal to "Success" but got "File exists".
[  FAILED  ] LlvmLibcSysStatvfsTest.StatvfsInvalidPath
Ran 2 tests.  PASS: 1  FAIL: 1
[964/1095] Running unit test libc.test.src.sys.wait.wait4_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcwait4Test.NoHangTest
[       OK ] LlvmLibcwait4Test.NoHangTest (4 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[965/1095] Running unit test libc.test.src.sys.epoll.linux.epoll_ctl_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcEpollCtlTest.Basic
[       OK ] LlvmLibcEpollCtlTest.Basic (52 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[966/1095] Running unit test libc.test.src.sys.auxv.linux.getauxval_test
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcGetauxvalTest.Basic
[       OK ] LlvmLibcGetauxvalTest.Basic (64 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[967/1095] Running unit test libc.test.src.sys.epoll.linux.epoll_create1_test
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcEpollCreate1Test.Basic
[       OK ] LlvmLibcEpollCreate1Test.Basic (19 us)
[ RUN      ] LlvmLibcEpollCreate1Test.CloseOnExecute
[       OK ] LlvmLibcEpollCreate1Test.CloseOnExecute (10 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[968/1095] Running unit test libc.test.src.sys.prctl.linux.prctl_test
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcSysPrctlTest.GetSetName
[       OK ] LlvmLibcSysPrctlTest.GetSetName (26 us)
[ RUN      ] LlvmLibcSysPrctlTest.GetTHPDisable

@jurahul
Copy link
Contributor Author

jurahul commented Nov 12, 2024

Its not clear to me if the failure is real or intermittent:

FAILURE
Failed to match LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU) against Succeeds(0).
Expected return value to be equal to 0 but got -1.
Expected errno to be equal to "Success" but got "File exists".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants