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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 19 11:52:34 PST 2021


HazardyKnusperkeks added a comment.

In D114142#3142122 <https://reviews.llvm.org/D114142#3142122>, @MyDeveloperDay wrote:

>> I only now this from the tests with `-debug`. Is there a way to get "normal" clang-format to print these? Or did you write a test for that to print the information?
>
> I just use the --debug option to clang-format.exe?
>
> I develop on windows, using Visual Studio 2019 (Command Shell)  - (with cygwin bash) and build with ninja (so much faster than anything else)
>
> I build Debug  (its possible --debug is only available on Debug builds)
>
>   export CC=cl.exe
>   export CXX=cl.exe
>   c:/Program\ Files/CMake/bin/cmake.exe ../llvm-project/llvm -G "Ninja" \
>   -DLLVM_BUILD_TESTS=ON \
>   -DCMAKE_BUILD_TYPE=Debug \
>   -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
>   -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"
>
> Then just run with --debug
>
>   $ clang-format --debug test1.cpp
>   Args: C:\llvm\build_ninja\bin\clang-format.exe --debug test
>   1.cpp
>   Trying C:\clang-format-examples\comment\.clang-format...
>   Using configuration file C:\clang-format-examples\comment\.c
>   lang-format
>   File encoding: UTF8
>   Language: C++
>   ----
>   Line(0, FSC=0): comment[T=93, OC=0]
>   Line(0, FSC=0): eof[T=93, OC=119]

Okay, my debug build does not produce a working clang-format, only the tests. And my normal clang-format is release, maybe it's that.

On the matter of this change, I would second the test with `//`, and if the `tok::comment`` does the trick, that should be better, than using the type.


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