Add underscores to private data members (#898)

This is the last PR I plan to have focused on #720
This commit is contained in:
Jon Meow
2021-10-19 14:27:10 -07:00
committed by GitHub
parent dc9c36660b
commit ffa4e76ede
17 changed files with 363 additions and 356 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ class BisonWrap {
public:
// Assigning a value initializes the wrapper.
auto operator=(T&& rhs) -> BisonWrap& {
val = std::move(rhs);
val_ = std::move(rhs);
return *this;
}
@@ -29,14 +29,14 @@ class BisonWrap {
// Deliberately releases the contained value. Errors if not initialized.
// Called directly in parser.ypp when releasing pairs.
auto Release() -> T {
CHECK(val.has_value());
T ret = std::move(*val);
val.reset();
CHECK(val_.has_value());
T ret = std::move(*val_);
val_.reset();
return ret;
}
private:
std::optional<T> val;
std::optional<T> val_;
};
} // namespace Carbon
@@ -18,13 +18,13 @@ class ParseAndLexContext {
public:
// Creates an instance analyzing the given input file.
ParseAndLexContext(Nonnull<const std::string*> input_file_name, bool trace)
: input_file_name(input_file_name), trace_(trace) {}
: input_file_name_(input_file_name), trace_(trace) {}
// Writes a syntax error diagnostic containing message to standard error.
auto PrintDiagnostic(const std::string& message) -> void;
auto source_loc() -> SourceLocation {
return SourceLocation(input_file_name,
return SourceLocation(input_file_name_,
static_cast<int>(current_token_position.begin.line));
}
@@ -36,7 +36,7 @@ class ParseAndLexContext {
private:
// A path to the file processed, relative to the current working directory
// when *this is called.
Nonnull<const std::string*> input_file_name;
Nonnull<const std::string*> input_file_name_;
bool trace_;
};