[clang] [SystemZ][z/OS] Add visibility features for z/OS (eg. _Export, pragma export) (PR #111035)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 11:13:59 PDT 2025


================
@@ -1401,6 +1417,164 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
   return true;
 }
 
+NestedNameSpecifier *Parser::zOSParseIdentifier(StringRef PragmaName,
+                                                IdentifierInfo *IdentName) {
+  NestedNameSpecifier *NestedId = nullptr;
+  if (Tok.is(tok::coloncolon)) {
+    NestedId = NestedNameSpecifier::Create(Actions.Context, IdentName);
+  } else if (Actions.CurContext->isNamespace()) {
+    auto *NS = cast<NamespaceDecl>(Actions.CurContext);
+    NestedId =
+        NestedNameSpecifier::Create(Actions.Context, NS->getIdentifier());
+    NestedId =
+        NestedNameSpecifier::Create(Actions.Context, NestedId, IdentName);
+    PP.Lex(Tok);
+  } else {
+    NestedId = NestedNameSpecifier::Create(Actions.Context, IdentName);
+    PP.Lex(Tok);
+  }
+  while (Tok.is(tok::coloncolon)) {
+    PP.Lex(Tok);
+    IdentName = Tok.getIdentifierInfo();
----------------
AaronBallman wrote:

```suggestion
    IdentifierInfo *II = Tok.getIdentifierInfo();
```
Better to use a local variable instead of reusing the parameter.

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


More information about the cfe-commits mailing list