Izaron added a comment.

I'm going to use this matcher very soon in my new `clang-tidy` check.

If you're interested and want to read more, I have a design document about my 
ne check - here (gist.github.com) 
<https://gist.github.com/Izaron/74b087007380a901714e8bd23f61fba2#initialized-constinit-object-that-is-const-qualified-and-has-constant-destruction-should-rather-be-constexpr>
 is the concrete check for `constinit` variables.

I think an ASTMatcher would be good, because:

1. As far I tried there is no way to get only `constinit` variables in 
`clang-query` (?)
2. The way to check in code if a variable is `constinit` is not quite obvious. 
A user may expect `Node.isConstinit()` (because `Node.isConstexpr()` works), 
but it's not working. The user has to examine AST and grep until they find 
`Node.hasAttr<ConstInitAttr>()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117846

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to