xref: /aosp_15_r20/external/llvm/test/tools/dsymutil/X86/module-warnings.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# Compile with:
2*9880d681SAndroid Build Coastguard Worker#    cat >modules.modulemap <<EOF
3*9880d681SAndroid Build Coastguard Worker#      module Foo {
4*9880d681SAndroid Build Coastguard Worker#        header "Foo.h"
5*9880d681SAndroid Build Coastguard Worker#        export *
6*9880d681SAndroid Build Coastguard Worker#      }
7*9880d681SAndroid Build Coastguard Worker#      module Bar {
8*9880d681SAndroid Build Coastguard Worker#        header "Bar.h"
9*9880d681SAndroid Build Coastguard Worker#        export *
10*9880d681SAndroid Build Coastguard Worker#      }
11*9880d681SAndroid Build Coastguard Worker# EOF
12*9880d681SAndroid Build Coastguard Worker#    echo 'typedef int bar;' >Bar.h
13*9880d681SAndroid Build Coastguard Worker#    echo '@import Bar; typedef bar foo;' >Foo.h
14*9880d681SAndroid Build Coastguard Worker#    echo '@import Foo; foo f() { return 0; }' >module-warnings.m
15*9880d681SAndroid Build Coastguard Worker#    clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
16*9880d681SAndroid Build Coastguard Worker#      -fmodule-format=obj -debug-info-kind=standalone -dwarf-ext-refs \
17*9880d681SAndroid Build Coastguard Worker#      -fmodules-cache-path=ModuleCache \
18*9880d681SAndroid Build Coastguard Worker#      -fdisable-module-hash module-warnings.m -o 1.o
19*9880d681SAndroid Build Coastguard Worker#
20*9880d681SAndroid Build Coastguard Worker# Test for module-related warnings.
21*9880d681SAndroid Build Coastguard Worker#
22*9880d681SAndroid Build Coastguard Worker# RUN: rm -rf %t.dir && mkdir %t.dir && mkdir %t.dir/ModuleCache
23*9880d681SAndroid Build Coastguard Worker# RUN: cp %p/../Inputs/module-warnings/1.o %t.dir
24*9880d681SAndroid Build Coastguard Worker# RUN: cp %p/../Inputs/module-warnings/Foo.pcm %t.dir/ModuleCache
25*9880d681SAndroid Build Coastguard Worker#
26*9880d681SAndroid Build Coastguard Worker# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y \
27*9880d681SAndroid Build Coastguard Worker# RUN:   %p/dummy-debug-map.map -o %t 2>&1 | FileCheck %s
28*9880d681SAndroid Build Coastguard Worker#
29*9880d681SAndroid Build Coastguard Worker# Module-not-found should be reported only once.
30*9880d681SAndroid Build Coastguard Worker# The exact error message depends on the OS so we don't check for it.
31*9880d681SAndroid Build Coastguard Worker# CHECK:     warning: {{.*}}Bar.pcm:
32*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: warning: {{.*}}Bar.pcm:
33*9880d681SAndroid Build Coastguard Worker#
34*9880d681SAndroid Build Coastguard Worker# RUN: cp %p/../Inputs/module-warnings/libstatic.a %t.dir
35*9880d681SAndroid Build Coastguard Worker# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y %s -o %t 2>&1 | FileCheck %s
36*9880d681SAndroid Build Coastguard Worker# CHECK: rebuild the module cache
37*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: static libraries
38*9880d681SAndroid Build Coastguard Worker#
39*9880d681SAndroid Build Coastguard Worker# RUN: rm -rf %t.dir/ModuleCache
40*9880d681SAndroid Build Coastguard Worker# RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir -y %s -o %t 2>&1 \
41*9880d681SAndroid Build Coastguard Worker# RUN:   | FileCheck %s --check-prefix=STATIC
42*9880d681SAndroid Build Coastguard Worker# STATIC: warning: {{.*}}Bar.pcm:
43*9880d681SAndroid Build Coastguard Worker# STATIC: note: Linking a static library
44*9880d681SAndroid Build Coastguard Worker# STATIC: warning: {{.*}}Foo.pcm:
45*9880d681SAndroid Build Coastguard Worker# STATIC-NOT: note:
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker---
48*9880d681SAndroid Build Coastguard Workertriple:          'x86_64-apple-darwin'
49*9880d681SAndroid Build Coastguard Workerobjects:
50*9880d681SAndroid Build Coastguard Worker  - filename: libstatic.a(1.o)
51*9880d681SAndroid Build Coastguard Worker    symbols:
52*9880d681SAndroid Build Coastguard Worker      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }
53*9880d681SAndroid Build Coastguard Worker...
54