[PATCH] D130123: Extend ptr32 support to be applied on typedef

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 08:00:27 PDT 2022


rnk added a comment.

That sounds reasonable to me, I confirmed that MSVC really only lets you apply these attributes directly to pointer types and to typedefs.

Can you add a test for the other most common type sugar node, the template parameter? It looks like this:

  template <typename T>
  void f(T __ptr32 a) {
      (*a) += 1;
  }
  void g(int *p) {
      f(p);
  }

If there isn't already a C++ test for __ptr32 & co, go ahead and make one.



================
Comment at: clang/lib/Sema/SemaType.cpp:7150
-  // type sugar between it and the pointer (other than attributes)? Eg, this
-  // disallows the attribute on a parenthesized pointer.
-  // And if so, should we really allow *any* type attribute?
----------------
I raised the issue because it wasn't clear if we had a definitive answer for the question in this FIXME.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130123



More information about the cfe-commits mailing list