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 @@ -50,19 +50,21 @@ class IncludeGuardEmitter {
5050};
5151
5252// Simple RAII helper for emitting namespace scope. Name can be a single
53- // namespace (empty for anonymous namespace) or nested namespace.
53+ // namespace or nested namespace. If the name is empty, will not generate any
54+ // namespace scope.
5455class NamespaceEmitter {
5556public:
56- NamespaceEmitter (raw_ostream &OS, StringRef Name)
57- : Name(trim(Name).str()), OS(OS) {
58- OS << " namespace " << this ->Name << " {\n " ;
57+ NamespaceEmitter (raw_ostream &OS, StringRef NameUntrimmed)
58+ : Name(trim(NameUntrimmed).str()), OS(OS) {
59+ if (!Name.empty ())
60+ OS << " namespace " << Name << " {\n " ;
5961 }
6062
6163 ~NamespaceEmitter () { close (); }
6264
6365 // Explicit function to close the namespace scopes.
6466 void close () {
65- if (!Closed)
67+ if (!Closed && !Name. empty () )
6668 OS << " } // namespace " << Name << " \n " ;
6769 Closed = true ;
6870 }
You can’t perform that action at this time.
0 commit comments