Skip to content

Commit

Permalink
Revert "[clang][Lex] Fix a crash on malformed string literals"
Browse files Browse the repository at this point in the history
This reverts commit 36a2002.
  • Loading branch information
kadircet committed Oct 5, 2022
1 parent 2813bc5 commit feea7ef
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions clang/lib/Lex/LiteralSupport.cpp
Expand Up @@ -545,6 +545,7 @@ static bool ProcessNamedUCNEscape(const char *ThisTokBegin,
diag::err_delimited_escape_missing_brace)
<< StringRef(&ThisTokBuf[-1], 1);
}
ThisTokBuf++;
return false;
}
ThisTokBuf++;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Lexer/char-escapes-delimited.c
Expand Up @@ -94,7 +94,7 @@ void named(void) {

unsigned h = U'\N{LOTUS}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned i = u'\N{GREEK CAPITAL LETTER DELTA}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
char j = '\NN'; // expected-error {{expected '{' after '\N' escape sequence}} expected-warning {{multi-character character constant}}
char j = '\NN'; // expected-error {{expected '{' after '\N' escape sequence}}
unsigned k = u'\N{LOTUS'; // expected-error {{incomplete universal character name}}
}

Expand Down
8 changes: 0 additions & 8 deletions clang/unittests/Lex/LexerTest.cpp
Expand Up @@ -18,7 +18,6 @@
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleLoader.h"
Expand Down Expand Up @@ -660,11 +659,4 @@ TEST_F(LexerTest, RawAndNormalLexSameForLineComments) {
}
EXPECT_TRUE(ToksView.empty());
}

TEST_F(LexerTest, BrokenStringLiteral) {
const llvm::StringLiteral Source = R"cpp("\N")cpp";
// Make sure this isn't crashing.
StringLiteralParser P(Lex(Source), *PP);
EXPECT_TRUE(P.hadError);
}
} // anonymous namespace

0 comments on commit feea7ef

Please sign in to comment.