Skip to content

[TextAPI] Reorder addRPath parameters #87601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/include/llvm/TextAPI/InterfaceFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ class InterfaceFile {
}

/// Set the runpath search paths.
/// \param InputTarget The target applicable to runpath search path.
/// \param RPath The name of runpath.
void addRPath(const Target &InputTarget, StringRef RPath);
/// \param InputTarget The target applicable to runpath search path.
void addRPath(StringRef RPath, const Target &InputTarget);

/// Get the list of runpath search paths.
///
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/TextAPI/InterfaceFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
ParentUmbrellas.emplace(Iter, Target_, std::string(Parent));
}

void InterfaceFile::addRPath(const Target &InputTarget, StringRef RPath) {
void InterfaceFile::addRPath(StringRef RPath, const Target &InputTarget) {
if (RPath.empty())
return;
using RPathEntryT = const std::pair<Target, std::string>;
Expand Down Expand Up @@ -198,9 +198,9 @@ InterfaceFile::merge(const InterfaceFile *O) const {
IF->addReexportedLibrary(Lib.getInstallName(), Target);

for (const auto &[Target, Path] : rpaths())
IF->addRPath(Target, Path);
IF->addRPath(Path, Target);
for (const auto &[Target, Path] : O->rpaths())
IF->addRPath(Target, Path);
IF->addRPath(Path, Target);

for (const auto *Sym : symbols()) {
IF->addSymbol(Sym->getKind(), Sym->getName(), Sym->targets(),
Expand Down Expand Up @@ -319,7 +319,7 @@ InterfaceFile::extract(Architecture Arch) const {

for (const auto &It : rpaths())
if (It.first.Arch == Arch)
IF->addRPath(It.first, It.second);
IF->addRPath(It.second, It.first);

for (const auto &Lib : allowableClients())
for (const auto &Target : Lib.targets())
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/TextAPI/TextStubV5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ Expected<IFPtr> parseToInterfaceFile(const Object *File) {
F->addParentUmbrella(Target, Lib);
for (auto &[Path, Targets] : RPaths)
for (auto Target : Targets)
F->addRPath(Target, Path);
F->addRPath(Path, Target);
for (auto &[Targets, Symbols] : Exports)
for (auto &Sym : Symbols)
F->addSymbol(Sym.Kind, Sym.Name, Targets, Sym.Flags);
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/TextAPI/TextStubV5Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ TEST(TBDv5, WriteFile) {
File.setInstallName("@rpath/S/L/F/Foo.framework/Foo");
File.setCurrentVersion(PackedVersion(1, 2, 0));
File.setCompatibilityVersion(PackedVersion(1, 1, 0));
File.addRPath(AllTargets[0], "@executable_path/.../Frameworks");
File.addRPath("@executable_path/.../Frameworks", AllTargets[0]);

for (const auto &Targ : AllTargets) {
File.addParentUmbrella(Targ, "System");
Expand Down Expand Up @@ -897,7 +897,7 @@ TEST(TBDv5, WriteMultipleDocuments) {
NestedFile.setTwoLevelNamespace();
NestedFile.setApplicationExtensionSafe(false);
NestedFile.setCurrentVersion(PackedVersion(2, 1, 1));
NestedFile.addRPath(AllTargets[0], "@executable_path/.../Frameworks");
NestedFile.addRPath("@executable_path/.../Frameworks", AllTargets[0]);
for (const auto &Targ : AllTargets)
NestedFile.addReexportedLibrary("@rpath/libfoo.dylib", Targ);
NestedFile.addSymbol(EncodeKind::GlobalSymbol, "_funcFoo", AllTargets,
Expand Down