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:
Xi Ge
2019-08-21 19:01:55 -07:00
committed by GitHub
6 changed files with 65 additions and 21 deletions

View File

@@ -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();