[PATCH] D71272: [OpenCL] Pretty print __private addr space

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 10 07:33:24 PST 2019


Anastasia created this revision.
Anastasia added reviewers: svenvh, mantognini, bader, arsenm, yaxunl.
Herald added subscribers: ebevhan, jfb, arphaman, wdng.

Historically Clang didn't have representation of `__private` and therefore it has never been printed in types. It appeared to be the same as no address space and appeared to be confusing to the users. Also it was unnecessarily exposing the implementation details of Clang.

We have added a representation of it in AST https://reviews.llvm.org/D35082 but it hasn't been added to the type printing yet.

Current patch adds printing of `__private` in type printer. The main motivation for this are:

1. Avoid situations where `__private` addr space is missing in the type of diagnostics even if it was provided in the source code.
2. Improve frontend debugging support because we  will now be able to differentiate between `__private` and absence of addr space in AST dumps.

There is one potential issue that some diagnostics will become more verbose with extra `__private` addr spaces being printed that were deduced implicitly. This aligns however with the rest of behaviour i.e. deduced `__generic` addr space is currently printed in AST dump and diagnostics. It is also reasonable for deduced addr spaces to appear in type printing because it can be explained by the language rules. However, absence of `__private` from type printing has been an implementation detail of Clang that never was intuitive to the users.


https://reviews.llvm.org/D71272

Files:
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Index/opencl-types.cl
  clang/test/Parser/opencl-astype.cl
  clang/test/Parser/opencl-atomics-cl20.cl
  clang/test/SemaOpenCL/access-qualifier.cl
  clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
  clang/test/SemaOpenCL/address-spaces.cl
  clang/test/SemaOpenCL/arithmetic-conversions.cl
  clang/test/SemaOpenCL/as_type.cl
  clang/test/SemaOpenCL/atomic-ops.cl
  clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
  clang/test/SemaOpenCL/clk_event_t.cl
  clang/test/SemaOpenCL/event_t.cl
  clang/test/SemaOpenCL/extension-begin.cl
  clang/test/SemaOpenCL/half.cl
  clang/test/SemaOpenCL/images.cl
  clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
  clang/test/SemaOpenCL/invalid-block.cl
  clang/test/SemaOpenCL/invalid-image.cl
  clang/test/SemaOpenCL/invalid-kernel-parameters.cl
  clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
  clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
  clang/test/SemaOpenCL/null_literal.cl
  clang/test/SemaOpenCL/null_queue.cl
  clang/test/SemaOpenCL/predefined-expr.cl
  clang/test/SemaOpenCL/queue_t_overload.cl
  clang/test/SemaOpenCL/shifts.cl
  clang/test/SemaOpenCL/to_addr_builtin.cl
  clang/test/SemaOpenCL/vec_step.cl
  clang/test/SemaOpenCL/vector_conv_invalid.cl
  clang/test/SemaOpenCLCXX/address-space-deduction.cl
  clang/test/SemaOpenCLCXX/address-space-lambda.cl
  clang/test/SemaOpenCLCXX/address-space-templates.cl
  clang/test/SemaOpenCLCXX/addrspace-auto.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71272.233088.patch
Type: text/x-patch
Size: 126610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191210/07f267ce/attachment-0001.bin>


More information about the cfe-commits mailing list