Add workaround for unexpected libclang behaviour

`clang_tokenize(tu, clang_getCursorExtent(cursor), ...)` doesn't seem
to work properly when cursor points to expanded macro:
the result includes too many tokens
This commit is contained in:
Svyatoslav Scherbina
2018-09-20 12:57:57 +03:00
committed by SvyatoslavScherbina
parent 30fd4060d3
commit 9dfd347ef2
4 changed files with 88 additions and 28 deletions
+10
View File
@@ -2733,6 +2733,10 @@ kotlinNativeInterop {
defFile 'interop/basics/cmacros.def'
}
cunsupported {
defFile 'interop/basics/cunsupported.def'
}
if (isMac()) {
objcSmoke {
defFile 'interop/objc/objcSmoke.def'
@@ -2820,6 +2824,12 @@ task interop_macros(type: RunInteropKonanTest) {
interop = 'cmacros'
}
task interop_unsupported(type: RunInteropKonanTest) {
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
source = "interop/basics/unsupported.kt"
interop = 'cunsupported'
}
task interop_echo_server(type: RunInteropKonanTest) {
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
if (!isMac()) {
@@ -0,0 +1,27 @@
compilerOpts = -mno-xsave
---
static void noAttr() {}
__attribute__((always_inline)) noTargetAttr() {}
__attribute__((always_inline, __target__("xsave"))) void plainAttrs1() {}
__attribute__((__target__("xsave"), always_inline)) void plainAttrs2() {}
#define TARGET __target__
__attribute__((always_inline, TARGET("xsave"))) void macroAttr1() {}
__attribute__((TARGET("xsave"), always_inline)) void macroAttr2() {}
#define TARGET_ATTR __target__("xsave")
__attribute__((TARGET_ATTR, always_inline)) void macroAttr3() {}
__attribute__((always_inline, TARGET_ATTR)) void macroAttr4() {}
#define ALL_ATTRS1 __attribute__((always_inline, __target__("xsave")))
ALL_ATTRS1 void macroAttr5() {}
#define ALL_ATTRS2 __attribute__((always_inline, __target__("xsave")))
ALL_ATTRS2 void macroAttr6() {}
@@ -0,0 +1,12 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
import kotlin.test.*
import cunsupported.*
fun main(args: Array<String>) {
noAttr()
noTargetAttr()
}