================
@@ -20,6 +20,10 @@ namespace {
AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
if (Node.isConstexpr())
return true;
+ if (llvm::any_of(Node.redecls(), [](const VarDecl *D) {
+ return D->hasAttr<ConstInitAttr>();
+ }))
+ return true;
----------------
zeyi2 wrote:
IMO we have to do that: https://clang-tidy.godbolt.org/z/qTbvKs69W
```c++
extern int b;
constinit int b = 42;
```
```
|-VarDecl prev 0x11b00d88 <line:7:1, col:19> col:15 b 'int' cinit
| |-IntegerLiteral <col:19> 'int' 42
| `-ConstInitAttr <col:1> constinit
```
`extern int b` doesn't have `ConstInitAttr`
> Do we have a test to cover this?
Currently no, I'll add a few new tests tomorrow :)
https://github.com/llvm/llvm-project/pull/174744
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits