[PATCH] D141787: [clang-tidy] fix a false positive of `modernize-concat-nested-namespaces`

Vincent Hong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 22 08:46:45 PST 2023


v1nh1shungry added a comment.

Ping? @njames93



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp:173
+namespace n48 {
+// CHECK-MESSAGES-DAG: :[[@LINE-2]]:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
+// CHECK-FIXES: namespace n47::n48
----------------
v1nh1shungry wrote:
> njames93 wrote:
> > Is `CHECK-MESSAGES-DAG` needed here, why does it fail if this is omitted?
> Hmm, doesn't `CHECK-MESSAGES-DAG` means to check whether there is a message? (I referred to the tests above.)
> 
> If it's other cases, maybe it's due to https://github.com/llvm/llvm-project/issues/60051.
> 
> I'm not sure I understand what you mean, sorry!
> Hmm, doesn't `CHECK-MESSAGES-DAG` means to check whether there is a message? (I referred to the tests above.)
> 
> If it's other cases, maybe it's due to https://github.com/llvm/llvm-project/issues/60051.
> 
> I'm not sure I understand what you mean, sorry!

I think I understand now. You mean the whole test doesn't fail even without this `CHECK-MESSAGES-DAG`, right?

If so, this `CHECK-MESSAGES-DAG` is needed. I think the reason that the test doesn't fail without it is https://github.com/llvm/llvm-project/issues/60051. The check isn't applied correctly before I make any code changes, you can have a play with https://godbolt.org/z/nc34shM8W. But I think the problem isn't related to the check itself because when I apply this check through clangd's code action it produces correct codes as I mentioned in the GitHub issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141787



More information about the cfe-commits mailing list