Giter Club home page Giter Club logo

clang-unformat's Introduction

clang-unformat's People

Contributors

alandefreitas avatar andrei-ng avatar carlosnihelton avatar marzelpan avatar repojohnray avatar ryanenzo avatar technic avatar threaderic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clang-unformat's Issues

Memory leak on edlibAlign

Thanks for this nice piece of software! Besides the usefulness, I was curious about the nice TUI colors and navigating the source code i spot a suspicious call to what looked to be a C API that would lead to a memory leak.

In fact, the leak was confirmed on edlibAlign.

image

For the record, the screenshot is from heaptrack analyzing the memory profile of clang-unformat running against its own source code: heaptrack ./build/clang-unformat --input standalone --output build/.clang-format

Fails to generate compatible .clang-format file

I tried running it on your example in standalone/main.cpp. I tried various versions of clan-format, up to version 12. None seem to work.

Which clang-version did you use ?

I can provide a full log, but for a sample, see below

SpaceInEmptyParentheses: true                      # parameter failed
SpacesBeforeTrailingComments: 0                    # parameter failed
SpacesInAngles: Never                              # parameter failed
SpacesInCStyleCastParentheses: true                # parameter failed
SpacesInConditionalStatement: true                 # parameter failed
SpacesInContainerLiterals: true                    # parameter failed
SpacesInParentheses: true                          # parameter failed
Standard: c++03                                    # parameter failed
TabWidth: 0                                        # parameter failed
UseCRLF: true                                      # parameter failed
# Total evaluation time: 17s:637ms:47µs
# Average evaluation time: 0s:41ms:992µs per parameter value
# Estimated time left: 0s:209ms:964µs
==============================

Adjust UseTab
Evaluating UseTab: UT_Never (failed option)
Evaluating UseTab: UT_ForIndentation (failed option)
Evaluating UseTab: UT_ForContinuationAndIndentation (failed option)
Evaluating UseTab: UT_AlignWithSpaces (failed option)
Evaluating UseTab: UT_Always (failed option)
Parameter UseTab did not affect the output

Inheriting innocuous entry AccessModifierOffset
Inheriting failed entry AlignArrayOfStructures
Inheriting failed entry AlignConsecutiveAssignments
Inheriting failed entry AlignConsecutiveBitFields
Inheriting failed entry AlignConsecutiveDeclarations
Inheriting failed entry AlignConsecutiveMacros

compilation error: cannot convert ‘asio::thread_pool::basic_executor_type<std::allocator<void>, 0>’ to ‘const boost::asio::thread_pool::executor_type&’

I'm getting a really long compilation error that starts with cannot convert ‘asio::thread_pool::basic_executor_type<std::allocator<void>, 0>’ to ‘const boost::asio::thread_pool::executor_type&’ in clang-unformat/standalone/application.cpp:402:13.

Build logs:

  • full log: https://paste.rs/j6aYF
  • Appropriate chunk of the output of cmake --build . --target clang-unformat -j8:
[ 97%] Building CXX object CMakeFiles/clang-unformat.dir/standalone/main.cpp.o
/home/bit/temp/clang-unformat/standalone/application.cpp: In member function ‘void application::clang_format_local_search()’:
/home/bit/temp/clang-unformat/standalone/application.cpp:402:13: error: cannot convert ‘asio::thread_pool::basic_executor_type<std::allocator<void>, 0>’ to ‘const boost::asio::thread_pool::executor_type&’ {aka ‘const boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>&’}
  402 |             ex,
      |             ^~
      |             |
      |             asio::thread_pool::basic_executor_type<std::allocator<void>, 0>
/home/bit/temp/clang-unformat/standalone/application.cpp:180:52: note:   initializing argument 1 of ‘void application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)’
  180 |     const boost::asio::thread_pool::executor_type &ex,
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/asio/detail/descriptor_read_op.hpp:29,
                 from /usr/include/asio/detail/reactive_descriptor_service.hpp:33,
                 from /usr/include/asio/basic_readable_pipe.hpp:38,
                 from /usr/include/asio.hpp:36,
                 from /home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/config/asio_include.h:56,
                 from /home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/executor/inline_executor.h:11,
                 from /home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:11,
                 from /home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures.h:66,
                 from /home/bit/temp/clang-unformat/standalone/application.cpp:16:
/usr/include/asio/dispatch.hpp: In instantiation of ‘auto asio::dispatch(const Executor&, NullaryToken&&, typename constraint<(execution::is_executor<T>::value || is_executor<Executor>::value)>::type) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; NullaryToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; typename constraint<(execution::is_executor<T>::value || is_executor<Executor>::value)>::type = int]’:
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:220:35:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::detail::async_future_scheduler::operator()(futures::detail::schedule_future_policy, const Executor&, Function&&, Args&& ...) const [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; futures::detail::async_result_of_t<Function, Args ...> = futures::basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:315:39:   required from ‘decltype(auto) futures::async(launch, const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:356:21:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::async(const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; detail::async_result_of_t<Function, Args ...> = basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/standalone/application.cpp:217:57:   required from here
/usr/include/asio/dispatch.hpp:158:46: error: call of overloaded ‘async_initiate<futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >, void()>(asio::detail::initiate_dispatch_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >, futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >&)’ is ambiguous
  158 |   return async_initiate<NullaryToken, void()>(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  159 |       detail::initiate_dispatch_with_executor<Executor>(ex), token);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/asio/detail/handler_type_requirements.hpp:53,
                 from /usr/include/asio/impl/execution_context.hpp:18,
                 from /usr/include/asio/execution_context.hpp:407,
                 from /usr/include/asio/detail/scheduler.hpp:21,
                 from /usr/include/asio/system_context.hpp:19,
                 from /usr/include/asio/impl/system_executor.hpp:21,
                 from /usr/include/asio/system_executor.hpp:669,
                 from /usr/include/asio/associated_executor.hpp:24,
                 from /usr/include/asio/any_completion_handler.hpp:28,
                 from /usr/include/asio.hpp:19:
/usr/include/asio/async_result.hpp:890:1: note: candidate: ‘typename asio::constraint<asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = detail::initiate_dispatch_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  890 | async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
In file included from /home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/detail/handler_type_requirements.hpp:53,
                 from /home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/impl/execution_context.hpp:18,
                 from /home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/execution_context.hpp:409,
                 from /home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/detail/scheduler.hpp:21,
                 from /home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/thread_pool.hpp:20,
                 from /home/bit/temp/clang-unformat/standalone/application.hpp:13,
                 from /home/bit/temp/clang-unformat/standalone/application.cpp:8:
/home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/async_result.hpp:891:1: note: candidate: ‘typename boost::asio::constraint<boost::asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (boost::asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type boost::asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = asio::detail::initiate_dispatch_with_executor<thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  891 | async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
In file included from /usr/include/asio.hpp:73:
/usr/include/asio/defer.hpp: In instantiation of ‘auto asio::defer(const Executor&, NullaryToken&&, typename constraint<((execution::is_executor<T>::value && can_require<Executor, execution::detail::blocking::never_t<0> >::value) || is_executor<Executor>::value)>::type) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; NullaryToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; typename constraint<((execution::is_executor<T>::value && can_require<Executor, execution::detail::blocking::never_t<0> >::value) || is_executor<Executor>::value)>::type = int]’:
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:223:32:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::detail::async_future_scheduler::operator()(futures::detail::schedule_future_policy, const Executor&, Function&&, Args&& ...) const [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; futures::detail::async_result_of_t<Function, Args ...> = futures::basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:315:39:   required from ‘decltype(auto) futures::async(launch, const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:356:21:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::async(const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; detail::async_result_of_t<Function, Args ...> = basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/standalone/application.cpp:217:57:   required from here
/usr/include/asio/defer.hpp:179:46: error: call of overloaded ‘async_initiate<futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >, void()>(asio::detail::initiate_defer_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >, futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >&)’ is ambiguous
  179 |   return async_initiate<NullaryToken, void()>(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  180 |       detail::initiate_defer_with_executor<Executor>(ex), token);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/asio/async_result.hpp:890:1: note: candidate: ‘typename asio::constraint<asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = detail::initiate_defer_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  890 | async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
/home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/async_result.hpp:891:1: note: candidate: ‘typename boost::asio::constraint<boost::asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (boost::asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type boost::asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = asio::detail::initiate_defer_with_executor<thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  891 | async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
In file included from /usr/include/asio/basic_socket.hpp:28,
                 from /usr/include/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/asio.hpp:30:
/usr/include/asio/post.hpp: In instantiation of ‘auto asio::post(const Executor&, NullaryToken&&, typename constraint<((execution::is_executor<T>::value && can_require<Executor, execution::detail::blocking::never_t<0> >::value) || is_executor<Executor>::value)>::type) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; NullaryToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; typename constraint<((execution::is_executor<T>::value && can_require<Executor, execution::detail::blocking::never_t<0> >::value) || is_executor<Executor>::value)>::type = int]’:
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:226:31:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::detail::async_future_scheduler::operator()(futures::detail::schedule_future_policy, const Executor&, Function&&, Args&& ...) const [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; futures::detail::async_result_of_t<Function, Args ...> = futures::basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:315:39:   required from ‘decltype(auto) futures::async(launch, const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0]’
/home/bit/temp/clang-unformat/build/_deps/futures-src/source/futures/futures/async.h:356:21:   required from ‘futures::detail::async_result_of_t<Function, Args ...> futures::async(const Executor&, Function&&, Args&& ...) [with Executor = boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0>; Function = application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>; Args = {}; typename std::enable_if<is_valid_async_input_v<Executor, Function, Args ...>, int>::type <anonymous> = 0; detail::async_result_of_t<Function, Args ...> = basic_future<long unsigned int, std::integral_constant<bool, false>, std::integral_constant<bool, true>, std::integral_constant<bool, false> >]’
/home/bit/temp/clang-unformat/standalone/application.cpp:217:57:   required from here
/usr/include/asio/post.hpp:175:46: error: call of overloaded ‘async_initiate<futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >, void()>(asio::detail::initiate_post_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >, futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >&)’ is ambiguous
  175 |   return async_initiate<NullaryToken, void()>(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  176 |       detail::initiate_post_with_executor<Executor>(ex), token);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/asio/async_result.hpp:890:1: note: candidate: ‘typename asio::constraint<asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = detail::initiate_post_with_executor<boost::asio::thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  890 | async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
/home/bit/temp/clang-unformat/build/_deps/boost-src/libs/asio/include/boost/asio/async_result.hpp:891:1: note: candidate: ‘typename boost::asio::constraint<boost::asio::detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (boost::asio::async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type boost::asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >; Signatures = {void()}; Initiation = asio::detail::initiate_post_with_executor<thread_pool::basic_executor_type<std::allocator<void>, 0> >; Args = {}; typename constraint<detail::async_result_has_initiate_memfn<CompletionToken, Signatures>::value, decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...))>::type = void; decltype (async_result<typename std::decay<_Ex>::type, Signatures ...>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(), (declval<Args&&>)()...)) = void; typename std::decay<_Ex>::type = futures::detail::async_future_scheduler::promise_fulfill_handle<futures::detail::empty_value_type, application::evaluate_option_values(const boost::asio::thread_pool::executor_type&, std::size_t&, std::size_t&, const std::string&, const clang_format_possible_values&)::<lambda()>, futures::packaged_task<long unsigned int()> >]’
  891 | async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation,
      | ^~~~~~~~~~~~~~
make[3]: *** [CMakeFiles/clang-unformat.dir/build.make:76: CMakeFiles/clang-unformat.dir/standalone/application.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/Makefile2:1199: CMakeFiles/clang-unformat.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1206: CMakeFiles/clang-unformat.dir/rule] Error 2
make: *** [Makefile:169: clang-unformat] Error 2

Predefined forced options

It would nice if there was an option to use existing .clang-format file which settings should be always included in resulted file. So that user can set base rules and algorithm can skip them and detect only others.

Fails to build due to missing library linkage

Hi @alandefreitas.

I forgot to raise this issue. The program fails to build because it cannot link against the correct threading library. I tried this on 2 different machines. I am going to submit a PR with the fix.

The error message at linker stage is:

[build] [100%] Linking CXX executable clang-unformat
[build] /usr/bin/ld: CMakeFiles/clang-unformat.dir/standalone/main.cpp.o: undefined reference to symbol 'pthread_condattr_setclock@@GLIBC_2.3.3'
[build] /usr/bin/ld: /usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line
[build] collect2: error: ld returned 1 exit status
[build] make[2]: *** [CMakeFiles/clang-unformat.dir/build.make:101: clang-unformat] Error 1
[build] make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/clang-unformat.dir/all] Error 2
[build] make: *** [Makefile:91: all] Error 2
[build] Build finished with exit code 2

Declaration of ... changes meaning of 'invoke' [-Wchanges-meaning]

Attempting to build on Arch Linux x86_64 with Boost v1.83.0-2 and CMake v3.27.8, cmake --build . --target clang-unformat fails at building CMakeFiles/clang-unformat.dir/standalone/application.cpp.o with error code 2.

Appropriate chunk of build logs:

[ 89%] Building CXX object CMakeFiles/clang-unformat.dir/standalone/application.cpp.o
In file included from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/range/concepts.h:32,
                 from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/futures/wait_for_all.h:12,
                 from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/futures.h:71,
                 from /home/bit/src/cp/clang-unformat/standalone/application.cpp:16:
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:2390:57: error: declaration of ‘template<class Fn> template<class State, class A> using futures::detail::meta::ranges_detail::partition_<Fn>::invoke = futures
::detail::meta::_t<futures::detail::meta::ranges_detail::partition_<Fn>::impl<State, A> >’ changes meaning of ‘invoke’ [-Wchanges-meaning]
 2390 |             template <typename State, typename A> using invoke = _t<impl<State, A>>;
      |                                                         ^~~~~~
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:2387:34: note: used here to mean ‘using futures::detail::meta::invoke = typename Fn::invoke<A>’
 2387 |                 using type = if_<invoke<Fn, A>, pair<list<Yes..., A>, list<No...>>, pair<list<Yes...>, list<No..., A>>>;
      |                                  ^~~~~~~~~~~~~
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:459:11: note: declared here
  459 |     using invoke = typename Fn::template invoke<Args...>;
      |           ^~~~~~
make[3]: *** [CMakeFiles/clang-unformat.dir/build.make:76: CMakeFiles/clang-unformat.dir/standalone/application.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1199: CMakeFiles/clang-unformat.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1206: CMakeFiles/clang-unformat.dir/rule] Error 2
make: *** [Makefile:169: clang-unformat] Error 2

Dulplication of `AfterFunctionDeclarationName`

When I running the unformat, it would generate 2 line with same content:

  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDeclarationName: false              # edit distance 69

In the section of :

SpaceBeforeParensOptions:
  AfterControlStatements: false                    # edit distance 69
  AfterForeachMacros: true                         # did not affect the output
  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDefinitionName: true                # did not affect the output
  AfterIfMacros: true                              # did not affect the output
  AfterOverloadedOperator: true                    # did not affect the output
  AfterRequiresInClause: true                      # did not affect the output
  AfterRequiresInExpression: true                  # did not affect the output
  BeforeNonEmptyParentheses: false                 # edit distance 69

Required Boost version seems to high

First of all, congratulations for this great tool.

I was compiling in Ubuntu 22.04, which uses Boost 1.74 by default, and I realized that the current CMakeLists.txt requires boost 1.78.

I have changed the file to require version 1.74, and it compiled and executed fine.

Something went wrong when uploading a .clang-foramt file

I use clang 16.0.0 with this master code, and built it locally.

When I upload a .clang-format file(this one), the front UI shows :

Something went wrong:
Clang-format returned non zero code
<command-line>:18:7: error: unknown key '10'
      "10": 'e',
      ^~~~
Error parsing -style: Invalid argument

The server has the following log:

DEBU[502286] Start formatting
version:16.0.0
filenameExt: .cpp
Code:
 #include <iostream>
// IndentPPDirectives
#ifdef WIN32
#include <windows.h>
#endif
// SortIncludes
#include "AnotherHeader.h"
#include "MyHeader.h"
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/write.hpp>
#include <map>
#include <string>
#include <vector>

// AlignConsecutiveMacros
#define SHORT_NAME 42
#define LONGER_NAME 0x007f
#define EVEN_LONGER_NAME (2)
#define fooo(x) (x * x)
#define baar(y, z) (y + z)

// AlignEscapedNewlines
#define PPP                                                                    \
  int aaaa;                                                                    \
  int b;                                                                       \
  int dddddddddd;

namespace LevelOneNamespace {
namespace LevelTwoNamespace {

struct AAAAAAAAAAAAAAAAAAAA {
  // AlignConsecutiveDeclarations
  int a;
  int bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
  std::string cccccccccccccccccc;
};

// AlwaysBreakTemplateDeclarations
template <typename T> T foo() {}

template <typename T>
T foo(int aaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbbbbbbbbbb) {}

// AllowShortEnumsOnASingleLine
enum : unsigned int { AA = 0, BB } myEnum;

// SpaceBeforeInheritanceColon
class B : public E {
private:
  // AlignArrayOfStructures
  struct AAAAAAAAAAAAAAAAAAAA test[3] = {
      {56, 23, "hello"}, {-1, 93463, "world"}, {7, 5, "!!"}};

  // AlignTrailingComments, AlignConsecutiveDeclarations, QualifierOrder,
  // QualifierAlignment, AlignTrailingComments
  static char const *variable; // very important variable
  void *const *x = nullptr;    // not so important variable
  char const *anotherVariable; // another comment
  int a = 1;                   // another variable
  // used for this, this, and that
  int longComplicatedName = 4;
  int b = 3;

protected:
  // AlwaysBreakAfterReturnType, QualifierAlignment
  constexpr static inline int function(int a, int b) { return (a + b) / 2; }

  // AllowShortFunctionsOnASingleLine
  static bool shortFilter(AAAAAAAAAAAAAAAAAAAA v) { return v.a != 4; }

  void empty() {}

  // IndentWrappedFunctionNames
  std::map<std::basic_string<wchar_t>, std::vector<std::pair<char, int>>>
  func(AAAAAAAAAAAAAAAAAAAA *v);

public:
  // SpaceBeforeCtorInitializerColon
  explicit B() : a(9){};

  // PackConstructorInitializers
  explicit B(int _a, int _b, int _c, std::vector<std::string> str)
      : a(_a), b(_b), longComplicatedName(_c), anotherVariable(str[0].c_str()) {
    // AllowShortIfStatementsOnASingleLine, SpaceBeforeParens
    if (_c)
      anotherVariable = nullptr;
    if (_a)
      anotherVariable = "baz";
    else
      anotherVariable = "bar";
  }

  // AllowAllParametersOfDeclarationOnNextLine BinPackParameters
  int myFunction(int aaaaaaaaaaaaa, int bbbbbbbbbbbbbbbbbbbbbbb,
                 int ccccccccccccc, int d, int e) {
    int myvar = aaaaaaaaaaaaa / 10;
    long anothervaw = d % 2;
    // comment
    char *msg = "Hello all";

    // AlignOperands
    myvar = bbbbbbbbbbbbbbbbbbbbbbb + ccccccccccccc + aaaaaaaaaaaaa;

    // AllowShortCaseLabelsOnASingleLine, SpaceBeforeParens
    switch (e) {
    case 1:
      return e;
    case 2:
      return 2;
    };

    // AllowShortBlocksOnASingleLine, SpaceBeforeParens
    while (true) {
    }
    while (true) {
      continue;
    }
  }

  // AlignAfterOpenBracket, BinPackParameters,
  void loooonFunctionIsVeryLongButNotAsLongAsJavaTypeNames(
      std::vector<AAAAAAAAAAAAAAAAAAAA> const &inputVector,
      std::map<int, std::string> *outputMap) {
    std::vector<AAAAAAAAAAAAAAAAAAAA> bar;
    std::copy_if(inputVector.begin(), inputVector.end(),
                 std::back_inserter(bar), &shortFilter);
    // AllowShortLambdasOnASingleLine
    std::sort(inputVector.begin(), inputVector.end(),
              [](auto v) { return v.a < v.b; });
    std::transform(inputVector.begin(), inputVector.end(),
                   std::inserter(*outputMap, outputMap->end()),
                   [](const AAAAAAAAAAAAAAAAAAAA &element) {
                     // LambdaBodyIndentation
                     return std::make_pair(
                         element.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
                         element.cccccccccccccccccc);
                   });
  };
  int notInline(AAAAAAAAAAAAAAAAAAAA *v);
};

// AllowShortFunctionsOnASingleLine
int notInline(AAAAAAAAAAAAAAAAAAAA *v) { return v->a + 1; }

} // namespace LevelTwoNamespace
} // namespace LevelOneNamespace

int main() {
  // ReflowComments
  // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
  // information
  /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty
   * of information */

  // SortUsingDeclarations
  using std::cin;
  using std::cout;

  int aaaaaaaaaaaaaaaaaaa, bbbbbbbbbbb, ppppppppppp, eeeee;
  // AlignConsecutiveAssignments
  aaaaaaaaaaaaaaaaaaa = 6;
  bbbbbbbbbbb = 5;
  ppppppppppp = 10;
  LevelOneNamespace::LevelTwoNamespace::B b{
      1, 3, 4,
      // SpaceBeforeCpp11BracedList
      std::vector<std::string>{"aaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbb",
                               "cccccccccccccccccccccccccccc"}};
  // AllowShortLoopsOnASingleLine
  for (int i = 0; i < 10; i++)
    cout << i;
  LevelOneNamespace::LevelTwoNamespace::AAAAAAAAAAAAAAAAAAAA
      ddddddddddddddddddddddddd{5, 5, "ff"};
  b.notInline(ddddddddddddddddddddddddd);
  // SpaceAfterCStyleCast, AllowAllArgumentsOnNextLine
  cout << (bool)b.myFunction(aaaaaaaaaaaaaaaaaaa, bbbbbbbbbbb, ppppppppppp,
                             eeeee, 0);

  return 0;
}



Style:
{
  BasedOnStyle: 'LLVM',
  AccessModifierOffset: '-8',
  AlignAfterOpenBracket: 'Align',
  AlignArrayOfStructures: 'Right',
  AlignConsecutiveAssignments:
    {
      "0": 'C',
      "1": 'o',
      "2": 'n',
      "3": 's',
      "4": 'e',
      "5": 'c',
      "6": 'u',
      "7": 't',
      "8": 'i',
      "9": 'v',
      "10": 'e',
      Enabled: 'false',
      AcrossEmptyLines: 'false',
      AcrossComments: 'false',
      AlignCompound: 'false',
      PadOperators: 'true'
    },
  AlignConsecutiveBitFields:
    {
      "0": 'C',
      "1": 'o',
      "2": 'n',
      "3": 's',
      "4": 'e',
      "5": 'c',
      "6": 'u',
      "7": 't',
      "8": 'i',
      "9": 'v',
      "10": 'e',
      Enabled: 'false',
      AcrossEmptyLines: 'false',
      AcrossComments: 'false',
      AlignCompound: 'false',
      PadOperators: 'false'
    },
  AlignConsecutiveDeclarations:
    {
      "0": 'C',
      "1": 'o',
      "2": 'n',
      "3": 's',
      "4": 'e',
      "5": 'c',
      "6": 'u',
      "7": 't',
      "8": 'i',
      "9": 'v',
      "10": 'e',
      Enabled: 'false',
      AcrossEmptyLines: 'false',
      AcrossComments: 'false',
      AlignCompound: 'false',
      PadOperators: 'false'
    },
  AlignConsecutiveMacros:
    {
      "0": 'C',
      "1": 'o',
      "2": 'n',
      "3": 's',
      "4": 'e',
      "5": 'c',
      "6": 'u',
      "7": 't',
      "8": 'i',
      "9": 'v',
      "10": 'e',
      Enabled: 'false',
      AcrossEmptyLines: 'false',
      AcrossComments: 'false',
      AlignCompound: 'false',
      PadOperators: 'false'
    },
  AlignEscapedNewlines: 'Right',
  AlignOperands: 'DontAlign',
  AlignTrailingComments: { Kind: 'Always', OverEmptyLines: '0' },
  AllowAllArgumentsOnNextLine: 'true',
  AllowAllParametersOfDeclarationOnNextLine: 'true',
  AllowShortBlocksOnASingleLine: 'Never',
  AllowShortCaseLabelsOnASingleLine: 'true',
  AllowShortEnumsOnASingleLine: 'true',
  AllowShortFunctionsOnASingleLine: 'None',
  AllowShortIfStatementsOnASingleLine: 'Never',
  AllowShortLambdasOnASingleLine: 'None',
  AllowShortLoopsOnASingleLine: 'true',
  AlwaysBreakAfterDefinitionReturnType: 'All',
  AlwaysBreakAfterReturnType: 'All',
  AlwaysBreakBeforeMultilineStrings: 'true',
  AlwaysBreakTemplateDeclarations: 'Yes',
  AttributeMacros: [ '__capability' ],
  BinPackArguments: 'true',
  BinPackParameters: 'true',
  BitFieldColonSpacing: 'Both',
  BraceWrapping:
    {
      AfterCaseLabel: 'true',
      AfterClass: 'true',
      AfterControlStatement: 'Never',
      AfterEnum: 'true',
      AfterFunction: 'true',
      AfterNamespace: 'true',
      AfterObjCDeclaration: 'true',
      AfterStruct: 'true',
      AfterUnion: 'true',
      AfterExternBlock: 'true',
      BeforeCatch: 'true',
      BeforeElse: 'true',
      BeforeLambdaBody: 'true',
      BeforeWhile: 'true',
      IndentBraces: 'true',
      SplitEmptyFunction: 'true',
      SplitEmptyRecord: 'true',
      SplitEmptyNamespace: 'true'
    },
  BreakAfterAttributes: 'Never',
  BreakAfterJavaFieldAnnotations: 'true',
  BreakArrays: 'true',
  BreakBeforeBinaryOperators: 'All',
  BreakBeforeBraces: 'Custom',
  BreakBeforeConceptDeclarations: 'true',
  BreakBeforeInlineASMColon: 'OnlyMultiline',
  BreakBeforeTernaryOperators: 'true',
  BreakConstructorInitializers: 'BeforeColon',
  BreakInheritanceList: 'BeforeColon',
  BreakStringLiterals: 'true',
  ColumnLimit: '40',
  CommentPragmas: '^ IWYU pragma:',
  CompactNamespaces: 'true',
  ConstructorInitializerIndentWidth: '0',
  ContinuationIndentWidth: '0',
  Cpp11BracedListStyle: 'true',
  DerivePointerAlignment: 'true',
  DisableFormat: 'false',
  EmptyLineAfterAccessModifier: 'Always',
  EmptyLineBeforeAccessModifier: 'Always',
  ExperimentalAutoDetectBinPacking: 'true',
  FixNamespaceComments: 'true',
  ForEachMacros: [ 'foreach', 'Q_FOREACH', 'BOOST_FOREACH' ],
  IfMacros: [ 'KJ_IF_MAYBE' ],
  IncludeBlocks: 'Preserve',
  IncludeCategories:
    [
      {
          Regex: '^"(llvm|llvm-c|clang|clang-c)/',
          Priority: '2',
          SortPriority: '0',
          CaseSensitive: 'false'
        },
      {
          Regex: '^(<|"(gtest|gmock|isl|json)/)',
          Priority: '3',
          SortPriority: '0',
          CaseSensitive: 'false'
        },
      {
          Regex: '.*',
          Priority: '1',
          SortPriority: '0',
          CaseSensitive: 'false'
        }
    ],
  IncludeIsMainRegex: '(Test)?$',
  IncludeIsMainSourceRegex: '',
  IndentAccessModifiers: 'true',
  IndentCaseBlocks: 'true',
  IndentCaseLabels: 'true',
  IndentExternBlock: 'AfterExternBlock',
  IndentGotoLabels: 'true',
  IndentPPDirectives: 'None',
  IndentRequiresClause: 'true',
  IndentWidth: '0',
  IndentWrappedFunctionNames: 'true',
  InsertBraces: 'false',
  InsertNewlineAtEOF: 'false',
  InsertTrailingCommas: 'None',
  IntegerLiteralSeparator: { Binary: '0', Decimal: '0', Hex: '0' },
  JavaScriptQuotes: 'Leave',
  JavaScriptWrapImports: 'true',
  KeepEmptyLinesAtTheStartOfBlocks: 'true',
  LambdaBodyIndentation: 'Signature',
  Language: 'Cpp',
  LineEnding: 'DeriveLF', the
  MacroBlockBegin: '',
  MacroBlockEnd: '',
  MaxEmptyLinesToKeep: '0',
  NamespaceIndentation: 'None',
  ObjCBinPackProtocolList: 'Auto',
  ObjCBlockIndentWidth: '2',
  ObjCBreakBeforeNestedBlockParam: 'true',
  ObjCSpaceAfterProperty: 'false',
  ObjCSpaceBeforeProtocolList: 'true',
  PPIndentWidth: '-1',
  PackConstructorInitializers: 'Never',
  PenaltyBreakAssignment: '2',
  PenaltyBreakBeforeFirstCallParameter: '2',
  PenaltyBreakComment: '2',
  PenaltyBreakFirstLessLess: '2',
  PenaltyBreakOpenParenthesis: '2',
  PenaltyBreakString: '2',
  PenaltyBreakTemplateDeclaration: '2',
  PenaltyExcessCharacter: '2',
  PenaltyIndentedWhitespace: '2',
  PenaltyReturnTypeOnItsOwnLine: '2',
  PointerAlignment: 'Left',
  QualifierAlignment: 'Leave',
  ReferenceAlignment: 'Pointer',
  ReflowComments: 'true',
  RemoveBracesLLVM: 'true',
  RemoveSemicolon: 'false',
  RequiresClausePosition: 'OwnLine',
  RequiresExpressionIndentation: 'OuterScope',
  SeparateDefinitionBlocks: 'Leave',
  ShortNamespaceLines: '0',
  SortIncludes: 'Never',
  SortJavaStaticImport: 'Before',
  SortUsingDeclarations: 'true',
  SpaceAfterCStyleCast: 'true',
  SpaceAfterLogicalNot: 'true',
  SpaceAfterTemplateKeyword: 'true',
  SpaceAroundPointerQualifiers: 'Default',
  SpaceBeforeAssignmentOperators: 'true',
  SpaceBeforeCaseColon: 'true',
  SpaceBeforeCpp11BracedList: 'true',
  SpaceBeforeCtorInitializerColon: 'true',
  SpaceBeforeInheritanceColon: 'true',
  SpaceBeforeParens: 'Always',
  SpaceBeforeParensOptions:
    {
      AfterControlStatements: 'true',
      AfterForeachMacros: 'true',
      AfterFunctionDeclarationName: 'true',
      AfterFunctionDefinitionName: 'true',
      AfterIfMacros: 'true',
      AfterOverloadedOperator: 'true',
      AfterRequiresInClause: 'true',
      AfterRequiresInExpression: 'true',
      BeforeNonEmptyParentheses: 'true'
    },
  SpaceBeforeRangeBasedForLoopColon: 'true',
  SpaceBeforeSquareBrackets: 'true',
  SpaceInEmptyBlock: 'true',
  SpaceInEmptyParentheses: 'true',
  SpacesBeforeTrailingComments: '0',
  SpacesInAngles: 'Never',
  SpacesInCStyleCastParentheses: 'true',
  SpacesInConditionalStatement: 'true',
  SpacesInContainerLiterals: 'true',
  SpacesInLineCommentPrefix: { Minimum: '1', Maximum: '-1' },
  SpacesInParentheses: 'true',
  SpacesInSquareBrackets: 'false',
  Standard: 'c++03',
  StatementAttributeLikeMacros: [ 'Q_EMIT' ],
  StatementMacros: [ 'Q_UNUSED', 'QT_REQUIRE_VERSION' ],
  TabWidth: '0',
  UseTab: 'Never',
  WhitespaceSensitiveMacros:
    [
      'BOOST_PP_STRINGIZE',
      'CF_SWIFT_NAME',
      'NS_SWIFT_NAME',
      'PP_STRINGIZE',
      'STRINGIZE'
    ],
  DeriveLineEnding: 'true',
  UseCRLF: 'true'
}


WARN[502286] Failed to format: <command-line>:18:7: error: unknown key '10'
      "10": 'e',
      ^~~~
Error parsing -style: Invalid argument

Any tips to fix this?

Compilation fails on Windows 11

C:\Users\k-Knight\Git\clang-unformat\standalone\cli_config.cpp:147:19:   required from here
C:/Users/k-Knight/Git/clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1451:54: error: 'constexpr bool fmt::v8::detail::has_const_formatter() [with T = std::filesystem::__cxx11::path; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>]' called in a constant expression before its definition is complete
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
C:/Users/k-Knight/Git/clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1452:68: note: in template argument for type 'bool'
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1452 |                       !std::is_const<remove_reference_t<T>>::value ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 1453 |                       has_fallback_formatter<U, char_type>::value> {};
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make[3]: *** [CMakeFiles\clang-unformat.dir\build.make:106: CMakeFiles/clang-unformat.dir/standalone/cli_config.cpp.obj] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:1216: CMakeFiles/clang-unformat.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:1223: CMakeFiles/clang-unformat.dir/rule] Error 2
mingw32-make: *** [Makefile:168: clang-unformat] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.