From 01dd9eb5f3bfdd57d94ada63b88b1bc092155ebe Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 29 May 2026 11:53:08 +0000 Subject: [PATCH] revert upstream commit 947b9f55b5f327e14368a48fb6ce10242ea29bf3 It breaks cpp -traditional -dM https://github.com/llvm/llvm-project/issues/200085 --- .../clang/lib/Frontend/PrintPreprocessedOutput.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gnu/llvm/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/gnu/llvm/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 9e046633328..f0a1e50e62d 100644 --- a/gnu/llvm/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/gnu/llvm/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -914,7 +914,8 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, PP.Lex(Tok); continue; } else if (Tok.is(tok::annot_repl_input_end)) { - // Fall through to exit the loop. + PP.Lex(Tok); + continue; } else if (Tok.is(tok::eod)) { // Don't print end of directive tokens, since they are typically newlines // that mess up our line tracking. These come from unknown pre-processor @@ -1023,8 +1024,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, Callbacks->setEmittedTokensOnThisLine(); IsStartOfLine = false; - if (Tok.is(tok::eof) || Tok.is(tok::annot_repl_input_end)) - break; + if (Tok.is(tok::eof)) break; PP.Lex(Tok); // If lexing that token causes us to need to skip future tokens, do so now. @@ -1047,7 +1047,9 @@ static void DoPrintMacros(Preprocessor &PP, raw_ostream *OS) { // the macro table at the end. PP.EnterMainSourceFile(); - PP.LexTokensUntilEOF(); + Token Tok; + do PP.Lex(Tok); + while (Tok.isNot(tok::eof)); SmallVector MacrosByID; for (Preprocessor::macro_iterator I = PP.macro_begin(), E = PP.macro_end();