[clang] [clang-format] Improve annotating star and amp (PR #194190)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 26 22:04:29 PDT 2026
owenca wrote:
> We can, but we also need it for `tok::star` and I don't know which way is better.
Then add the `tok::star` case too:
```diff
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2741,6 +2741,8 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType,
case tok::kw_requires:
parseRequiresExpression();
break;
+ case tok::star:
+ case tok::amp:
case tok::ampamp:
if (AmpAmpTokenType != TT_Unknown)
FormatTok->setFinalizedType(AmpAmpTokenType);
```
I prefer plugging the hole above because that's the direct cause that unlike `&&`, `*` and `&` are not annotated as `TT_PointerOrReference`.
https://github.com/llvm/llvm-project/pull/194190
More information about the cfe-commits
mailing list