mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Explorer: Replace StringRef with string_view in trace stream (#3090)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <bitset>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "common/check.h"
|
||||
@@ -129,19 +130,19 @@ class TraceStream {
|
||||
auto Source() const -> llvm::raw_ostream& { return *this << "*** "; }
|
||||
|
||||
// Format utility methods
|
||||
void Heading(llvm::StringRef heading) const {
|
||||
void Heading(std::string_view heading) const {
|
||||
CARBON_CHECK(is_enabled() && stream_);
|
||||
const std::string stars = "* * * * * * * * * *";
|
||||
const std::string_view stars = "* * * * * * * * * *";
|
||||
const std::string dashed_line(stars.size() * 2 + heading.size() + 4, '-');
|
||||
**stream_ << stars << " " << heading << " " << stars << "\n"
|
||||
<< dashed_line << "\n";
|
||||
}
|
||||
|
||||
void SubHeading(llvm::StringRef heading) const {
|
||||
void SubHeading(std::string_view heading) const {
|
||||
CARBON_CHECK(is_enabled() && stream_);
|
||||
const std::string stars = "- - - - -";
|
||||
const std::string dashed_line(stars.size() * 2 + heading.size() + 4, '-');
|
||||
**stream_ << stars << " " << heading << " " << stars << "\n"
|
||||
const std::string_view dashes = "- - - - -";
|
||||
const std::string dashed_line(dashes.size() * 2 + heading.size() + 4, '-');
|
||||
**stream_ << dashes << " " << heading << " " << dashes << "\n"
|
||||
<< dashed_line << "\n";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user