mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-04 08:37:45 +00:00
Revert "Make YAML support SmallVector"
This breaks building dsymutil, causing my local build and many bots to fail. This reverts r277870. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
466b4f2148
commit
5d9e1414ec
@ -1359,63 +1359,66 @@ operator<<(Output &yout, T &seq) {
|
||||
return yout;
|
||||
}
|
||||
|
||||
template <typename T> struct SequenceTraitsImpl {
|
||||
typedef typename T::value_type _type;
|
||||
static size_t size(IO &io, T &seq) { return seq.size(); }
|
||||
static _type &element(IO &io, T &seq, size_t index) {
|
||||
if (index >= seq.size())
|
||||
seq.resize(index + 1);
|
||||
return seq[index];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace yaml
|
||||
} // namespace llvm
|
||||
|
||||
/// Utility for declaring that a std::vector of a particular type
|
||||
/// should be considered a YAML sequence.
|
||||
#define LLVM_YAML_IS_SEQUENCE_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template <> \
|
||||
struct SequenceTraits<std::vector<_type>> \
|
||||
: public SequenceTraitsImpl<std::vector<_type>> {}; \
|
||||
template <unsigned N> \
|
||||
struct SequenceTraits<SmallVector<_type, N>> \
|
||||
: public SequenceTraitsImpl<SmallVector<_type, N>> {}; \
|
||||
} \
|
||||
#define LLVM_YAML_IS_SEQUENCE_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template<> \
|
||||
struct SequenceTraits< std::vector<_type> > { \
|
||||
static size_t size(IO &io, std::vector<_type> &seq) { \
|
||||
return seq.size(); \
|
||||
} \
|
||||
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
|
||||
if ( index >= seq.size() ) \
|
||||
seq.resize(index+1); \
|
||||
return seq[index]; \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
/// Utility for declaring that a std::vector of a particular type
|
||||
/// should be considered a YAML flow sequence.
|
||||
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template <unsigned N> \
|
||||
struct SequenceTraits<SmallVector<_type, N>> \
|
||||
: public SequenceTraitsImpl<SmallVector<_type, N>> { \
|
||||
static const bool flow = true; \
|
||||
}; \
|
||||
template <> \
|
||||
struct SequenceTraits<std::vector<_type>> \
|
||||
: public SequenceTraitsImpl<std::vector<_type>> { \
|
||||
static const bool flow = true; \
|
||||
}; \
|
||||
} \
|
||||
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template<> \
|
||||
struct SequenceTraits< std::vector<_type> > { \
|
||||
static size_t size(IO &io, std::vector<_type> &seq) { \
|
||||
return seq.size(); \
|
||||
} \
|
||||
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
|
||||
(void)flow; /* Remove this workaround after PR17897 is fixed */ \
|
||||
if ( index >= seq.size() ) \
|
||||
seq.resize(index+1); \
|
||||
return seq[index]; \
|
||||
} \
|
||||
static const bool flow = true; \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
/// Utility for declaring that a std::vector of a particular type
|
||||
/// should be considered a YAML document list.
|
||||
#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template <unsigned N> \
|
||||
struct DocumentListTraits<SmallVector<_type, N>> \
|
||||
: public SequenceTraitsImpl<SmallVector<_type, N>> {}; \
|
||||
template <> \
|
||||
struct DocumentListTraits<std::vector<_type>> \
|
||||
: public SequenceTraitsImpl<std::vector<_type>> {}; \
|
||||
} \
|
||||
#define LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(_type) \
|
||||
namespace llvm { \
|
||||
namespace yaml { \
|
||||
template<> \
|
||||
struct DocumentListTraits< std::vector<_type> > { \
|
||||
static size_t size(IO &io, std::vector<_type> &seq) { \
|
||||
return seq.size(); \
|
||||
} \
|
||||
static _type& element(IO &io, std::vector<_type> &seq, size_t index) {\
|
||||
if ( index >= seq.size() ) \
|
||||
seq.resize(index+1); \
|
||||
return seq[index]; \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // LLVM_SUPPORT_YAMLTRAITS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user