llvm-tblgen: Anonymize some functions.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 17 Feb 2023 14:25:40 +0000 (23:25 +0900)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 19 Feb 2023 05:44:56 +0000 (14:44 +0900)
llvm/utils/TableGen/DirectiveEmitter.cpp
llvm/utils/TableGen/InstrDocsEmitter.cpp

index f18b9ee..d4ef9f5 100644 (file)
@@ -37,9 +37,6 @@ private:
   StringRef Name;
   raw_ostream &OS;
 };
-} // end anonymous namespace
-
-namespace llvm {
 
 // Generate enum class
 void GenerateEnumClass(const std::vector<Record *> &Records, raw_ostream &OS,
@@ -163,6 +160,8 @@ bool HasDuplicateClausesInDirectives(const std::vector<Record *> &Directives) {
   return HasDuplicate;
 }
 
+} // namespace
+
 // Check consitency of records. Return true if an error has been detected.
 // Return false if the records are valid.
 bool DirectiveLanguage::HasValidityErrors() const {
@@ -174,6 +173,8 @@ bool DirectiveLanguage::HasValidityErrors() const {
   return HasDuplicateClausesInDirectives(getDirectives());
 }
 
+namespace llvm {
+
 // Generate the declaration section for the enumeration in the directive
 // language
 void EmitDirectivesDecl(RecordKeeper &Records, raw_ostream &OS) {
@@ -245,6 +246,10 @@ void EmitDirectivesDecl(RecordKeeper &Records, raw_ostream &OS) {
   OS << "#endif // LLVM_" << DirLang.getName() << "_INC\n";
 }
 
+} // namespace llvm
+
+namespace {
+
 // Generate function implementation for get<Enum>Name(StringRef Str)
 void GenerateGetName(const std::vector<Record *> &Records, raw_ostream &OS,
                      StringRef Enum, const DirectiveLanguage &DirLang,
@@ -869,6 +874,10 @@ void EmitDirectivesBasicImpl(const DirectiveLanguage &DirLang,
   GenerateIsAllowedClause(DirLang, OS);
 }
 
+} // namespace
+
+namespace llvm {
+
 // Generate the implemenation section for the enumeration in the directive
 // language.
 void EmitDirectivesImpl(RecordKeeper &Records, raw_ostream &OS) {
index bc39122..ca39927 100644 (file)
@@ -28,7 +28,7 @@
 
 using namespace llvm;
 
-namespace llvm {
+namespace {
 
 void writeTitle(StringRef Str, raw_ostream &OS, char Kind = '-') {
   OS << std::string(Str.size(), Kind) << "\n" << Str << "\n"
@@ -55,6 +55,10 @@ std::string escapeForRST(StringRef Str) {
   return Result;
 }
 
+} // namespace
+
+namespace llvm {
+
 void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) {
   CodeGenDAGPatterns CDP(RK);
   CodeGenTarget &Target = CDP.getTargetInfo();