aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2020-05-01 11:30:24 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2020-06-03 21:56:52 -0400
commit049d860707ef22978b9379fee6dce38c66a22671 (patch)
tree8bd4686a0f42597f0424f9a916112435c9282f94 /clang/lib/Lex/ModuleMap.cpp
parentb6020c330d3826aa542164842d6ba71fdee3650b (diff)
downloadllvm-049d860707ef22978b9379fee6dce38c66a22671.zip
llvm-049d860707ef22978b9379fee6dce38c66a22671.tar.gz
llvm-049d860707ef22978b9379fee6dce38c66a22671.tar.bz2
[CUDA][HIP] Fix constexpr variables for C++17
constexpr variables are compile time constants and implicitly const, therefore they are safe to emit on both device and host side. Besides, in many cases they are intended for both device and host, therefore it makes sense to emit them on both device and host sides if necessary. In most cases constexpr variables are used as rvalue and the variables themselves do not need to be emitted. However if their address is taken, then they need to be emitted. For C++14, clang is able to handle that since clang emits them with available_externally linkage together with the initializer. However for C++17, the constexpr static data member of a class or template class become inline variables implicitly. Therefore they become definitions with linkonce_odr or weak_odr linkages. As such, they can not have available_externally linkage. This patch fixes that by adding implicit constant attribute to file scope constexpr variables and constexpr static data members in device compilation. Differential Revision: https://reviews.llvm.org/D79237
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions