[Mlir-commits] [mlir] b454ecc - [mlir] Apply ClangTidy fix (NFC)

Adrian Kuegel llvmlistbot at llvm.org
Mon Aug 28 01:54:08 PDT 2023


Author: Adrian Kuegel
Date: 2023-08-28T10:53:15+02:00
New Revision: b454ecc84f988f4e59288d1d606605c8fd261686

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

LOG: [mlir] Apply ClangTidy fix (NFC)

Prefer to use .empty() instead of checking for size() > 0.

Added: 
    

Modified: 
    mlir/lib/Dialect/GPU/IR/GPUDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 7c1d8b0e1abb73..317510063933a8 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -1578,7 +1578,7 @@ void GPUModuleOp::build(OpBuilder &builder, OperationState &result,
 void GPUModuleOp::build(OpBuilder &builder, OperationState &result,
                         StringRef name, ArrayRef<Attribute> targets) {
   build(builder, result, name,
-        targets.size() > 0 ? builder.getArrayAttr(targets) : ArrayAttr());
+        targets.empty() ? ArrayAttr() : builder.getArrayAttr(targets));
 }
 
 ParseResult GPUModuleOp::parse(OpAsmParser &parser, OperationState &result) {
@@ -1661,7 +1661,7 @@ void BinaryOp::build(OpBuilder &builder, OperationState &result, StringRef name,
 void BinaryOp::build(OpBuilder &builder, OperationState &result, StringRef name,
                      Attribute offloadingHandler, ArrayRef<Attribute> objects) {
   build(builder, result, name, offloadingHandler,
-        objects.size() > 0 ? builder.getArrayAttr(objects) : ArrayAttr());
+        objects.empty() ? ArrayAttr() : builder.getArrayAttr(objects));
 }
 
 static ParseResult parseOffloadingHandler(OpAsmParser &parser,


        


More information about the Mlir-commits mailing list