[PATCH] D131750: [clang-format] Distinguish logical and after bracket from reference

2022-09-03 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Is there any chance we also add this patch to version 15? https://github.com/llvm/llvm-project/issues/57534#issuecomment-1236132578 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131750/new/ https://reviews.llvm.org/D131

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 marked 7 inline comments as done. jackhong12 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2375-2378 +const FormatToken *Prev = PrevToken; +if (Prev->is(tok::r_square) && (Prev = Prev->getPreviousNonComment()) && +Prev->is(tok::

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 456836. jackhong12 retitled this revision from "Fix annotating when deleting array of pointers" to "[clang-format] Fix annotating when deleting array of pointers". jackhong12 edited the summary of this revision. jackhong12 added a comment. Add left alignme

[PATCH] D132911: Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 456834. jackhong12 retitled this revision from "[clang-format] Fix annotating when deleting array of pointers" to "Fix annotating when deleting array of pointers". jackhong12 edited the summary of this revision. jackhong12 added a comment. Use endsSequence

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2381-2385 if (PrevToken->Tok.isLiteral() || PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true, tok::kw_false, tok::r_brace)) { return TT_B

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. In this case, I think it's dereferencing a pointer instead of multiplying two numbers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132911/new/ https://reviews.llvm.org/D132911

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 456563. jackhong12 added a comment. Annotate `*` as UnaryOperator instead of `PointerOrReference` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132911/new/ https://reviews.llvm.org/D132911 Files: clang/li

[PATCH] D132911: Fix annotating when deleting array of pointers

2022-08-29 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 created this revision. jackhong12 added reviewers: owenpan, MyDeveloperDay, curdeius, HazardyKnusperkeks. Herald added a project: All. jackhong12 edited the summary of this revision. jackhong12 published this revision for review. Herald added a project: clang. Fixes https://github.com/

[PATCH] D131750: [clang-format] Distinguish logical and after bracket from reference

2022-08-12 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 452351. jackhong12 added a comment. Remove redundant code. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131750/new/ https://reviews.llvm.org/D131750 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp clang/un

[PATCH] D131750: [clang-format] Distinguish logical and after bracket from reference

2022-08-12 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 452345. jackhong12 edited the summary of this revision. jackhong12 added a comment. Remove redundant code. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131750/new/ https://reviews.llvm.org/D131750 Files: clang/lib/Format/TokenAnnotator.cpp

[PATCH] D131750: [clang-format] Distinguish logical and after bracket from reference

2022-08-11 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 created this revision. jackhong12 added reviewers: owenpan, MyDeveloperDay, curdeius, HazardyKnusperkeks. Herald added a project: All. jackhong12 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. In https://reviews.llvm.org/D12787

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-08-11 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Right, I think we can fix this in the same way. I'll look into it soon. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 ___ cfe-comm

[PATCH] D129771: [clang-format] distinguish multiplication after brace-init from pointer

2022-08-11 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Right, I think we can fix this in the same way. I'll look into it soon. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129771/new/ https://reviews.llvm.org/D129771 ___ cfe-comm

[PATCH] D129771: [clang-format] distinguish multiplication after brace-init from pointer

2022-07-14 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 accepted this revision. jackhong12 added a comment. I think we can also add new test cases in `clang/unittests/Format/TokenAnnotatorTest.cpp`. Tokens = annotate("int i = int{42} * 34;"); ... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-07-14 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Good point! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-07-14 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. I think we cannot identify `struct`, `union`, `class` or `enum` by the right bracket. Clang-format will split the input into multiple lines. For instance `struct Tmp {} *tmp;` will be separated as `struct Tmp {` and `} *tmp;`. In annotating, we only handle the relat

[PATCH] D129061: [Lex] Diagnose macro in command lines

2022-07-10 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added inline comments. Comment at: clang/include/clang/Driver/Options.td:664 HelpText<"Define to (or 1 if omitted)">; +def DriverDefine : JoinedOrSeparate<["-"], "driver-define">, Group, +Flags<[CC1Option, FlangOption, FC1Option]>, MetaVarName<"=">, --

[PATCH] D129061: [Lex] Diagnose macro in command lines

2022-07-10 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 443516. jackhong12 added a comment. - modify option names - only allow driver-defined macros used in cc1 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129061/new/ https://reviews.llvm.org/D129061 Files: clang-tools-extra/test/pp-trace/pp-trace

[PATCH] D129061: [Lex] Diagnose macro in command lines

2022-07-09 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 443447. jackhong12 added a comment. Herald added subscribers: mstorsjo, MaskRay. Herald added a reviewer: sscalpone. Herald added a project: clang-tools-extra. I added two flags, `-driver-define` and `-driver-undefine`, to indicate macros that the driver d

[PATCH] D129061: [Lex] Diagnose macro in command lines

2022-07-04 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Sorry, I didn't consider some cases. I'll fix it soon! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129061/new/ https://reviews.llvm.org/D129061 ___ cfe-commits mailing list

[PATCH] D129061: [Lex] Diagnose macro in command lines

2022-07-03 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 created this revision. jackhong12 added a reviewer: aaron.ballman. Herald added a project: All. jackhong12 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. - Fixes https://github.com/llvm/llvm-project/issues/56159 Description ---

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-29 Thread Jack Huang via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb646f0955574: [clang-format] Fix misplacement of `*` in declaration of pointer to struct (authored by Huang Zhen-Hong , com

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-28 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Sorry, I don't have commit access. @HazardyKnusperkeks, could you help me commit it? If I want to contribute to LLVM in the future, how do I get the commit permission? Does it depend on the number of patches I submit? CHANGES SINCE LAST ACTION https://reviews.llv

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-26 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. Got it. Thanks for your reply! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-25 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 marked 2 inline comments as done. jackhong12 added a comment. Hi. I passed the unit tests on my computer. But the build status here is failed. The build log only shows the issue is related to `git reset --hard`. So, I don't know where the bug is. Could you give me some hints to fix th

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-22 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 439091. jackhong12 added a comment. Right. It looks better. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp clang/u

[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

2022-06-22 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 438921. jackhong12 marked an inline comment as done. jackhong12 added a comment. I have added a variable for `MatchingLBrace->getPreviousNonComment()`. Thanks. I am not sure which modification will be better, the patch I submitted or the following code.

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-21 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 438669. jackhong12 added a comment. Thanks for your reply! I added comments for each clause. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittest

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-20 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2328 +} + if (PrevToken->Tok.isLiteral() || HazardyKnusperkeks wrote: > MyDeveloperDay wrote: > > Thank you I wish more of the clauses were commented like this > +1 I'm not

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-19 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 438194. jackhong12 edited the summary of this revision. jackhong12 added a comment. Just like mentioned above, UnwrappedLineParser will split the input into multiple lines. And `MatchingParen` will be reset before annotating(code

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-17 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2314-2315 +if (PrevToken->is(tok::r_brace) && Tok.isOneOf(tok::amp, tok::ampamp) && +PrevToken->MatchingParen && PrevToken->MatchingParen->is(TT_Unknown)) + return TT_BinaryOperator

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-17 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2314-2315 +if (PrevToken->is(tok::r_brace) && Tok.isOneOf(tok::amp, tok::ampamp) && +PrevToken->MatchingParen && PrevToken->MatchingParen->is(TT_Unknown)) + return TT_BinaryOperator

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-17 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 437881. jackhong12 added a comment. Add Left/Middle/Right alignment test cases. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://reviews.llvm.org/D127873 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/Form

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-17 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 updated this revision to Diff 437868. jackhong12 edited the summary of this revision. jackhong12 added a comment. - Add annotator test - Add formatting test - Handle reference cases by `PrevToken->MatchingParen` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https:

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declaration of pointer to struct

2022-06-16 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 added a comment. I think it's a good idea. When does `MatchingParen` bind? The value of `PrevToken->MatchingParen` is still NULL in `determineStarAmpUsage` function. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127873/new/ https://revi

[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declartion of pointer to struct

2022-06-15 Thread Jack Huang via Phabricator via cfe-commits
jackhong12 created this revision. jackhong12 added a reviewer: clang-format. Herald added a project: All. jackhong12 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fixes #55810 Star tokens should be categorized as TT_PointerOrReference in