compnerd wrote:

> @compnerd This code snippet does not compile and I could not massage it into 
> a form where it would, so I suspect this case is not legal C++.

Sorry, this should give you the separated LinkageSpecDecl that changes:

```c++
namespace {
extern "C++" {
extern "C" {
  struct S {
    __attribute__((__used__)) static void f() { }
  };
}
}
}
```

```
|-NamespaceDecl 0x8c6d29a18 <reduced.cc:1:1, line:9:1> line:1:11
| `-LinkageSpecDecl 0x8c6d29b00 <line:2:1, line:8:1> line:2:8 C++
|   `-LinkageSpecDecl 0x8c6d29b70 <line:3:1, line:7:1> line:3:8 C
|     `-CXXRecordDecl 0x8c6d29bc0 <line:4:3, line:6:3> line:4:10 struct S 
definition
|       |-DefinitionData pass_in_registers empty aggregate standard_layout 
trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor 
can_const_default_init
|       | |-DefaultConstructor exists trivial constexpr needs_implicit 
defaulted_is_constexpr
|       | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
|       | |-MoveConstructor exists simple trivial needs_implicit
|       | |-CopyAssignment simple trivial has_const_param needs_implicit 
implicit_has_const_param
|       | |-MoveAssignment exists simple trivial needs_implicit
|       | `-Destructor simple irrelevant trivial needs_implicit
|       |-CXXRecordDecl 0x8c6d29cd8 <col:3, col:10> col:10 implicit struct S
|       `-CXXMethodDecl 0x8c6d29df0 <line:5:5, col:49> col:43 used f 'void ()' 
static implicit-inline
|         |-CompoundStmt 0x8c6d29f08 <col:47, col:49>
|         `-UsedAttr 0x8c6d29e98 <col:20>
```

The parent of `f` is not `LinkageSpecDecl` but `CXXRecordDecl`.

https://github.com/llvm/llvm-project/pull/176792
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to