python3kgae updated this revision to Diff 432023.
python3kgae added a comment.

Update comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124753/new/

https://reviews.llvm.org/D124753

Files:
  clang/lib/Driver/ToolChains/HLSL.cpp
  clang/test/CodeGenHLSL/entry_default.hlsl


Index: clang/test/CodeGenHLSL/entry_default.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/entry_default.hlsl
@@ -0,0 +1,10 @@
+// RUN: %clang --driver-mode=dxc -Tcs_6_1 -fcgl -Fo - %s | FileCheck %s
+
+// Make sure main is default entry.
+// Make sure not mangle entry.
+// CHECK:define void @main()
+// Make sure add function attribute.
+// CHECK:"dx.shader"="compute"
+[numthreads(1, 1, 1)] void main() {
+
+}
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -188,5 +188,11 @@
                         Opts.getOption(options::OPT_dxil_validator_version),
                         DefaultValidatorVer);
   }
+  // If entry is not set explicitly, default is main.
+  if (!DAL->hasArg(options::OPT_hlsl_entrypoint)) {
+    const StringRef DefaultEntry = "main";
+    DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_hlsl_entrypoint),
+                        DefaultEntry);
+  }
   return DAL;
 }


Index: clang/test/CodeGenHLSL/entry_default.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/entry_default.hlsl
@@ -0,0 +1,10 @@
+// RUN: %clang --driver-mode=dxc -Tcs_6_1 -fcgl -Fo - %s | FileCheck %s
+
+// Make sure main is default entry.
+// Make sure not mangle entry.
+// CHECK:define void @main()
+// Make sure add function attribute.
+// CHECK:"dx.shader"="compute"
+[numthreads(1, 1, 1)] void main() {
+
+}
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -188,5 +188,11 @@
                         Opts.getOption(options::OPT_dxil_validator_version),
                         DefaultValidatorVer);
   }
+  // If entry is not set explicitly, default is main.
+  if (!DAL->hasArg(options::OPT_hlsl_entrypoint)) {
+    const StringRef DefaultEntry = "main";
+    DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_hlsl_entrypoint),
+                        DefaultEntry);
+  }
   return DAL;
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to