[clangd] Fix serialization logic for Origin and Flags.

llvm-svn: 359470
This commit is contained in:
Kadir Cetinkaya 2019-04-29 17:25:58 +00:00
parent 2755b73ba0
commit 250eae2452
2 changed files with 6 additions and 5 deletions

View File

@ -314,8 +314,8 @@ Symbol readSymbol(Reader &Data, llvm::ArrayRef<llvm::StringRef> Strings) {
Sym.Definition = readLocation(Data, Strings);
Sym.CanonicalDeclaration = readLocation(Data, Strings);
Sym.References = Data.consumeVar();
Sym.Flags = static_cast<Symbol::SymbolFlag>(Data.consumeVar());
Sym.Origin = static_cast<SymbolOrigin>(Data.consumeVar());
Sym.Flags = static_cast<Symbol::SymbolFlag>(Data.consume8());
Sym.Origin = static_cast<SymbolOrigin>(Data.consume8());
Sym.Signature = Data.consumeString(Strings);
Sym.CompletionSnippetSuffix = Data.consumeString(Strings);
Sym.Documentation = Data.consumeString(Strings);

View File

@ -40,8 +40,8 @@ CanonicalDeclaration:
End:
Line: 1
Column: 1
Origin: 4
Flags: 1
Origin: 128
Flags: 129
Documentation: 'Foo doc'
ReturnType: 'int'
IncludeHeaders:
@ -115,7 +115,8 @@ TEST(SerializationTest, YAMLConversions) {
EXPECT_EQ(Sym1.Documentation, "Foo doc");
EXPECT_EQ(Sym1.ReturnType, "int");
EXPECT_EQ(StringRef(Sym1.CanonicalDeclaration.FileURI), "file:///path/foo.h");
EXPECT_EQ(Sym1.Origin, SymbolOrigin::Static);
EXPECT_EQ(Sym1.Origin, static_cast<SymbolOrigin>(1 << 7));
EXPECT_EQ(static_cast<uint8_t>(Sym1.Flags), 129);
EXPECT_TRUE(Sym1.Flags & Symbol::IndexedForCodeCompletion);
EXPECT_FALSE(Sym1.Flags & Symbol::Deprecated);
EXPECT_THAT(Sym1.IncludeHeaders,