@@ -386,15 +386,17 @@ class EmergeLlvmContext(
386386 fn.llvmRef!! .addAttributeToFunction(LlvmFunctionAttribute .UnwindTableAsync )
387387 fn.llvmRef!! .addAttributeToFunction(LlvmFunctionAttribute .NoUnwind ) // emerge doesn't use unwinding as of now
388388
389- val diBuilder = fn.declaredAt.file.diBuilder
390- fn.llvmRef!! .diFunction = diBuilder.createFunction(
391- name = fn.canonicalName.toString(),
392- linkageName = fn.llvmName,
393- fn.declaredAt.lineNumber,
394- diBuilder.createSubroutineType((listOf (coreReturnValueLlvmType) + llvmParameterTypes).mapIndexed { index, paramLlvmType ->
395- paramLlvmType.getDiType(diBuilder)
396- })
397- )
389+ if (! fn.isExternalC) {
390+ val diBuilder = fn.declaredAt.file.diBuilder
391+ fn.llvmRef!! .diFunction = diBuilder.createFunction(
392+ name = fn.canonicalName.toString(),
393+ linkageName = fn.llvmName,
394+ fn.declaredAt.lineNumber,
395+ diBuilder.createSubroutineType((listOf (coreReturnValueLlvmType) + llvmParameterTypes).mapIndexed { index, paramLlvmType ->
396+ paramLlvmType.getDiType(diBuilder)
397+ })
398+ )
399+ }
398400
399401 fn.parameters.zip(llvmParameterTypes).forEachIndexed { index, (param, llvmParamType) ->
400402 val paramLlvmRawValue = Llvm .LLVMGetParam (rawRef, index)
0 commit comments