Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ class AnnotatingParser {
}
if (!CurrentToken || CurrentToken->isNot(tok::l_paren))
return false;
skipToNextNonComment();
next();
// FIXME: Hack using inheritance to child context
Contexts.back().IsTableGenBangOpe = true;
bool Result = parseParens();
Expand All @@ -1124,12 +1124,10 @@ class AnnotatingParser {
}
// SimpleValue 9: Cond operator
if (Tok->is(TT_TableGenCondOperator)) {
Tok = CurrentToken;
skipToNextNonComment();
if (!Tok || Tok->isNot(tok::l_paren))
if (!CurrentToken || CurrentToken->isNot(tok::l_paren))
return false;
bool Result = parseParens();
return Result;
next();
return parseParens();
}
// We have to check identifier at the last because the kind of bang/cond
// operators are also identifier.
Expand Down
3 changes: 3 additions & 0 deletions clang/unittests/Format/FormatTestTableGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ TEST_F(FormatTestTableGen, BangOperators) {
" \"zerozero\",\n"
" true: // default\n"
" \"positivepositive\");\n"
" let Foo = !cond(\n"
" // comment\n"
" !eq(/* comment */ x, 0): \"zero\");\n"
"}");
}

Expand Down
Loading