xref: /llvm-project/llvm/test/tools/llvm-readobj/COFF/codeview-inlining.test (revision dbf520f617440d62ca46f64cdc41159945911902)
1*dbf520f6SGeorgii Rymar; The following two object files were generated using the following command:
2*dbf520f6SGeorgii Rymar;   $ cl /d2Zi+ /Zc:inline /O2 /Z7 /c t.cpp
3*dbf520f6SGeorgii Rymar; The contents of t.cpp follow:
4*dbf520f6SGeorgii Rymar;   static void bar() {
5*dbf520f6SGeorgii Rymar;     __asm nop
6*dbf520f6SGeorgii Rymar;   }
7*dbf520f6SGeorgii Rymar;   static void baz() {
8*dbf520f6SGeorgii Rymar;     __asm nop
9*dbf520f6SGeorgii Rymar;   }
10*dbf520f6SGeorgii Rymar;   static __forceinline void foo() {
11*dbf520f6SGeorgii Rymar;     __asm nop
12*dbf520f6SGeorgii Rymar;   #include "a.h"
13*dbf520f6SGeorgii Rymar;   #include "b.h"
14*dbf520f6SGeorgii Rymar;     __asm nop
15*dbf520f6SGeorgii Rymar;     goto forwards;
16*dbf520f6SGeorgii Rymar;
17*dbf520f6SGeorgii Rymar;   backwards:
18*dbf520f6SGeorgii Rymar;     __asm nop
19*dbf520f6SGeorgii Rymar;     return;
20*dbf520f6SGeorgii Rymar;
21*dbf520f6SGeorgii Rymar;   forwards:
22*dbf520f6SGeorgii Rymar;     __asm rep nop
23*dbf520f6SGeorgii Rymar;     goto backwards;
24*dbf520f6SGeorgii Rymar;   }
25*dbf520f6SGeorgii Rymar;   int main() {
26*dbf520f6SGeorgii Rymar;     bar();
27*dbf520f6SGeorgii Rymar;     baz();
28*dbf520f6SGeorgii Rymar;     foo();
29*dbf520f6SGeorgii Rymar;   }
30*dbf520f6SGeorgii Rymar;
31*dbf520f6SGeorgii Rymar; Both a.h and b.h contain "__asm nop".
32*dbf520f6SGeorgii Rymar
33*dbf520f6SGeorgii RymarRUN: llvm-readobj -S --codeview --section-symbols %p/Inputs/codeview-inlining.obj.coff | FileCheck %s
34*dbf520f6SGeorgii Rymar
35*dbf520f6SGeorgii Rymar; FIXME: If we were more clever, we could turn FileIDs into paths.
36*dbf520f6SGeorgii Rymar
37*dbf520f6SGeorgii Rymar; CHECK:       SubSectionType: InlineeLines (0xF6)
38*dbf520f6SGeorgii Rymar; CHECK-NEXT:  SubSectionSize: 0x3C
39*dbf520f6SGeorgii Rymar; CHECK-NEXT:  InlineeSourceLine {
40*dbf520f6SGeorgii Rymar; CHECK-NEXT:    Inlinee: bar (0x1002)
41*dbf520f6SGeorgii Rymar; CHECK-NEXT:    FileID: d:\src\llvm\build\t.cpp (0x30)
42*dbf520f6SGeorgii Rymar; CHECK-NEXT:    SourceLineNum: 2
43*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFileCount: 0
44*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFiles [
45*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ]
46*dbf520f6SGeorgii Rymar; CHECK-NEXT:  }
47*dbf520f6SGeorgii Rymar; CHECK-NEXT:  InlineeSourceLine {
48*dbf520f6SGeorgii Rymar; CHECK-NEXT:    Inlinee: baz (0x1003)
49*dbf520f6SGeorgii Rymar; CHECK-NEXT:    FileID: d:\src\llvm\build\t.cpp (0x30)
50*dbf520f6SGeorgii Rymar; CHECK-NEXT:    SourceLineNum: 5
51*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFileCount: 0
52*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFiles [
53*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ]
54*dbf520f6SGeorgii Rymar; CHECK-NEXT:  }
55*dbf520f6SGeorgii Rymar;   The 'foo' inline site has extra files due to includes.
56*dbf520f6SGeorgii Rymar; CHECK-NEXT:  InlineeSourceLine {
57*dbf520f6SGeorgii Rymar; CHECK-NEXT:    Inlinee: foo (0x1004)
58*dbf520f6SGeorgii Rymar; CHECK-NEXT:    FileID: d:\src\llvm\build\a.h (0x0)
59*dbf520f6SGeorgii Rymar; CHECK-NEXT:    SourceLineNum: 1
60*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFileCount: 2
61*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ExtraFiles [
62*dbf520f6SGeorgii Rymar; CHECK-NEXT:      FileID: d:\src\llvm\build\b.h (0x18)
63*dbf520f6SGeorgii Rymar; CHECK-NEXT:      FileID: d:\src\llvm\build\t.cpp (0x30)
64*dbf520f6SGeorgii Rymar; CHECK-NEXT:    ]
65*dbf520f6SGeorgii Rymar; CHECK-NEXT:  }
66