[Lldb-commits] [lldb] d1f0a76 - [YAMLTraits] Remove char trait and serialize as uint8_t in lldb.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue May 26 11:07:36 PDT 2020
Author: Jonas Devlieghere
Date: 2020-05-26T11:07:27-07:00
New Revision: d1f0a76b21975ba66ec2427c2d3ddb7ed1e63949
URL: https://github.com/llvm/llvm-project/commit/d1f0a76b21975ba66ec2427c2d3ddb7ed1e63949
DIFF: https://github.com/llvm/llvm-project/commit/d1f0a76b21975ba66ec2427c2d3ddb7ed1e63949.diff
LOG: [YAMLTraits] Remove char trait and serialize as uint8_t in lldb.
As discussed in https://reviews.llvm.org/D79745
Added:
Modified:
lldb/include/lldb/Utility/Args.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/Support/YAMLTraits.cpp
llvm/unittests/Support/YAMLIOTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/Args.h b/lldb/include/lldb/Utility/Args.h
index 560f25795d3b..2cce7d0c697c 100644
--- a/lldb/include/lldb/Utility/Args.h
+++ b/lldb/include/lldb/Utility/Args.h
@@ -391,7 +391,7 @@ template <> struct MappingTraits<lldb_private::Args::ArgEntry> {
return lldb_private::Args::ArgEntry(value, quote);
}
StringRef value;
- char quote;
+ uint8_t quote;
};
static void mapping(IO &io, lldb_private::Args::ArgEntry &v);
};
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index 9aa96401ae17..f93f36037679 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -1159,12 +1159,6 @@ struct ScalarTraits<bool> {
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
-template <> struct ScalarTraits<char> {
- static void output(const char &, void *, raw_ostream &);
- static StringRef input(StringRef, void *, char &);
- static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
-};
-
template<>
struct ScalarTraits<StringRef> {
static void output(const StringRef &, void *, raw_ostream &);
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index a4b782db0a96..f27be3e97430 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -864,17 +864,6 @@ StringRef ScalarTraits<bool>::input(StringRef Scalar, void *, bool &Val) {
return "invalid boolean";
}
-void ScalarTraits<char>::output(const char &Val, void *, raw_ostream &Out) {
- Out << Val;
-}
-
-StringRef ScalarTraits<char>::input(StringRef Scalar, void *, char &Val) {
- if (Scalar.size() != 1)
- return "invalid character";
- Val = Scalar[0];
- return StringRef();
-}
-
void ScalarTraits<StringRef>::output(const StringRef &Val, void *,
raw_ostream &Out) {
Out << Val;
diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp
index b2ea5aab5935..d86489cf7560 100644
--- a/llvm/unittests/Support/YAMLIOTest.cpp
+++ b/llvm/unittests/Support/YAMLIOTest.cpp
@@ -333,7 +333,6 @@ struct BuiltInTypes {
uint16_t u16;
uint8_t u8;
bool b;
- char c;
int64_t s64;
int32_t s32;
int16_t s16;
@@ -358,7 +357,6 @@ namespace yaml {
io.mapRequired("u16", bt.u16);
io.mapRequired("u8", bt.u8);
io.mapRequired("b", bt.b);
- io.mapRequired("c", bt.c);
io.mapRequired("s64", bt.s64);
io.mapRequired("s32", bt.s32);
io.mapRequired("s16", bt.s16);
@@ -388,7 +386,6 @@ TEST(YAMLIO, TestReadBuiltInTypes) {
"u16: 65000\n"
"u8: 255\n"
"b: false\n"
- "c: 'c'\n"
"s64: -5000000000\n"
"s32: -2000000000\n"
"s16: -32000\n"
@@ -399,7 +396,7 @@ TEST(YAMLIO, TestReadBuiltInTypes) {
"h16: 0x8765\n"
"h32: 0xFEDCBA98\n"
"h64: 0xFEDCBA9876543210\n"
- "...\n");
+ "...\n");
yin >> map;
EXPECT_FALSE(yin.error());
@@ -410,7 +407,6 @@ TEST(YAMLIO, TestReadBuiltInTypes) {
EXPECT_EQ(map.u16, 65000);
EXPECT_EQ(map.u8, 255);
EXPECT_EQ(map.b, false);
- EXPECT_EQ(map.c, 'c');
EXPECT_EQ(map.s64, -5000000000LL);
EXPECT_EQ(map.s32, -2000000000L);
EXPECT_EQ(map.s16, -32000);
@@ -438,7 +434,6 @@ TEST(YAMLIO, TestReadWriteBuiltInTypes) {
map.u16 = 50000;
map.u8 = 254;
map.b = true;
- map.c = 'd';
map.s64 = -6000000000LL;
map.s32 = -2000000000;
map.s16 = -32000;
@@ -468,7 +463,6 @@ TEST(YAMLIO, TestReadWriteBuiltInTypes) {
EXPECT_EQ(map.u16, 50000);
EXPECT_EQ(map.u8, 254);
EXPECT_EQ(map.b, true);
- EXPECT_EQ(map.c, 'd');
EXPECT_EQ(map.s64, -6000000000LL);
EXPECT_EQ(map.s32, -2000000000L);
EXPECT_EQ(map.s16, -32000);
More information about the lldb-commits
mailing list