Skip to content

Commit

Permalink
UnwrappedLine: Reorder data members to decrease object size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Glebocki committed Apr 30, 2022
1 parent 7f7bfb5 commit 439bd07
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions common/formatting/unwrapped_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ class UnwrappedLine {
// PreFormatToken spanned by this range, which is initially empty.
UnwrappedLine(int d, token_iterator b,
PartitionPolicyEnum p = PartitionPolicyEnum::kUninitialized)
: indentation_spaces_(d), tokens_(b, b), partition_policy_(p) {}
: tokens_(b, b), indentation_spaces_(d), partition_policy_(p) {}

// Allow default construction for use in resize-able containers.
UnwrappedLine() = default;
// Allow default construction for use in resizeable containers.
constexpr UnwrappedLine() : indentation_spaces_(0){};
UnwrappedLine(const UnwrappedLine&) = default;
UnwrappedLine(UnwrappedLine&&) = default;
UnwrappedLine& operator=(const UnwrappedLine&) = default;
Expand Down Expand Up @@ -183,21 +183,21 @@ class UnwrappedLine {
private:
// Data members:

// indentation_spaces_ is the number of spaces to indent from the left.
int indentation_spaces_;

// The range of sequential PreFormatTokens spanned by this UnwrappedLine.
// These represent the tokens that will be formatted independently.
// The memory for these must be owned elsewhere.
FormatTokenRange tokens_;

// This determines under what conditions this UnwrappedLine should be
// further partitioned for formatting.
PartitionPolicyEnum partition_policy_ = PartitionPolicyEnum::kUninitialized;

// Hint about the origin of this partition, e.g. a particular syntax
// tree node/leaf.
const Symbol* origin_ = nullptr;

// indentation_spaces_ is the number of spaces to indent from the left.
int indentation_spaces_;

// This determines under what conditions this UnwrappedLine should be
// further partitioned for formatting.
PartitionPolicyEnum partition_policy_ = PartitionPolicyEnum::kUninitialized;
};

std::ostream& operator<<(std::ostream&, const UnwrappedLine&);
Expand Down

0 comments on commit 439bd07

Please sign in to comment.