[all-commits] [llvm/llvm-project] 2d0137: [clang] Differentiate between identifier and strin...

Sergei Barannikov via All-commits all-commits at lists.llvm.org
Sun Feb 18 06:44:31 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d0137dd64017c34101f8a763fd8958c20acd6bb
      https://github.com/llvm/llvm-project/commit/2d0137dd64017c34101f8a763fd8958c20acd6bb
  Author: Sergei Barannikov <barannikov88 at gmail.com>
  Date:   2024-02-18 (Sun, 18 Feb 2024)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/lib/Parse/ParseDecl.cpp
    M clang/test/Sema/attr-function-return.c
    M clang/test/Sema/callingconv-iamcu.c
    M clang/test/Sema/callingconv.c
    M clang/test/Sema/mips-interrupt-attr.c
    M clang/test/Sema/riscv-interrupt-attr.c
    M clang/test/Sema/zero_call_used_regs.c
    M clang/test/SemaCXX/warn-consumed-parsing.cpp
    M clang/test/SemaHLSL/shader_type_attr.hlsl
    M clang/utils/TableGen/ClangAttrEmitter.cpp

  Log Message:
  -----------
  [clang] Differentiate between identifier and string EnumArgument (#68550)

EnumArgument may be a string or an identifier. If it is a string, it
should be parsed as unevaluated string literal. Add IsString flag to
EnumArgument so that the parser can choose the correct parsing method.

Target-specific attributes that share spelling may have different
attribute "prototypes". For example, ARM's version of "interrupt"
attribute accepts a string enum, while MSP430's version accepts an
unsigned integer. Adjust ClangAttrEmitter so that the generated
`attributeStringLiteralListArg` returns the correct mask depending on
target triple.

It is worth noting that even after this change some string arguments are
still parsed as identifiers or, worse, as expressions. This is because
of some special logic in `ParseAttributeArgsCommon`. Fixing it is out of
scope of this patch.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list