[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:

@efriedma-quic I've found a problem related to this comment.  If I have a pragma like:
```cpp
void fd6(int (*)()) {}
#pragma export (fd6(int (*)()))
```
I noticed that the type chain for the function arguments when I parse them on the pragma has the ParenType.  eg:
```
PointerType 0xc7957d5eeb0 'int (*)(void)'
`-ParenType 0xc7957d5ee80 'int (void)' sugar
  `-FunctionProtoType 0xc7957d5eb90 'int (void)' cdecl
    `-BuiltinType 0xc7957d2e570 'int'
```
This results in a type mismatch when I do the QualType compare in this code.  Any idea on how to solve this?  Thanks


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


More information about the cfe-commits mailing list