[clang] abe3b90 - [CIR] Fix warnings, again! (#135284)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 11 10:57:12 PDT 2025


Author: Andy Kaylor
Date: 2025-04-11T10:57:08-07:00
New Revision: abe3b90b3fa49829a165f2174191c33542597052

URL: https://github.com/llvm/llvm-project/commit/abe3b90b3fa49829a165f2174191c33542597052
DIFF: https://github.com/llvm/llvm-project/commit/abe3b90b3fa49829a165f2174191c33542597052.diff

LOG: [CIR] Fix warnings, again! (#135284)

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.

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenFunction.h
    clang/lib/CIR/CodeGen/CIRGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index 8082592598c19..a96d277d0bc0b 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


        


More information about the cfe-commits mailing list