Skip to content

Commit

Permalink
🛠 [Lex, Frontend] Remove comma hardcoding since we are servicing a fu…
Browse files Browse the repository at this point in the history
…ll file
  • Loading branch information
ThePhD authored and h-vetinari committed Oct 14, 2023
1 parent b356860 commit 36c1a5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions clang/lib/Frontend/PrintPreprocessedOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, '(');
Expand All @@ -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, ',');
}
Expand Down

0 comments on commit 36c1a5f

Please sign in to comment.