-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathv18.1.8.diff
521 lines (502 loc) · 20.3 KB
/
v18.1.8.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index efcb4e1d87ea..d002b6e5dc7f 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -4967,6 +4967,8 @@ private:
FormatStyle getLLVMStyle(
FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
+FormatStyle getHaikuStyle();
+
/// Returns a format style complying with one of Google's style guides:
/// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
/// http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml.
@@ -5160,6 +5162,8 @@ extern const char *DefaultFormatStyle;
/// Different builds can modify the value to the preferred styles.
extern const char *DefaultFallbackStyle;
+extern bool Haiku;
+
/// Construct a FormatStyle based on ``StyleName``.
///
/// ``StyleName`` can take several forms:
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 53cd169b0590..9ffc79a93d92 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1534,10 +1534,12 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
// : First(...), ...
// Next(...)
// ^ line up here.
- CurrentState.Indent = State.Column + (Style.BreakConstructorInitializers ==
- FormatStyle::BCIS_BeforeComma
- ? 0
- : 2);
+ CurrentState.Indent =
+ State.Column + (Haiku || // Haiku CtorInitializerColon on its own line
+ Style.BreakConstructorInitializers ==
+ FormatStyle::BCIS_BeforeComma
+ ? 0
+ : 2);
CurrentState.NestedBlockIndent = CurrentState.Indent;
if (Style.PackConstructorInitializers > FormatStyle::PCIS_BinPack) {
CurrentState.AvoidBinPacking = true;
@@ -1692,7 +1694,7 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
(!Previous || Previous->isNot(tok::kw_return) ||
(Style.Language != FormatStyle::LK_Java && PrecedenceLevel > 0)) &&
(Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign ||
- PrecedenceLevel != prec::Comma || Current.NestingLevel == 0)) {
+ PrecedenceLevel > prec::Comma || Current.NestingLevel == 0)) {
NewParenState.Indent = std::max(
std::max(State.Column, NewParenState.Indent), CurrentState.LastSpace);
}
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 10fe35c79a4f..9aecf2cf3fd9 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -818,8 +818,9 @@ template <> struct MappingTraits<FormatStyle> {
StringRef BasedOnStyle;
if (IO.outputting()) {
- StringRef Styles[] = {"LLVM", "Google", "Chromium", "Mozilla",
- "WebKit", "GNU", "Microsoft", "clang-format"};
+ StringRef Styles[] = {"LLVM", "Google", "Chromium",
+ "Mozilla", "Haiku", "WebKit",
+ "GNU", "Microsoft", "clang-format"};
for (StringRef StyleName : Styles) {
FormatStyle PredefinedStyle;
if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) &&
@@ -1608,6 +1609,45 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
return LLVMStyle;
}
+FormatStyle getHaikuStyle() {
+ FormatStyle Style = getLLVMStyle();
+ Style.AccessModifierOffset = -4;
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign;
+ Style.AlignEscapedNewlines = FormatStyle::ENAS_DontAlign;
+ Style.AlignOperands = FormatStyle::OAS_DontAlign;
+ Style.AlignTrailingComments.Kind = FormatStyle::TCAS_Never;
+ Style.AllowAllArgumentsOnNextLine = false;
+ Style.AllowAllParametersOfDeclarationOnNextLine = false;
+ Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_InlineOnly;
+ Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_TopLevelDefinitions;
+ Style.BraceWrapping.AfterCaseLabel = true;
+ Style.BraceWrapping.AfterExternBlock = true;
+ Style.BraceWrapping.AfterFunction = true;
+ Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.ColumnLimit = 100;
+ Style.IndentCaseLabels = true;
+ Style.IndentWidth = 4;
+ Style.InsertBraces = true;
+ Style.InsertNewlineAtEOF = true;
+ Style.LineEnding = FormatStyle::LE_LF;
+ Style.MaxEmptyLinesToKeep = 2;
+ Style.PackConstructorInitializers = FormatStyle::PCIS_Never;
+ Style.PointerAlignment = FormatStyle::PAS_Left;
+ Style.RemoveBracesLLVM = true;
+ Style.RemoveParentheses = FormatStyle::RPS_ReturnStatement;
+ Style.RemoveSemicolon = true;
+ Style.SpaceAfterTemplateKeyword = false;
+ Style.SpaceBeforeParens = FormatStyle::SBPO_Custom;
+ Style.SpaceBeforeParensOptions.AfterPlacementOperator = false;
+ Style.TabWidth = 4;
+ Style.UseTab = FormatStyle::UT_Always;
+
+ Haiku = true;
+
+ return Style;
+}
+
FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
if (Language == FormatStyle::LK_TextProto) {
FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto);
@@ -1926,6 +1966,8 @@ bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
FormatStyle *Style) {
if (Name.equals_insensitive("llvm"))
*Style = getLLVMStyle(Language);
+ else if (Name == "Haiku")
+ *Style = getHaikuStyle();
else if (Name.equals_insensitive("chromium"))
*Style = getChromiumStyle(Language);
else if (Name.equals_insensitive("mozilla"))
@@ -3849,11 +3891,11 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
const char *StyleOptionHelpDescription =
"Set coding style. <string> can be:\n"
"1. A preset: LLVM, GNU, Google, Chromium, Microsoft,\n"
- " Mozilla, WebKit.\n"
+ " Haiku, Mozilla, WebKit.\n"
"2. 'file' to load style configuration from a\n"
- " .clang-format file in one of the parent directories\n"
+ " .haiku-format file in one of the parent directories\n"
" of the source file (for stdin, see --assume-filename).\n"
- " If no .clang-format file is found, falls back to\n"
+ " If no .haiku-format file is found, falls back to\n"
" --fallback-style.\n"
" --style=file is the default.\n"
"3. 'file:<format_file_path>' to explicitly specify\n"
@@ -3917,7 +3959,9 @@ FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) {
// Update StyleOptionHelpDescription above when changing this.
const char *DefaultFormatStyle = "file";
-const char *DefaultFallbackStyle = "LLVM";
+const char *DefaultFallbackStyle = "Haiku";
+
+bool Haiku = false;
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
loadAndParseConfigFile(StringRef ConfigFile, llvm::vfs::FileSystem *FS,
@@ -3935,7 +3979,9 @@ llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
StringRef FallbackStyleName,
StringRef Code, llvm::vfs::FileSystem *FS,
bool AllowUnknownOptions) {
- FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
+ FormatStyle Style = FallbackStyleName == DefaultFallbackStyle
+ ? getHaikuStyle()
+ : getLLVMStyle(guessLanguage(FileName, Code));
FormatStyle FallbackStyle = getNoStyle();
if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle))
return make_string_error("Invalid fallback style: " + FallbackStyleName);
@@ -4015,11 +4061,7 @@ llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
}
};
- // Look for .clang-format/_clang-format file in the file's parent directories.
- llvm::SmallVector<std::string, 2> FilesToLookFor;
- FilesToLookFor.push_back(".clang-format");
- FilesToLookFor.push_back("_clang-format");
-
+ // Look for .clang-format/.haiku-format file in the file's parent directories.
SmallString<128> UnsuitableConfigFiles;
for (StringRef Directory = Path; !Directory.empty();
Directory = llvm::sys::path::parent_path(Directory)) {
@@ -4029,10 +4071,11 @@ llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
continue;
}
- for (const auto &F : FilesToLookFor) {
+ {
SmallString<128> ConfigFile(Directory);
- llvm::sys::path::append(ConfigFile, F);
+ llvm::sys::path::append(ConfigFile,
+ Haiku ? ".haiku-format" : ".clang-format");
LLVM_DEBUG(llvm::dbgs() << "Trying " << ConfigFile << "...\n");
Status = FS->status(ConfigFile);
@@ -4071,12 +4114,6 @@ llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
Style.InheritsParentConfig = false;
ChildFormatTextToApply.emplace_back(std::move(*Text));
-
- // Breaking out of the inner loop, since we don't want to parse
- // .clang-format AND _clang-format, if both exist. Then we continue the
- // outer loop (parent directories) in search for the parent
- // configuration.
- break;
}
}
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 628fe46cc348..6fcd28d49a09 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3125,10 +3125,25 @@ private:
void TokenAnnotator::setCommentLineLevels(
SmallVectorImpl<AnnotatedLine *> &Lines) const {
+ AnnotatedLine *NextCommentLine = nullptr;
const AnnotatedLine *NextNonCommentLine = nullptr;
for (AnnotatedLine *Line : llvm::reverse(Lines)) {
assert(Line->First);
+ // Indented comments immediately below a code line are for the code above.
+ if (Haiku) {
+ if (Line->isComment()) {
+ NextCommentLine = Line;
+ } else {
+ if (NextCommentLine && NextCommentLine->First->NewlinesBefore == 1 &&
+ NextCommentLine->First->OriginalColumn ==
+ Line->First->OriginalColumn + 4) {
+ NextCommentLine->Level = Line->Level + 1;
+ }
+ NextCommentLine = nullptr;
+ }
+ }
+
// If the comment is currently aligned with the line immediately following
// it, that's probably intentional and we should keep it.
if (NextNonCommentLine && NextNonCommentLine->First->NewlinesBefore < 2 &&
@@ -3279,6 +3294,20 @@ void TokenAnnotator::annotate(AnnotatedLine &Line) {
Style.InsertNewlineAtEOF) {
First->NewlinesBefore = 1;
}
+
+ if (!Haiku)
+ return;
+
+ // Use exactly 2 empty lines to separate Haiku top-level function definitions.
+ static bool Comment = false;
+ if (First->is(tok::comment)) {
+ Comment = true;
+ } else if (Comment) {
+ Comment = false;
+ } else if (Line.Level == 0 && !First->IsFirst && Line.MightBeFunctionDecl &&
+ Line.mightBeFunctionDefinition()) {
+ First->NewlinesBefore = 3;
+ }
}
// This function heuristically determines whether 'Current' starts the name of a
@@ -5193,6 +5222,11 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
break;
}
}
+
+ // Also break after Haiku CtorInitializerColon to put it on its own line.
+ if (Haiku && Left.is(TT_CtorInitializerColon))
+ return true;
+
if (Style.PackConstructorInitializers == FormatStyle::PCIS_Never) {
if (Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon &&
(Left.is(TT_CtorInitializerComma) ||
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 179d77bf0049..9e71483f2e04 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2644,7 +2644,8 @@ void UnwrappedLineParser::keepAncestorBraces() {
if (!Style.RemoveBracesLLVM)
return;
- const int MaxNestingLevels = 2;
+ const int MaxNestingLevels = Haiku ? 1 // Haiku only removes innermost braces.
+ : 2;
const int Size = NestedTooDeep.size();
if (Size >= MaxNestingLevels)
NestedTooDeep[Size - MaxNestingLevels] = true;
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index e122cea50f72..7a7e4b63644f 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -69,9 +69,9 @@ static cl::opt<std::string>
static cl::opt<std::string>
FallbackStyle("fallback-style",
cl::desc("The name of the predefined style used as a\n"
- "fallback in case clang-format is invoked with\n"
- "-style=file, but can not find the .clang-format\n"
- "file to use. Defaults to 'LLVM'.\n"
+ "fallback in case haiku-format is invoked with\n"
+ "-style=file, but can not find the .haiku-format\n"
+ "file to use. Defaults to 'Haiku'.\n"
"Use -fallback-style=none to skip formatting."),
cl::init(clang::format::DefaultFallbackStyle),
cl::cat(ClangFormatCategory));
@@ -79,9 +79,9 @@ static cl::opt<std::string>
static cl::opt<std::string> AssumeFileName(
"assume-filename",
cl::desc("Set filename used to determine the language and to find\n"
- ".clang-format file.\n"
+ ".haiku-format file.\n"
"Only used when reading from stdin.\n"
- "If this is not passed, the .clang-format file is searched\n"
+ "If this is not passed, the .haiku-format file is searched\n"
"relative to the current working directory when reading stdin.\n"
"Unrecognized filenames are treated as C++.\n"
"supported:\n"
@@ -542,7 +542,7 @@ static bool format(StringRef FileName) {
} // namespace clang
static void PrintVersion(raw_ostream &OS) {
- OS << clang::getClangToolFullVersion("clang-format") << '\n';
+ OS << clang::getClangToolFullVersion("haiku-format") << '\n';
}
// Dump the configuration.
diff --git a/clang/unittests/Format/CMakeLists.txt b/clang/unittests/Format/CMakeLists.txt
index 71f5886d946c..9641ea90a326 100644
--- a/clang/unittests/Format/CMakeLists.txt
+++ b/clang/unittests/Format/CMakeLists.txt
@@ -24,6 +24,7 @@ add_clang_unittest(FormatTests
FormatTestVerilog.cpp
FormatTokenSourceTest.cpp
FormatReplacementTest.cpp
+ HaikuTest.cpp
IntegerLiteralSeparatorTest.cpp
MacroCallReconstructorTest.cpp
MacroExpanderTest.cpp
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 11ae41bc78ac..52496e945418 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9148,6 +9148,14 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) {
" b));",
Style);
+ Style.ColumnLimit = 30;
+ verifyFormat("for (int foo = 0; foo < FOO;\n"
+ " ++foo) {\n"
+ " bar(foo);\n"
+ "}",
+ Style);
+ Style.ColumnLimit = 80;
+
Style.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
Style.BinPackArguments = false;
Style.BinPackParameters = false;
diff --git a/clang/unittests/Format/HaikuTest.cpp b/clang/unittests/Format/HaikuTest.cpp
new file mode 100644
index 000000000000..7c90cd74d4e9
--- /dev/null
+++ b/clang/unittests/Format/HaikuTest.cpp
@@ -0,0 +1,169 @@
+//===- unittest/Format/HaikuTest.cpp --------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "FormatTestBase.h"
+
+#define verifyHaiku(...) _verifyHaiku(__FILE__, __LINE__, __VA_ARGS__)
+#define verifyFormatted(...) _verifyFormatted(__FILE__, __LINE__, __VA_ARGS__)
+
+namespace clang {
+namespace format {
+namespace test {
+namespace {
+
+class HaikuTest : public FormatTestBase {
+ FormatStyle Style;
+
+public:
+ HaikuTest() : Style(getHaikuStyle()) { Style.ColumnLimit = 60; }
+
+protected:
+ void _verifyHaiku(const char *File, int Line, StringRef Expected,
+ StringRef Code, bool MessUp = true) {
+ testing::ScopedTrace t(File, Line, testing::Message() << Code.str());
+ EXPECT_EQ(Expected.str(), format(Expected, Style))
+ << "Expected code is not stable";
+ EXPECT_EQ(Expected.str(), format(Code, Style));
+ if (MessUp)
+ EXPECT_EQ(Expected.str(), format(messUp(Code), Style));
+ }
+
+ void _verifyHaiku(const char *File, int Line, StringRef Code) {
+ _verifyHaiku(File, Line, Code, Code);
+ }
+
+ void _verifyFormatted(const char *File, int Line, StringRef Code) {
+ _verifyHaiku(File, Line, Code, Code, /*MessUp=*/false);
+ }
+};
+
+TEST_F(HaikuTest, BreakConstructorInitializers) {
+ verifyHaiku("Foo::Foo(int32 param)\n"
+ "\t:\n"
+ "\tfMember(param),\n"
+ "\tfPointerMember(NULL)\n"
+ "{\n"
+ "}\n");
+
+ verifyHaiku("class BreakCtorInitializers {\n"
+ "private:\n"
+ "\tint a, b;\n"
+ "\n"
+ "public:\n"
+ "\tBreakCtorInitializers(int i)\n"
+ "\t\t:\n"
+ "\t\ta(i)\n"
+ "\t{\n"
+ "\t\tb = 0;\n"
+ "\t}\n"
+ "\tBreakCtorInitializers(int i, int j);\n"
+ "};\n"
+ "\n"
+ "\n"
+ "BreakCtorInitializers::BreakCtorInitializers(int i, int j)\n"
+ "\t:\n"
+ "\ta(i),\n"
+ "\tb(j)\n"
+ "{\n"
+ "}\n",
+ "class BreakCtorInitializers {\n"
+ " private: int a, b;\n"
+ "\n"
+ " public:\n"
+ " BreakCtorInitializers(int i)\n"
+ " : a(i) { b = 0; }\n"
+ " BreakCtorInitializers(int i, int j);\n"
+ "};\n"
+ "\n"
+ "BreakCtorInitializers::BreakCtorInitializers(int i, int j)\n"
+ ": a(i), b(j) {}\n");
+}
+
+TEST_F(HaikuTest, ContinuationIndent) {
+ verifyHaiku("for (int32 i = 0; ar->FindMessage(str, i, &msg) == B_OK;\n"
+ "\ti++) {\n"
+ "\tf(i);\n"
+ "}\n");
+}
+
+TEST_F(HaikuTest, CommentsBelowCode) {
+ verifyFormatted("return B_BENDIAN_TO_HOST_INT32(*(uint32*)&color);\n"
+ "\t// rgb_color is always in rgba format, no matter what\n"
+ "\t// endian; we always return the value in host endian.\n");
+}
+
+TEST_F(HaikuTest, SeparateFunctionDefinitions) {
+ verifyHaiku("void\n"
+ "f()\n"
+ "{\n"
+ "}\n"
+ "\n"
+ "\n"
+ "void\n"
+ "g()\n"
+ "{\n"
+ "} // g\n"
+ "\n"
+ "\n"
+ "void\n"
+ "h()\n"
+ "{\n"
+ "}\n"
+ "// comment\n"
+ "void\n"
+ "foo()\n"
+ "{\n"
+ "}\n",
+ "void f() {}\n"
+ "void g() {\n"
+ "}\t// g\n"
+ "\n"
+ "void\n"
+ "h() {}\n"
+ "// comment\n"
+ "void foo()\n"
+ "{\n"
+ "}");
+}
+
+TEST_F(HaikuTest, NoSpaceBetweenNewAndLParen) {
+ verifyHaiku("return new(std::nothrow) BView(data);\n");
+}
+
+TEST_F(HaikuTest, InsertAndRemoveBraces) {
+ verifyHaiku("while (a) {\n"
+ "\tif (b)\n"
+ "\t\tc();\n"
+ "}\n",
+ "while (a)\n"
+ "\tif (b)\n"
+ "\t\tc();");
+
+ verifyHaiku("while (a) {\n"
+ "\tif (b)\n"
+ "\t\tc();\n"
+ "}\n",
+ "while (a) {\n"
+ "\tif (b) {\n"
+ "\t\tc();"
+ "\t}\n"
+ "}");
+}
+
+TEST_F(HaikuTest, BinPackArguments) {
+ verifyHaiku("BString f(reinterpret_cast<char*>(addressof(*o)),\n"
+ "\tdistance(o, r));\n");
+
+ verifyHaiku("BString f{reinterpret_cast<char*>(addressof(*o)),\n"
+ "\tdistance(o, r)};\n");
+}
+
+} // namespace
+} // namespace test
+} // namespace format
+} // namespace clang