[clang] 77e71bc - [randstruct] NFC change to use static

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 9 13:25:35 PDT 2022


Author: Bill Wendling
Date: 2022-04-09T13:25:25-07:00
New Revision: 77e71bcfde7264466849babaa0e9ccbec51a8a08

URL: https://github.com/llvm/llvm-project/commit/77e71bcfde7264466849babaa0e9ccbec51a8a08
DIFF: https://github.com/llvm/llvm-project/commit/77e71bcfde7264466849babaa0e9ccbec51a8a08.diff

LOG: [randstruct] NFC change to use static

Added: 
    

Modified: 
    clang/unittests/AST/RandstructTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/AST/RandstructTest.cpp b/clang/unittests/AST/RandstructTest.cpp
index b64d9fdfb2ad4..9e03beaa9caf8 100644
--- a/clang/unittests/AST/RandstructTest.cpp
+++ b/clang/unittests/AST/RandstructTest.cpp
@@ -36,9 +36,7 @@ using namespace clang::randstruct;
 
 using field_names = std::vector<std::string>;
 
-namespace {
-
-std::unique_ptr<ASTUnit> makeAST(const std::string &SourceCode) {
+static std::unique_ptr<ASTUnit> makeAST(const std::string &SourceCode) {
   std::vector<std::string> Args = getCommandLineArgsForTesting(Lang_C99);
   Args.push_back("-frandomize-layout-seed=1234567890abcdef");
 
@@ -51,13 +49,14 @@ std::unique_ptr<ASTUnit> makeAST(const std::string &SourceCode) {
       tooling::FileContentMappings(), &IgnoringConsumer);
 }
 
-RecordDecl *getRecordDeclFromAST(const ASTContext &C, const std::string &Name) {
+static RecordDecl *getRecordDeclFromAST(const ASTContext &C,
+                                        const std::string &Name) {
   RecordDecl *RD = FirstDeclMatcher<RecordDecl>().match(
       C.getTranslationUnitDecl(), recordDecl(hasName(Name)));
   return RD;
 }
 
-std::vector<std::string> getFieldNamesFromRecord(const RecordDecl *RD) {
+static std::vector<std::string> getFieldNamesFromRecord(const RecordDecl *RD) {
   std::vector<std::string> Fields;
 
   Fields.reserve(8);
@@ -67,7 +66,7 @@ std::vector<std::string> getFieldNamesFromRecord(const RecordDecl *RD) {
   return Fields;
 }
 
-bool isSubsequence(const field_names &Seq, const field_names &Subseq) {
+static bool isSubsequence(const field_names &Seq, const field_names &Subseq) {
   unsigned SeqLen = Seq.size();
   unsigned SubLen = Subseq.size();
 
@@ -86,8 +85,6 @@ bool isSubsequence(const field_names &Seq, const field_names &Subseq) {
   return IsSubseq;
 }
 
-} // end anonymous namespace
-
 namespace clang {
 namespace ast_matchers {
 


        


More information about the cfe-commits mailing list