This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix wrong parameter name in printFormattedEntry
ClosedPublic

Authored by nullptr.cpp on Aug 27 2020, 1:56 AM.

Details

Summary

Function printFormattedEntry has declaration:

static void printFormattedEntry(
    llvm::raw_ostream &Out,
    std::pair<StringRef, StringRef> EntryDescPair,
    size_t EntryWidth, size_t InitialPad, size_t MinLineWidth = 0);

But in its definition:

void AnalyzerOptions::printFormattedEntry(
    llvm::raw_ostream &Out,
    std::pair<StringRef, StringRef> EntryDescPair,
    size_t InitialPad, size_t EntryWidth, size_t MinLineWidth) {

EntryWidth and InitialPad have different position.

The definition code and all printFormattedEntry's usages use the same
position as the definition, so fix the wrong parameter name in declaration.
Also fix some errors in the comments and make the comments clearer.

Diff Detail

Event Timeline

nullptr.cpp created this revision.Aug 27 2020, 1:56 AM
nullptr.cpp requested review of this revision.Aug 27 2020, 1:56 AM
Szelethus accepted this revision.Aug 27 2020, 2:13 AM

Nice, thank you! Did you stumble across this, or found it with a tool?

This revision is now accepted and ready to land.Aug 27 2020, 2:13 AM

Nice, thank you! Did you stumble across this, or found it with a tool?

I just happened to see these code:-).
Maybe we should write a checker to check this situation? I will start doing this!

BTW, I don't have commit access, can you help commit this and D86334? Thanks!

martong accepted this revision.Aug 27 2020, 6:16 AM

Nice, thank you! Did you stumble across this, or found it with a tool?

I just happened to see these code:-).
Maybe we should write a checker to check this situation? I will start doing this!

Good idea! And thanks for the fix! :)

@Szelethus @martong
Sorry to interrupt, I don't have commit access, can you help commit this and D86334?
Yang Fan <nullptr.cpp@gmail.com>
Thanks!

@Szelethus @martong
Sorry to interrupt, I don't have commit access, can you help commit this and D86334?
Yang Fan <nullptr.cpp@gmail.com>
Thanks!

Yep, no problem, I'll commit them tomorrow, first thing! Thanks again!

Nice, thank you! Did you stumble across this, or found it with a tool?

I just happened to see these code:-).
Maybe we should write a checker to check this situation? I will start doing this!

Good idea! And thanks for the fix! :)

There already have a clang-tidy checker can check this situation.
See readability-inconsistent-declaration-parameter-name for more information.