From 8a27a2f89f83c55d352c001b3b308c35900cbdfc Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Fri, 22 Apr 2022 22:56:15 -0700 Subject: [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 --- clang/lib/Frontend/CompilerInvocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 82dcc2a..7073828 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -510,6 +510,10 @@ static bool FixupInvocation(CompilerInvocation &Invocation, Diags.Report(diag::err_drv_argument_not_allowed_with) << "-fgnu89-inline" << GetInputKindName(IK); + if (Args.hasArg(OPT_hlsl_entrypoint) && !LangOpts.HLSL) + Diags.Report(diag::err_drv_argument_not_allowed_with) + << "-hlsl-entry" << GetInputKindName(IK); + if (Args.hasArg(OPT_fgpu_allow_device_init) && !LangOpts.HIP) Diags.Report(diag::warn_ignored_hip_only_option) << Args.getLastArg(OPT_fgpu_allow_device_init)->getAsString(Args); -- cgit v1.1