Generate C interop adapters for functions defined in headers
This commit is contained in:
committed by
SvyatoslavScherbina
parent
edd8489f6b
commit
49f1873efd
+4
-1
@@ -266,7 +266,10 @@ internal class NativeIndexImpl(val language: Language) : NativeIndex() {
|
|||||||
Language.C -> clang_Cursor_getMangling(cursor).convertAndDispose()
|
Language.C -> clang_Cursor_getMangling(cursor).convertAndDispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
functionByName[name] = FunctionDecl(name, args, returnType, binaryName)
|
val definitionCursor = clang_getCursorDefinition(cursor)
|
||||||
|
val isDefined = (clang_Cursor_isNull(definitionCursor) == 0)
|
||||||
|
|
||||||
|
functionByName[name] = FunctionDecl(name, args, returnType, binaryName, isDefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
CXIdxEntity_Enum -> {
|
CXIdxEntity_Enum -> {
|
||||||
|
|||||||
+2
-1
@@ -69,7 +69,8 @@ class Parameter(val name: String?, val type: Type)
|
|||||||
/**
|
/**
|
||||||
* C function declaration.
|
* C function declaration.
|
||||||
*/
|
*/
|
||||||
class FunctionDecl(val name: String, val parameters: List<Parameter>, val returnType: Type, val binaryName: String)
|
class FunctionDecl(val name: String, val parameters: List<Parameter>, val returnType: Type, val binaryName: String,
|
||||||
|
val isDefined: Boolean)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C typedef definition.
|
* C typedef definition.
|
||||||
|
|||||||
+2
-1
@@ -909,7 +909,8 @@ class StubGenerator(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.returnsRecord() ||
|
return this.isDefined ||
|
||||||
|
this.returnsRecord() ||
|
||||||
this.parameters.map { it.type }.any { it.unwrapTypedefs() is RecordType }
|
this.parameters.map { it.type }.any { it.unwrapTypedefs() is RecordType }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user