llvm/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-compare-logical-elements.test

; REQUIRES: x86-registered-target

; Test case 1 - General options

; test.cpp
;  1  using INTPTR = const int *;
;  2  int foo(INTPTR ParamPtr, unsigned ParamUnsigned, bool ParamBool) {
;  3    if (ParamBool) {
;  4      typedef int INTEGER;
;  5      const INTEGER CONSTANT = 7;
;  6      return CONSTANT;
;  7    }
;  8    return ParamUnsigned;
;  9  }

; Compare mode - Logical view.
; The output shows in view form the 'missing (-), added (+)' elements,
; giving more context by swapping the reference and target object files.

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=view \
; RUN:                         --print=symbols,types \
; RUN:                         %p/Inputs/test-dwarf-clang.o \
; RUN:                         %p/Inputs/test-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s

; ONE:      Reference: 'test-dwarf-clang.o'
; ONE-NEXT: Target:    'test-dwarf-gcc.o'
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT:  [000]           {File} 'test-dwarf-clang.o'
; ONE-EMPTY:
; ONE-NEXT:  [001]             {CompileUnit} 'test.cpp'
; ONE-NEXT:  [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
; ONE-NEXT:  [002]     2         {Function} extern not_inlined 'foo' -> 'int'
; ONE-NEXT:  [003]                 {Block}
; ONE-NEXT:  [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
; ONE-NEXT: +[004]     4             {TypeAlias} 'INTEGER' -> 'int'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamBool' -> 'bool'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'
; ONE-NEXT: -[003]     4           {TypeAlias} 'INTEGER' -> 'int'

; Compare mode - Logical elements.
; The output shows in tabular form the 'missing (-), added (+)' elements,
; giving more context by swapping the reference and target object files.

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=list \
; RUN:                         --print=symbols,types,summary \
; RUN:                         %p/Inputs/test-dwarf-clang.o \
; RUN:                         %p/Inputs/test-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s

; TWO:      Reference: 'test-dwarf-clang.o'
; TWO-NEXT: Target:    'test-dwarf-gcc.o'
; TWO-EMPTY:
; TWO-NEXT: (1) Missing Types:
; TWO-NEXT: -[003]     4     {TypeAlias} 'INTEGER' -> 'int'
; TWO-EMPTY:
; TWO-NEXT: (1) Added Types:
; TWO-NEXT: +[004]     4     {TypeAlias} 'INTEGER' -> 'int'
; TWO-EMPTY:
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Element   Expected    Missing      Added
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Scopes           4          0          0
; TWO-NEXT: Symbols          0          0          0
; TWO-NEXT: Types            2          1          1
; TWO-NEXT: Lines            0          0          0
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Total            6          1          1

; Changing the 'Reference' and 'Target' order:

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=list \
; RUN:                         --print=symbols,types,summary \
; RUN:                         %p/Inputs/test-dwarf-gcc.o \
; RUN:                         %p/Inputs/test-dwarf-clang.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=THR %s

; THR:      Reference: 'test-dwarf-gcc.o'
; THR-NEXT: Target:    'test-dwarf-clang.o'
; THR-EMPTY:
; THR-NEXT: (1) Missing Types:
; THR-NEXT: -[004]     4     {TypeAlias} 'INTEGER' -> 'int'
; THR-EMPTY:
; THR-NEXT: (1) Added Types:
; THR-NEXT: +[003]     4     {TypeAlias} 'INTEGER' -> 'int'
; THR-EMPTY:
; THR-NEXT: ----------------------------------------
; THR-NEXT: Element   Expected    Missing      Added
; THR-NEXT: ----------------------------------------
; THR-NEXT: Scopes           4          0          0
; THR-NEXT: Symbols          0          0          0
; THR-NEXT: Types            2          1          1
; THR-NEXT: Lines            0          0          0
; THR-NEXT: ----------------------------------------
; THR-NEXT: Total            6          1          1