Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

feature request: automatically nest namespaces #24900

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24901
Status NEW
Importance P enhancement
Reported by Gonzalo BG (gonzalo.gadeschi@gmail.com)
Reported on 2015-09-21 10:57:23 -0700
Last modified on 2017-02-21 03:33:25 -0800
Version unspecified
Hardware All All
CC alexfh@google.com, djasper@google.com, edwin.vane@intel.com, eugene.zelenko@gmail.com, klimek@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
In C++ >= 17 one can nest different namespace definitions, so it would be nice
to have a tool that automatically transforms

namespace A {
namespace B {

// watch out with comments
namespace C {

...

}
}
}

to

namespace A::B {

// watch out with comments
namespace C {

 ...

}
}
Quuxplusone commented 7 years ago
Test 2: basic functionality

Input:

namespace A {
namespace B {
namespace C {

/// Doc comment
namespace D {
  // ...
}

}
}
}

Output:

namespace A::B::C {

/// Doc comment
namespace D {
  // ...
}

}

Test 3: play well with other clang-tidy checks, like e.g. google/;lvm-namespace-
comment

Input:

namespace A {
namespace B {
namespace C {

/// Doc comment
namespace D {
  // ...
}  // namespace D

}  // namespace C
}  // namespace B
}  // namespace A

Output

namespace A::B::C {

/// Doc comment
namespace D {
  // ...
}  // namespace D

}  // namespace A::B::C