[lld] 058ec20 - [lld] As part of using inclusive language within the llvm
Eric Christopher via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 21:50:48 PDT 2020
Author: Eric Christopher
Date: 2020-06-19T21:50:14-07:00
New Revision: 058ec2067724ee7d973af4201c7f53157d9810aa
URL: https://github.com/llvm/llvm-project/commit/058ec2067724ee7d973af4201c7f53157d9810aa
DIFF: https://github.com/llvm/llvm-project/commit/058ec2067724ee7d973af4201c7f53157d9810aa.diff
LOG: [lld] As part of using inclusive language within the llvm
project, migrate away from the use of blacklist and whitelist.
Added:
Modified:
lld/include/lld/ReaderWriter/MachOLinkingContext.h
lld/lib/Driver/DarwinLdDriver.cpp
lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
Removed:
################################################################################
diff --git a/lld/include/lld/ReaderWriter/MachOLinkingContext.h b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
index cd57604fa17d..974f323bc612 100644
--- a/lld/include/lld/ReaderWriter/MachOLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
@@ -55,8 +55,8 @@ class MachOLinkingContext : public LinkingContext {
enum class ExportMode {
globals, // Default, all global symbols exported.
- whiteList, // -exported_symbol[s_list], only listed symbols exported.
- blackList // -unexported_symbol[s_list], no listed symbol exported.
+ exported, // -exported_symbol[s_list], only listed symbols exported.
+ unexported // -unexported_symbol[s_list], no listed symbol exported.
};
enum class DebugInfoMode {
@@ -423,8 +423,6 @@ class MachOLinkingContext : public LinkingContext {
private:
Writer &writer() const override;
mach_o::MachODylibFile* loadIndirectDylib(StringRef path);
- void checkExportWhiteList(const DefinedAtom *atom) const;
- void checkExportBlackList(const DefinedAtom *atom) const;
struct ArchInfo {
StringRef archName;
MachOLinkingContext::Arch arch;
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp
index b1659b9f0016..1a57def4ebbe 100644
--- a/lld/lib/Driver/DarwinLdDriver.cpp
+++ b/lld/lib/Driver/DarwinLdDriver.cpp
@@ -650,12 +650,12 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) {
// Handle -exported_symbols_list <file>
for (auto expFile : parsedArgs.filtered(OPT_exported_symbols_list)) {
- if (ctx.exportMode() == MachOLinkingContext::ExportMode::blackList) {
+ if (ctx.exportMode() == MachOLinkingContext::ExportMode::unexported) {
error("-exported_symbols_list cannot be combined with "
"-unexported_symbol[s_list]");
return false;
}
- ctx.setExportMode(MachOLinkingContext::ExportMode::whiteList);
+ ctx.setExportMode(MachOLinkingContext::ExportMode::exported);
if (std::error_code ec = parseExportsList(expFile->getValue(), ctx)) {
error(ec.message() + ", processing '-exported_symbols_list " +
expFile->getValue());
@@ -665,23 +665,23 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) {
// Handle -exported_symbol <symbol>
for (auto symbol : parsedArgs.filtered(OPT_exported_symbol)) {
- if (ctx.exportMode() == MachOLinkingContext::ExportMode::blackList) {
+ if (ctx.exportMode() == MachOLinkingContext::ExportMode::unexported) {
error("-exported_symbol cannot be combined with "
"-unexported_symbol[s_list]");
return false;
}
- ctx.setExportMode(MachOLinkingContext::ExportMode::whiteList);
+ ctx.setExportMode(MachOLinkingContext::ExportMode::exported);
ctx.addExportSymbol(symbol->getValue());
}
// Handle -unexported_symbols_list <file>
for (auto expFile : parsedArgs.filtered(OPT_unexported_symbols_list)) {
- if (ctx.exportMode() == MachOLinkingContext::ExportMode::whiteList) {
+ if (ctx.exportMode() == MachOLinkingContext::ExportMode::exported) {
error("-unexported_symbols_list cannot be combined with "
"-exported_symbol[s_list]");
return false;
}
- ctx.setExportMode(MachOLinkingContext::ExportMode::blackList);
+ ctx.setExportMode(MachOLinkingContext::ExportMode::unexported);
if (std::error_code ec = parseExportsList(expFile->getValue(), ctx)) {
error(ec.message() + ", processing '-unexported_symbols_list " +
expFile->getValue());
@@ -691,12 +691,12 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) {
// Handle -unexported_symbol <symbol>
for (auto symbol : parsedArgs.filtered(OPT_unexported_symbol)) {
- if (ctx.exportMode() == MachOLinkingContext::ExportMode::whiteList) {
+ if (ctx.exportMode() == MachOLinkingContext::ExportMode::exported) {
error("-unexported_symbol cannot be combined with "
"-exported_symbol[s_list]");
return false;
}
- ctx.setExportMode(MachOLinkingContext::ExportMode::blackList);
+ ctx.setExportMode(MachOLinkingContext::ExportMode::unexported);
ctx.addExportSymbol(symbol->getValue());
}
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 4152ecb59ff3..6fe9cde544d6 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -604,7 +604,7 @@ bool MachOLinkingContext::validateImpl() {
}
// If -exported_symbols_list used, all exported symbols must be defined.
- if (_exportMode == ExportMode::whiteList) {
+ if (_exportMode == ExportMode::exported) {
for (const auto &symbol : _exportedSymbols)
addInitialUndefinedSymbol(symbol.getKey());
}
@@ -618,7 +618,7 @@ bool MachOLinkingContext::validateImpl() {
if (needsStubsPass())
addDeadStripRoot(binderSymbolName());
// If using -exported_symbols_list, make all exported symbols live.
- if (_exportMode == ExportMode::whiteList) {
+ if (_exportMode == ExportMode::exported) {
setGlobalsAreDeadStripRoots(false);
for (const auto &symbol : _exportedSymbols)
addDeadStripRoot(symbol.getKey());
@@ -852,9 +852,9 @@ bool MachOLinkingContext::exportSymbolNamed(StringRef sym) const {
case ExportMode::globals:
llvm_unreachable("exportSymbolNamed() should not be called in this mode");
break;
- case ExportMode::whiteList:
+ case ExportMode::exported:
return _exportedSymbols.count(sym);
- case ExportMode::blackList:
+ case ExportMode::unexported:
return !_exportedSymbols.count(sym);
}
llvm_unreachable("_exportMode unknown enum value");
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index db11f73748d8..55dcad955e85 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -990,7 +990,7 @@ llvm::Error Util::getSymbolTableRegion(const DefinedAtom* atom,
inGlobalsRegion = false;
return llvm::Error::success();
case Atom::scopeLinkageUnit:
- if ((_ctx.exportMode() == MachOLinkingContext::ExportMode::whiteList) &&
+ if ((_ctx.exportMode() == MachOLinkingContext::ExportMode::exported) &&
_ctx.exportSymbolNamed(atom->name())) {
return llvm::make_error<GenericError>(
Twine("cannot export hidden symbol ") + atom->name());
More information about the llvm-commits
mailing list