diff options
author | Juergen Ributzka <juergen@ributzka.de> | 2024-01-08 11:04:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 11:04:22 -0800 |
commit | f4bc70e886f2eb1b646d84871b93897db749c826 (patch) | |
tree | 2853b146312fd6110a870e661a4cf9086a695b1f | |
parent | 478ec63312582c24c8d6ecab280da2380137c0b7 (diff) | |
download | llvm-f4bc70e886f2eb1b646d84871b93897db749c826.zip llvm-f4bc70e886f2eb1b646d84871b93897db749c826.tar.gz llvm-f4bc70e886f2eb1b646d84871b93897db749c826.tar.bz2 |
[clang][modules] Remove `_Private` suffix from framework auto-link hints. (#77120)
- [clang][modules] Remove no longer needed autolink test for TBD files.
- [clang][modules] Remove `_Private` suffix from framework auto-link
hints.
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 4 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd | 1 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h | 1 | ||||
-rw-r--r-- | clang/test/Modules/autolinkTBD.m | 16 | ||||
-rw-r--r-- | clang/test/Modules/autolink_private_module.m | 25 |
5 files changed, 28 insertions, 19 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index ea5d13d..42d55d0 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -984,7 +984,9 @@ static void inferFrameworkLink(Module *Mod) { assert(!Mod->isSubFramework() && "Can only infer linking for top-level frameworks"); - Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name, + StringRef FrameworkName(Mod->Name); + FrameworkName.consume_back("_Private"); + Mod->LinkLibraries.push_back(Module::LinkLibrary(FrameworkName.str(), /*IsFramework=*/true)); } diff --git a/clang/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd b/clang/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd deleted file mode 100644 index 4aa0f85..0000000 --- a/clang/test/Modules/Inputs/AutolinkTBD.framework/AutolinkTBD.tbd +++ /dev/null @@ -1 +0,0 @@ -empty file - clang only needs to check if it exists. diff --git a/clang/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h b/clang/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h deleted file mode 100644 index 914983c..0000000 --- a/clang/test/Modules/Inputs/AutolinkTBD.framework/Headers/AutolinkTBD.h +++ /dev/null @@ -1 +0,0 @@ -extern int foo(void); diff --git a/clang/test/Modules/autolinkTBD.m b/clang/test/Modules/autolinkTBD.m deleted file mode 100644 index 69253294..0000000 --- a/clang/test/Modules/autolinkTBD.m +++ /dev/null @@ -1,16 +0,0 @@ -// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}} -// RUN: rm -rf %t -// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s | FileCheck --check-prefix=CHECK-AUTOLINK-DISABLED %s - -@import AutolinkTBD; - -int f(void) { - return foo(); -} - -// CHECK: !llvm.linker.options = !{![[AUTOLINK_FRAMEWORK:[0-9]+]]} -// CHECK: ![[AUTOLINK_FRAMEWORK]] = !{!"-framework", !"AutolinkTBD"} - -// CHECK-AUTOLINK-DISABLED: !llvm.module.flags -// CHECK-AUTOLINK-DISABLED-NOT: !llvm.linker.options diff --git a/clang/test/Modules/autolink_private_module.m b/clang/test/Modules/autolink_private_module.m new file mode 100644 index 0000000..54bebc3 --- /dev/null +++ b/clang/test/Modules/autolink_private_module.m @@ -0,0 +1,25 @@ +// Test that autolink hints for frameworks don't use the private module name. +// RUN: rm -rf %t && mkdir %t +// RUN: split-file %s %t + +// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t/ModuleCache -fmodules -fimplicit-module-maps -F %t/Frameworks %t/test.m | FileCheck %s + +// CHECK: !{!"-framework", !"Autolink"} +// CHECK-NOT: !{!"-framework", !"Autolink_Private"} + +//--- test.m +#include <Autolink/Autolink.h> +#include <Autolink/Autolink_Private.h> + +//--- Frameworks/Autolink.framework/Headers/Autolink.h +void public(); + +//--- Frameworks/Autolink.framework/PrivateHeaders/Autolink_Private.h +void private(); + +//--- Frameworks/Autolink.framework/Modules/module.modulemap +framework module Autolink { header "Autolink.h"} + +//--- Frameworks/Autolink.framework/Modules/module.private.modulemap +framework module Autolink_Private { header "Autolink_Private.h"} + |