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

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 5 13:29:39 PST 2025


================
@@ -1327,6 +1327,60 @@ void Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) {
     FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size()));
 }
 
+NamedDecl *Sema::lookupExternCName(IdentifierInfo *IdentId,
+                                   SourceLocation NameLoc, Scope *curScope) {
+  LookupResult Result(*this, IdentId, NameLoc, LookupOrdinaryName);
+  LookupName(Result, curScope);
----------------
perry-ca wrote:

This is intentional.  It allows usage like:
```cpp
namespace ABC {
  extern "C" int var;
#pragma export(var)
}
```
It the scope was the TU, this example wouldn't work.

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


More information about the cfe-commits mailing list