This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Make readability-string-compare check use <string> header
ClosedPublic

Authored by mikecrowe on Mar 4 2023, 1:09 PM.

Details

Summary

Improve the generic <string> header by adding another constructor,
std::basic_string::empty and operator!= overload set so that it can be
used to replace the custom implementation in the
readability-string-compare check.

Depends on D145311

Diff Detail

Event Timeline

mikecrowe created this revision.Mar 4 2023, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2023, 1:09 PM
Herald added a subscriber: xazax.hun. · View Herald Transcript
mikecrowe requested review of this revision.Mar 4 2023, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2023, 1:09 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
carlosgalvezp added inline comments.Mar 5 2023, 9:37 AM
clang-tools-extra/test/clang-tidy/checkers/readability/string-compare.cpp
4–8

Would it make sense to add these to the new header?

mikecrowe marked an inline comment as done.Mar 9 2023, 12:51 PM
mikecrowe added inline comments.
clang-tools-extra/test/clang-tidy/checkers/readability/string-compare.cpp
4–8
This revision is now accepted and ready to land.Mar 10 2023, 1:53 AM

@PiotrZSL I believe you have landed some patches of this chain. Would you mind sharing how you do it? I'm not an expert in Phabricator and simply doing arc patch D145312 leads to cherry-pick conflicts, and when I solve them I don't end up having this patch as HEAD. With this knowledge I will be able to help out closing these patches!

@mikecrowe I seems I cannot land this until it's rebased on top of main, would you be able to do that? Thanks!

PiotrZSL added a comment.EditedMar 12 2023, 6:28 AM

@PiotrZSL I believe you have landed some patches of this chain. Would you mind sharing how you do it? I'm not an expert in Phabricator and simply doing arc patch D145312 leads to cherry-pick conflicts, and when I solve them I don't end up having this patch as HEAD. With this knowledge I will be able to help out closing these patches!

arc patch --nobranch --skip-dependencies D145312
I will push them...

@PiotrZSL I believe you have landed some patches of this chain. Would you mind sharing how you do it? I'm not an expert in Phabricator and simply doing arc patch D145312 leads to cherry-pick conflicts, and when I solve them I don't end up having this patch as HEAD. With this knowledge I will be able to help out closing these patches!

arc patch --nobranch --skip-dependencies D145312
I will push them...

Ahh that was it, thank you!