Skip to content

Commit 85ee97f

Browse files
author
Jonathan Coe
committed
Revert "[clang-format] C# property formatting can be controlled by config options"
Committed in error without approval https://reviews.llvm.org/D79000 This reverts commit 015bca3.
1 parent 015bca3 commit 85ee97f

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,6 @@ bool UnwrappedLineParser::tryToParsePropertyAccessor() {
15311531
// Try to parse the property accessor:
15321532
// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties
15331533
Tokens->setPosition(StoredPosition);
1534-
if (Style.BraceWrapping.AfterFunction == true)
1535-
addUnwrappedLine();
15361534
nextToken();
15371535
do {
15381536
switch (FormatTok->Tok.getKind()) {

clang/unittests/Format/FormatTestCSharp.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,11 @@ TEST_F(FormatTestCSharp, Attributes) {
245245
"}");
246246

247247
verifyFormat("[TestMethod]\n"
248-
"public string Host\n"
249-
"{ set; get; }");
248+
"public string Host { set; get; }");
250249

251250
verifyFormat("[TestMethod(\"start\", HelpText = \"Starts the server "
252251
"listening on provided host\")]\n"
253-
"public string Host\n"
254-
"{ set; get; }");
252+
"public string Host { set; get; }");
255253

256254
verifyFormat(
257255
"[DllImport(\"Hello\", EntryPoint = \"hello_world\")]\n"
@@ -671,32 +669,6 @@ class MyClass {
671669
set => veryLongNamedField = value;
672670
} = VeryLongNamedTypeIndeed.Create(DefaultFirstArgument, DefaultSecondArgument,
673671
DefaultThirdArgument);
674-
})",
675-
Style);
676-
677-
// Brace wrapping and single-lining of accessor can be controlled by config.
678-
Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;
679-
Style.BreakBeforeBraces = FormatStyle::BS_Custom;
680-
Style.BraceWrapping.AfterFunction = true;
681-
682-
verifyFormat(R"(//
683-
public class SaleItem {
684-
public decimal Price
685-
{ get; set; }
686-
})",
687-
Style);
688-
689-
verifyFormat(R"(//
690-
class TimePeriod {
691-
public double Hours
692-
{
693-
get {
694-
return _seconds / 3600;
695-
}
696-
set {
697-
_seconds = value * 3600;
698-
}
699-
}
700672
})",
701673
Style);
702674
}

0 commit comments

Comments
 (0)