llvm-project/clang/unittests
Francois Ferrand 5f07f443be clang-format: Fix C99 designated initializers corner cases
Summary:
This fixes the missing space before the designated initializer when `Cpp11BracedListStyle=false` :

  const struct A a = { .a = 1, .b = 2 };
                      ^

Also, wrapping between opening brace and designated array initializers used to have an excessive penalty (like breaking between an expression and the subscript operator), leading to unexpected wrapping:

  const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa =
      {[1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
       [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};

instead of:

  const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa = {
      [1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
      [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};

Finally, designated array initializers are not binpacked, just like designated member initializers.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, krasimir, klimek

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

llvm-svn: 305696
2017-06-19 14:41:21 +00:00
..
AST Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC. 2017-06-15 21:01:24 +00:00
ASTMatchers Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC. 2017-06-15 21:01:24 +00:00
Analysis [analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector" 2017-04-06 14:34:07 +00:00
Basic Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC. 2017-06-15 21:01:24 +00:00
CodeGen Make sure the LLVMContext outlive the CompilerInstance 2016-04-14 05:37:41 +00:00
Driver Driver must return non-zero code on errors in command line 2017-05-24 14:57:17 +00:00
Format clang-format: Fix C99 designated initializers corner cases 2017-06-19 14:41:21 +00:00
Frontend Remove 'Filename' parameter from BeginSourceFileAction. 2017-06-09 01:36:10 +00:00
Lex LexerTest memory leak fix- 2017-06-15 18:34:47 +00:00
Rewrite Remove autoconf support 2016-01-26 21:30:40 +00:00
Sema [Sema] Allow an external sema source to handle delayed typo corrections. 2016-05-19 10:46:10 +00:00
StaticAnalyzer Add a method to get the list of registered static analyzer checkers. 2016-11-08 07:23:32 +00:00
Tooling Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC. 2017-06-15 21:01:24 +00:00
libclang Fixed more signed/unsigned mismatch warnings introduced in my change at r279076 2016-08-18 20:56:48 +00:00
CMakeLists.txt CFGBuilder: Fix crash when visiting a range-based for over a dependent type 2016-07-08 10:50:51 +00:00