[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:43:47 PST 2018


zturner added inline comments.


================
Comment at: include/llvm/DebugInfo/CodeView/CodeView.h:302
+  Unaligned = 0x0004,
+  Restrict = 0x0008
 };
----------------
zturner wrote:
> 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)
> ```
1 additional line of grep context for clarity:

```
$ llvm-pdbutil.exe dump -types restricttest.pdb | grep -B 1 0x104C
           options: has ctor / dtor | contains nested class | has unique name
  0x104C | LF_STRUCTURE [size = 36] `Foo`
--
  0x104D | LF_POINTER [size = 12]
           referent = 0x104C, mode = ref, opts = restrict, kind = ptr32
```


https://reviews.llvm.org/D43060





More information about the llvm-commits mailing list