| author | |
| committer | |
| log | 652efe38b40af8c2a98756e71c9e98fe339d059d |
| tree | 5b6342a9a7fb9643ab03ab8c3fb42d372bd164cb |
| parent | b15958c557d3b29c8d4cee9951a8bfd30c215482 |
| parent | 85830386402e2050a3dc97778b3a28af2be16e90 |
| signature |
translate-c: change OutOfMemory → ASTUnitFailure4 files changed, 5 insertions(+), 1 deletions(-)
src-self-hosted/stage1.zig+2| ... | @@ -92,6 +92,7 @@ const Error = extern enum { | ... | @@ -92,6 +92,7 @@ const Error = extern enum { |
| 92 | InvalidCpuFeatures, | 92 | InvalidCpuFeatures, |
| 93 | InvalidLlvmCpuFeaturesFormat, | 93 | InvalidLlvmCpuFeaturesFormat, |
| 94 | UnknownApplicationBinaryInterface, | 94 | UnknownApplicationBinaryInterface, |
| 95 | ASTUnitFailure, | ||
| 95 | }; | 96 | }; |
| 96 | 97 | ||
| 97 | const FILE = std.c.FILE; | 98 | const FILE = std.c.FILE; |
| ... | @@ -114,6 +115,7 @@ export fn stage2_translate_c( | ... | @@ -114,6 +115,7 @@ export fn stage2_translate_c( |
| 114 | out_errors_len.* = errors.len; | 115 | out_errors_len.* = errors.len; |
| 115 | return Error.CCompileErrors; | 116 | return Error.CCompileErrors; |
| 116 | }, | 117 | }, |
| 118 | error.ASTUnitFailure => return Error.ASTUnitFailure, | ||
| 117 | error.OutOfMemory => return Error.OutOfMemory, | 119 | error.OutOfMemory => return Error.OutOfMemory, |
| 118 | }; | 120 | }; |
| 119 | return Error.None; | 121 | return Error.None; |
src-self-hosted/translate_c.zig+1-1| ... | @@ -264,7 +264,7 @@ pub fn translate( | ... | @@ -264,7 +264,7 @@ pub fn translate( |
| 264 | &errors.len, | 264 | &errors.len, |
| 265 | resources_path, | 265 | resources_path, |
| 266 | ) orelse { | 266 | ) orelse { |
| 267 | if (errors.len == 0) return error.OutOfMemory; | 267 | if (errors.len == 0) return error.ASTUnitFailure; |
| 268 | return error.SemanticAnalyzeFail; | 268 | return error.SemanticAnalyzeFail; |
| 269 | }; | 269 | }; |
| 270 | defer ZigClangASTUnit_delete(ast_unit); | 270 | defer ZigClangASTUnit_delete(ast_unit); |
src/error.cpp+1| ... | @@ -64,6 +64,7 @@ const char *err_str(Error err) { | ... | @@ -64,6 +64,7 @@ const char *err_str(Error err) { |
| 64 | case ErrorInvalidCpuFeatures: return "invalid CPU features"; | 64 | case ErrorInvalidCpuFeatures: return "invalid CPU features"; |
| 65 | case ErrorInvalidLlvmCpuFeaturesFormat: return "invalid LLVM CPU features format"; | 65 | case ErrorInvalidLlvmCpuFeaturesFormat: return "invalid LLVM CPU features format"; |
| 66 | case ErrorUnknownApplicationBinaryInterface: return "unknown application binary interface"; | 66 | case ErrorUnknownApplicationBinaryInterface: return "unknown application binary interface"; |
| 67 | case ErrorASTUnitFailure: return "ASTUnit failure"; | ||
| 67 | } | 68 | } |
| 68 | return "(invalid error)"; | 69 | return "(invalid error)"; |
| 69 | } | 70 | } |
src/userland.h+1| ... | @@ -84,6 +84,7 @@ enum Error { | ... | @@ -84,6 +84,7 @@ enum Error { |
| 84 | ErrorInvalidCpuFeatures, | 84 | ErrorInvalidCpuFeatures, |
| 85 | ErrorInvalidLlvmCpuFeaturesFormat, | 85 | ErrorInvalidLlvmCpuFeaturesFormat, |
| 86 | ErrorUnknownApplicationBinaryInterface, | 86 | ErrorUnknownApplicationBinaryInterface, |
| 87 | ErrorASTUnitFailure, | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | // ABI warning | 90 | // ABI warning |