summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 03920982ee08..8d1b2ea5d522 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2368,6 +2368,8 @@ void CodeGenModule::EmitDeferred() {
}
// Emit CUDA/HIP static device variables referenced by host code only.
+ // Note we should not clear CUDADeviceVarODRUsedByHost since it is still
+ // needed for further handling.
if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice)
for (const auto *V : getContext().CUDADeviceVarODRUsedByHost)
DeferredDeclsToEmit.push_back(V);