[clang] [HLSL] (DRAFT) Another way to implement #92071: [HLSL] Default linkage of HLSL function should be internal (PR #95331)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 13:02:58 PDT 2024


================
@@ -158,7 +158,8 @@ def FunctionTmpl
 
 def HLSLEntry
     : SubsetSubject<Function,
-                    [{S->isExternallyVisible() && !isa<CXXMethodDecl>(S)}],
+                   [{S->getDeclContext()->getRedeclContext()->isFileContext() &&
+                    S->getStorageClass() != SC_Static}],
----------------
pow2clk wrote:

Perhaps this is what's expected to enforce that entry functions not be static? From [this description](https://github.com/llvm/llvm-project/blob/a737b8704c031310460d492cef90eee5054cabd7/clang/include/clang/Basic/Attr.td#L84), it sounds to me like it would prevent a static function from being considered an entry function, which is appropriate, but doesn't produce any error when it does. 

https://github.com/llvm/llvm-project/pull/95331


More information about the cfe-commits mailing list