[PATCH] D56644: [clang-tidy] readability-container-size-empty handle std::string length()

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 03:57:09 PDT 2023


PiotrZSL added inline comments.


================
Comment at: test/clang-tidy/readability-container-size-empty.cpp:135
+  // CHECK-FIXES: {{^  }}if (str.empty()){{$}}
+  if (str.length() == 0)
+    ;
----------------
MyDeveloperDay wrote:
> could you add a  test that checks if StringRef.str().length() >0 becomes !StringRef.str.empty()
> 
> e.g. 
> 
> 
> ```
> LLVM::StringRef ArgRef;
> ....
> return (ArgRef.str().length() > 0) ? ArgRef.str() + ")" : "()";
> ```
No point, should work anyway. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56644/new/

https://reviews.llvm.org/D56644



More information about the cfe-commits mailing list