Skip to content

Conversation

@google-yfyang
Copy link
Contributor

#165519 causes some builds to fail.
[clang/lib/CodeGen/CGCUDARuntime.cpp:65]:15: error: unused variable 'Ctx' [-Werror,-Wunused-variable]
65 | ASTContext &Ctx = CGM.getContext();

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. labels Dec 1, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 1, 2025

@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-clang

Author: None (google-yfyang)

Changes

#165519 causes some builds to fail.
[clang/lib/CodeGen/CGCUDARuntime.cpp:65]:15: error: unused variable 'Ctx' [-Werror,-Wunused-variable]
65 | ASTContext &Ctx = CGM.getContext();


Full diff: https://github.com/llvm/llvm-project/pull/170205.diff

1 Files Affected:

  • (modified) clang/lib/CodeGen/CGCUDARuntime.cpp (+2-2)
diff --git a/clang/lib/CodeGen/CGCUDARuntime.cpp b/clang/lib/CodeGen/CGCUDARuntime.cpp
index 9cbdb641d00a1..9c831b26c3a7b 100644
--- a/clang/lib/CodeGen/CGCUDARuntime.cpp
+++ b/clang/lib/CodeGen/CGCUDARuntime.cpp
@@ -62,8 +62,8 @@ static llvm::Value *emitGetParamBuf(CodeGenFunction &CGF,
 RValue CGCUDARuntime::EmitCUDADeviceKernelCallExpr(
     CodeGenFunction &CGF, const CUDAKernelCallExpr *E,
     ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke) {
-  ASTContext &Ctx = CGM.getContext();
-  assert(Ctx.getcudaLaunchDeviceDecl() == E->getConfig()->getDirectCallee());
+  assert(CGM.getContext().getcudaLaunchDeviceDecl() ==
+         E->getConfig()->getDirectCallee());
 
   llvm::BasicBlock *ConfigOKBlock = CGF.createBasicBlock("dkcall.configok");
   llvm::BasicBlock *ContBlock = CGF.createBasicBlock("dkcall.end");

@google-yfyang google-yfyang changed the title Fix an unused variable error when compiled with optimization [CUDA] Fix an unused variable error when compiled with optimization Dec 1, 2025
@google-yfyang
Copy link
Contributor Author

@rupprecht Can you take a look at this?

@rupprecht rupprecht changed the title [CUDA] Fix an unused variable error when compiled with optimization [CUDA][NFC] Fix an unused variable error when compiled with optimization Dec 1, 2025
@rupprecht rupprecht merged commit e0e897e into llvm:main Dec 1, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants