[libcxx-commits] [PATCH] D92229: [libc++] Update clang-format configuration

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 15 08:58:35 PST 2020

Mordante added inline comments.

Comment at: libcxx/.clang-format:5
 Language: Cpp
 Standard: Cpp03
curdeius wrote:
> Mordante wrote:
> > Do we need to keep this at Cpp03? Changing this to newer versions of C++ will of course break code like 'std::vector<std::pair<int, int>>`. But this seems to break formatting the C++11 string literal prefixes: u8, u, U.
> I'd love to remove Cpp03... But clang in c++03 mode gives error: `error: a space is required between consecutive right angle brackets (use '> >')`.
> BTW, from clang-format documentation: "Cpp03 is a deprecated alias for c++03".
> Personally I'd like to use `Standard: Latest`.
> There's also `Standard: Auto`, that may be a compromise to use `> >` in c++03 sensitive code and `>>` elsewhere.
> Ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
True for C++98 the right angle brackets need spaces. AFAIK it's not possible to force that when using a newer C++ version. But C++03 will add a space when using `u8"foo"` and turn it into `u8 "foo"`. This gives issue with C++11.  C++14 code like `1'000'000` will also fail. So maybe we should switch to the newest mode and not format everything, but format per patch basis?

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list