Debian Codegraph @

internal/refactor/inline/testdata/cgo.txtar

raw
1 Test that attempts to inline with caller or callee in a cgo-generated
2 file are rejected. (This is just a special case of rejecting generated files.)
3
4 -- go.mod --
5 module testdata
6 go 1.12
7
8 -- a/a.go --
9 package a
10
11 /*
12 static void f() {}
13 */
14 import "C"
15
16 func a() {
17 C.f() //@ inline(re"f", re"cannot inline cgo-generated functions")
18 g() //@ inline(re"g", re`cannot inline calls from generated files`)
19 }
20
21 func g() {
22 println()
23 }
24
25 -- a/a2.go --
26 package a
27
28 func b() {
29 a() //@ inline(re"a", re"cannot inline cgo-generated functions")
30 }
31
32 func c() {
33 b() //@ inline(re"b", result)
34 }
35
36 -- result --
37 package a
38
39 func b() {
40 a() //@ inline(re"a", re"cannot inline cgo-generated functions")
41 }
42
43 func c() {
44 a() //@ inline(re"b", result)
45 }