Page MenuHomePhabricator

dougpuob (Douglas Chen)
User

Projects

User does not belong to any projects.

User Details

User Since
Dec 7 2018, 10:34 PM (233 w, 5 d)

๐Ÿ“ง dougpuob@gmail.com

Recent Activity

Apr 14 2023

dougpuob added a comment to D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.

I will push into repository this in a moment....

Apr 14 2023, 7:12 PM ยท Restricted Project, Restricted Project
dougpuob added a comment to D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.

Change in tests is ok, change in release notes not needed (please remove).
Change title into [clang-tidy][NFC] Improved ...

NFC - Non Functional Change

Apr 14 2023, 9:59 AM ยท Restricted Project, Restricted Project
dougpuob retitled D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review from [clang-tidy] Improved hungarian notation regression test at post-commit review to [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.
Apr 14 2023, 9:55 AM ยท Restricted Project, Restricted Project
dougpuob updated the diff for D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.
  • Removed unnecessary information from ReleaseNotes.rst
Apr 14 2023, 9:53 AM ยท Restricted Project, Restricted Project
dougpuob added a comment to D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.

And you forget to attach changes in unit tests.

Apr 14 2023, 7:29 AM ยท Restricted Project, Restricted Project
dougpuob updated the diff for D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.

Against trunk.

Apr 14 2023, 7:25 AM ยท Restricted Project, Restricted Project
dougpuob requested review of D148314: [clang-tidy][NFC] Improved hungarian notation regression test at post-commit review.
Apr 14 2023, 2:01 AM ยท Restricted Project, Restricted Project

Apr 11 2023

dougpuob added a comment to D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.

arc land should work, I usually use arc patch --nobranch to check things before committing and then git push.

Apr 11 2023, 6:48 AM ยท Restricted Project, Restricted Project

Apr 10 2023

dougpuob added a comment to D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.

Hi @PiotrZSL
I do not have permission to land the change. Can you please help me to land this change?

Apr 10 2023, 9:08 PM ยท Restricted Project, Restricted Project
dougpuob added a comment to D144510: [clang-tidy] improve readability-identifier-naming hungarian options test.

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.

Apr 10 2023, 4:49 PM ยท Restricted Project, Restricted Project
dougpuob added a comment to D144510: [clang-tidy] improve readability-identifier-naming hungarian options test.

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.

Apr 10 2023, 1:37 AM ยท Restricted Project, Restricted Project

Apr 9 2023

dougpuob updated the diff for D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.
  • Improved suggestions in code review
Apr 9 2023, 9:31 AM ยท Restricted Project, Restricted Project
dougpuob updated the diff for D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.
  • Extract method
  • Remove template parameters in the getDeclTypeName() function
Apr 9 2023, 2:26 AM ยท Restricted Project, Restricted Project
dougpuob added a comment to D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.

Missing release notes.

Apr 9 2023, 2:20 AM ยท Restricted Project, Restricted Project

Apr 7 2023

dougpuob updated the summary of D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.
Apr 7 2023, 3:39 AM ยท Restricted Project, Restricted Project
dougpuob requested review of D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability.
Apr 7 2023, 3:31 AM ยท Restricted Project, Restricted Project

Jan 16 2022

dougpuob added a comment to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).

About the error message, "relocation truncated to fit: R_68K_PC16 against '.rodata.str1.1'" when compile with -static option. I traced the source code. M68K doesn't support CodeModel::Large and CodeModel::Kernel. So, to build a static executable binary via clang, adding -mcmodel=medium is a suitable choice at this moment.

Jan 16 2022, 5:22 AM ยท Restricted Project, Unknown Object (Project)
dougpuob added a comment to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).

Hi @myhsu
Even though the instruction selection is focused on sub 0 x only, I still want to build a simple function with clang and run it with QEMU user emulator (qemu-m68k). But I have no idea how to cross-compile it with GCC runtime, do you have any document for it or could you show me a brief instruction.

FYI, You can build it with
clang --target=m68k $(SOURCE_FILE) -c -o
and then
m68k-linux-gnu-gcc $(SOURCE_OBJECT) -o $(FILE_NAME)

or
clang --target=m68k $(SOURCE_FILE) -o $(FILE_NAME) -ccc-gcc-name linux-gnu-gcc

Currently lld doesn't have M68k support, but I'm trying on it.
In the future, you may use lld to link m68k object with:
`clang --target=m68k $(SOURCE_FILE) -o $(FILE_NAME) -fuse-ld=lld

LLD is not required, you can use m68k-linux-gnu-ld to link. The key is using the correct target triple: m68k-linux-gnu rather than just m68k. Such that the compiler driver can find the right tools (in this case m68k-linux-gnu-ld) and libraries to use.
Actually, I just put up a document regarding m68k cross-compiling: https://m680x0.github.io/doc/cross-compile-how-to

That makes sense. Thanks

Hi @0x59616e and @myhsu,
Thank your reply. Now I can compile a hello program as an elf executable binary for m68k and execute it in Debian (qemu-system-m68k).

But I still cannot build the hello program with -static. My sample program just call print("Hello M68K!!! \n") in main(). Is it an issue?

โฏ bin/clang++ --target=m68k-linux-gnu -static hello.cpp -o hello.m68k.out
/tmp/hello-a7168e.o: in function `main':
hello.cpp:(.text+0x14): relocation truncated to fit: R_68K_PC16 against `.rodata.str1.1'
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

Hi,

I haven't dived into the problem, so this just my guess.

It seems that the address of the string (.rodata.str.1, I guess it's the string in your printf) is too far from the instruction itself, PC16 addressing mode is not enough, it needs (maybe ?) PC32.

I guess this issue may have something to do with the code model ?

Jan 16 2022, 2:20 AM ยท Restricted Project, Unknown Object (Project)
dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Rebase against trunk.
Jan 16 2022, 1:43 AM ยท Restricted Project, Unknown Object (Project)

Jan 15 2022

dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Add a descriptive comment.
Jan 15 2022, 10:50 PM ยท Restricted Project, Unknown Object (Project)
dougpuob added inline comments to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
Jan 15 2022, 10:13 PM ยท Restricted Project, Unknown Object (Project)
dougpuob added a comment to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).

Hi @myhsu
Even though the instruction selection is focused on sub 0 x only, I still want to build a simple function with clang and run it with QEMU user emulator (qemu-m68k). But I have no idea how to cross-compile it with GCC runtime, do you have any document for it or could you show me a brief instruction.

FYI, You can build it with
clang --target=m68k $(SOURCE_FILE) -c -o
and then
m68k-linux-gnu-gcc $(SOURCE_OBJECT) -o $(FILE_NAME)

or
clang --target=m68k $(SOURCE_FILE) -o $(FILE_NAME) -ccc-gcc-name linux-gnu-gcc

Currently lld doesn't have M68k support, but I'm trying on it.
In the future, you may use lld to link m68k object with:
`clang --target=m68k $(SOURCE_FILE) -o $(FILE_NAME) -fuse-ld=lld

LLD is not required, you can use m68k-linux-gnu-ld to link. The key is using the correct target triple: m68k-linux-gnu rather than just m68k. Such that the compiler driver can find the right tools (in this case m68k-linux-gnu-ld) and libraries to use.
Actually, I just put up a document regarding m68k cross-compiling: https://m680x0.github.io/doc/cross-compile-how-to

That makes sense. Thanks

Jan 15 2022, 10:09 PM ยท Restricted Project, Unknown Object (Project)

Jan 10 2022

dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Add a break to the case of switch statement. (Suggestions from RKSimon)
Jan 10 2022, 9:58 PM ยท Restricted Project, Unknown Object (Project)
dougpuob added inline comments to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
Jan 10 2022, 9:52 PM ยท Restricted Project, Unknown Object (Project)

Jan 9 2022

dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Refine the code and increase test coverage. (Suggestions from RKSimon)
Jan 9 2022, 8:28 PM ยท Restricted Project, Unknown Object (Project)
dougpuob added inline comments to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
Jan 9 2022, 8:21 PM ยท Restricted Project, Unknown Object (Project)
dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Remove braces for single line if statements.
Jan 9 2022, 7:03 AM ยท Restricted Project, Unknown Object (Project)
dougpuob added a comment to D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).

Hi @myhsu
Even though the instruction selection is focused on sub 0 x only, I still want to build a simple function with clang and run it with QEMU user emulator (qemu-m68k). But I have no idea how to cross-compile it with GCC runtime, do you have any document for it or could you show me a brief instruction.

Jan 9 2022, 5:39 AM ยท Restricted Project, Unknown Object (Project)
dougpuob retitled D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588) from [M68k][WIP] Make mul x -1 with neg x in instruction selection to [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
Jan 9 2022, 5:24 AM ยท Restricted Project, Unknown Object (Project)
dougpuob updated the diff for D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
  • Apply only the dividend value is zero and revert *.ll files.
Jan 9 2022, 5:14 AM ยท Restricted Project, Unknown Object (Project)
dougpuob requested review of D116886: [M68k] Instruction selection to choose neg x when mul x -1 (Fix issue 48588).
Jan 9 2022, 3:57 AM ยท Restricted Project, Unknown Object (Project)

Oct 6 2021

dougpuob updated dougpuob.
Oct 6 2021, 10:09 PM
dougpuob updated dougpuob.
Oct 6 2021, 10:09 PM

Aug 3 2021

dougpuob added a comment to D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.

The bot is happy again, thanks.

Aug 3 2021, 8:14 PM ยท Restricted Project
dougpuob added a comment to D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.

Hi @thakis:
I can't access the repo, could you please help me to land?

Aug 3 2021, 7:59 AM ยท Restricted Project
dougpuob updated the diff for D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.
  • Improved code review suggestions.
Aug 3 2021, 6:12 AM ยท Restricted Project
dougpuob added inline comments to D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.
Aug 3 2021, 6:11 AM ยท Restricted Project
dougpuob added a comment to D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.

Thanks!

Since the config file contents are fixed as far as I can tell, maybe we could instead just add a file with the right contents to clang-tools-extra/test/clang-tidy/checkers/Inputs and refer to that? (Use %S/Inputs/myfile.txt) (Alternatively you could use the split-file utility, but putting the file in Inputs is probably easier if you're new, and it's not any worse :) )

Aug 3 2021, 4:49 AM ยท Restricted Project
dougpuob updated the diff for D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.
  • Moved config content of regression test to clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/hungarian-notation*/.clang-tidy, then refer to those files in tests.
Aug 3 2021, 4:45 AM ยท Restricted Project
dougpuob updated the summary of D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.
Aug 3 2021, 12:11 AM ยท Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Any news here? This has been broken for over a day now.

Aug 3 2021, 12:07 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

you can reopen the revision via "Add Action..."

Aug 3 2021, 12:01 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Aug 2 2021

dougpuob requested review of D107325: [clang-tidy] Fix command line is too long issue which breaks test on Windows.
Aug 2 2021, 11:26 PM ยท Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

This breaks tests on windows: http://45.33.8.238/win/43180/step_8.txt

"The command line is too long" Maybe some arts could be passed via a response file instead?

Aug 2 2021, 10:06 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Jun 25 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Is this ready to merge soon?

Jun 25 2021, 8:18 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Jun 10 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

@njames93, Ping

Jun 10 2021, 2:01 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 16 2021

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Moved all static functions into IdentifierNamingCheck class, and called the configurationDiag() directly in IdentifierNamingCheck::getFileStyleFromOptions() method.
May 16 2021, 1:50 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 13 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @njames93:
Could you do me a favor? Because it is my first patch, something I'm not sure. I'm confused about can I land this patch now? I read the "LLVM Code-Review Policy and Practices" document, it said patches can be landed if received a LGTM, but seems you are still reviewing.

If you have made significant changes (excluding what a reviewer asks when giving an LGTM) Its best to get those further changes also reviewed.

May 13 2021, 7:11 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 11 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @njames93:
Could you do me a favor? Because it is my first patch, something I'm not sure. I'm confused about can I land this patch now? I read the "LLVM Code-Review Policy and Practices" document, it said patches can be landed if received a LGTM, but seems you are still reviewing.

May 11 2021, 9:21 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 10 2021

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Removed diagnoseInvalidConfigOption() function.
  • Created a HungarianNotation class and moved related functions into there.
May 10 2021, 7:43 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 8 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

I tried to create a class, HungarianNotation, and put all related functions into the class. Then I can call configurationDiag() in HungarianNotation::checkOptionValid() function.
How about this way?

May 8 2021, 9:05 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 2 2021

dougpuob added inline comments to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
May 2 2021, 7:37 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

That's ok. You have helped me a lots. Thank you.

May 2 2021, 12:02 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

May 1 2021

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Against trunk.
  • Refined isHungarianNotationOptionEnabled() function.
  • Changed old way that showing invalid config option in .clang-tidy config file. Now added a new function ClangTidyCheck::OptionsView::diagnoseInvalidConfigOption() instead.
  • Recovered that document content missing in .rst.
May 1 2021, 12:14 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Jan 13 2021

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Ping @njames93

Jan 13 2021, 7:18 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 30 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Addressed comments by @njames93. Including adding warning message for unsupported options in config file, refining code in getFileStyleFromOptions(), and for consistent reason to use llvm::yaml::parseBool() function instead of checking On/Off string.

Dec 30 2020, 1:22 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 29 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Removed unrelated comments.
Dec 29 2020, 11:01 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Against git master.
  • Refined isHungarianNotationOptionEnabled() function.
  • Classify document and test cases.
  • Fixed assertions by clang-format.
  • Instead check On/Off string with llvm::yaml::parseBool() function for consistent.
  • Improved code.
  • Add new check for unsupported option.
Dec 29 2020, 7:50 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 22 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

One last point, is there a way to validate that these options are only set where it makes sense. If someone tries to use say MacroDefinitionHungarianPrefix That could be warning worthy?

Dec 22 2020, 4:40 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 11 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @njames93, thank you for your review suggestions, I have improved them and against my change to the main branch.

Dec 11 2020, 10:25 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Fixed assertions by clang-format.
Dec 11 2020, 9:59 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Against git master.
  • Refined isHungarianNotationOptionEnabled() function.
  • Classify document and test cases.
Dec 11 2020, 6:23 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 6 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

arc diff with the correct base.

Dec 6 2020, 7:01 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Improved code review suggestions from @njames93. Including move the IdentifierNamingCheck::HNOption variable to IdentifierNamingCheck::FileStyle::HNOption, use try_emplace() instead of insert() and lookup().
Dec 6 2020, 6:48 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Dec 1 2020

dougpuob requested review of D92410: Summary: Fixed a broken link to the 'Widening integer arithmetic' paper in document..
Dec 1 2020, 10:41 AM ยท Unknown Object (Project)

Nov 24 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Improved code review suggestions from Aaron.Ballman and Eugene.Zelenko. Including return default initializer instead of empty string, use isa<>() instead of if statement with multiple conditions, use StringRef array instead of list<std::string>.
Nov 24 2020, 9:20 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @aaron.ballman and @Eugene.Zelenko, thank you for your suggestions. I will improve them and upload my diff later.

Nov 24 2020, 7:56 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 22 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Improved code review suggestions from Aaron Ballman(aaron.ballman). Including document, single-line if statements, no reference with StringRef, "char"-->"char[]" for HNOption.CString, use llvm::transform insteads of for-loop to uppercase string, don't check CXXMethod in getDeclTypeName(), remove const_cast<char *> in getDeclTypeName(), use if-else insteads of switch-case(simplify src).
Nov 22 2020, 5:37 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob removed a project from D86671: [clang-tidy] Add new case type to check variables with Hungarian notation: Restricted Project.
Nov 22 2020, 5:00 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @aaron.ballman, thank you for your feedback. I will update my change later. Unrelated change were mixed with other commits when I against git master. I did it again then the problem was gone. I found the command, arc diff master --preview, knowing exactly changes before uploading diff by arc.

Nov 22 2020, 3:43 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 21 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Against git master.

Nov 21 2020, 11:57 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 19 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Against git master.

Nov 19 2020, 7:32 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 18 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

ping?

Nov 18 2020, 6:04 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 12 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Shortened namespace with type alias.
  • Removed namespace for StringRef.
Nov 12 2020, 10:10 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 4 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Fixed warnings of Clang-Tidy.
Nov 4 2020, 8:38 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  1. Fixed build failure on BuildBot. (Touch empty data from Options.get())
  2. Changed llvm::StringMap with std::pair in getHungarianNotationDefaultConfig().
  3. Moved HNOpts and HNDerviedTypes declarations out of getHungarianNotationDefaultConfig().
  4. Reused SmallString<128> for string concatenation.
  5. Removed redundant m(HungarianNotation) in #define NAMING_KEYS(m).
Nov 4 2020, 7:37 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added inline comments to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
Nov 4 2020, 7:34 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Nov 1 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  1. Applied all patches with the trunk(1800b44651c19b11e7680f908344d5751e8d2246).
  2. Moved HNOption pointer out of NamingStyle data structure.
  3. Removed parseHungarianPrefix() function, use Options.get() instead.
Nov 1 2020, 5:00 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added inline comments to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
Nov 1 2020, 4:58 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 31 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Removed clearAll() function and made the HPOption variable passing by value(origin is std::move()).
  • Moved static HNOption variable from static getNamingStyles() function to IdentifierNamingCheck class a private data member.
  • Replaced auto keyword with explicit std::string.
  • Elided braces around single-line.
  • Used CXXRecordDecl::isAbstract() directly.
  • changed const auto to const auto * for pointer objects.
  • Enhanced test case for enum with two EnumConstant decls.
  • Removed unnecessary clang:: namespace for variables.
  • Executed arc lint
  • Final changes.
  • Executed arc lint
Oct 31 2020, 5:45 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 30 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Reply code review suggestions. I will upload my change later.

Oct 30 2020, 7:49 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 23 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Changed the type of HNOption from std::shared_ptr to reference.
Oct 23 2020, 7:52 AM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Thank you for the suggestion.

Oct 23 2020, 6:25 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 21 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Changed Hungarian Notation as an prefix style (not a case type).
  • Changed XxxHungarianPrefix as an enumeration from bool.
  • Updated documents.
Oct 21 2020, 7:45 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 20 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @njames93,

It's a smart idea, the rework for it is worth. There is a special case if lowercase name with Hungarian prefix, it possibly makes variable ambiguous, like the Case1. How about separating them and aNy_CasE with an underscore, like Case2 ?

// Case1
bool bRIGHT_LEVEL;     // UPPER_CASE
bool bRightLevel;      // CamelCase
bool bRight_Level;     // Camel_Snake_Case
bool baNy_CasE;        // aNy_CasE
bool bright_level;     // lower_case
bool brightLevel;      // camelBack
bool bright_Level;     // camel_Snake_Back
.....^^^^^^ <-- right? bright?

// Case2
bool bRIGHT_LEVEL;     // UPPER_CASE
bool bRightLevel;      // CamelCase
bool bRight_Level;     // Camel_Snake_Case
bool b_aNy_CasE;       // aNy_CasE
bool b_right_level;    // lower_case
bool b_rightLevel;     // camelBack
bool b_right_Level;    // camel_Snake_Back
.....^^^^^^^ <-- add an underscore

That still has hidden surprises. Maybe instead of a bool, an enum is used for controlling hungarian prefix (Off|On|...).
Can't think of a good name for the third option but it would do the inserting of '_' (bright_level ->b_right_level) or capitalising the first word of the identifier (brightLevel -> bRightLevel).

Oct 20 2020, 4:38 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Is this diff been created incorrectly again?

Taking a step back, Is Hungarian notation really a case style, Seems to me its mainly about the prefix and a user may want DWORD dwUPPER_CASE, Right now there is no way of adopting that.
Maybe extend the options for hungarian type decls to

<Type>Case
<Type>Prefix
<Type>Suffix
<Type>HungarianPrefix

<Type>HungarianPrefix would likely be a bool and if enabled, it would be prepended to <Type>Prefix
I could see a situation like this

[Options]
// VariableCase: UPPER_CASE
// VariablePrefix: PRE_
// VariableSuffix: _POST
// VariableHungarianPrefix: true

DWORD MyVariable; -> DWORD dwPRE_MY_VARIABLE_POST;

This would give users full control of exactly how they want their declarations with no hidden surprises.

Granted this approach would require a little rework but it would satisfy more users.

Oct 20 2020, 7:54 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 13 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Merged all commits as one single commit. (Trying to resolve "No such file or directory" error from the scripts/phabtalk/apply_patch2.py!_apply_diff() function)

Oct 13 2020, 10:47 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @aaron.ballman and @njames93,
I addressed your code review suggestions and supported Hungarian Notation prefix for decl of enum and class(option) at latest patch. Unfortunately, I encountered a problem that new patch failed on remote BuildBot, it showed the "No such file or directory" error message when it was trying to call apply_patch2.py!_apply_diff(). Do you have any idea what is going on? Do you suggest I create a new Diff(new diff id) for it ?

Oct 13 2020, 6:20 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Rename file name, "readability-identifier-naming-hungarian-notation-default.cpp" to "readability-identifier-naming-hungarian-notation.cpp".

Oct 13 2020, 5:45 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Merged with the master then do arc diff master --update D86671 again. (Trying to resolve "No such file or directory" error from the scripts/phabtalk/apply_patch2.py!_apply_diff() function)

Oct 13 2020, 4:09 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 11 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Previous arc diff got problem(failed on builtbot), do it again with arc diff master --update D86671.

Oct 11 2020, 6:40 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Oct 10 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Support to add Class prefix for Hungarian Notation.
  • Support to add Enum prefix for Hungarian Notation.
  • Support unsigned long long, ULONG, and HANDLE types and others.
  • Support options for Hungarian Notation in config file.
  • Added more test cases.
Oct 10 2020, 11:11 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added inline comments to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
Oct 10 2020, 9:46 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 30 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Not strictly relevant here, but this does open up the idea of enforcing the style where an enum constant is prefixed by the initials of the enum name.

Sep 30 2020, 8:17 PM ยท Unknown Object (Project), Restricted Project, Restricted Project
dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @aaron.ballman
About changing size_t nLength to cbLength. I searched MSVC folders with size_t, many names of variable start with n, or i in MFC related files. So I prefer to keep it starts with n. Another side to name starts with cb, I found variables like cbXxx are defined with ULONG, DWORD, or UCHAR type.

I think the important point is that cb is used for APIs that specify a count of bytes, whereas i, n, and l are used for integers (there is no specific prefix for size_t that I'm aware of or that MSDN documents, so the lack of consistency there is not too surprising). That's why I mentioned that using a heuristic approach may allow you to identify the parameters that are intended to be a count of bytes so that you can use the more specific prefix if there's more specific contextual information available.

Sep 30 2020, 9:57 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 20 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @aaron.ballman
About changing size_t nLength to cbLength. I searched MSVC folders with size_t, many names of variable start with n, or i in MFC related files. So I prefer to keep it starts with n. Another side to name starts with cb, I found variables like cbXxx are defined with ULONG, DWORD, or UCHAR type.

Sep 20 2020, 10:24 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 19 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Replied comments by @aaron.ballman

Sep 19 2020, 10:16 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 13 2020

dougpuob added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Did you upload this incorrectly again, context is missing and seems to be a relative diff from a previous version of this patch?

Sorry for it, I think it's my bad. It is possible that I manually merged the last master(github) with changes then updated them both via web interface ...

Can I fix it if switch back to the base (14948a0) then merge all my changes, then update the diff again via web interface? Or do you have any better suggestion?

I am curious about how do you know this mistake? You got error messages with arc patch D86671 ?

The no context is easy to spot as phab says context not available. Its easy to find knowing that there is no mention of hungarian notation in the trunk version of IdentifierNamingCheck.cpp, yet there is mention of that in the before diff.

The way I do my patches is I create a branch from the current master. Then all commits go into that branch. When its time to update the PR I can just do a diff from <feature_branch> to <master>.
Though I do use arcanist for my patches

arc diff master

arcanist will check to see if the current branch has tags for PR and automatically update that PR. Otherwise it will create a new PR.
If it goes to create a new PR instead of updating an existing one you can pass update

arc diff master --update D86671
Sep 13 2020, 8:02 AM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 11 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Fixed crash on Windows when run regression test (llvm-lit for readability-identifier-naming.cpp file).

Sep 11 2020, 7:53 PM ยท Unknown Object (Project), Restricted Project, Restricted Project

Sep 9 2020

dougpuob updated the diff for D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.
  • Fixed lint warnings and regression test failures on Windows.
Sep 9 2020, 6:43 AM ยท Restricted Project, Restricted Project, Restricted Project