[all-commits] [llvm/llvm-project] 45ccfd: Treat opencl_unroll_hint subject errors as semanti...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Fri Feb 5 04:21:13 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45ccfd9c9d0311371a8217c15c2ef3ba969a0aff
      https://github.com/llvm/llvm-project/commit/45ccfd9c9d0311371a8217c15c2ef3ba969a0aff
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2021-02-05 (Fri, 05 Feb 2021)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseStmt.cpp
    M clang/lib/Sema/SemaStmtAttr.cpp
    M clang/test/Parser/opencl-unroll-hint.cl

  Log Message:
  -----------
  Treat opencl_unroll_hint subject errors as semantic rather than parse errors

The attribute definition claimed the attribute was inheritable (which
only applies to declaration attributes) and not a statement attribute.
Further, it treats subject appertainment errors as being parse errors
rather than semantic errors, which leads to us accepting invalid code.
For instance, we currently fail to reject:

void foo() {
  int i = 1000;
  __attribute__((nomerge, opencl_unroll_hint(8)))
  if (i) { foo(); }
}

This addresses the issues by clarifying that opencl_unroll_hint is a
statement attribute and handles its appertainment checks in the
semantic layer instead of the parsing layer. This changes the output of
the diagnostic text to be more consistent with other appertainment
errors.




More information about the All-commits mailing list