mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #26773 from nkcsgexi/abort-compiler-error
ABI/API checker: abort after error occurs while importing a module
This commit is contained in:
@@ -48,6 +48,7 @@ namespace {
|
||||
DeserializeSDK,
|
||||
GenerateNameCorrectionTemplate,
|
||||
FindUsr,
|
||||
GenerateEmptyBaseline,
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
@@ -173,7 +174,10 @@ Action(llvm::cl::desc("Mode:"), llvm::cl::init(ActionType::None),
|
||||
"Find USR for decls by given condition"),
|
||||
clEnumValN(ActionType::GenerateNameCorrectionTemplate,
|
||||
"generate-name-correction",
|
||||
"Generate name correction template")));
|
||||
"Generate name correction template"),
|
||||
clEnumValN(ActionType::GenerateEmptyBaseline,
|
||||
"generate-empty-baseline",
|
||||
"Generate an empty baseline")));
|
||||
|
||||
static llvm::cl::list<std::string>
|
||||
SDKJsonPaths("input-paths",
|
||||
@@ -2480,13 +2484,12 @@ static CheckerOptions getCheckOpts(int argc, char *argv[]) {
|
||||
return Opts;
|
||||
}
|
||||
|
||||
static SDKNodeRoot *getSDKRoot(const char *Main, SDKContext &Ctx,
|
||||
CheckerOptions Opts, bool IsBaseline) {
|
||||
static SDKNodeRoot *getSDKRoot(const char *Main, SDKContext &Ctx, bool IsBaseline) {
|
||||
CompilerInvocation Invok;
|
||||
llvm::StringSet<> Modules;
|
||||
if (prepareForDump(Main, Invok, Modules, IsBaseline))
|
||||
return nullptr;
|
||||
return getSDKNodeRoot(Ctx, Invok, Modules, Opts);
|
||||
return getSDKNodeRoot(Ctx, Invok, Modules);
|
||||
}
|
||||
|
||||
static bool hasBaselineInput() {
|
||||
@@ -2537,8 +2540,8 @@ int main(int argc, char *argv[]) {
|
||||
std::move(protocolWhitelist));
|
||||
else {
|
||||
SDKContext Ctx(Opts);
|
||||
return diagnoseModuleChange(Ctx, getSDKRoot(argv[0], Ctx, Opts, true),
|
||||
getSDKRoot(argv[0], Ctx, Opts, false),
|
||||
return diagnoseModuleChange(Ctx, getSDKRoot(argv[0], Ctx, true),
|
||||
getSDKRoot(argv[0], Ctx, false),
|
||||
options::OutputFile,
|
||||
std::move(protocolWhitelist));
|
||||
}
|
||||
@@ -2567,6 +2570,11 @@ int main(int argc, char *argv[]) {
|
||||
Store.addStorePath(Paths[I]);
|
||||
return deserializeNameCorrection(Store, options::OutputFile);
|
||||
}
|
||||
case ActionType::GenerateEmptyBaseline: {
|
||||
SDKContext Ctx(Opts);
|
||||
dumpSDKRoot(getEmptySDKNodeRoot(Ctx), options::OutputFile);
|
||||
return 0;
|
||||
}
|
||||
case ActionType::FindUsr: {
|
||||
if (options::SDKJsonPaths.size() != 1) {
|
||||
llvm::cl::PrintHelpMessage();
|
||||
|
||||
Reference in New Issue
Block a user