This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] improve readability-identifier-naming hungarian options test
ClosedPublic

Authored by amurzeau on Feb 21 2023, 11:19 AM.

Details

Summary

Adjust identifier-naming-hungarian-notation-cfgfile test with
changes for all configs in .clang-tidy to ensure they are really taken
into account.

This is done this way:

  • Set all HungarianNotation.* options to cust prefix + their default value.
  • Set TreatStructAsClass to true as it defaults to false.
  • Because of the TreatStructAsClass change, add a test to check that structs are really checked the same way as classes (see struct StructCase).

Also, TreatStructAsClass was wrongly named in the test's .clang-tidy file
and was fixed (it is in General, not in Options).

Depends on D144431

Diff Detail

Event Timeline

amurzeau created this revision.Feb 21 2023, 11:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 11:19 AM
Herald added a subscriber: xazax.hun. · View Herald Transcript
amurzeau requested review of this revision.Feb 21 2023, 11:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 11:19 AM
This revision is now accepted and ready to land.Feb 21 2023, 10:58 PM

@amurzeau I'm having some trouble downloading the patch, would you mind trying out a rebase on top of latest master? Otherwise I'll try downloading the raw diff.

amurzeau updated this revision to Diff 500256.Feb 24 2023, 10:46 AM

Rebase on main

This revision was landed with ongoing or failed builds.Feb 24 2023, 11:18 AM
This revision was automatically updated to reflect the committed changes.

Hi @amurzeau

I missed the review before landing. I have a suggestion regarding the customized prefix "cust" because it confused me when I found the Hungarian notation patterns in the output message. Perhaps using "my" instead of "cust" would improve readability.

Take some examples:

  • const char *custszNamePtr = "Name"; --> myszNamePtr
  • uint8_t custu8ValueU8 = 0; --> myu8ValueU8
  • DWORD custdwMsDword = 0; --> mydwMsDword

Hi @amurzeau

I missed the review before landing. I have a suggestion regarding the customized prefix "cust" because it confused me when I found the Hungarian notation patterns in the output message. Perhaps using "my" instead of "cust" would improve readability.

Take some examples:

  • const char *custszNamePtr = "Name"; --> myszNamePtr
  • uint8_t custu8ValueU8 = 0; --> myu8ValueU8
  • DWORD custdwMsDword = 0; --> mydwMsDword

Hi,

Yes this is a good idea, m and y are less used as type prefixes.

Do you want to make the change ? I can do it if you want.

Hi @amurzeau

I missed the review before landing. I have a suggestion regarding the customized prefix "cust" because it confused me when I found the Hungarian notation patterns in the output message. Perhaps using "my" instead of "cust" would improve readability.

Take some examples:

  • const char *custszNamePtr = "Name"; --> myszNamePtr
  • uint8_t custu8ValueU8 = 0; --> myu8ValueU8
  • DWORD custdwMsDword = 0; --> mydwMsDword

Hi,

Yes this is a good idea, m and y are less used as type prefixes.

Do you want to make the change ? I can do it if you want.

Thank you. I will send a patch for the change.