forked from OSchip/llvm-project
clang-format: Fix assertion when trying to build a nullptr StringRef.
llvm-svn: 226448
This commit is contained in:
parent
2bd7a64d12
commit
9d22bcc53e
|
@ -549,6 +549,7 @@ void UnwrappedLineParser::conditionalCompilationEnd() {
|
|||
void UnwrappedLineParser::parsePPIf(bool IfDef) {
|
||||
nextToken();
|
||||
bool IsLiteralFalse = (FormatTok->Tok.isLiteral() &&
|
||||
FormatTok->Tok.getLiteralData() != nullptr &&
|
||||
StringRef(FormatTok->Tok.getLiteralData(),
|
||||
FormatTok->Tok.getLength()) == "0") ||
|
||||
FormatTok->Tok.is(tok::kw_false);
|
||||
|
|
|
@ -2600,6 +2600,7 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
|
|||
" y)), // expected-warning",
|
||||
getLLVMStyleWithColumns(28));
|
||||
verifyFormat("#d, = };");
|
||||
verifyFormat("#if \"a");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {
|
||||
|
|
Loading…
Reference in New Issue