Skip to content

Commit 2efb5b2

Browse files
committed
ABI/API checker: abort after error occurs while importing a module
1 parent 0b9bd99 commit 2efb5b2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tools/swift-api-digester/ModuleAnalyzerNodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ swift::ide::api::getSDKNodeRoot(SDKContext &SDKCtx,
20972097
if (Opts.Verbose)
20982098
llvm::errs() << "Loading module: " << Name << "...\n";
20992099
auto *M = Ctx.getModuleByName(Name);
2100-
if (!M || M->failedToLoad()) {
2100+
if (!M || M->failedToLoad() || Ctx.Diags.hadAnyError()) {
21012101
llvm::errs() << "Failed to load module: " << Name << '\n';
21022102
if (Opts.AbortOnModuleLoadFailure)
21032103
return nullptr;

utils/api_checker/swift-api-checker.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ def escapeCmdArg(arg):
3333
def check_call(cmd, cwd=None, env=os.environ, verbose=False, output=None):
3434
if verbose:
3535
print(' '.join([escapeCmdArg(arg) for arg in cmd]))
36-
return subprocess.check_call(cmd, cwd=cwd, env=env,
37-
stderr=None, stdout=output)
36+
try:
37+
subprocess.check_call(cmd, cwd=cwd, env=env,
38+
stderr=None, stdout=output)
39+
return 0
40+
except Exception as error:
41+
printerr(error)
42+
return 1
3843

3944

4045
def check_output(cmd, verbose=False):

0 commit comments

Comments
 (0)