Skip to content

Conversation

@andykaylor
Copy link
Contributor

The calleeDecl var will be used in the near future, so I left it. At least for clang, the [[maybe_unused]] attribute takes care of the warnings related to that variable. The other warning was a simple lack of return after errorNYI.

@andykaylor andykaylor requested a review from erichkeane April 10, 2025 23:39
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Apr 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clangir

Author: Andy Kaylor (andykaylor)

Changes

The calleeDecl var will be used in the near future, so I left it. At least for clang, the [[maybe_unused]] attribute takes care of the warnings related to that variable. The other warning was a simple lack of return after errorNYI.


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

2 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+1-1)
  • (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+1)
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index 17aa68492f983..0ca95625b313c 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -164,7 +164,7 @@ class CIRGenFunction : public CIRGenTypeCache {
   /// An abstract representation of regular/ObjC call/message targets.
   class AbstractCallee {
     /// The function declaration of the callee.
-    const clang::Decl *calleeDecl;
+    [[maybe_unused]] const clang::Decl *calleeDecl;
 
   public:
     AbstractCallee() : calleeDecl(nullptr) {}
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 4b5acb36a9319..fd11523ebba61 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -262,6 +262,7 @@ CIRGenModule::getOrCreateCIRGlobal(StringRef mangledName, mlir::Type ty,
   }
 
   errorNYI(d->getSourceRange(), "reference of undeclared global");
+  return {};
 }
 
 cir::GlobalOp

@andykaylor andykaylor merged commit abe3b90 into llvm:main Apr 11, 2025
14 checks passed
@andykaylor andykaylor deleted the cir-warnings branch April 11, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants