[llvm] 8ca0364 - [TextAPI] Skip adding empty attributes (#77400)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 09:41:18 PST 2024
Author: Cyndy Ishida
Date: 2024-01-09T09:41:14-08:00
New Revision: 8ca0364d33c7e6c4083e3b1c0b77b00b2c93ff46
URL: https://github.com/llvm/llvm-project/commit/8ca0364d33c7e6c4083e3b1c0b77b00b2c93ff46
DIFF: https://github.com/llvm/llvm-project/commit/8ca0364d33c7e6c4083e3b1c0b77b00b2c93ff46.diff
LOG: [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.
Added:
Modified:
llvm/lib/TextAPI/InterfaceFile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TextAPI/InterfaceFile.cpp b/llvm/lib/TextAPI/InterfaceFile.cpp
index 3689ab9191915a..d712ed3868258d 100644
--- a/llvm/lib/TextAPI/InterfaceFile.cpp
+++ b/llvm/lib/TextAPI/InterfaceFile.cpp
@@ -24,17 +24,23 @@ void InterfaceFileRef::addTarget(const Target &Target) {
void InterfaceFile::addAllowableClient(StringRef InstallName,
const Target &Target) {
+ if (InstallName.empty())
+ return;
auto Client = addEntry(AllowableClients, InstallName);
Client->addTarget(Target);
}
void InterfaceFile::addReexportedLibrary(StringRef InstallName,
const Target &Target) {
+ if (InstallName.empty())
+ return;
auto Lib = addEntry(ReexportedLibraries, InstallName);
Lib->addTarget(Target);
}
void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
+ if (Parent.empty())
+ return;
auto Iter = lower_bound(ParentUmbrellas, Target_,
[](const std::pair<Target, std::string> &LHS,
Target RHS) { return LHS.first < RHS; });
@@ -48,6 +54,8 @@ void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
}
void InterfaceFile::addRPath(const Target &InputTarget, StringRef RPath) {
+ if (RPath.empty())
+ return;
using RPathEntryT = const std::pair<Target, std::string>;
RPathEntryT Entry(InputTarget, RPath);
auto Iter =
More information about the llvm-commits
mailing list