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

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 13:11:11 PDT 2025


================
@@ -1273,6 +1273,168 @@ void Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) {
     FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size()));
 }
 
+static bool typeListMatches(FunctionDecl *FD,
+                            const clang::Sema::SymbolLabel &Label) {
+  assert(Label.TypeList.has_value());
+  if (FD->getNumParams() != Label.TypeList->size()) {
+    return false;
+  }
+
+  // Check if arguments match.
+  for (unsigned i = 0; i != FD->getNumParams(); ++i) {
+    const ParmVarDecl *PVD = FD->getParamDecl(i);
+    QualType ParmType = PVD->getOriginalType().getCanonicalType();
----------------
perry-ca wrote:

Good catch.  This code does work for a case like:
```
void func(int []);
#pragma export(func(int[]))
```
but not for:
```
void func(int []);
#pragma export(func(int*))
```
(or vice versa)

The later case should work.  I'll add code to use `getType()` and then to decay the types.

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


More information about the cfe-commits mailing list