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