To reproduce, apply this diff:
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -9207,7 +9207,7 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
if (g->zig_target->is_native) {
if (target_supports_clang_march_native(g->zig_target)) {
- args.append("-march=native");
+ args.append("-march=bogus");
}
} else {
args.append("-target");
Create test.c:
int main(int argc, char **argv) {
return 0;
}
Finally:
$ ./zig translate-c test.c
unable to parse C file: out of memory
This issue is extracted from #3210; see the discussion there for context and clues of where the problematic code lives.
This is marked contributor friendly because, as @LemonBoy notes, the next step here is sending a polite email to the llvm-dev mailing list and see what they recommend.
Related: #4467
When using clang::ASTUnit::LoadFromCommandLine, both the clang::ASTUnit*
return value and the clang::ASTUnit* ErrAST out parameter are NULL.
The ErrAST is not null, it's the StoredDiagnostics vector that's swapped with FailedParseDiagnostics before returning that makes the errors impossible to get.
Is this the same as #4028?
I've sent a libclang patch to fix this problem.
@LemonBoy here's the trick to getting it landed [source]:
On 4/15/20 4:52 PM, David Blaikie wrote:
Generally an author should submit an approved patch. If they do not have
commit access they should ask someone who does (usually the approver) to
commit it on their behalf.(you generally shouldn't approve patches if you aren't in a position to
have committed the patch without review if it was your own patch - so at
the very least having commit access, but also being sufficiently
familiar with the norms of the part of the project that you're confident
committing without review (this doesn't fully cover all cases, some
areas do more cross-review than others, etc))Thanks David, that makes sense. So:
Find someone who has commit access and knowledge about the touched
areas of code.Convince them to review & land the patch.
In summary I think if the right set of people get CC'd then it will get reviewed & landed.

u hate 2 see it
anyone want to take on the task of finding the right people and sending a gentle reminder every week?
Thanks to diligent work by @LemonBoy this is now fixed in clang master branch, and should be available in LLVM 12.