Skip to content

Commit 8ca0364

Browse files
authored
[TextAPI] Skip adding empty attributes (#77400)
An empty string attribute value (e.g. a parent-umbrella: "") is equivalent to omitting it. Theres no reason to write it out.
1 parent 810c291 commit 8ca0364

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,23 @@ void InterfaceFileRef::addTarget(const Target &Target) {
2424

2525
void InterfaceFile::addAllowableClient(StringRef InstallName,
2626
const Target &Target) {
27+
if (InstallName.empty())
28+
return;
2729
auto Client = addEntry(AllowableClients, InstallName);
2830
Client->addTarget(Target);
2931
}
3032

3133
void InterfaceFile::addReexportedLibrary(StringRef InstallName,
3234
const Target &Target) {
35+
if (InstallName.empty())
36+
return;
3337
auto Lib = addEntry(ReexportedLibraries, InstallName);
3438
Lib->addTarget(Target);
3539
}
3640

3741
void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
42+
if (Parent.empty())
43+
return;
3844
auto Iter = lower_bound(ParentUmbrellas, Target_,
3945
[](const std::pair<Target, std::string> &LHS,
4046
Target RHS) { return LHS.first < RHS; });
@@ -48,6 +54,8 @@ void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
4854
}
4955

5056
void InterfaceFile::addRPath(const Target &InputTarget, StringRef RPath) {
57+
if (RPath.empty())
58+
return;
5159
using RPathEntryT = const std::pair<Target, std::string>;
5260
RPathEntryT Entry(InputTarget, RPath);
5361
auto Iter =

0 commit comments

Comments
 (0)