From 989173c09c2930a9f523ccb455111ef446e9f96d Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 28 Sep 2023 23:29:24 +0800 Subject: [C++20] [Modules] Don't generate call to an imported module that dont init anything (#67638) Close https://github.com/llvm/llvm-project/issues/56794 And see https://github.com/llvm/llvm-project/issues/67582 for a detailed backgrond for the issue. As required by the Itanium ABI, the module units have to generate the initialization function. However, the importers are allowed to elide the call to the initialization function if they are sure the initialization function doesn't do anything. This patch implemented this semantics. --- clang/lib/Basic/Module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Basic/Module.cpp') diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 4e6fbfc..23683ea 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -44,7 +44,7 @@ Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, InferSubmodules(false), InferExplicitSubmodules(false), InferExportWildcard(false), ConfigMacrosExhaustive(false), NoUndeclaredIncludes(false), ModuleMapIsPrivate(false), - NameVisibility(Hidden) { + NamedModuleHasNoInit(false), NameVisibility(Hidden) { if (Parent) { IsAvailable = Parent->isAvailable(); IsUnimportable = Parent->isUnimportable(); -- cgit v1.1