Skip to content

Commit ced51a0

Browse files
committed
[Parser] Fix transforming '>>' into '>' '>'
1 parent 97723fc commit ced51a0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lldb/include/lldb/ValueObject/DILLexer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class Token {
136136
m_kind(kind), m_spelling(std::move(spelling)), m_start_pos(start) {}
137137

138138
Kind GetKind() const { return m_kind; }
139+
void SetKind(Kind kind) { m_kind = kind; }
139140

140141
std::string GetSpelling() const { return m_spelling; }
141142

@@ -176,7 +177,7 @@ class DILLexer {
176177
static llvm::Expected<DILLexer> Create(llvm::StringRef expr);
177178

178179
/// Return the current token to be handled by the DIL parser.
179-
const Token& GetCurrentToken() { return m_lexed_tokens[m_tokens_idx]; }
180+
Token &GetCurrentToken() { return m_lexed_tokens[m_tokens_idx]; }
180181

181182
/// Advance the current token position by N.
182183
void Advance(uint32_t N = 1) {

lldb/source/ValueObject/DILParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ std::string DILParser::ParseTypeName() {
20152015
// consume it -- it will be done on the outer level when completing the
20162016
// outer template argument list or C++-style cast.
20172017
uint32_t loc = m_dil_token.GetLocation();
2018-
m_dil_token = Token(Token::greater, ">", loc);
2018+
m_dil_lexer.GetCurrentToken().SetKind(Token::greater);
20192019
m_dil_lexer.InsertToken(Token(Token::greater, ">", loc+1));
20202020

20212021
} else {

lldb/unittests/DIL/DILTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,10 +2104,10 @@ TEST_F(EvalTest, TestTemplateCpp11) {
21042104
// Template types lookup doesn't work well in the upstream LLDB.
21052105
this->compare_with_lldb_ = false;
21062106

2107-
EXPECT_THAT(Eval("(T_1<T_1<int>>::myint)1"), XFail(IsEqual("1")));
2108-
EXPECT_THAT(Eval("(T_1<T_1<T_1<int>>>::myint)2"), XFail(IsEqual("2")));
2107+
EXPECT_THAT(Eval("(T_1<T_1<int>>::myint)1"), IsEqual("1"));
2108+
EXPECT_THAT(Eval("(T_1<T_1<T_1<int>>>::myint)2"), IsEqual("2"));
21092109
EXPECT_THAT(Eval("(T_2<T_1<T_1<int>>, T_1<char>>::myint)1.5"),
2110-
XFail(IsEqual("1.5")));
2110+
IsEqual("1.5"));
21112111

21122112
// Here T_1 is a local variable.
21132113
EXPECT_THAT(Eval("T_1<2>1"), IsEqual("false")); // (p < 2) > 1
@@ -2128,7 +2128,7 @@ TEST_F(EvalTest, TestTemplateWithNumericArguments) {
21282128
IsEqual(Is32Bit() ? "0x00000000" : "0x0000000000000000"));
21292129
// Test C++11's ">>" syntax.
21302130
EXPECT_THAT(Eval("(TArray<int, Allocator<4>>::ElementType*)0"),
2131-
XFail(IsEqual(Is32Bit() ? "0x00000000" : "0x0000000000000000")));
2131+
IsEqual(Is32Bit() ? "0x00000000" : "0x0000000000000000"));
21322132
}
21332133

21342134
#ifndef __EMSCRIPTEN__

0 commit comments

Comments
 (0)