[PATCH] D95408: [Sema][C] members of anonymous struct inherit QualType

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 05:39:32 PST 2021


aaron.ballman added a comment.

I know we don't have to deal with `restrict` because that qualifies a pointer (so there's no way to use it with an anonymous struct), but are there others? There's `DeclSpec::TQ_unaligned` (which has no corresponding qualifier in `Qualifiers::TQ` despite the comment about keeping them in sync). Similarly, what about:

  struct S {
    _Atomic struct {
      int i;
    };
  }
  
  void foo(void) {
    struct S s;
    s.i = 12; // Is this an atomic assignment?
  }

Further, do we have to worry about things which are not type specifiers but still impact the declaration, like various type attributes?



================
Comment at: clang/test/AST/ast-dump-decl.c:132
 
+// CHECK: IndirectFieldDecl{{.*}} Test48755Const 'int'
+// CHECK-NEXT: Field{{.*}} 'const struct testIndirectFieldDecl::{{.*}}'
----------------
This looks wrong to me -- I would have assumed the type would be `const int` and not `int`, which would match the behavior if the type was directly qualified: https://godbolt.org/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95408



More information about the cfe-commits mailing list