From c45e90cf152decb1a3dcd208273ca025e14f1b4f Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 17 Feb 2023 23:25:40 +0900 Subject: [PATCH] llvm-tblgen: Anonymize some functions. --- llvm/utils/TableGen/DirectiveEmitter.cpp | 15 ++++++++++++--- llvm/utils/TableGen/InstrDocsEmitter.cpp | 6 +++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/llvm/utils/TableGen/DirectiveEmitter.cpp b/llvm/utils/TableGen/DirectiveEmitter.cpp index f18b9ee..d4ef9f5 100644 --- a/llvm/utils/TableGen/DirectiveEmitter.cpp +++ b/llvm/utils/TableGen/DirectiveEmitter.cpp @@ -37,9 +37,6 @@ private: StringRef Name; raw_ostream &OS; }; -} // end anonymous namespace - -namespace llvm { // Generate enum class void GenerateEnumClass(const std::vector &Records, raw_ostream &OS, @@ -163,6 +160,8 @@ bool HasDuplicateClausesInDirectives(const std::vector &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 getName(StringRef Str) void GenerateGetName(const std::vector &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) { diff --git a/llvm/utils/TableGen/InstrDocsEmitter.cpp b/llvm/utils/TableGen/InstrDocsEmitter.cpp index bc39122..ca39927 100644 --- a/llvm/utils/TableGen/InstrDocsEmitter.cpp +++ b/llvm/utils/TableGen/InstrDocsEmitter.cpp @@ -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(); -- 2.7.4