Workaround clang crash in cinterop tool (KT-34467)
This commit is contained in:
committed by
Ilya Matveev
parent
f50ea1397c
commit
838cccf275
+1
-1
@@ -958,7 +958,7 @@ fun buildNativeIndexImpl(library: NativeLibrary, verbose: Boolean): IndexerResul
|
||||
|
||||
private fun indexDeclarations(nativeIndex: NativeIndexImpl): CompilationWithPCH {
|
||||
withIndex { index ->
|
||||
val translationUnit = nativeIndex.library.parse(
|
||||
val translationUnit = nativeIndex.library.copyWithArgsForPCH().parse(
|
||||
index,
|
||||
options = CXTranslationUnit_DetailedPreprocessingRecord or CXTranslationUnit_ForSerialization
|
||||
)
|
||||
|
||||
+6
-1
@@ -257,6 +257,11 @@ fun Compilation.copy(
|
||||
language = language
|
||||
)
|
||||
|
||||
// Clang-8 crashes when consuming a precompiled header built with -fmodule-map-file argument (see KT-34467).
|
||||
// We ignore this argument when building a pch to workaround this crash.
|
||||
fun Compilation.copyWithArgsForPCH(): Compilation =
|
||||
copy(compilerArgs = compilerArgs.filterNot { it.startsWith("-fmodule-map-file") })
|
||||
|
||||
data class CompilationImpl(
|
||||
override val includes: List<String>,
|
||||
override val additionalPreambleLines: List<String>,
|
||||
@@ -271,7 +276,7 @@ data class CompilationImpl(
|
||||
*/
|
||||
fun Compilation.precompileHeaders(): CompilationWithPCH = withIndex { index ->
|
||||
val options = CXTranslationUnit_ForSerialization
|
||||
val translationUnit = this.parse(index, options)
|
||||
val translationUnit = copyWithArgsForPCH().parse(index, options)
|
||||
try {
|
||||
translationUnit.ensureNoCompileErrors()
|
||||
withPrecompiledHeader(translationUnit)
|
||||
|
||||
Reference in New Issue
Block a user