[PATCH] D70974: [clang-tidy] Fix PR26274

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 09:32:44 PST 2019


alexfh added a comment.

In D70974#1769036 <https://reviews.llvm.org/D70974#1769036>, @gribozavr2 wrote:

> In D70974#1768902 <https://reviews.llvm.org/D70974#1768902>, @aaron.ballman wrote:
>
> > In D70974#1768871 <https://reviews.llvm.org/D70974#1768871>, @gribozavr2 wrote:
> >
> > > I'm not convinced this feature is worth implementing at all, because there's a good alternative to a macro here -- a namespace alias. What is the reason to use a macro instead of a namespace alias?
> >
> >
> > While I think that's a superior solution to using macros, some users have macros instead. This fixes a bug reported in https://bugs.llvm.org/show_bug.cgi?id=26274 and I agree that the behavior described in that bug is not what I would expect it to be.
>
>
> I mean, it is possible to break pretty much any ClangTidy check with sneaky code. But there's a limit to which we should try to make things work in tricky corner cases. For example, the fix in this patch does not handle function-like macros (`namespace MY_LIBRARY_NAMESPACE_FOR_VERSION(42) {`).
>
> LGTM if we must... but I don't think we should.


Apart from preprocessor-related stuff, this patch improves support for nested inline namespace declarations (`namespace a::inline b::c`), attributes on namespaces and comments inside namespace declarations. And also reduces the number of special cases. It should be a net positive effect ;)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70974/new/

https://reviews.llvm.org/D70974





More information about the cfe-commits mailing list