From ddeab07ca63235f8d952e1171b56fdb0f2d761c9 Mon Sep 17 00:00:00 2001 From: Anubhab Ghosh Date: Mon, 6 Mar 2023 16:50:02 +0530 Subject: [clang-repl][CUDA] Re-land: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d809e7063cf0..d2a28b66cac9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -6272,6 +6272,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 &CurCGF = GlobalTopLevelStmtBlockInFlight.first; -- cgit v1.2.3