[HLSL] Support -E option for HLSL.
authorXiang Li <python3kgae@outlook.com>
Sat, 23 Apr 2022 05:56:15 +0000 (22:56 -0700)
committerXiang Li <python3kgae@outlook.com>
Thu, 4 Aug 2022 23:54:19 +0000 (16:54 -0700)
commit8a27a2f89f83c55d352c001b3b308c35900cbdfc
treeaa5fcd61fa8a0c198af3298735e1bfe4236b044d
parent4982d8ac7694591d541492faac0f6d9091a18540
[HLSL] Support -E option for HLSL.

-E option will set entry function for hlsl.
The format is -E entry_name.

To avoid conflict with existing option with name 'E', add an extra prefix '--'.

A new field HLSLEntry is added to TargetOption.
To share code with HLSLShaderAttr, entry function will be add HLSLShaderAttr attribute too.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D124751
15 files changed:
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/TargetOptions.h
clang/include/clang/Driver/Options.td
clang/include/clang/Sema/Sema.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Driver/dxc_E.hlsl [new file with mode: 0644]
clang/test/Driver/hlsl-entry.cpp [new file with mode: 0644]
clang/test/SemaHLSL/entry.hlsl [new file with mode: 0644]
clang/test/SemaHLSL/prohibit_pointer.hlsl
clang/test/SemaHLSL/shader_type_attr.hlsl