[PATCH] D69855: [clang-tidy] Fix llvm-namespace-comment for macro expansions

Marcin Twardak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 10:00:50 PST 2019


twardakm added a comment.

The reason for this whole patch was a bug in clang-tidy, which caused warning in the following code:

  #define SOME_RANDOM_MACRO macro
  
  namespace SOME_RANDOM_MACRO {
  
  } // namespace SOME_RANDOM_MACRO

and clang-tidy suggested:

  namespace SOME_RANDOM_MACRO {
  
  } // namespace macro

which is obviously wrong.

During review we decided that it would be a good idea (apparently not so good) to detect macro expansions and force users to use only macro definitions. This could be useful to avoid mixing macro definitions with macro expansions.

@alexfh, @gribozavr2, @aaron.ballman I think the best way out here is just to implement the basic fix for the above problem and only allow to use macro definition in closing comment and skip checking macro expansions completely. If you agree I will provide a patch for that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69855





More information about the cfe-commits mailing list