[Mlir-commits] [mlir] 8f072bb - [MLIR] Fix warnings in AttrTypeSubElements.h

Uday Bondhugula llvmlistbot at llvm.org
Tue Mar 21 05:26:14 PDT 2023


Author: Uday Bondhugula
Date: 2023-03-21T17:48:51+05:30
New Revision: 8f072bbd74021d1aee913ae500d439a23b591297

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

LOG: [MLIR] Fix warnings in AttrTypeSubElements.h

Fix warnings in AttrTypeSubElements.h (below) with GCC 9.4.0.

```
mlir/lib/IR/ExtensibleDialect.cpp:443:62:   required from here
mlir/include/mlir/IR/AttrTypeSubElements.h:412:37: warning: parameter ‘derived’ set but not used [-Wunused-but-set-parameter]
  412 | void walkImmediateSubElementsImpl(T derived,
      |                                   ~~^~~
```

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D146107

Added: 
    

Modified: 
    mlir/include/mlir/IR/AttrTypeSubElements.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/AttrTypeSubElements.h b/mlir/include/mlir/IR/AttrTypeSubElements.h
index fe3f4cd24effd..8382162d9a373 100644
--- a/mlir/include/mlir/IR/AttrTypeSubElements.h
+++ b/mlir/include/mlir/IR/AttrTypeSubElements.h
@@ -413,16 +413,17 @@ void walkImmediateSubElementsImpl(T derived,
                                   function_ref<void(Attribute)> walkAttrsFn,
                                   function_ref<void(Type)> walkTypesFn) {
   using ImplT = typename T::ImplType;
+  (void)derived;
+  (void)walkAttrsFn;
+  (void)walkTypesFn;
   if constexpr (llvm::is_detected<has_get_as_key, ImplT>::value) {
     auto key = static_cast<ImplT *>(derived.getImpl())->getAsKey();
 
     // If we don't have any sub-elements, there is nothing to do.
-    if constexpr (!has_sub_attr_or_type_v<decltype(key)>) {
+    if constexpr (!has_sub_attr_or_type_v<decltype(key)>)
       return;
-    } else {
-      AttrTypeImmediateSubElementWalker walker(walkAttrsFn, walkTypesFn);
-      AttrTypeSubElementHandler<decltype(key)>::walk(key, walker);
-    }
+    AttrTypeImmediateSubElementWalker walker(walkAttrsFn, walkTypesFn);
+    AttrTypeSubElementHandler<decltype(key)>::walk(key, walker);
   }
 }
 


        


More information about the Mlir-commits mailing list