translate-c: change OutOfMemory → ASTUnitFailure
- return a better error when no diagnostics are availablemaster
parent
b15958c557
commit
8583038640
|
@ -92,6 +92,7 @@ const Error = extern enum {
|
|||
InvalidCpuFeatures,
|
||||
InvalidLlvmCpuFeaturesFormat,
|
||||
UnknownApplicationBinaryInterface,
|
||||
ASTUnitFailure,
|
||||
};
|
||||
|
||||
const FILE = std.c.FILE;
|
||||
|
@ -114,6 +115,7 @@ export fn stage2_translate_c(
|
|||
out_errors_len.* = errors.len;
|
||||
return Error.CCompileErrors;
|
||||
},
|
||||
error.ASTUnitFailure => return Error.ASTUnitFailure,
|
||||
error.OutOfMemory => return Error.OutOfMemory,
|
||||
};
|
||||
return Error.None;
|
||||
|
|
|
@ -264,7 +264,7 @@ pub fn translate(
|
|||
&errors.len,
|
||||
resources_path,
|
||||
) orelse {
|
||||
if (errors.len == 0) return error.OutOfMemory;
|
||||
if (errors.len == 0) return error.ASTUnitFailure;
|
||||
return error.SemanticAnalyzeFail;
|
||||
};
|
||||
defer ZigClangASTUnit_delete(ast_unit);
|
||||
|
|
|
@ -64,6 +64,7 @@ const char *err_str(Error err) {
|
|||
case ErrorInvalidCpuFeatures: return "invalid CPU features";
|
||||
case ErrorInvalidLlvmCpuFeaturesFormat: return "invalid LLVM CPU features format";
|
||||
case ErrorUnknownApplicationBinaryInterface: return "unknown application binary interface";
|
||||
case ErrorASTUnitFailure: return "ASTUnit failure";
|
||||
}
|
||||
return "(invalid error)";
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ enum Error {
|
|||
ErrorInvalidCpuFeatures,
|
||||
ErrorInvalidLlvmCpuFeaturesFormat,
|
||||
ErrorUnknownApplicationBinaryInterface,
|
||||
ErrorASTUnitFailure,
|
||||
};
|
||||
|
||||
// ABI warning
|
||||
|
|
Loading…
Reference in New Issue