Skip to content

Commit 3f3712f

Browse files
committed
WIP test reindent
1 parent fbedfdd commit 3f3712f

File tree

120 files changed

+1504
-1241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1504
-1241
lines changed

gcc/rust/ast/rust-ast-builder-type.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ ASTTypeBuilder::visit (TypePath &path)
6262
{
6363
switch (seg->get_type ())
6464
{
65-
case TypePathSegment::REG: {
65+
case TypePathSegment::REG:
66+
{
6667
const TypePathSegment &segment
6768
= (const TypePathSegment &) (*seg.get ());
6869
TypePathSegment *s
@@ -74,7 +75,8 @@ ASTTypeBuilder::visit (TypePath &path)
7475
}
7576
break;
7677

77-
case TypePathSegment::GENERIC: {
78+
case TypePathSegment::GENERIC:
79+
{
7880
TypePathSegmentGeneric &generic
7981
= (TypePathSegmentGeneric &) (*seg.get ());
8082

@@ -89,7 +91,8 @@ ASTTypeBuilder::visit (TypePath &path)
8991
}
9092
break;
9193

92-
case TypePathSegment::FUNCTION: {
94+
case TypePathSegment::FUNCTION:
95+
{
9396
rust_unreachable ();
9497
// TODO
9598
// const TypePathSegmentFunction &fn

gcc/rust/ast/rust-ast-builder.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ Builder::new_type_param (
574574
{
575575
switch (b->get_bound_type ())
576576
{
577-
case TypeParamBound::TypeParamBoundType::TRAIT: {
577+
case TypeParamBound::TypeParamBoundType::TRAIT:
578+
{
578579
const TraitBound &tb = (const TraitBound &) *b.get ();
579580
const TypePath &path = tb.get_type_path ();
580581

@@ -599,7 +600,8 @@ Builder::new_type_param (
599600
{
600601
switch (seg->get_type ())
601602
{
602-
case TypePathSegment::REG: {
603+
case TypePathSegment::REG:
604+
{
603605
const TypePathSegment &segment
604606
= (const TypePathSegment &) (*seg.get ());
605607
TypePathSegment *s = new TypePathSegment (
@@ -611,7 +613,8 @@ Builder::new_type_param (
611613
}
612614
break;
613615

614-
case TypePathSegment::GENERIC: {
616+
case TypePathSegment::GENERIC:
617+
{
615618
TypePathSegmentGeneric &generic
616619
= (TypePathSegmentGeneric &) (*seg.get ());
617620

@@ -625,7 +628,8 @@ Builder::new_type_param (
625628
}
626629
break;
627630

628-
case TypePathSegment::FUNCTION: {
631+
case TypePathSegment::FUNCTION:
632+
{
629633
rust_unreachable ();
630634
// TODO
631635
// const TypePathSegmentFunction &fn
@@ -647,7 +651,8 @@ Builder::new_type_param (
647651
}
648652
break;
649653

650-
case TypeParamBound::TypeParamBoundType::LIFETIME: {
654+
case TypeParamBound::TypeParamBoundType::LIFETIME:
655+
{
651656
const Lifetime &l = (const Lifetime &) *b.get ();
652657

653658
auto bl = new Lifetime (l.get_lifetime_type (),
@@ -700,7 +705,8 @@ Builder::new_generic_args (GenericArgs &args)
700705
{
701706
switch (arg.get_kind ())
702707
{
703-
case GenericArg::Kind::Type: {
708+
case GenericArg::Kind::Type:
709+
{
704710
std::unique_ptr<Type> ty = new_type (arg.get_type ());
705711
GenericArg arg = GenericArg::create_type (std::move (ty));
706712
}

gcc/rust/ast/rust-ast-collector.cc

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,24 @@ TokenCollector::visit (Attribute &attrib)
154154
{
155155
switch (attrib.get_attr_input ().get_attr_input_type ())
156156
{
157-
case AST::AttrInput::AttrInputType::LITERAL: {
157+
case AST::AttrInput::AttrInputType::LITERAL:
158+
{
158159
visit (static_cast<AttrInputLiteral &> (attrib.get_attr_input ()));
159160
break;
160161
}
161-
case AST::AttrInput::AttrInputType::MACRO: {
162+
case AST::AttrInput::AttrInputType::MACRO:
163+
{
162164
visit (static_cast<AttrInputMacro &> (attrib.get_attr_input ()));
163165
break;
164166
}
165-
case AST::AttrInput::AttrInputType::META_ITEM: {
167+
case AST::AttrInput::AttrInputType::META_ITEM:
168+
{
166169
visit (static_cast<AttrInputMetaItemContainer &> (
167170
attrib.get_attr_input ()));
168171
break;
169172
}
170-
case AST::AttrInput::AttrInputType::TOKEN_TREE: {
173+
case AST::AttrInput::AttrInputType::TOKEN_TREE:
174+
{
171175
visit (static_cast<DelimTokenTree &> (attrib.get_attr_input ()));
172176
break;
173177
}
@@ -634,7 +638,8 @@ TokenCollector::visit (GenericArg &arg)
634638
case GenericArg::Kind::Type:
635639
visit (arg.get_type ());
636640
break;
637-
case GenericArg::Kind::Either: {
641+
case GenericArg::Kind::Either:
642+
{
638643
auto path = arg.get_path ();
639644
push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (path)));
640645
}
@@ -789,7 +794,8 @@ TokenCollector::visit (Literal &lit, location_t locus)
789794
push (Rust::Token::make_float (locus, std::move (value),
790795
lit.get_type_hint ()));
791796
break;
792-
case Literal::LitType::BOOL: {
797+
case Literal::LitType::BOOL:
798+
{
793799
if (value == Values::Keywords::FALSE_LITERAL)
794800
push (Rust::Token::make (FALSE_LITERAL, locus));
795801
else if (value == Values::Keywords::TRUE_LITERAL)
@@ -1534,33 +1540,40 @@ TokenCollector::visit (InlineAsm &expr)
15341540
using RegisterType = AST::InlineAsmOperand::RegisterType;
15351541
switch (operand.get_register_type ())
15361542
{
1537-
case RegisterType::In: {
1543+
case RegisterType::In:
1544+
{
15381545
visit (operand.get_in ().expr);
15391546
break;
15401547
}
1541-
case RegisterType::Out: {
1548+
case RegisterType::Out:
1549+
{
15421550
visit (operand.get_out ().expr);
15431551
break;
15441552
}
1545-
case RegisterType::InOut: {
1553+
case RegisterType::InOut:
1554+
{
15461555
visit (operand.get_in_out ().expr);
15471556
break;
15481557
}
1549-
case RegisterType::SplitInOut: {
1558+
case RegisterType::SplitInOut:
1559+
{
15501560
auto split = operand.get_split_in_out ();
15511561
visit (split.in_expr);
15521562
visit (split.out_expr);
15531563
break;
15541564
}
1555-
case RegisterType::Const: {
1565+
case RegisterType::Const:
1566+
{
15561567
visit (operand.get_const ().anon_const.expr);
15571568
break;
15581569
}
1559-
case RegisterType::Sym: {
1570+
case RegisterType::Sym:
1571+
{
15601572
visit (operand.get_sym ().expr);
15611573
break;
15621574
}
1563-
case RegisterType::Label: {
1575+
case RegisterType::Label:
1576+
{
15641577
visit (operand.get_label ().expr);
15651578
break;
15661579
}
@@ -1776,7 +1789,8 @@ TokenCollector::visit (UseTreeGlob &use_tree)
17761789
{
17771790
switch (use_tree.get_glob_type ())
17781791
{
1779-
case UseTreeGlob::PathType::PATH_PREFIXED: {
1792+
case UseTreeGlob::PathType::PATH_PREFIXED:
1793+
{
17801794
auto path = use_tree.get_path ();
17811795
visit (path);
17821796
push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1796,7 +1810,8 @@ TokenCollector::visit (UseTreeList &use_tree)
17961810
{
17971811
switch (use_tree.get_path_type ())
17981812
{
1799-
case UseTreeList::PathType::PATH_PREFIXED: {
1813+
case UseTreeList::PathType::PATH_PREFIXED:
1814+
{
18001815
auto path = use_tree.get_path ();
18011816
visit (path);
18021817
push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1824,7 +1839,8 @@ TokenCollector::visit (UseTreeRebind &use_tree)
18241839
visit (path);
18251840
switch (use_tree.get_new_bind_type ())
18261841
{
1827-
case UseTreeRebind::NewBindType::IDENTIFIER: {
1842+
case UseTreeRebind::NewBindType::IDENTIFIER:
1843+
{
18281844
push (Rust::Token::make (AS, UNDEF_LOCATION));
18291845
auto id = use_tree.get_identifier ().as_string ();
18301846
push (

gcc/rust/ast/rust-ast-dump.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class Dump
4949
{
5050
switch (item.get_kind ())
5151
{
52-
case AST::CollectItem::Kind::Token: {
52+
case AST::CollectItem::Kind::Token:
53+
{
5354
TokenPtr current = item.get_token ();
5455
if (require_spacing (previous, current))
5556
stream << " ";
@@ -90,7 +91,6 @@ class Dump
9091
} // namespace Rust
9192

9293
// In the global namespace to make it easier to call from debugger
93-
void
94-
debug (Rust::AST::Visitable &v);
94+
void debug (Rust::AST::Visitable &v);
9595

9696
#endif // !RUST_AST_DUMP_H

gcc/rust/ast/rust-ast-formatting.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,18 @@ enum AttrMode
3535
INNER
3636
};
3737

38-
std::string
39-
indent_spaces (enum indent_mode mode);
38+
std::string indent_spaces (enum indent_mode mode);
4039

4140
// Gets a string in a certain delim type.
42-
std::string
43-
get_string_in_delims (std::string str_input, DelimType delim_type);
41+
std::string get_string_in_delims (std::string str_input, DelimType delim_type);
4442

45-
std::string
46-
get_mode_dump_desc (AttrMode mode);
43+
std::string get_mode_dump_desc (AttrMode mode);
4744

4845
// Adds lines below adding attributes
49-
std::string
50-
append_attributes (std::vector<Attribute> attrs, AttrMode mode);
46+
std::string append_attributes (std::vector<Attribute> attrs, AttrMode mode);
5147

5248
// Removes the beginning and end quotes of a quoted string.
53-
std::string
54-
unquote_string (std::string input);
49+
std::string unquote_string (std::string input);
5550

5651
} // namespace AST
5752
} // namespace Rust

gcc/rust/ast/rust-ast-visitor.cc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -680,33 +680,40 @@ DefaultASTVisitor::visit (AST::InlineAsm &expr)
680680
{
681681
switch (operand.get_register_type ())
682682
{
683-
case RegisterType::In: {
683+
case RegisterType::In:
684+
{
684685
visit (operand.get_in ().expr);
685686
break;
686687
}
687-
case RegisterType::Out: {
688+
case RegisterType::Out:
689+
{
688690
visit (operand.get_out ().expr);
689691
break;
690692
}
691-
case RegisterType::InOut: {
693+
case RegisterType::InOut:
694+
{
692695
visit (operand.get_in_out ().expr);
693696
break;
694697
}
695-
case RegisterType::SplitInOut: {
698+
case RegisterType::SplitInOut:
699+
{
696700
auto split = operand.get_split_in_out ();
697701
visit (split.in_expr);
698702
visit (split.out_expr);
699703
break;
700704
}
701-
case RegisterType::Const: {
705+
case RegisterType::Const:
706+
{
702707
visit (operand.get_const ().anon_const.expr);
703708
break;
704709
}
705-
case RegisterType::Sym: {
710+
case RegisterType::Sym:
711+
{
706712
visit (operand.get_sym ().expr);
707713
break;
708714
}
709-
case RegisterType::Label: {
715+
case RegisterType::Label:
716+
{
710717
visit (operand.get_label ().expr);
711718
break;
712719
}

gcc/rust/ast/rust-ast.cc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,27 +249,31 @@ Attribute::get_traits_to_derive ()
249249
auto &input = get_attr_input ();
250250
switch (input.get_attr_input_type ())
251251
{
252-
case AST::AttrInput::META_ITEM: {
252+
case AST::AttrInput::META_ITEM:
253+
{
253254
auto &meta = static_cast<AST::AttrInputMetaItemContainer &> (input);
254255
for (auto &current : meta.get_items ())
255256
{
256257
// HACK: Find a better way to achieve the downcast.
257258
switch (current->get_kind ())
258259
{
259-
case AST::MetaItemInner::Kind::MetaItem: {
260+
case AST::MetaItemInner::Kind::MetaItem:
261+
{
260262
// Let raw pointer go out of scope without freeing, it doesn't
261263
// own the data anyway
262264
auto meta_item
263265
= static_cast<AST::MetaItem *> (current.get ());
264266
switch (meta_item->get_item_kind ())
265267
{
266-
case AST::MetaItem::ItemKind::Path: {
268+
case AST::MetaItem::ItemKind::Path:
269+
{
267270
auto path
268271
= static_cast<AST::MetaItemPath *> (meta_item);
269272
result.push_back (path->get_path ());
270273
}
271274
break;
272-
case AST::MetaItem::ItemKind::Word: {
275+
case AST::MetaItem::ItemKind::Word:
276+
{
273277
auto word = static_cast<AST::MetaWord *> (meta_item);
274278
// Convert current word to path
275279
current = std::make_unique<AST::MetaItemPath> (
@@ -782,7 +786,8 @@ UseTreeGlob::as_string () const
782786
return "*";
783787
case GLOBAL:
784788
return "::*";
785-
case PATH_PREFIXED: {
789+
case PATH_PREFIXED:
790+
{
786791
std::string path_str = path.as_string ();
787792
return path_str + "::*";
788793
}
@@ -805,7 +810,8 @@ UseTreeList::as_string () const
805810
case GLOBAL:
806811
path_str = "::{";
807812
break;
808-
case PATH_PREFIXED: {
813+
case PATH_PREFIXED:
814+
{
809815
path_str = path.as_string () + "::{";
810816
break;
811817
}
@@ -3653,14 +3659,16 @@ AttributeParser::parse_path_meta_item ()
36533659

36543660
switch (peek_token ()->get_id ())
36553661
{
3656-
case LEFT_PAREN: {
3662+
case LEFT_PAREN:
3663+
{
36573664
std::vector<std::unique_ptr<MetaItemInner>> meta_items
36583665
= parse_meta_item_seq ();
36593666

36603667
return std::unique_ptr<MetaItemSeq> (
36613668
new MetaItemSeq (std::move (path), std::move (meta_items)));
36623669
}
3663-
case EQUAL: {
3670+
case EQUAL:
3671+
{
36643672
skip_token ();
36653673

36663674
location_t locus = peek_token ()->get_locus ();
@@ -5047,7 +5055,8 @@ FormatArgs::get_outer_attrs ()
50475055
rust_unreachable ();
50485056
}
50495057

5050-
void FormatArgs::set_outer_attrs (std::vector<Attribute>)
5058+
void
5059+
FormatArgs::set_outer_attrs (std::vector<Attribute>)
50515060
{
50525061
rust_unreachable ();
50535062
}

0 commit comments

Comments
 (0)