[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 23:21:05 PDT 2022


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseInlineConstVariablesInHeadersCheck.cpp:64-68
+      unless(hasType(isVolatileQualified())),             // non-volatile
+      unless(isTemplateVariable()),                       // non-template
+      unless(isVarInline()),                              // non-inline
+      unless(isExternC()),               // not "extern C" variable
+      unless(isInAnonymousNamespace())); // not within an anonymous namespace
----------------
LegalizeAdulthood wrote:
> Comment: Why don't we have a variadic `unless(...)` matcher?
> 
> Is there any utility to reordering these `unless()` clauses in
> order of "most likely encountered first" to get an early out
> when matching?
does `unless(isVarInline(), isExternC())` mean `unless(isVarInline() && isExternC())` or `unless(isVarInline() || isExternC())`
This kind of ambiguity could be addressed with `unlessAllOf` and `unlessAnyOf` but I don't think its worth the effort.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118743



More information about the cfe-commits mailing list