Skip to content

Commit 36c1a5f

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

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
@@ -892,10 +892,6 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
892892
std::string Name = M->getFullModuleName();
893893
Callbacks->OS->write(Name.data(), Name.size());
894894
Callbacks->HandleNewlinesInToken(Name.data(), Name.size());
895-
} else if (Tok.is(tok::comma)) {
896-
// hard-wire comma writing to prevent #embed from spilling unread contents
897-
// from fast token dumping or builtin speed writing
898-
OS.write(',');
899895
} else if (Tok.isAnnotation()) {
900896
// Ignore annotation tokens created by pragmas - the pragmas themselves
901897
// 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
@@ -3943,7 +3943,7 @@ void Preprocessor::HandleEmbedDirectiveNaive(
39433943
TargetEmbedBuffer.append(Spelling.data(), Spelling.size());
39443944
}
39453945
}
3946-
for (size_t I = 0; I < BinaryContents.size(); ++I) {
3946+
for (size_t I = 0; I < TotalSize; ++I) {
39473947
unsigned char ByteValue = BinaryContents[I];
39483948
StringRef ByteRepresentation = IntegerLiterals[ByteValue];
39493949
TargetEmbedBuffer.append(2, '(');
@@ -3952,7 +3952,7 @@ void Preprocessor::HandleEmbedDirectiveNaive(
39523952
TargetEmbedBuffer.append(ByteRepresentation.data(),
39533953
ByteRepresentation.size());
39543954
TargetEmbedBuffer.append(1, ')');
3955-
bool AtEndOfContents = I == (BinaryContents.size() - 1);
3955+
bool AtEndOfContents = I == (TotalSize - 1);
39563956
if (!AtEndOfContents) {
39573957
TargetEmbedBuffer.append(1, ',');
39583958
}

0 commit comments

Comments
 (0)