[Sema] Fix reporting of invalid shader attribute on HLSL entry function
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 5 Apr 2023 18:25:21 +0000 (19:25 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 6 Apr 2023 09:56:01 +0000 (10:56 +0100)
commit03a9a1e664de58fb52ce93e9fb73f61e75a5359a
treed412a5e1114df73893a02ec4af6450df807dc588
parentb29ec28fd67fb72b007d9d763d4c054e5fd9cd63
[Sema] Fix reporting of invalid shader attribute on HLSL entry function

If the HLSL entry function had a shader attribute that conflicted
with the pipeline stage specified in the target triple, Clang
would emit:

   error: (null) attribute parameters do not match the previous declaration
   conflicting attribute is here

(where the second line doesn't reference an attribute).

This was because the code constructed a dummy attribute that had
only a source location, but no kind or syntax.

Noticed while doing some changes to the attribute handling.

Differential Revision: https://reviews.llvm.org/D147657
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaHLSL/entry_shader.hlsl [new file with mode: 0644]