Issue 154762
Summary Clang-tidy invalid suggestion: readability-container-size-empty
Labels clang-tidy
Assignees
Reporter joker-eph
    With clang-tidy built at current head and applying it on MLIR:

```
$ clang-tidy -p build mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp --checks=-*,readability-container-size-empty -fix -fix-errors
```

Yields this diff:

```
diff --git a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
index 7659481cd607..6d482f35eb31 100644
--- a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
@@ -183,7 +183,7 @@ LLVMTypeConverter::LLVMTypeConverter(MLIRContext *ctx,
       // If it has been initialized, has the same body and packed bit, just use
       // it. This ensures that recursive structs keep being recursive rather
       // than including a non-updated name.
-      if (TypeRange(convertedType.getBody()) == TypeRange(convertedElemTypes) &&
+ if (TypeRange(convertedElemTypes).empty() &&
 convertedType.isPacked() == type.isPacked()) {
 results.push_back(convertedType);
         return success();
```

I don't quite get the logic that clang-tidy applied, but that's not equivalent (this lead to a test failure).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to