[PATCH] D119045: Fix address space for function types with AS qualifier

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 11:49:15 PST 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some nits



================
Comment at: clang/lib/AST/ASTContext.cpp:11962-11963
 unsigned ASTContext::getTargetAddressSpace(QualType T) const {
-  return T->isFunctionType() ? getTargetInfo().getProgramAddressSpace()
-                             : getTargetAddressSpace(T.getQualifiers());
+  // For function type, return program address space, unless
+  // type has address space qualifier
+  return T->isFunctionType() && !T.hasAddressSpace()
----------------
How about something like that?


================
Comment at: clang/test/CodeGen/address-space-ptr32.c:3
+
+int foo() {
+  int (*__ptr32 a)(int);
----------------



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

https://reviews.llvm.org/D119045



More information about the cfe-commits mailing list