[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 07:16:11 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]() {
----------------
erichkeane wrote:

Instead of calling this everywhere, we can just do this as a :

`auto exit = llvm::make_scope_exit(<lambda>);`.  


That said, I THINK the `StopBeforeMatch` is wrong here.  In the `correct` case you consume the EOF, in the `error` case you're not?  Perhaps this should consume it too? 

https://github.com/llvm/llvm-project/pull/141671


More information about the cfe-commits mailing list