[PATCH] D47630: [Sema] Allow creating types with multiple of the same addrspace.

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 7 09:18:42 PDT 2018


bader added inline comments.


================
Comment at: test/Sema/address_spaces.c:17
   int *_AS1 _AS2 *Z;  // expected-error {{multiple address spaces specified for type}}
+  int *_AS1 _AS1 *M;
 
----------------
ebevhan wrote:
> Anastasia wrote:
> > ebevhan wrote:
> > > bader wrote:
> > > > I think it might be valuable to give a warning or remark to user. 
> > > > Using the same address space qualifier multiple times is not something OpenCL C developers are supposed to do.
> > > > 
> > > The test is obviously a bit contrived, but it could happen by mistake, or as a result of some typedef or macro combination. It also cannot go wrong, so there's no harm in it happening.
> > > 
> > > I see your point, though. A warning feels like a bit much, so I'm not sure what else to use. A note?
> > Just checked for const qualifier we get a warning:
> >   warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
> > 
> > We could do the same... not sure if we could try to share the diagnostic as well.
> I have a patch ready that adds a warning in the same warning group and uses that. I'm not sure about reusing the other one since address spaces don't have to be declaration specifiers.
> 
> The warning is 'multiple identical address spaces specified for type', similar to the error. Is that acceptable?
Sounds good to me. Could you share your patch, please?


Repository:
  rC Clang

https://reviews.llvm.org/D47630





More information about the cfe-commits mailing list