Update clang to r339409.
Change-Id: I800772d2d838223be1f6b40d490c4591b937fca2
diff --git a/linux-x64/clang/include/llvm/Support/EndianStream.h b/linux-x64/clang/include/llvm/Support/EndianStream.h
index 43ecd4a..9742e25 100644
--- a/linux-x64/clang/include/llvm/Support/EndianStream.h
+++ b/linux-x64/clang/include/llvm/Support/EndianStream.h
@@ -23,44 +23,44 @@
namespace support {
namespace endian {
+
+template <typename value_type>
+inline void write(raw_ostream &os, value_type value, endianness endian) {
+ value = byte_swap<value_type>(value, endian);
+ os.write((const char *)&value, sizeof(value_type));
+}
+
+template <>
+inline void write<float>(raw_ostream &os, float value, endianness endian) {
+ write(os, FloatToBits(value), endian);
+}
+
+template <>
+inline void write<double>(raw_ostream &os, double value,
+ endianness endian) {
+ write(os, DoubleToBits(value), endian);
+}
+
+template <typename value_type>
+inline void write(raw_ostream &os, ArrayRef<value_type> vals,
+ endianness endian) {
+ for (value_type v : vals)
+ write(os, v, endian);
+}
+
/// Adapter to write values to a stream in a particular byte order.
-template <endianness endian> struct Writer {
+struct Writer {
raw_ostream &OS;
- Writer(raw_ostream &OS) : OS(OS) {}
- template <typename value_type> void write(ArrayRef<value_type> Vals) {
- for (value_type V : Vals)
- write(V);
+ endianness Endian;
+ Writer(raw_ostream &OS, endianness Endian) : OS(OS), Endian(Endian) {}
+ template <typename value_type> void write(ArrayRef<value_type> Val) {
+ endian::write(OS, Val, Endian);
}
template <typename value_type> void write(value_type Val) {
- Val = byte_swap<value_type, endian>(Val);
- OS.write((const char *)&Val, sizeof(value_type));
+ endian::write(OS, Val, Endian);
}
};
-template <>
-template <>
-inline void Writer<little>::write<float>(float Val) {
- write(FloatToBits(Val));
-}
-
-template <>
-template <>
-inline void Writer<little>::write<double>(double Val) {
- write(DoubleToBits(Val));
-}
-
-template <>
-template <>
-inline void Writer<big>::write<float>(float Val) {
- write(FloatToBits(Val));
-}
-
-template <>
-template <>
-inline void Writer<big>::write<double>(double Val) {
- write(DoubleToBits(Val));
-}
-
} // end namespace endian
} // end namespace support