llvm-project/clang/lib
Francois Ferrand f92f806aa4 clang-format: tweak formatting of variable initialization blocks
Summary:
This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
so that is does not apply after a brace, when Cpp11BracedListStyle is
false.

This way, variable initialization is wrapped more like an initializer
than like a function call, which is more consistent with user
expectations for this braced list style.

With PenaltyBreakBeforeFirstCallParameter=200, this gives the following
code: (with Cpp11BracedListStyle=false)

Before :

  const std::unordered_map<std::string, int> Something::MyHashTable =
      { { "aaaaaaaaaaaaaaaaaaaaa", 0 },
        { "bbbbbbbbbbbbbbbbbbbbb", 1 },
        { "ccccccccccccccccccccc", 2 } };

After :

  const std::unordered_set<std::string> Something::MyUnorderedSet = {
    { "aaaaaaaaaaaaaaaaaaaaa", 0 },
    { "bbbbbbbbbbbbbbbbbbbbb", 1 },
    { "ccccccccccccccccccccc", 2 }
  };

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D43290

llvm-svn: 332434
2018-05-16 08:03:52 +00:00
..
ARCMigrate Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
AST [Attr] Don't print implicit attributes 2018-05-15 22:16:47 +00:00
ASTMatchers Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Analysis [analyzer] Do not crash on callback for call_once passed by value 2018-05-16 00:29:13 +00:00
Basic [Solaris] Only define _REENTRANT if -pthread 2018-05-15 11:36:00 +00:00
CodeGen Move helper classes into anonymous namespaces. NFCI. 2018-05-15 21:26:47 +00:00
CrossTU [CrossTU] Fix handling of Cross Translation Unit directory path 2017-10-27 12:53:37 +00:00
Driver [Driver] Only use -lc++ on Fuchsia 2018-05-11 20:42:31 +00:00
Edit Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Format clang-format: tweak formatting of variable initialization blocks 2018-05-16 08:03:52 +00:00
Frontend Revert commits r332160, r332164, r332236. 2018-05-16 00:27:43 +00:00
FrontendTool Make a build bot happy. 2018-02-10 14:26:53 +00:00
Headers [X86] Revert part of r332266: Use __builtin_convertvector to replace some of the avx512 truncate builtins. 2018-05-15 03:17:52 +00:00
Index Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Lex Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective' 2018-05-10 19:05:36 +00:00
Parse Improve diagnostics and error recovery for template name lookup. 2018-05-11 02:43:08 +00:00
Rewrite Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Sema Don't produce a redundant "auto type is incompatible with C++98" on every lambda with no explicit return type. 2018-05-15 21:27:30 +00:00
Serialization Move helper classes into anonymous namespaces. NFCI. 2018-05-15 21:26:47 +00:00
StaticAnalyzer [analyzer] Make plist-html diagnostic consumer produce multi-file reports. 2018-05-16 00:11:24 +00:00
Tooling [clang] Update uses of DEBUG macro to LLVM_DEBUG. 2018-05-15 13:30:56 +00:00
CMakeLists.txt Add Cross Translation Unit support library 2017-09-22 11:11:01 +00:00