From 76864e6af134aa240069d42ba15e0b89fd7d6b4c Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Fri, 28 Jun 2024 15:40:55 +0800 Subject: [C++20] [Modules] Don't find module for linkage for decls in global module Possibly fix https://github.com/llvm/llvm-project/issues/96693 The direct reason is that we are calculating the linkage for the declaration too early so that the linkage got calculated incorrectly. And after I look into the problem, I found it is completely not necessary to calculate the linkage there. It is for ModulesTS. So I simply removes that legacy experimental code and fix the issue. --- clang/lib/Sema/SemaLookup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaLookup.cpp') diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 12b13eb..9a3fabc 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -5965,7 +5965,7 @@ RedeclarationKind Sema::forRedeclarationInCurContext() const { // anything that is not visible. We don't need to check linkage here; if // the context has internal linkage, redeclaration lookup won't find things // from other TUs, and we can't safely compute linkage yet in general. - if (cast(CurContext)->getOwningModuleForLinkage(/*IgnoreLinkage*/ true)) + if (cast(CurContext)->getOwningModuleForLinkage()) return RedeclarationKind::ForVisibleRedeclaration; return RedeclarationKind::ForExternalRedeclaration; } -- cgit v1.1