[PATCH] D123167: [HLSL] Pointers are unsupported in HLSL

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 13:41:44 PDT 2022


beanz added a comment.

In D123167#3434023 <https://reviews.llvm.org/D123167#3434023>, @aaron.ballman wrote:

> I think you're going to need semantic restrictions as well as parsing restrictions because of type deduction. Even if you don't support templates (yet), there's still `auto`, `decltype`, `__typeof__`, and `__auto_type` (I probably missed some, lol) to worry about.

Thankfully HLSL is like C++98-based... I don't think we support any of those cases.

> Also... can HLSL be combined with Objective-C mode (do we have to worry about their pointers as well)?

Oh god... Now you're giving me nightmares. I feel like implementing objc_msgsend on a GPU might be a bridge (or ten) too far...



================
Comment at: clang/test/ParserHLSL/parse_pointer.hlsl:23
+  return F->X;
+}
----------------
aaron.ballman wrote:
> Here are a few more fun test cases (which may require semantic tests instead of parsing tests):
> ```
> void func();
> 
> void devilish_language(auto look_ma_no_pointers); // templates get you the same effects as well
> 
> void test() {
>   int x;
>   devilish_language(&x); // I presume we want this to be diagnosed
>   devilish_language(func); // I think you wanted this to not be diagnosed?
>   devilish_language("oh no, not array decay!"); // Same here as function decay?
> 
>   auto but_but_but = "please, stop Aaron!" + 0; // Uhhh... is the addition okay but the declaration bad?
> 
>   int array[2];
>   *(&array[0] + 1) = 12; // Maaaayybbbe this is fine?
> }
> ```
> (Thing for you to double-check: do any targets predefine macros that expand to a pointer? I checked InitPreprocessor.cpp and things looked fine there, but I didn't check targets.)
I am in awe of your gift for finding ways to trip things up :)

I think most of these we can't hit because of `auto`. Eyeballing that lat case we _might_ handle it. I'll double check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123167



More information about the cfe-commits mailing list