[PATCH] D25845: [CUDA] Ignore implicit target attributes during function template instantiation.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 13:51:43 PDT 2016


tra created this revision.
tra added reviewers: jlebar, rsmith.
tra added a subscriber: cfe-commits.

Some functions and templates are treated as `__host__` `__device__` even when they don't have explicitly specified target attributes.
What's worse, this treatment may change depending on command line options (-fno-cuda-host-device-constexpr) or `#pragma clang force_cuda_host_device`.

Combined with strict checking for matching function target that comes with https://reviews.llvm.org/D25809, it makes it hard to write code which would explicitly instantiate or specialize some functions regardless of pragmas or command line options in effect.

This patch changes the way we match target attributes of base template vs attributes used in explicit instantiation or specialization so that only explicitly specified attributes are considered.


https://reviews.llvm.org/D25845

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaCUDA.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaTemplate.cpp
  test/SemaCUDA/function-template-overload.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25845.75348.patch
Type: text/x-patch
Size: 9949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161020/2cafdd5f/attachment.bin>


More information about the cfe-commits mailing list