[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)
Sean Perry via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 13 14:31:54 PST 2026
================
@@ -1386,6 +1402,77 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
return true;
}
+void 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();
+
+ auto SkipToEnd = [this]() {
----------------
perry-ca wrote:
What I have handles the tokens the same way the other pragma parsing functions in ParsePragma.cpp like `HandlePragmaAttribute()`. The other practice is to use the bool return type to indicate if the tokens up to, and including, EOF need to be consumed. Looks like another area for code improvements.
The SkipUntil call does consume the EOF token after and SkipUntil won't consume more tokens if the current is already EOF. It looks like I can do what you suggest.
I'll change the code to use llvm::scope_exit.
https://github.com/llvm/llvm-project/pull/141671
More information about the cfe-commits
mailing list