Skip to content

Commit 9ebe8b9

Browse files
authored
[NFC][TableGen] Change global variables from anonymous NS to static (llvm#105504)
- Move global variables in TableGen.cpp out of anonymous namespace and make them static, per LLVM coding standards.
1 parent aa4c655 commit 9ebe8b9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

llvm/utils/TableGen/TableGen.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,23 @@ cl::opt<bool> EmitLongStrLiterals(
3333
cl::Hidden, cl::init(true));
3434
} // end namespace llvm
3535

36-
namespace {
36+
static cl::OptionCategory PrintEnumsCat("Options for -print-enums");
37+
static cl::opt<std::string> Class("class",
38+
cl::desc("Print Enum list for this class"),
39+
cl::value_desc("class name"),
40+
cl::cat(PrintEnumsCat));
3741

38-
cl::OptionCategory PrintEnumsCat("Options for -print-enums");
39-
cl::opt<std::string> Class("class", cl::desc("Print Enum list for this class"),
40-
cl::value_desc("class name"),
41-
cl::cat(PrintEnumsCat));
42-
43-
void PrintRecords(RecordKeeper &Records, raw_ostream &OS) {
42+
static void PrintRecords(RecordKeeper &Records, raw_ostream &OS) {
4443
OS << Records; // No argument, dump all contents
4544
}
4645

47-
void PrintEnums(RecordKeeper &Records, raw_ostream &OS) {
46+
static void PrintEnums(RecordKeeper &Records, raw_ostream &OS) {
4847
for (Record *Rec : Records.getAllDerivedDefinitions(Class))
4948
OS << Rec->getName() << ", ";
5049
OS << "\n";
5150
}
5251

53-
void PrintSets(RecordKeeper &Records, raw_ostream &OS) {
52+
static void PrintSets(RecordKeeper &Records, raw_ostream &OS) {
5453
SetTheory Sets;
5554
Sets.addFieldExpander("Set", "Elements");
5655
for (Record *Rec : Records.getAllDerivedDefinitions("Set")) {
@@ -63,7 +62,7 @@ void PrintSets(RecordKeeper &Records, raw_ostream &OS) {
6362
}
6463
}
6564

66-
TableGen::Emitter::Opt X[] = {
65+
static TableGen::Emitter::Opt X[] = {
6766
{"print-records", PrintRecords, "Print all records to stdout (default)",
6867
true},
6968
{"print-detailed-records", EmitDetailedRecords,
@@ -75,8 +74,6 @@ TableGen::Emitter::Opt X[] = {
7574
{"print-sets", PrintSets, "Print expanded sets for testing DAG exprs"},
7675
};
7776

78-
} // namespace
79-
8077
int main(int argc, char **argv) {
8178
InitLLVM X(argc, argv);
8279
cl::ParseCommandLineOptions(argc, argv);

0 commit comments

Comments
 (0)