The parsing of GNU C extended asm statements was a little brittle and
had a few issues:
- It was using Parse::ParseTypeQualifierListOpt to parse the volatile qualifier. That parser is really meant for TypeQualifiers; an asm statement doesn't really have a type qualifier. This is still maybe nice to have, but not necessary. We now can check for the volatile token by properly expanding the grammer, rather than abusing Parse::ParseTypeQualifierListOpt.
- The parsing of goto was position dependent, so asm goto volatile wouldn't parse. The qualifiers should be position independent to one another. Now they are.
- We would warn on duplicate volatile, but the parse error for duplicate goto was a generic parse error and wasn't clear.
- We need to add support for the recent GNU C extension asm inline. Adding support to the parser with the above issues highlighted the need for this refactoring.
If we know of any compilers that support asm statements with qualifiers other than what Clang supports, it may make sense for these diagnostics to be warnings that are treated as an error by default so that users can disable the warning when compiling with Clang. I don't know of any such compilers off the top of my head, but perhaps you know of some.