[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)
Sean Perry via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 13:29:38 PST 2025
================
@@ -1386,6 +1402,74 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
return true;
}
+bool Parser::zOSHandlePragmaHelper(tok::TokenKind PragmaKind) {
+ assert(Tok.is(PragmaKind));
+
+ StringRef PragmaName = "export";
+
+ using namespace clang::charinfo;
+ auto *TheTokens =
+ (std::pair<std::unique_ptr<Token[]>, size_t> *)Tok.getAnnotationValue();
+ PP.EnterTokenStream(std::move(TheTokens->first), TheTokens->second, true,
+ false);
+ ConsumeAnnotationToken();
+
+ do {
+ PP.Lex(Tok);
----------------
perry-ca wrote:
I took a look at this. My conclusion is we should be calling PP.Lex(). The reasons are:
- ConsumeToken()/ConsumeAnyToken() track state information which applies to the user source code, not the pragmas. An unbalanced '(' would affect code outside of the pragma
- All the other pragma handling functions call PP.Lex() too
https://github.com/llvm/llvm-project/pull/141671
More information about the cfe-commits
mailing list