|
@@ -61,23 +61,24 @@ class OutputMapping {
|
|
|
public:
|
|
public:
|
|
|
class Map {
|
|
class Map {
|
|
|
public:
|
|
public:
|
|
|
- explicit Map(llvm::yaml::IO& io) : io_(io) {}
|
|
|
|
|
|
|
+ // `io` must not be null.
|
|
|
|
|
+ explicit Map(llvm::yaml::IO* io) : io_(io) {}
|
|
|
|
|
|
|
|
// Maps a value. This mainly takes responsibility for copying the value,
|
|
// Maps a value. This mainly takes responsibility for copying the value,
|
|
|
// letting mapRequired take `&value`.
|
|
// letting mapRequired take `&value`.
|
|
|
template <typename T>
|
|
template <typename T>
|
|
|
auto Add(llvm::StringRef key, T value) -> void {
|
|
auto Add(llvm::StringRef key, T value) -> void {
|
|
|
- io_.mapRequired(key.data(), value);
|
|
|
|
|
|
|
+ io_->mapRequired(key.data(), value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
private:
|
|
|
- llvm::yaml::IO& io_;
|
|
|
|
|
|
|
+ llvm::yaml::IO* io_;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
explicit OutputMapping(std::function<auto(OutputMapping::Map)->void> output)
|
|
explicit OutputMapping(std::function<auto(OutputMapping::Map)->void> output)
|
|
|
: output_(std::move(output)) {}
|
|
: output_(std::move(output)) {}
|
|
|
|
|
|
|
|
- auto Output(llvm::yaml::IO& io) -> void { output_(Map(io)); }
|
|
|
|
|
|
|
+ auto Output(llvm::yaml::IO& io) -> void { output_(Map(&io)); }
|
|
|
|
|
|
|
|
private:
|
|
private:
|
|
|
std::function<auto(OutputMapping::Map)->void> output_;
|
|
std::function<auto(OutputMapping::Map)->void> output_;
|