[PATCH] D114142: [clang-format] [PR52527] can join * with /* to form an outside of comment error C4138

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 18 02:52:08 PST 2021


owenpan added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3219
+  // of comment.
+  if (Left.is(tok::star) && Right.is(TT_BlockComment))
+    return true;
----------------
MyDeveloperDay wrote:
> owenpan wrote:
> > Isn't `tok::comment` better than `TT_BlockComment` if a space is also required between `*` and `//`?
> I guess for formatting as we type, then perhaps that might be better, I just couldn't think of a use case for legal code where * would be the last value on the line, but perhaps
> 
> ```
> void foo(int *  // this is the first parameter
>               ,int second);
> ```
> 
> Let me add that as a test and update the review.
Maybe something like:
```
  double term = factor1 * // first factor
                factor2;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114142/new/

https://reviews.llvm.org/D114142



More information about the cfe-commits mailing list