|
3 | 3 | // RUN: %empty-directory(%t)
|
4 | 4 | // RUN: mkdir -p %t/pch %t/pch-dir
|
5 | 5 | // RUN: split-file %s %t
|
| 6 | +// RUN: sed -e "s|TEST_DIR|%/t|g" %t/hmap.json > %t/inner.json |
6 | 7 |
|
7 | 8 | // Check that the pch is output even though it has errors
|
8 |
| -// RUN: %target-swift-frontend -emit-pch -o %t/pch/bridging-header.pch -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/bridging-header.h |
9 |
| -// RUN: %target-swift-frontend -typecheck -verify -import-objc-header %t/pch/bridging-header.pch -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift |
| 9 | +// RUN: %target-swift-frontend -emit-pch -o %t/pch/bridging-header.pch -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/bridging-header.h -Xcc -I%t/inner.hmap |
| 10 | +// RUN: not %target-swift-frontend -typecheck -import-objc-header %t/pch/bridging-header.pch -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift -Xcc -I%t/inner.hmap 2>&1 | %FileCheck %s -check-prefix MISSING_HMAP |
10 | 11 | // RUN: ls %t/pch/*.pch | count 1
|
11 | 12 |
|
12 | 13 | // Same but with implicit PCH instead
|
13 |
| -// RUN: %target-swift-frontend -typecheck -verify -import-objc-header %t/bridging-header.h -pch-output-dir %t/pch-dir -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift |
| 14 | +// RUN: not %target-swift-frontend -typecheck -import-objc-header %t/bridging-header.h -pch-output-dir %t/pch-dir -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift -Xcc -I%t/inner.hmap 2>&1 | %FileCheck %s -check-prefix MISSING_HMAP |
14 | 15 | // RUN: ls %t/pch-dir/*.pch | count 1
|
15 | 16 |
|
16 | 17 | // Second implicit run since we may go down a different path if the PCH already
|
17 | 18 | // exists
|
18 |
| -// RUN: %target-swift-frontend -typecheck -verify -import-objc-header %t/bridging-header.h -pch-output-dir %t/pch-dir -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift |
| 19 | +// RUN: not %target-swift-frontend -typecheck -import-objc-header %t/bridging-header.h -pch-output-dir %t/pch-dir -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift -Xcc -I%t/inner.hmap 2>&1 | %FileCheck %s -check-prefix MISSING_HMAP |
| 20 | +// RUN: ls %t/pch-dir/*.pch | count 1 |
| 21 | + |
| 22 | +// Create the headermap, should now have no errors |
| 23 | +// RUN: %hmaptool write %t/inner.json %t/inner.hmap |
| 24 | +// RUN: %target-swift-frontend -typecheck -verify -import-objc-header %t/bridging-header.h -pch-output-dir %t/pch-dir -Xcc -Xclang -Xcc -fallow-pcm-with-compiler-errors -Xcc -Xclang -Xcc -fmodule-format=raw %t/use.swift -Xcc -I%t/inner.hmap |
19 | 25 | // RUN: ls %t/pch-dir/*.pch | count 1
|
20 | 26 |
|
21 | 27 | //--- bridging-header.h
|
22 |
| -@import DoesNotExist; |
| 28 | +#include "inner.h" |
23 | 29 |
|
24 | 30 | struct SomeTy {
|
25 | 31 | int a;
|
26 | 32 | };
|
27 | 33 |
|
| 34 | +//--- inner/inner.h |
| 35 | +struct InnerTy { |
| 36 | + int b; |
| 37 | +}; |
| 38 | + |
| 39 | +//--- hmap.json |
| 40 | +{ |
| 41 | + "mappings": { |
| 42 | + "inner.h": "TEST_DIR/inner/inner.h" |
| 43 | + } |
| 44 | +} |
| 45 | + |
28 | 46 | //--- use.swift
|
29 |
| -func use(s: SomeTy) {} |
| 47 | +func use(s: SomeTy, s2: InnerTy) {} |
| 48 | +// MISSING_HMAP-NOT: cannot find type 'SomeTy' in scope |
| 49 | +// MISSING_HMAP: cannot find type 'InnerTy' in scope |
| 50 | +// MISSING_HMAP-NOT: cannot find type 'SomeTy' in scope |
0 commit comments