Skip to content

Commit 4d6917a

Browse files
committed
Clang format
1 parent eaa22c7 commit 4d6917a

File tree

119 files changed

+1499
-1236
lines changed

Some content is hidden

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

119 files changed

+1499
-1236
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)
@@ -1550,33 +1556,40 @@ TokenCollector::visit (InlineAsm &expr)
15501556
using RegisterType = AST::InlineAsmOperand::RegisterType;
15511557
switch (operand.get_register_type ())
15521558
{
1553-
case RegisterType::In: {
1559+
case RegisterType::In:
1560+
{
15541561
visit (operand.get_in ().expr);
15551562
break;
15561563
}
1557-
case RegisterType::Out: {
1564+
case RegisterType::Out:
1565+
{
15581566
visit (operand.get_out ().expr);
15591567
break;
15601568
}
1561-
case RegisterType::InOut: {
1569+
case RegisterType::InOut:
1570+
{
15621571
visit (operand.get_in_out ().expr);
15631572
break;
15641573
}
1565-
case RegisterType::SplitInOut: {
1574+
case RegisterType::SplitInOut:
1575+
{
15661576
auto split = operand.get_split_in_out ();
15671577
visit (split.in_expr);
15681578
visit (split.out_expr);
15691579
break;
15701580
}
1571-
case RegisterType::Const: {
1581+
case RegisterType::Const:
1582+
{
15721583
visit (operand.get_const ().anon_const.get_inner_expr ());
15731584
break;
15741585
}
1575-
case RegisterType::Sym: {
1586+
case RegisterType::Sym:
1587+
{
15761588
visit (operand.get_sym ().expr);
15771589
break;
15781590
}
1579-
case RegisterType::Label: {
1591+
case RegisterType::Label:
1592+
{
15801593
visit (operand.get_label ().expr);
15811594
break;
15821595
}
@@ -1792,7 +1805,8 @@ TokenCollector::visit (UseTreeGlob &use_tree)
17921805
{
17931806
switch (use_tree.get_glob_type ())
17941807
{
1795-
case UseTreeGlob::PathType::PATH_PREFIXED: {
1808+
case UseTreeGlob::PathType::PATH_PREFIXED:
1809+
{
17961810
auto path = use_tree.get_path ();
17971811
visit (path);
17981812
push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1812,7 +1826,8 @@ TokenCollector::visit (UseTreeList &use_tree)
18121826
{
18131827
switch (use_tree.get_path_type ())
18141828
{
1815-
case UseTreeList::PathType::PATH_PREFIXED: {
1829+
case UseTreeList::PathType::PATH_PREFIXED:
1830+
{
18161831
auto path = use_tree.get_path ();
18171832
visit (path);
18181833
push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
@@ -1840,7 +1855,8 @@ TokenCollector::visit (UseTreeRebind &use_tree)
18401855
visit (path);
18411856
switch (use_tree.get_new_bind_type ())
18421857
{
1843-
case UseTreeRebind::NewBindType::IDENTIFIER: {
1858+
case UseTreeRebind::NewBindType::IDENTIFIER:
1859+
{
18441860
push (Rust::Token::make (AS, UNDEF_LOCATION));
18451861
auto id = use_tree.get_identifier ().as_string ();
18461862
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
@@ -692,33 +692,40 @@ DefaultASTVisitor::visit (AST::InlineAsm &expr)
692692
{
693693
switch (operand.get_register_type ())
694694
{
695-
case RegisterType::In: {
695+
case RegisterType::In:
696+
{
696697
visit (operand.get_in ().expr);
697698
break;
698699
}
699-
case RegisterType::Out: {
700+
case RegisterType::Out:
701+
{
700702
visit (operand.get_out ().expr);
701703
break;
702704
}
703-
case RegisterType::InOut: {
705+
case RegisterType::InOut:
706+
{
704707
visit (operand.get_in_out ().expr);
705708
break;
706709
}
707-
case RegisterType::SplitInOut: {
710+
case RegisterType::SplitInOut:
711+
{
708712
auto split = operand.get_split_in_out ();
709713
visit (split.in_expr);
710714
visit (split.out_expr);
711715
break;
712716
}
713-
case RegisterType::Const: {
717+
case RegisterType::Const:
718+
{
714719
visit (operand.get_const ().anon_const.get_inner_expr ());
715720
break;
716721
}
717-
case RegisterType::Sym: {
722+
case RegisterType::Sym:
723+
{
718724
visit (operand.get_sym ().expr);
719725
break;
720726
}
721-
case RegisterType::Label: {
727+
case RegisterType::Label:
728+
{
722729
visit (operand.get_label ().expr);
723730
break;
724731
}

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
}
@@ -3665,14 +3671,16 @@ AttributeParser::parse_path_meta_item ()
36653671

36663672
switch (peek_token ()->get_id ())
36673673
{
3668-
case LEFT_PAREN: {
3674+
case LEFT_PAREN:
3675+
{
36693676
std::vector<std::unique_ptr<MetaItemInner>> meta_items
36703677
= parse_meta_item_seq ();
36713678

36723679
return std::unique_ptr<MetaItemSeq> (
36733680
new MetaItemSeq (std::move (path), std::move (meta_items)));
36743681
}
3675-
case EQUAL: {
3682+
case EQUAL:
3683+
{
36763684
skip_token ();
36773685

36783686
location_t locus = peek_token ()->get_locus ();
@@ -5071,7 +5079,8 @@ FormatArgs::get_outer_attrs ()
50715079
rust_unreachable ();
50725080
}
50735081

5074-
void FormatArgs::set_outer_attrs (std::vector<Attribute>)
5082+
void
5083+
FormatArgs::set_outer_attrs (std::vector<Attribute>)
50755084
{
50765085
rust_unreachable ();
50775086
}

0 commit comments

Comments
 (0)