================
@@ -1327,23 +1327,35 @@ void
Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) {
FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size()));
}
-void Sema::ActOnPragmaExport(IdentifierInfo *IdentId, SourceLocation NameLoc) {
+NamedDecl *Sema::lookupExternCName(IdentifierInfo *IdentId,
+ SourceLocation NameLoc, Scope *curScope) {
+ LookupResult Result(*this, IdentId, NameLoc, LookupOrdinaryName);
+ LookupName(Result, curScope);
+ if (!getLangOpts().CPlusPlus)
+ return Result.getAsSingle<NamedDecl>();
+ for (LookupResult::iterator I = Result.begin(); I != Result.end(); ++I) {
+ NamedDecl *D = (*I)->getUnderlyingDecl();
+ if (auto *FD = dyn_cast<FunctionDecl>(D->getCanonicalDecl()))
+ if (FD->isExternC())
+ return D;
+ if (isa<VarDecl>(D->getCanonicalDecl()))
+ return D;
+ }
----------------
perry-ca wrote:
Anything in particular that doesn't look right? The use of lookupName is
similar to other uses. This does have the loop after that looks for the extern
"C" declaration. That is part of the functionality of the pragma.
Dependent names aren't supported. This is pragma can only be used at file
scope. There aren't any dependent names there.
https://github.com/llvm/llvm-project/pull/141671
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits