[all-commits] [llvm/llvm-project] c50ef3: [ParserHLSL] Attempt to parse HLSL annotations on ...
Joshua Batista via All-commits
all-commits at lists.llvm.org
Fri Jun 28 01:54:16 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c50ef30cce32b8e864b90a4ca27c68882d46a19c
https://github.com/llvm/llvm-project/commit/c50ef30cce32b8e864b90a4ca27c68882d46a19c
Author: Joshua Batista <jbatista at microsoft.com>
Date: 2024-06-28 (Fri, 28 Jun 2024)
Changed paths:
M clang/include/clang/Parse/Parser.h
M clang/lib/Parse/ParseDeclCXX.cpp
M clang/lib/Parse/ParseHLSL.cpp
M clang/lib/Sema/SemaHLSL.cpp
A clang/test/ParserHLSL/bitfields.hlsl
A clang/test/ParserHLSL/hlsl_annotations_on_struct_members.hlsl
M clang/test/SemaHLSL/Semantics/invalid_entry_parameter.hlsl
M clang/test/SemaHLSL/resource_binding_attr_error.hlsl
Log Message:
-----------
[ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (#96346)
`MaybeParseHLSLAnnotations` should be run on Field Decls instead of just
assuming that any colon after a field decl is a bitfield. In the case
that HLSL is the language, the code after the colon may be an
annotation. This PR gives the parser a chance to parse the subsequent
text as if it was an HLSL annotation.
The burden of parsing is now on the HLSL parser, but the actual work
needs to be done in handling every case of an hlsl annotation on a field
decl. SV_DispatchThreadID was straightforward enough to implement in
this PR, and tests have been added that the annotation appears as an
attribute in the AST.
Previously, the `hlsl_annotations_on_struct_members.hlsl` test would
result in an error shown below on the line that declares variable `a` in
struct Eg9:
error: use of undeclared identifier
'SV_DispatchThreadID'
This is because the annotation is parsed as if it was a c++ bit field,
and an identifier
that represents an integer is expected, but not found.
This test ensures that hlsl annotations are parsed when parsing struct
decls.
This test not only ensures we make progress by moving the validation
error from the realm of
C++ and expecting bitfields, to HLSL and a specialized error for the
recognized annotation, but also
validates that the parser does parse the annotation and adds an
attribute to the field decl in the AST.
Fixes https://github.com/llvm/llvm-project/issues/57889
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