[clang] [Clang][Sema] Accept weak reference after declaration (PR #228809)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 17:33:50 PST 2026


================
@@ -9386,6 +9386,24 @@ bool Sema::CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous) {
   return false;
 }
 
+void Sema::CheckPragmaWeakAliasRedeclaration(NamedDecl *NewD) {
+  assert(CurContext->isTranslationUnit() &&
+         "#pragma weak alias is declared at translation unit scope");
+  LookupResult Previous(*this, NewD->getDeclName(), NewD->getLocation(),
+                        LookupOrdinaryName, forRedeclarationInCurContext());
+  LookupName(Previous, TUScope);
----------------
efriedma-quic wrote:

Do we need to do name lookup twice?  We already called LookupSingleName().

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


More information about the cfe-commits mailing list