[HIP] Add option -fgpu-allow-device-init
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Tue, 22 Oct 2019 17:41:25 +0000 (13:41 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Tue, 22 Oct 2019 20:06:20 +0000 (16:06 -0400)
commit68f5ca4e19c16f12895a6f0b9fbabc1d86c4b6b0
treedbbbee3f58bc3c4434dc32b519e06156d94c59a9
parent4334892e7b077feac3124b789733dbec3380db4c
[HIP] Add option -fgpu-allow-device-init

Add this option to allow device side class type global variables
with non-trivial ctor/dtor. device side init/fini functions will
be emitted, which will be executed by HIP runtime when
the fat binary is loaded/unloaded.

This feature is to facilitate implementation of device side
sanitizer which requires global vars with non-trival ctors.

By default this option is disabled.

Differential Revision: https://reviews.llvm.org/D69268
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/Driver/ToolChains/HIP.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Sema/SemaCUDA.cpp
clang/test/CodeGenCUDA/device-init-fun.cu [new file with mode: 0644]
clang/test/Frontend/warn-device-init-fun.cu [new file with mode: 0644]