mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-25 01:12:08 +00:00
Fix newline handling in clang-query parser
Don't prematurely remove characters from the end of the string
This commit is contained in:
parent
dc93540acb
commit
544f200c78
@ -250,7 +250,7 @@ QueryRef QueryParser::doParse() {
|
||||
return completeMatcherExpression();
|
||||
|
||||
Diagnostics Diag;
|
||||
auto MatcherSource = Line.trim();
|
||||
auto MatcherSource = Line.ltrim();
|
||||
auto OrigMatcherSource = MatcherSource;
|
||||
Optional<DynTypedMatcher> Matcher = Parser::parseMatcherExpression(
|
||||
MatcherSource, nullptr, &QS.NamedValues, &Diag);
|
||||
|
@ -348,4 +348,12 @@ match callExpr
|
||||
|
||||
ASSERT_TRUE(isa<InvalidQuery>(Q));
|
||||
EXPECT_EQ("1:1: Invalid token <NewLine> found when looking for a value.", cast<InvalidQuery>(Q)->ErrStr);
|
||||
|
||||
Q = parse("\nm parmVarDecl()\nlet someMatcher\n");
|
||||
|
||||
ASSERT_TRUE(isa<MatchQuery>(Q));
|
||||
Q = parse(Q->RemainingContent);
|
||||
|
||||
ASSERT_TRUE(isa<InvalidQuery>(Q));
|
||||
EXPECT_EQ("1:1: Invalid token <NewLine> found when looking for a value.", cast<InvalidQuery>(Q)->ErrStr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user