无效字段';子程序';在解析Rust生成的LLVM-IR时

无效字段';子程序';在解析Rust生成的LLVM-IR时,rust,llvm,llvm-ir,Rust,Llvm,Llvm Ir,在解析Rust生成的LLVM-IR时,我得到了“无效字段‘子程序’”。它立即发生在!0 用于分析的代码: MemoryBuffer* buf = MemoryBuffer::getMemBuffer(StringRef(fC)).release(); SMDiagnostic err; LLVMContext *Context=new LLVMContext(); Module* module = parseIR(buf->getMemBufferRef(), err, *Context)

在解析Rust生成的LLVM-IR时,我得到了“无效字段‘子程序’”。它立即发生在
!0

用于分析的代码:

MemoryBuffer* buf = MemoryBuffer::getMemBuffer(StringRef(fC)).release();
SMDiagnostic err;
LLVMContext *Context=new LLVMContext();
Module* module = parseIR(buf->getMemBufferRef(), err, *Context).release();
if(!module){
    NSString* errorMsg=[NSString stringWithFormat:@"%@ at line:%@ col:%@\n>>%@",[NSString stringWithCString:err.getMessage().str().c_str() encoding:NSUTF8StringEncoding], @(err.getLineNo()), @(err.getColumnNo()), [NSString stringWithCString:err.getLineContents().str().c_str() encoding:NSUTF8StringEncoding]];
    NSError* error=[[NSError alloc] initWithDomain:errorMsg code:-1 userInfo:nil];
    //Deal with NSError later
}
DebugInfoFinder* dif = new DebugInfoFinder();
dif->processModule(*module);
发生的地方:

!0 = distinct !DICompileUnit(language: 36864, file: !1, producer: "rustc version 1.7.0 (a5d1e7a59 2016-02-29)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !10, subprograms: !29)
引用只是对子程序的一系列引用,正如预期的那样:

!29 = !{!30, !47, !55, !65, !77, !83, !92, !99, !113, !114}
!30 = !DISubprogram(name: "main", linkageName: "_ZN8fizzbuzz4mainE", scope: !32, file: !31, line: 3, type: !33, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, function: void ()* @_ZN4main20hbe8861d85740ed2deaaE, templateParams: !35, variables: !36)

我认为红外代码看起来不错;这可能是Rust使用的LLVM版本与LLVM ir解析代码段使用的版本之间的问题吗?

调试元数据格式最近发生了重大变化


有关更多信息,请参见

此错误记录单来自2015年。我尝试过最新的稳定的rust版本,但这种情况仍然存在,那么这是否意味着rust仍然使用较旧版本的llvm?@LeonardoMarques rust是开源的,因此您可以浏览查看他们的llvm版本。在这种情况下,锈病有一个小的变化,还没有被上游。这项工作以各种形式保存。从2016-05-03年我每晚的Rust build中,
llc
自我识别为LLVM 3.8.0。