[PATCH] D43060: [CodeView] Lower type for dwarf::DW_TAG_restrict_type type

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 14:40:11 PST 2018


zturner added inline comments.


================
Comment at: include/llvm/DebugInfo/CodeView/CodeView.h:302
+  Unaligned = 0x0004,
+  Restrict = 0x0008
 };
----------------
Can you post a code fragment that I can compile with cl.exe to see this value of 0x0008 being emitted on an `LF_MODIFIER` CodeView record?

We already have a `PointerOptions::Restrict` which is a separate enum from `ModifierOptions` and corresponds to an `LF_POINTER` record.  Are you sure this value is correct?

If I write this code:

```

struct Foo {
  int x;
};

void foo(Foo &__restrict f) {
  printf("%d", f.x);
}
```

Then cl generates an `LF_POINTER` record with the `restrict` option, but it doesn't generate a corresponding `LF_MODIFIER` record

```
$ llvm-pdbutil.exe dump -types restricttest.pdb | grep 0x104C
  0x104C | LF_STRUCTURE [size = 36] `Foo`
           referent = 0x104C, mode = ref, opts = restrict, kind = ptr32

$ llvm-pdbutil.exe dump -types restricttest.pdb | grep -A 1 LF_MODIFIER | grep 0x104C
  (no results)
```


================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1268-1269
     return lowerTypeModifier(cast<DIDerivedType>(Ty));
+  case dwarf::DW_TAG_restrict_type:
+    return lowerTypeModifier(cast<DIDerivedType>(Ty));
   case dwarf::DW_TAG_subroutine_type:
----------------
Based on the above hypothesis, is it possible that you need to instead use `lowerTypePointer` here?


https://reviews.llvm.org/D43060





More information about the llvm-commits mailing list