From 36c1a5f04a61dff60d8326906a42c4bf8fdde2f9 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Mon, 9 Oct 2023 14:54:11 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20[Lex,=20Frontend]=20Remove=20com?= =?UTF-8?q?ma=20hardcoding=20since=20we=20are=20servicing=20a=20full=20fil?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clang/lib/Frontend/PrintPreprocessedOutput.cpp | 4 ---- clang/lib/Lex/PPDirectives.cpp | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index a5d12b400c0ee4..4e0931ebb50c64 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -892,10 +892,6 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, std::string Name = M->getFullModuleName(); Callbacks->OS->write(Name.data(), Name.size()); Callbacks->HandleNewlinesInToken(Name.data(), Name.size()); - } else if (Tok.is(tok::comma)) { - // hard-wire comma writing to prevent #embed from spilling unread contents - // from fast token dumping or builtin speed writing - OS.write(','); } else if (Tok.isAnnotation()) { // Ignore annotation tokens created by pragmas - the pragmas themselves // will be reproduced in the preprocessed output. diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index a4de216cc545a8..555c3c3f2eaffe 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -3943,7 +3943,7 @@ void Preprocessor::HandleEmbedDirectiveNaive( TargetEmbedBuffer.append(Spelling.data(), Spelling.size()); } } - for (size_t I = 0; I < BinaryContents.size(); ++I) { + for (size_t I = 0; I < TotalSize; ++I) { unsigned char ByteValue = BinaryContents[I]; StringRef ByteRepresentation = IntegerLiterals[ByteValue]; TargetEmbedBuffer.append(2, '('); @@ -3952,7 +3952,7 @@ void Preprocessor::HandleEmbedDirectiveNaive( TargetEmbedBuffer.append(ByteRepresentation.data(), ByteRepresentation.size()); TargetEmbedBuffer.append(1, ')'); - bool AtEndOfContents = I == (BinaryContents.size() - 1); + bool AtEndOfContents = I == (TotalSize - 1); if (!AtEndOfContents) { TargetEmbedBuffer.append(1, ','); }