================
@@ -4133,6 +4217,44 @@ void
PragmaMaxTokensTotalHandler::HandlePragma(Preprocessor &PP,
PP.overrideMaxTokens(MaxTokens, Loc);
}
+static void zOSPragmaHandlerHelper(Preprocessor &PP, Token &Tok,
+ tok::TokenKind TokKind) {
+ Token AnnotTok;
+ AnnotTok.startToken();
+ AnnotTok.setKind(TokKind);
+ AnnotTok.setLocation(Tok.getLocation());
+ AnnotTok.setAnnotationEndLoc(Tok.getLocation());
+ SmallVector<Token, 8> TokenVector;
+ // Suck up all of the tokens before the eod.
+ for (; Tok.isNot(tok::eod); PP.Lex(Tok)) {
+ TokenVector.push_back(Tok);
+ AnnotTok.setAnnotationEndLoc(Tok.getLocation());
+ }
+ // Add a sentinel EoF token to the end of the list.
+ Token EoF;
+ EoF.startToken();
+ EoF.setKind(tok::eof);
+ EoF.setLocation(Tok.getLocation());
+ TokenVector.push_back(EoF);
+ // We must allocate this array with new because EnterTokenStream is going to
+ // delete it later.
+ markAsReinjectedForRelexing(TokenVector);
+ auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
----------------
erichkeane wrote:
OH, this does. There is some really odd things happening here that we should
deal with.
Hmm... looking again, this is a particularly odd way to handle the token stream
issues? I find myself wondering why we are doing JUST `PP.EnterToken` for
these rather than `PP.EnterTokenStream` like the rest of the pragmas?
@perry-ca : Please either fix this, or revert this patch if you can't fix this
quickly.
https://github.com/llvm/llvm-project/pull/141671
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits