This is an archive of the discontinued LLVM Phabricator instance.

clang-format: Fix namespace end comments for namespaces with attributes and macros
ClosedPublic

Authored by thakis on Jul 22 2019, 4:24 PM.

Details

Summary

Fixes PR39247.

While here, also make C++20 namespace A::inline B::inline C nested
inline namespaced definitions work.

Before:

#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
void f() {}
} // namespace DEPRECATE_WOOFwoof

namespace [[deprecated("meow")]] woof {
  void f() {}
} // namespace [[deprecated("meow")]]woof

namespace woof::inline bark {
  void f() {}
} // namespace woof::inlinebark

Now:

#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
void f() {}
} // namespace woof

namespace [[deprecated("meow")]] woof {
void f() {}
} // namespace woof

namespace woof::inline bark {
void f() {}
} // namespace woof::inline bark

(In addition to the fixed namespace end comments, also note the correct
indent of the namespace contents.)

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.Jul 22 2019, 4:24 PM
klimek accepted this revision.Jul 23 2019, 6:49 AM

LG, thx!

This revision is now accepted and ready to land.Jul 23 2019, 6:49 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2019, 10:49 AM