Skip to content

Commit 748c3b5

Browse files
ThePhDh-vetinari
authored andcommitted
🛠 [Lex, Frontend] Remove comma hardcoding since we are servicing a full file
1 parent 1179116 commit 748c3b5

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

‎clang/lib/Frontend/PrintPreprocessedOutput.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -898,10 +898,6 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
898898
std::string Name = M->getFullModuleName();
899899
Callbacks->OS->write(Name.data(), Name.size());
900900
Callbacks->HandleNewlinesInToken(Name.data(), Name.size());
901-
} else if (Tok.is(tok::comma)) {
902-
// hard-wire comma writing to prevent #embed from spilling unread contents
903-
// from fast token dumping or builtin speed writing
904-
OS.write(',');
905901
} else if (Tok.isAnnotation()) {
906902
// Ignore annotation tokens created by pragmas - the pragmas themselves
907903
// will be reproduced in the preprocessed output.

‎clang/lib/Lex/PPDirectives.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,7 +3915,7 @@ void Preprocessor::HandleEmbedDirectiveNaive(
39153915
TargetEmbedBuffer.append(Spelling.data(), Spelling.size());
39163916
}
39173917
}
3918-
for (size_t I = 0; I < BinaryContents.size(); ++I) {
3918+
for (size_t I = 0; I < TotalSize; ++I) {
39193919
unsigned char ByteValue = BinaryContents[I];
39203920
StringRef ByteRepresentation = IntegerLiterals[ByteValue];
39213921
TargetEmbedBuffer.append(2, '(');
@@ -3924,7 +3924,7 @@ void Preprocessor::HandleEmbedDirectiveNaive(
39243924
TargetEmbedBuffer.append(ByteRepresentation.data(),
39253925
ByteRepresentation.size());
39263926
TargetEmbedBuffer.append(1, ')');
3927-
bool AtEndOfContents = I == (BinaryContents.size() - 1);
3927+
bool AtEndOfContents = I == (TotalSize - 1);
39283928
if (!AtEndOfContents) {
39293929
TargetEmbedBuffer.append(1, ',');
39303930
}

0 commit comments

Comments
 (0)