From c3d9da2a591b1f6529784ec246b9e0b44dcb704a Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 21 Aug 2013 18:57:51 +0000 Subject: [PATCH] Revert r188863 which could propose wrong fixits for multibyte character literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188918 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/LiteralSupport.cpp | 12 +++--------- test/Lexer/char-literal-encoding-fixit.c | 11 ----------- 2 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 test/Lexer/char-literal-encoding-fixit.c diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 2301aaed82..08d6c438d3 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -978,7 +978,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, uint32_t largest_character_for_kind; if (tok::wide_char_constant == Kind) { largest_character_for_kind = - 0xFFFFFFFFu >> (32 - PP.getTargetInfo().getWCharWidth()); + 0xFFFFFFFFu >> (32-PP.getTargetInfo().getWCharWidth()); } else if (tok::utf16_char_constant == Kind) { largest_character_for_kind = 0xFFFF; } else if (tok::utf32_char_constant == Kind) { @@ -1009,13 +1009,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, unsigned Msg = diag::err_bad_character_encoding; if (NoErrorOnBadEncoding) Msg = diag::warn_bad_character_encoding; - std::string escaped = llvm::utohexstr(static_cast(*start)); - FullSourceLoc SourceLoc(Loc, PP.getSourceManager()); - PP.Diag(Loc, Msg) << FixItHint::CreateReplacement( - MakeCharSourceRange(PP.getLangOpts(), - SourceLoc, TokBegin, start, - start + 1), - "\\x" + escaped); + PP.Diag(Loc, Msg); if (NoErrorOnBadEncoding) { start = tmp_in_start; buffer_begin = tmp_out_start; @@ -1053,7 +1047,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, unsigned CharWidth = getCharWidth(Kind, PP.getTargetInfo()); uint64_t result = ProcessCharEscape(TokBegin, begin, end, HadError, - FullSourceLoc(Loc, PP.getSourceManager()), + FullSourceLoc(Loc,PP.getSourceManager()), CharWidth, &PP.getDiagnostics(), PP.getLangOpts()); *buffer_begin++ = result; } diff --git a/test/Lexer/char-literal-encoding-fixit.c b/test/Lexer/char-literal-encoding-fixit.c deleted file mode 100644 index ab5d28aa53..0000000000 --- a/test/Lexer/char-literal-encoding-fixit.c +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: cp %s %t -// RUN: %clang_cc1 -fixit -x c %t -// RUN: FileCheck -input-file=%t %t - -// Note that this file is not valid UTF-8. - -int test1 = 'ˆ'; -// CHECK: int test1 = '\x88'; - -int test2 = 'abˆc'; -// CHECK: int test2 = 'ab\x88c'; -- 2.40.0