================
@@ -800,6 +809,10 @@ void BTFDebug::visitDerivedType(const DIDerivedType *DTy, 
uint32_t &TypeId,
                                 bool CheckPointer, bool SeenPointer) {
   unsigned Tag = DTy->getTag();
 
+  if (Tag == dwarf::DW_TAG_atomic_type)
+    return visitTypeEntry(DTy->getBaseType(), TypeId, CheckPointer,
+                          SeenPointer);
+
----------------
eddyz87 wrote:

Below there is a check:

```c++
if (CheckPointer && SeenPointer) {
    const DIType *Base = DTy->getBaseType();
if (Base) {
  ...
```

Is it necessary to skip atomic there?
E.g. to handle situation like below:

```c
struct foo {
  void * _Atomic a;
} root;

/*
$ clang -O2 -g -mcpu=v3 --target=bpf -c test4.c -o test4.o && bpftool btf dump 
file test4.o
[1] STRUCT 'foo' size=8 vlen=1
        'a' type_id=2 bits_offset=0
[2] PTR '(anon)' type_id=0
[3] VAR 'root' type_id=1, linkage=global
[4] DATASEC '.bss' size=0 vlen=1
        type_id=3 offset=0 size=8 (VAR 'root')
*/
```

https://github.com/llvm/llvm-project/pull/107343
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to