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
+6 -6
View File
@@ -17,9 +17,9 @@ class SourceLocation {
public:
// The filename should be eternal or arena-allocated to eliminate copies.
SourceLocation(const char* filename, int line_num)
: filename(filename), line_num(line_num) {}
: filename_(filename), line_num_(line_num) {}
SourceLocation(Nonnull<const std::string*> filename, int line_num)
: filename(filename->c_str()), line_num(line_num) {}
: filename_(filename->c_str()), line_num_(line_num) {}
SourceLocation(const SourceLocation&) = default;
SourceLocation(SourceLocation&&) = default;
@@ -27,17 +27,17 @@ class SourceLocation {
auto operator=(SourceLocation&&) -> SourceLocation& = default;
bool operator==(SourceLocation other) const {
return filename == other.filename && line_num == other.line_num;
return filename_ == other.filename_ && line_num_ == other.line_num_;
}
void Print(llvm::raw_ostream& out) const {
out << filename << ":" << line_num;
out << filename_ << ":" << line_num_;
}
LLVM_DUMP_METHOD void Dump() const { Print(llvm::errs()); }
private:
std::string_view filename;
int line_num;
std::string_view filename_;
int line_num_;
};
} // namespace Carbon