Skip to content

Conversation

@zeyi2
Copy link
Member

@zeyi2 zeyi2 commented Nov 12, 2025

Closes #157292

@llvmbot
Copy link
Member

llvmbot commented Nov 12, 2025

@llvm/pr-subscribers-clang-tidy

Author: mitchell (zeyi2)

Changes

Closes #157292


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

13 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp (+3-3)
  • (modified) clang-tools-extra/clang-tidy/cert/CMakeLists.txt (-1)
  • (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+1)
  • (modified) clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp (+4-2)
  • (renamed) clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp (+5-5)
  • (renamed) clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h (+8-8)
  • (modified) clang-tools-extra/docs/ReleaseNotes.rst (+11-1)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst (+6-2)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst (+8-6)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/list.rst (+3-1)
  • (added) clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst (+20)
  • (renamed) clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c (+2-2)
  • (renamed) clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp (+4-4)
diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
index f46dd4cc6195a..16d4be9802cc6 100644
--- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
@@ -34,6 +34,7 @@
 #include "../google/UnnamedNamespaceInHeaderCheck.h"
 #include "../misc/NewDeleteOverloadsCheck.h"
 #include "../misc/NonCopyableObjectsCheck.h"
+#include "../misc/PredictableRandCheck.h"
 #include "../misc/StaticAssertCheck.h"
 #include "../misc/ThrowByValueCatchByReferenceCheck.h"
 #include "../modernize/AvoidSetjmpLongjmpCheck.h"
@@ -41,7 +42,6 @@
 #include "../performance/MoveConstructorInitCheck.h"
 #include "../readability/EnumInitialValueCheck.h"
 #include "../readability/UppercaseLiteralSuffixCheck.h"
-#include "LimitedRandomnessCheck.h"
 
 namespace {
 
@@ -271,7 +271,7 @@ class CERTModule : public ClangTidyModule {
         .registerCheck<bugprone::DefaultOperatorNewOnOveralignedTypeCheck>(
             "cert-mem57-cpp");
     // MSC
-    CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp");
+    CheckFactories.registerCheck<misc::PredictableRandCheck>("cert-msc50-cpp");
     CheckFactories.registerCheck<bugprone::RandomGeneratorSeedCheck>(
         "cert-msc51-cpp");
     CheckFactories.registerCheck<bugprone::SignalHandlerCheck>(
@@ -324,7 +324,7 @@ class CERTModule : public ClangTidyModule {
     // MSC
     CheckFactories.registerCheck<bugprone::UnsafeFunctionsCheck>(
         "cert-msc24-c");
-    CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c");
+    CheckFactories.registerCheck<misc::PredictableRandCheck>("cert-msc30-c");
     CheckFactories.registerCheck<bugprone::RandomGeneratorSeedCheck>(
         "cert-msc32-c");
     CheckFactories.registerCheck<bugprone::UnsafeFunctionsCheck>(
diff --git a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
index 0ed903c4826a3..313790374788d 100644
--- a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
@@ -5,7 +5,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_library(clangTidyCERTModule STATIC
   CERTTidyModule.cpp
-  LimitedRandomnessCheck.cpp
 
   LINK_LIBS
   clangTidy
diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
index 6214ee92927f2..e8705aada3f22 100644
--- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
@@ -33,6 +33,7 @@ add_clang_library(clangTidyMiscModule STATIC
   NonCopyableObjectsCheck.cpp
   NonPrivateMemberVariablesInClassesCheck.cpp
   OverrideWithDifferentVisibilityCheck.cpp
+  PredictableRandCheck.cpp
   RedundantExpressionCheck.cpp
   StaticAssertCheck.cpp
   ThrowByValueCatchByReferenceCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 347fa2a82e43c..03f25775de0bf 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -23,6 +23,7 @@
 #include "NonCopyableObjectsCheck.h"
 #include "NonPrivateMemberVariablesInClassesCheck.h"
 #include "OverrideWithDifferentVisibilityCheck.h"
+#include "PredictableRandCheck.h"
 #include "RedundantExpressionCheck.h"
 #include "StaticAssertCheck.h"
 #include "ThrowByValueCatchByReferenceCheck.h"
@@ -63,6 +64,9 @@ class MiscModule : public ClangTidyModule {
         "misc-non-copyable-objects");
     CheckFactories.registerCheck<NonPrivateMemberVariablesInClassesCheck>(
         "misc-non-private-member-variables-in-classes");
+    CheckFactories.registerCheck<OverrideWithDifferentVisibilityCheck>(
+        "misc-override-with-different-visibility");
+    CheckFactories.registerCheck<PredictableRandCheck>("misc-predictable-rand");
     CheckFactories.registerCheck<RedundantExpressionCheck>(
         "misc-redundant-expression");
     CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
@@ -82,8 +86,6 @@ class MiscModule : public ClangTidyModule {
         "misc-use-anonymous-namespace");
     CheckFactories.registerCheck<UseInternalLinkageCheck>(
         "misc-use-internal-linkage");
-    CheckFactories.registerCheck<OverrideWithDifferentVisibilityCheck>(
-        "misc-override-with-different-visibility");
   }
 };
 
diff --git a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
similarity index 80%
rename from clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp
rename to clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
index 4fe9c6c22590b..eed80e07a030d 100644
--- a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
@@ -6,22 +6,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "LimitedRandomnessCheck.h"
+#include "PredictableRandCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
 
-namespace clang::tidy::cert {
+namespace clang::tidy::misc {
 
-void LimitedRandomnessCheck::registerMatchers(MatchFinder *Finder) {
+void PredictableRandCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(callExpr(callee(functionDecl(namedDecl(hasName("::rand")),
                                                   parameterCountIs(0))))
                          .bind("randomGenerator"),
                      this);
 }
 
-void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
+void PredictableRandCheck::check(const MatchFinder::MatchResult &Result) {
   std::string Msg;
   if (getLangOpts().CPlusPlus)
     Msg = "; use C++11 random library instead";
@@ -30,4 +30,4 @@ void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
   diag(MatchedDecl->getBeginLoc(), "rand() has limited randomness" + Msg);
 }
 
-} // namespace clang::tidy::cert
+} // namespace clang::tidy::misc
diff --git a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
similarity index 65%
rename from clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h
rename to clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
index a806cd344d217..2237e7e752a5e 100644
--- a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h
+++ b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
 
 #include "../ClangTidyCheck.h"
 
-namespace clang::tidy::cert {
+namespace clang::tidy::misc {
 
 /// Pseudorandom number generators are not genuinely random. The result of the
 /// std::rand() function makes no guarantees as to the quality of the random
@@ -19,15 +19,15 @@ namespace clang::tidy::cert {
 /// This check warns for the usage of std::rand() function.
 ///
 /// For the user-facing documentation see:
-/// https://clang.llvm.org/extra/clang-tidy/checks/cert/msc50-cpp.html
-class LimitedRandomnessCheck : public ClangTidyCheck {
+/// https://clang.llvm.org/extra/clang-tidy/checks/misc/predictable-rand.html
+class PredictableRandCheck : public ClangTidyCheck {
 public:
-  LimitedRandomnessCheck(StringRef Name, ClangTidyContext *Context)
+  PredictableRandCheck(StringRef Name, ClangTidyContext *Context)
       : ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace clang::tidy::cert
+} // namespace clang::tidy::misc
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 8637a9ab6d9f6..a06739f1b58cc 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -283,11 +283,21 @@ New check aliases
   <clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type>`
   keeping initial check as an alias to the new one.
 
+- Renamed :doc:`cert-msc30-c <clang-tidy/checks/cert/msc30-c>` to
+  :doc:`misc-predictable-rand
+  <clang-tidy/checks/misc/predictable-rand>`
+  keeping initial check as an alias to the new one.
+
 - Renamed :doc:`cert-msc32-c <clang-tidy/checks/cert/msc32-c>` to
   :doc:`bugprone-random-generator-seed
   <clang-tidy/checks/bugprone/random-generator-seed>`
   keeping initial check as an alias to the new one.
 
+- Renamed :doc:`cert-msc50-cpp <clang-tidy/checks/cert/msc50-cpp>` to
+  :doc:`misc-predictable-rand
+  <clang-tidy/checks/misc/predictable-rand>`
+  keeping initial check as an alias to the new one.
+
 - Renamed :doc:`cert-msc51-cpp <clang-tidy/checks/cert/msc51-cpp>` to
   :doc:`bugprone-random-generator-seed
   <clang-tidy/checks/bugprone/random-generator-seed>`
@@ -316,7 +326,7 @@ Changes in existing checks
   exceptions from captures are now diagnosed, exceptions in the bodies of
   lambdas that aren't actually invoked are not. Additionally, fixed an issue
   where the check wouldn't diagnose throws in arguments to functions or
-  constructors. Added fine-grained configuration via options 
+  constructors. Added fine-grained configuration via options
   `CheckDestructors`, `CheckMoveMemberFunctions`, `CheckMain`,
   `CheckedSwapFunctions`, and `CheckNothrowFunctions`.
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
index a2898f1a11acf..27f92a8f45d8b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
@@ -1,9 +1,13 @@
 .. title:: clang-tidy - cert-msc30-c
 .. meta::
-   :http-equiv=refresh: 5;URL=../cert/msc50-cpp.html
+   :http-equiv=refresh: 5;URL=../misc/predictable-rand.html
 
 cert-msc30-c
 ============
 
 The `cert-msc30-c` check is an alias, please see
-:doc:`cert-msc50-cpp <../cert/msc50-cpp>` for more information.
+:doc:`misc-predictable-rand <../misc/predictable-rand>` for more information.
+
+This check corresponds to the CERT C Coding Standard rule
+`MSC30-C. Do not use the rand() function for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/c/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
index debf01cf2d332..59738f5bf29ab 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
@@ -1,11 +1,13 @@
 .. title:: clang-tidy - cert-msc50-cpp
+.. meta::
+   :http-equiv=refresh: 5;URL=../misc/predictable-rand.html
 
 cert-msc50-cpp
 ==============
 
-Pseudorandom number generators use mathematical algorithms to produce a sequence
-of numbers with good statistical properties, but the numbers produced are not
-genuinely random. The ``std::rand()`` function takes a seed (number), runs a
-mathematical operation on it and returns the result. By manipulating the seed
-the result can be predictable. This check warns for the usage of
-``std::rand()``.
+The `cert-msc50-cpp` check is an alias, please see
+:doc:`misc-predictable-rand <../misc/predictable-rand>` for more information.
+
+This check corresponds to the CERT C Coding Standard rule
+`MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index a4014b5f15f0b..faf305699f953 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -278,6 +278,7 @@ Clang-Tidy Checks
    :doc:`misc-non-copyable-objects <misc/non-copyable-objects>`,
    :doc:`misc-non-private-member-variables-in-classes <misc/non-private-member-variables-in-classes>`,
    :doc:`misc-override-with-different-visibility <misc/override-with-different-visibility>`,
+   :doc:`misc-predictable-rand <misc/predictable-rand>`,
    :doc:`misc-redundant-expression <misc/redundant-expression>`, "Yes"
    :doc:`misc-static-assert <misc/static-assert>`, "Yes"
    :doc:`misc-throw-by-value-catch-by-reference <misc/throw-by-value-catch-by-reference>`,
@@ -460,7 +461,8 @@ Check aliases
    :doc:`cert-int09-c <cert/int09-c>`, :doc:`readability-enum-initial-value <readability/enum-initial-value>`, "Yes"
    :doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,
    :doc:`cert-msc24-c <cert/msc24-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
-   :doc:`cert-msc30-c <cert/msc30-c>`, :doc:`cert-msc50-cpp <cert/msc50-cpp>`,
+   :doc:`cert-msc30-c <cert/msc30-c>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
+   :doc:`cert-msc50-cpp <cert/msc50-cpp>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
    :doc:`cert-msc32-c <cert/msc32-c>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
    :doc:`cert-msc33-c <cert/msc33-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
    :doc:`cert-msc51-cpp <cert/msc51-cpp>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst
new file mode 100644
index 0000000000000..00156649cf220
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - misc-predictable-rand
+
+misc-predictable-rand
+=====================
+
+Warns for the usage of ``std::rand()``. Pseudorandom number generators use
+mathematical algorithms to produce a sequence of numbers with good
+statistical properties, but the numbers produced are not genuinely random.
+The ``std::rand()`` function takes a seed (number), runs a mathematical
+operation on it and returns the result. By manipulating the seed the result
+can be predictable.
+
+References
+----------
+
+This check corresponds to the CERT C Coding Standard rules
+`MSC30-C. Do not use the rand() function for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/c/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers>`_.
+`MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
similarity index 66%
rename from clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c
rename to clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
index 32e4a07b40919..d8233092b54ec 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
@@ -1,11 +1,11 @@
-// RUN: %check_clang_tidy %s cert-msc30-c %t
+// RUN: %check_clang_tidy %s misc-predictable-rand %t
 
 extern int rand(void);
 int nonrand(void);
 
 int cTest(void) {
   int i = rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness [cert-msc30-c]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness [misc-predictable-rand]
 
   int k = nonrand();
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
similarity index 61%
rename from clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp
rename to clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
index 845b7350de9f5..8f001868703d3 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s cert-msc50-cpp %t
+// RUN: %check_clang_tidy %s misc-predictable-rand %t
 
 int rand();
 int rand(int);
@@ -13,16 +13,16 @@ namespace nonstd {
 
 void testFunction1() {
   int i = std::rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 
   int j = ::rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 
   int k = rand(i);
 
   int l = nonstd::rand();
 
   int m = rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 }
 

@llvmbot
Copy link
Member

llvmbot commented Nov 12, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: mitchell (zeyi2)

Changes

Closes #157292


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

13 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp (+3-3)
  • (modified) clang-tools-extra/clang-tidy/cert/CMakeLists.txt (-1)
  • (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+1)
  • (modified) clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp (+4-2)
  • (renamed) clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp (+5-5)
  • (renamed) clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h (+8-8)
  • (modified) clang-tools-extra/docs/ReleaseNotes.rst (+11-1)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst (+6-2)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst (+8-6)
  • (modified) clang-tools-extra/docs/clang-tidy/checks/list.rst (+3-1)
  • (added) clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst (+20)
  • (renamed) clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c (+2-2)
  • (renamed) clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp (+4-4)
diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
index f46dd4cc6195a..16d4be9802cc6 100644
--- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
@@ -34,6 +34,7 @@
 #include "../google/UnnamedNamespaceInHeaderCheck.h"
 #include "../misc/NewDeleteOverloadsCheck.h"
 #include "../misc/NonCopyableObjectsCheck.h"
+#include "../misc/PredictableRandCheck.h"
 #include "../misc/StaticAssertCheck.h"
 #include "../misc/ThrowByValueCatchByReferenceCheck.h"
 #include "../modernize/AvoidSetjmpLongjmpCheck.h"
@@ -41,7 +42,6 @@
 #include "../performance/MoveConstructorInitCheck.h"
 #include "../readability/EnumInitialValueCheck.h"
 #include "../readability/UppercaseLiteralSuffixCheck.h"
-#include "LimitedRandomnessCheck.h"
 
 namespace {
 
@@ -271,7 +271,7 @@ class CERTModule : public ClangTidyModule {
         .registerCheck<bugprone::DefaultOperatorNewOnOveralignedTypeCheck>(
             "cert-mem57-cpp");
     // MSC
-    CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp");
+    CheckFactories.registerCheck<misc::PredictableRandCheck>("cert-msc50-cpp");
     CheckFactories.registerCheck<bugprone::RandomGeneratorSeedCheck>(
         "cert-msc51-cpp");
     CheckFactories.registerCheck<bugprone::SignalHandlerCheck>(
@@ -324,7 +324,7 @@ class CERTModule : public ClangTidyModule {
     // MSC
     CheckFactories.registerCheck<bugprone::UnsafeFunctionsCheck>(
         "cert-msc24-c");
-    CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c");
+    CheckFactories.registerCheck<misc::PredictableRandCheck>("cert-msc30-c");
     CheckFactories.registerCheck<bugprone::RandomGeneratorSeedCheck>(
         "cert-msc32-c");
     CheckFactories.registerCheck<bugprone::UnsafeFunctionsCheck>(
diff --git a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
index 0ed903c4826a3..313790374788d 100644
--- a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt
@@ -5,7 +5,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_library(clangTidyCERTModule STATIC
   CERTTidyModule.cpp
-  LimitedRandomnessCheck.cpp
 
   LINK_LIBS
   clangTidy
diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
index 6214ee92927f2..e8705aada3f22 100644
--- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
@@ -33,6 +33,7 @@ add_clang_library(clangTidyMiscModule STATIC
   NonCopyableObjectsCheck.cpp
   NonPrivateMemberVariablesInClassesCheck.cpp
   OverrideWithDifferentVisibilityCheck.cpp
+  PredictableRandCheck.cpp
   RedundantExpressionCheck.cpp
   StaticAssertCheck.cpp
   ThrowByValueCatchByReferenceCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 347fa2a82e43c..03f25775de0bf 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -23,6 +23,7 @@
 #include "NonCopyableObjectsCheck.h"
 #include "NonPrivateMemberVariablesInClassesCheck.h"
 #include "OverrideWithDifferentVisibilityCheck.h"
+#include "PredictableRandCheck.h"
 #include "RedundantExpressionCheck.h"
 #include "StaticAssertCheck.h"
 #include "ThrowByValueCatchByReferenceCheck.h"
@@ -63,6 +64,9 @@ class MiscModule : public ClangTidyModule {
         "misc-non-copyable-objects");
     CheckFactories.registerCheck<NonPrivateMemberVariablesInClassesCheck>(
         "misc-non-private-member-variables-in-classes");
+    CheckFactories.registerCheck<OverrideWithDifferentVisibilityCheck>(
+        "misc-override-with-different-visibility");
+    CheckFactories.registerCheck<PredictableRandCheck>("misc-predictable-rand");
     CheckFactories.registerCheck<RedundantExpressionCheck>(
         "misc-redundant-expression");
     CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
@@ -82,8 +86,6 @@ class MiscModule : public ClangTidyModule {
         "misc-use-anonymous-namespace");
     CheckFactories.registerCheck<UseInternalLinkageCheck>(
         "misc-use-internal-linkage");
-    CheckFactories.registerCheck<OverrideWithDifferentVisibilityCheck>(
-        "misc-override-with-different-visibility");
   }
 };
 
diff --git a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
similarity index 80%
rename from clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp
rename to clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
index 4fe9c6c22590b..eed80e07a030d 100644
--- a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.cpp
@@ -6,22 +6,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "LimitedRandomnessCheck.h"
+#include "PredictableRandCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
 
-namespace clang::tidy::cert {
+namespace clang::tidy::misc {
 
-void LimitedRandomnessCheck::registerMatchers(MatchFinder *Finder) {
+void PredictableRandCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(callExpr(callee(functionDecl(namedDecl(hasName("::rand")),
                                                   parameterCountIs(0))))
                          .bind("randomGenerator"),
                      this);
 }
 
-void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
+void PredictableRandCheck::check(const MatchFinder::MatchResult &Result) {
   std::string Msg;
   if (getLangOpts().CPlusPlus)
     Msg = "; use C++11 random library instead";
@@ -30,4 +30,4 @@ void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
   diag(MatchedDecl->getBeginLoc(), "rand() has limited randomness" + Msg);
 }
 
-} // namespace clang::tidy::cert
+} // namespace clang::tidy::misc
diff --git a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
similarity index 65%
rename from clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h
rename to clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
index a806cd344d217..2237e7e752a5e 100644
--- a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.h
+++ b/clang-tools-extra/clang-tidy/misc/PredictableRandCheck.h
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
 
 #include "../ClangTidyCheck.h"
 
-namespace clang::tidy::cert {
+namespace clang::tidy::misc {
 
 /// Pseudorandom number generators are not genuinely random. The result of the
 /// std::rand() function makes no guarantees as to the quality of the random
@@ -19,15 +19,15 @@ namespace clang::tidy::cert {
 /// This check warns for the usage of std::rand() function.
 ///
 /// For the user-facing documentation see:
-/// https://clang.llvm.org/extra/clang-tidy/checks/cert/msc50-cpp.html
-class LimitedRandomnessCheck : public ClangTidyCheck {
+/// https://clang.llvm.org/extra/clang-tidy/checks/misc/predictable-rand.html
+class PredictableRandCheck : public ClangTidyCheck {
 public:
-  LimitedRandomnessCheck(StringRef Name, ClangTidyContext *Context)
+  PredictableRandCheck(StringRef Name, ClangTidyContext *Context)
       : ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace clang::tidy::cert
+} // namespace clang::tidy::misc
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_LIMITEDRANDOMNESSCHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_PREDICTABLERANDCHECK_H
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 8637a9ab6d9f6..a06739f1b58cc 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -283,11 +283,21 @@ New check aliases
   <clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type>`
   keeping initial check as an alias to the new one.
 
+- Renamed :doc:`cert-msc30-c <clang-tidy/checks/cert/msc30-c>` to
+  :doc:`misc-predictable-rand
+  <clang-tidy/checks/misc/predictable-rand>`
+  keeping initial check as an alias to the new one.
+
 - Renamed :doc:`cert-msc32-c <clang-tidy/checks/cert/msc32-c>` to
   :doc:`bugprone-random-generator-seed
   <clang-tidy/checks/bugprone/random-generator-seed>`
   keeping initial check as an alias to the new one.
 
+- Renamed :doc:`cert-msc50-cpp <clang-tidy/checks/cert/msc50-cpp>` to
+  :doc:`misc-predictable-rand
+  <clang-tidy/checks/misc/predictable-rand>`
+  keeping initial check as an alias to the new one.
+
 - Renamed :doc:`cert-msc51-cpp <clang-tidy/checks/cert/msc51-cpp>` to
   :doc:`bugprone-random-generator-seed
   <clang-tidy/checks/bugprone/random-generator-seed>`
@@ -316,7 +326,7 @@ Changes in existing checks
   exceptions from captures are now diagnosed, exceptions in the bodies of
   lambdas that aren't actually invoked are not. Additionally, fixed an issue
   where the check wouldn't diagnose throws in arguments to functions or
-  constructors. Added fine-grained configuration via options 
+  constructors. Added fine-grained configuration via options
   `CheckDestructors`, `CheckMoveMemberFunctions`, `CheckMain`,
   `CheckedSwapFunctions`, and `CheckNothrowFunctions`.
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
index a2898f1a11acf..27f92a8f45d8b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cert/msc30-c.rst
@@ -1,9 +1,13 @@
 .. title:: clang-tidy - cert-msc30-c
 .. meta::
-   :http-equiv=refresh: 5;URL=../cert/msc50-cpp.html
+   :http-equiv=refresh: 5;URL=../misc/predictable-rand.html
 
 cert-msc30-c
 ============
 
 The `cert-msc30-c` check is an alias, please see
-:doc:`cert-msc50-cpp <../cert/msc50-cpp>` for more information.
+:doc:`misc-predictable-rand <../misc/predictable-rand>` for more information.
+
+This check corresponds to the CERT C Coding Standard rule
+`MSC30-C. Do not use the rand() function for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/c/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
index debf01cf2d332..59738f5bf29ab 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cert/msc50-cpp.rst
@@ -1,11 +1,13 @@
 .. title:: clang-tidy - cert-msc50-cpp
+.. meta::
+   :http-equiv=refresh: 5;URL=../misc/predictable-rand.html
 
 cert-msc50-cpp
 ==============
 
-Pseudorandom number generators use mathematical algorithms to produce a sequence
-of numbers with good statistical properties, but the numbers produced are not
-genuinely random. The ``std::rand()`` function takes a seed (number), runs a
-mathematical operation on it and returns the result. By manipulating the seed
-the result can be predictable. This check warns for the usage of
-``std::rand()``.
+The `cert-msc50-cpp` check is an alias, please see
+:doc:`misc-predictable-rand <../misc/predictable-rand>` for more information.
+
+This check corresponds to the CERT C Coding Standard rule
+`MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index a4014b5f15f0b..faf305699f953 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -278,6 +278,7 @@ Clang-Tidy Checks
    :doc:`misc-non-copyable-objects <misc/non-copyable-objects>`,
    :doc:`misc-non-private-member-variables-in-classes <misc/non-private-member-variables-in-classes>`,
    :doc:`misc-override-with-different-visibility <misc/override-with-different-visibility>`,
+   :doc:`misc-predictable-rand <misc/predictable-rand>`,
    :doc:`misc-redundant-expression <misc/redundant-expression>`, "Yes"
    :doc:`misc-static-assert <misc/static-assert>`, "Yes"
    :doc:`misc-throw-by-value-catch-by-reference <misc/throw-by-value-catch-by-reference>`,
@@ -460,7 +461,8 @@ Check aliases
    :doc:`cert-int09-c <cert/int09-c>`, :doc:`readability-enum-initial-value <readability/enum-initial-value>`, "Yes"
    :doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,
    :doc:`cert-msc24-c <cert/msc24-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
-   :doc:`cert-msc30-c <cert/msc30-c>`, :doc:`cert-msc50-cpp <cert/msc50-cpp>`,
+   :doc:`cert-msc30-c <cert/msc30-c>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
+   :doc:`cert-msc50-cpp <cert/msc50-cpp>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
    :doc:`cert-msc32-c <cert/msc32-c>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
    :doc:`cert-msc33-c <cert/msc33-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
    :doc:`cert-msc51-cpp <cert/msc51-cpp>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst
new file mode 100644
index 0000000000000..00156649cf220
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/predictable-rand.rst
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - misc-predictable-rand
+
+misc-predictable-rand
+=====================
+
+Warns for the usage of ``std::rand()``. Pseudorandom number generators use
+mathematical algorithms to produce a sequence of numbers with good
+statistical properties, but the numbers produced are not genuinely random.
+The ``std::rand()`` function takes a seed (number), runs a mathematical
+operation on it and returns the result. By manipulating the seed the result
+can be predictable.
+
+References
+----------
+
+This check corresponds to the CERT C Coding Standard rules
+`MSC30-C. Do not use the rand() function for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/c/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers>`_.
+`MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers
+<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers>`_.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
similarity index 66%
rename from clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c
rename to clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
index 32e4a07b40919..d8233092b54ec 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.c
@@ -1,11 +1,11 @@
-// RUN: %check_clang_tidy %s cert-msc30-c %t
+// RUN: %check_clang_tidy %s misc-predictable-rand %t
 
 extern int rand(void);
 int nonrand(void);
 
 int cTest(void) {
   int i = rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness [cert-msc30-c]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness [misc-predictable-rand]
 
   int k = nonrand();
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
similarity index 61%
rename from clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp
rename to clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
index 845b7350de9f5..8f001868703d3 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/predictable-rand.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s cert-msc50-cpp %t
+// RUN: %check_clang_tidy %s misc-predictable-rand %t
 
 int rand();
 int rand(int);
@@ -13,16 +13,16 @@ namespace nonstd {
 
 void testFunction1() {
   int i = std::rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 
   int j = ::rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 
   int k = rand(i);
 
   int l = nonstd::rand();
 
   int m = rand();
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]
 }
 

Copy link
Contributor

@vbvictor vbvictor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vbvictor vbvictor merged commit 8b55d77 into llvm:main Nov 16, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 16, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve2-vla running on linaro-g4-01 while building clang-tools-extra at step 7 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'HWAddressSanitizer-aarch64 :: TestCases/hwasan_symbolize_stack_overflow.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp; mkdir /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
# executed command: rm -rf /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
# executed command: mkdir /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
# RUN: at line 2
/home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions -Wl,--build-id -g /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp -o /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions -Wl,--build-id -g /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp -o /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
# RUN: at line 3
env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not  /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 16 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index | FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,AFTER0
# executed command: env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 16
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index
# .---command stderr------------
# | Could not find symbols for lib/aarch64-linux-gnu/libc.so.6 (Build ID: 034c9554b03099fc969ae2528ea6fd26286057d8)
# `-----------------------------
# executed command: FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,AFTER0
# RUN: at line 4
env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not  /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 17 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index | FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,AFTER1
# executed command: env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 17
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index
# .---command stderr------------
# | Could not find symbols for lib/aarch64-linux-gnu/libc.so.6 (Build ID: 034c9554b03099fc969ae2528ea6fd26286057d8)
# `-----------------------------
# executed command: FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,AFTER1
# RUN: at line 5
env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not  /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow -1 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index | FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,BEFORE1
# executed command: env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow -1
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index
# .---command stderr------------
# | Could not find symbols for lib/aarch64-linux-gnu/libc.so.6 (Build ID: 034c9554b03099fc969ae2528ea6fd26286057d8)
# `-----------------------------
# executed command: FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,BEFORE1
# RUN: at line 6
env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not  /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow -17 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index | FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,BEFORE17
# executed command: env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow -17
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index
# .---command stderr------------
# | Could not find symbols for lib/aarch64-linux-gnu/libc.so.6 (Build ID: 034c9554b03099fc969ae2528ea6fd26286057d8)
# `-----------------------------
# executed command: FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,BEFORE17
# RUN: at line 7
env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not  /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 1016 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index | FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/llvm/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp --check-prefixes=CHECK,AFTER1000
# executed command: env HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0 not /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow 1016
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/bin/hwasan_symbolize --symbols /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp --index
# .---command stderr------------
# | Could not find symbols for lib/aarch64-linux-gnu/libc.so.6 (Build ID: 034c9554b03099fc969ae2528ea6fd26286057d8)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[clang-tidy] Move 'cert-msc50-cpp', cert-msc30-c checks outside of 'cert' module and give a proper name

4 participants