ABIChecker: rename argument -protocol-requirement-white-list to -protocol-requirement-allow-list

This commit is contained in:
Xi Ge
2020-08-27 12:06:25 -07:00
parent b07ecb9efa
commit 103b61c8be
2 changed files with 16 additions and 16 deletions

View File

@@ -3,7 +3,7 @@
// RUN: %empty-directory(%t.module-cache)
// RUN: %api-digester -dump-sdk -module Foo -o %t.dump1.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %S/Inputs/Foo -avoid-location
// RUN: %api-digester -dump-sdk -module Foo -o %t.dump2.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %S/Inputs/Foo-new-version -avoid-location
// RUN: %api-digester -diagnose-sdk -protocol-requirement-white-list %S/Inputs/Foo-prot-allowlist.txt -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result
// RUN: %api-digester -diagnose-sdk -protocol-requirement-allow-list %S/Inputs/Foo-prot-allowlist.txt -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result
// RUN: %clang -E -P -x c %S/Outputs/Foo-diff.txt -o - | sed '/^\s*$/d' > %t.expected
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.result.tmp

View File

@@ -72,7 +72,7 @@ ModuleList("module-list-file",
llvm::cl::cat(Category));
static llvm::cl::opt<std::string>
ProtReqWhiteList("protocol-requirement-white-list",
ProtReqAllowList("protocol-requirement-allow-list",
llvm::cl::desc("File containing a new-line separated list of protocol names"),
llvm::cl::cat(Category));
@@ -1074,7 +1074,7 @@ class PrunePass : public MatchedNodeListener, public SDKTreeDiffPass {
SDKContext &Ctx;
UpdatedNodesMap &UpdateMap;
llvm::StringSet<> ProtocolReqWhitelist;
llvm::StringSet<> ProtocolReqAllowlist;
SDKNodeRoot *LeftRoot;
SDKNodeRoot *RightRoot;
@@ -1123,10 +1123,10 @@ class PrunePass : public MatchedNodeListener, public SDKTreeDiffPass {
public:
PrunePass(SDKContext &Ctx): Ctx(Ctx), UpdateMap(Ctx.getNodeUpdateMap()) {}
PrunePass(SDKContext &Ctx, llvm::StringSet<> prWhitelist):
PrunePass(SDKContext &Ctx, llvm::StringSet<> prAllowlist):
Ctx(Ctx),
UpdateMap(Ctx.getNodeUpdateMap()),
ProtocolReqWhitelist(std::move(prWhitelist)) {}
ProtocolReqAllowlist(std::move(prAllowlist)) {}
void diagnoseMissingAvailable(SDKNodeDecl *D) {
// For extensions of external types, we diagnose individual member's missing
@@ -1178,7 +1178,7 @@ public:
ShouldComplain = false;
}
if (ShouldComplain &&
ProtocolReqWhitelist.count(getParentProtocolName(D))) {
ProtocolReqAllowlist.count(getParentProtocolName(D))) {
// Ignore protocol requirement additions if the protocol has been added
// to the allowlist.
ShouldComplain = false;
@@ -2311,7 +2311,7 @@ createDiagConsumer(llvm::raw_ostream &OS, bool &FailOnError) {
static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
SDKNodeRoot *RightModule, StringRef OutputPath,
llvm::StringSet<> ProtocolReqWhitelist) {
llvm::StringSet<> ProtocolReqAllowlist) {
assert(LeftModule);
assert(RightModule);
llvm::raw_ostream *OS = &llvm::errs();
@@ -2334,7 +2334,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
RightModule->getJsonFormatVersion()));
TypeAliasDiffFinder(LeftModule, RightModule,
Ctx.getTypeAliasUpdateMap()).search();
PrunePass Prune(Ctx, std::move(ProtocolReqWhitelist));
PrunePass Prune(Ctx, std::move(ProtocolReqAllowlist));
Prune.pass(LeftModule, RightModule);
ChangeRefinementPass RefinementPass(Ctx.getNodeUpdateMap());
RefinementPass.pass(LeftModule, RightModule);
@@ -2347,7 +2347,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
StringRef OutputPath,
CheckerOptions Opts,
llvm::StringSet<> ProtocolReqWhitelist) {
llvm::StringSet<> ProtocolReqAllowlist) {
if (!fs::exists(LeftPath)) {
llvm::errs() << LeftPath << " does not exist\n";
return 1;
@@ -2362,7 +2362,7 @@ static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
SwiftDeclCollector RightCollector(Ctx);
RightCollector.deSerialize(RightPath);
diagnoseModuleChange(Ctx, LeftCollector.getSDKRoot(), RightCollector.getSDKRoot(),
OutputPath, std::move(ProtocolReqWhitelist));
OutputPath, std::move(ProtocolReqAllowlist));
return options::CompilerStyleDiags && Ctx.getDiags().hadAnyError() ? 1 : 0;
}
@@ -2837,9 +2837,9 @@ int main(int argc, char *argv[]) {
case ActionType::MigratorGen:
case ActionType::DiagnoseSDKs: {
ComparisonInputMode Mode = checkComparisonInputMode();
llvm::StringSet<> protocolWhitelist;
if (!options::ProtReqWhiteList.empty()) {
if (readFileLineByLine(options::ProtReqWhiteList, protocolWhitelist))
llvm::StringSet<> protocolAllowlist;
if (!options::ProtReqAllowList.empty()) {
if (readFileLineByLine(options::ProtReqAllowList, protocolAllowlist))
return 1;
}
if (options::Action == ActionType::MigratorGen) {
@@ -2853,21 +2853,21 @@ int main(int argc, char *argv[]) {
return diagnoseModuleChange(options::SDKJsonPaths[0],
options::SDKJsonPaths[1],
options::OutputFile, Opts,
std::move(protocolWhitelist));
std::move(protocolAllowlist));
}
case ComparisonInputMode::BaselineJson: {
SDKContext Ctx(Opts);
return diagnoseModuleChange(Ctx, getBaselineFromJson(argv[0], Ctx),
getSDKRoot(argv[0], Ctx, false),
options::OutputFile,
std::move(protocolWhitelist));
std::move(protocolAllowlist));
}
case ComparisonInputMode::BothLoad: {
SDKContext Ctx(Opts);
return diagnoseModuleChange(Ctx, getSDKRoot(argv[0], Ctx, true),
getSDKRoot(argv[0], Ctx, false),
options::OutputFile,
std::move(protocolWhitelist));
std::move(protocolAllowlist));
}
}
}