[PATCH] D71111: [Sema] Improve diagnostic about addr spaces for overload candidates

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 04:57:33 PST 2019


Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: ebevhan.

As discussed in https://reviews.llvm.org/D69938#inline-629726 this commit improves the diagnostic of addr spaces. The approach is currently reusing diagnostic streaming of `Qualifiers`.

There are a number of issues however:

1. Address spaces don't always have representation i.e. in C++ it is just a number or `Default` address space doesn't correspond to anything at all. For the former case with the current approach  we will get `'__attribute__((address_space(N)))'` printed into the diagnostic. For the latter one it will print `unqualified`.

2. In OpenCL we threat `__private` and `Default` in the same way and therefore it doesn't get printed. With this patch therefore `unqualified` will appear even if `__private` was specified in the original source. There is a bug open to fix that however: https://bugs.llvm.org/show_bug.cgi?id=43295. Perhaps it should be fixed as soon as this gets committed.


https://reviews.llvm.org/D71111

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaOverload.cpp
  clang/test/SemaCXX/address-space-references.cpp
  clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
  clang/test/SemaOpenCLCXX/address-space-lambda.cl
  clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71111.232534.patch
Type: text/x-patch
Size: 8881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191206/240be0a7/attachment.bin>


More information about the cfe-commits mailing list