summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAnubhab Ghosh <anubhabghosh.me@gmail.com>2023-03-06 16:50:02 +0530
committerAnubhab Ghosh <anubhabghosh.me@gmail.com>2023-05-20 14:00:48 +0530
commit80e7eed6a610ab3c7289e6f9b7ec006bc7d7ae31 (patch)
tree01efc2c4d2fa8819d158fca07890b2134f51010d /clang/lib/CodeGen/CodeGenModule.cpp
parent14f245d01a1ee489a13e843e9c77cecf5c7183a9 (diff)
[clang-repl][CUDA] Initial interactive CUDA support for clang-repl
CUDA support can be enabled in clang-repl with --cuda flag. Device code linking is not yet supported. inline must be used with all __device__ functions. Differential Revision: https://reviews.llvm.org/D146389
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5cd29d365787..803369009dfe 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -6255,6 +6255,10 @@ void CodeGenModule::EmitLinkageSpec(const LinkageSpecDecl *LSD) {
}
void CodeGenModule::EmitTopLevelStmt(const TopLevelStmtDecl *D) {
+ // Device code should not be at top level.
+ if (LangOpts.CUDA && LangOpts.CUDAIsDevice)
+ return;
+
std::unique_ptr<CodeGenFunction> &CurCGF =
GlobalTopLevelStmtBlockInFlight.first;