[all-commits] [llvm/llvm-project] 246398: [clang][Parse] properly parse asm-qualifiers, asm ...

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Thu Mar 12 15:25:46 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 246398ece7115b57a02dbe7876d86ae8e72406ef
      https://github.com/llvm/llvm-project/commit/246398ece7115b57a02dbe7876d86ae8e72406ef
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2020-03-12 (Thu, 12 Mar 2020)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseStmtAsm.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/test/CodeGen/inline-asm-mixed-style.c
    A clang/test/Parser/asm-qualifiers.c
    M clang/test/Parser/asm.c
    M clang/test/Sema/asm.c

  Log Message:
  -----------
  [clang][Parse] properly parse asm-qualifiers, asm inline

Summary:
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.

Link: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aheejin, jfb, nathanchance, cfe-commits, echristo, efriedma, rsmith, chandlerc, craig.topper, erichkeane, jyu2, void, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75563




More information about the All-commits mailing list