File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
llvm/include/llvm/TableGen Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -35,19 +35,21 @@ class IfDefEmitter {
3535};
3636
3737// Simple RAII helper for emitting namespace scope. Name can be a single
38- // namespace (empty for anonymous namespace) or nested namespace.
38+ // namespace or nested namespace. If the name is empty, will not generate any
39+ // namespace scope.
3940class NamespaceEmitter {
4041public:
41- NamespaceEmitter (raw_ostream &OS, StringRef Name)
42- : Name(trim(Name).str()), OS(OS) {
43- OS << " namespace " << this ->Name << " {\n " ;
42+ NamespaceEmitter (raw_ostream &OS, StringRef NameUntrimmed)
43+ : Name(trim(NameUntrimmed).str()), OS(OS) {
44+ if (!Name.empty ())
45+ OS << " namespace " << Name << " {\n " ;
4446 }
4547
4648 ~NamespaceEmitter () { close (); }
4749
4850 // Explicit function to close the namespace scopes.
4951 void close () {
50- if (!Closed)
52+ if (!Closed && !Name. empty () )
5153 OS << " } // namespace " << Name << " \n " ;
5254 Closed = true ;
5355 }
You can’t perform that action at this time.
0 commit comments