[clang] [SystemZ][z/OS] Implement #pragma export (PR #141671)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue May 27 14:51:02 PDT 2025
================
@@ -1395,6 +1411,171 @@ bool Parser::HandlePragmaMSAllocText(StringRef PragmaName,
return true;
}
+NestedNameSpecifier *
+Parser::zOSParseIdentifier(StringRef PragmaName,
+ const IdentifierInfo *IdentName) {
+ NestedNameSpecifier *NestedId = nullptr;
+ if (PP.getLangOpts().CPlusPlus) {
+ if (Tok.is(tok::coloncolon)) {
+ // Nothing to do.
+ } 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);
+ if (Tok.isNot(tok::identifier)) {
+ PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
+ << PragmaName;
+ return nullptr;
+ }
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+ NestedId = NestedNameSpecifier::Create(Actions.Context, NestedId, II);
+ PP.Lex(Tok);
+ }
+ } else {
+ NestedId = NestedNameSpecifier::Create(Actions.Context, IdentName);
+ PP.Lex(Tok);
+ }
+ return NestedId;
+}
+
+bool Parser::zOSParseParameterList(
+ StringRef PragmaName, std::optional<SmallVector<QualType, 4>> &TypeList,
+ Qualifiers &CVQual) {
+ if (Tok.is(tok::l_paren)) {
+ TypeList = SmallVector<QualType, 4>();
+ PP.Lex(Tok);
+ while (Tok.isNot(tok::eof) && !Tok.is(tok::r_paren)) {
+ TypeResult TResult = ParseTypeName(nullptr);
+ if (!TResult.isInvalid()) {
+ QualType QT = TResult.get().get();
+ if (!QT.getTypePtr()->isVoidType()) {
+ TypeList->push_back(QT);
----------------
erichkeane wrote:
This feels lossy... Also, why are we allowing 'void' in this list at all?
https://github.com/llvm/llvm-project/pull/141671
More information about the cfe-commits
mailing list