mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
557ee758e6
Enable quotes around MetaAddress during serialization, since ':' is a valid YAML separator, which causes wrong deserialization when a vector of MetaAddress is serialized as a list
28 lines
660 B
C++
28 lines
660 B
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/Support/YAMLTraits.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "revng/Support/MetaAddress.h"
|
|
|
|
template<>
|
|
struct llvm::yaml::ScalarTraits<MetaAddress> {
|
|
|
|
static void
|
|
output(const MetaAddress &Value, void *, llvm::raw_ostream &Output) {
|
|
Output << Value.toString();
|
|
}
|
|
|
|
static StringRef input(llvm::StringRef Scalar, void *, MetaAddress &Value) {
|
|
Value = MetaAddress::fromString(Scalar);
|
|
return StringRef();
|
|
}
|
|
|
|
static QuotingType mustQuote(StringRef) { return QuotingType::Double; }
|
|
};
|