Skip to content

Commit 515d3f7

Browse files
authored
[TextAPI] Reorder addRPath parameters (#87601)
It matches up with other _attribute_ adding member functions and helps simplify InterfaceFile assignment for InstallAPI.
1 parent 678f32a commit 515d3f7

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

llvm/include/llvm/TextAPI/InterfaceFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ class InterfaceFile {
299299
}
300300

301301
/// Set the runpath search paths.
302-
/// \param InputTarget The target applicable to runpath search path.
303302
/// \param RPath The name of runpath.
304-
void addRPath(const Target &InputTarget, StringRef RPath);
303+
/// \param InputTarget The target applicable to runpath search path.
304+
void addRPath(StringRef RPath, const Target &InputTarget);
305305

306306
/// Get the list of runpath search paths.
307307
///

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
5454
ParentUmbrellas.emplace(Iter, Target_, std::string(Parent));
5555
}
5656

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

200200
for (const auto &[Target, Path] : rpaths())
201-
IF->addRPath(Target, Path);
201+
IF->addRPath(Path, Target);
202202
for (const auto &[Target, Path] : O->rpaths())
203-
IF->addRPath(Target, Path);
203+
IF->addRPath(Path, Target);
204204

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

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

324324
for (const auto &Lib : allowableClients())
325325
for (const auto &Target : Lib.targets())

llvm/lib/TextAPI/TextStubV5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Expected<IFPtr> parseToInterfaceFile(const Object *File) {
672672
F->addParentUmbrella(Target, Lib);
673673
for (auto &[Path, Targets] : RPaths)
674674
for (auto Target : Targets)
675-
F->addRPath(Target, Path);
675+
F->addRPath(Path, Target);
676676
for (auto &[Targets, Symbols] : Exports)
677677
for (auto &Sym : Symbols)
678678
F->addSymbol(Sym.Kind, Sym.Name, Targets, Sym.Flags);

llvm/unittests/TextAPI/TextStubV5Tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ TEST(TBDv5, WriteFile) {
722722
File.setInstallName("@rpath/S/L/F/Foo.framework/Foo");
723723
File.setCurrentVersion(PackedVersion(1, 2, 0));
724724
File.setCompatibilityVersion(PackedVersion(1, 1, 0));
725-
File.addRPath(AllTargets[0], "@executable_path/.../Frameworks");
725+
File.addRPath("@executable_path/.../Frameworks", AllTargets[0]);
726726

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

0 commit comments

Comments
 (0)