Skip to content

Commit 3841250

Browse files
authored
Merge pull request swiftlang#30515 from rintaro/sourcekit-modulevalidation-rdar59567281
[SourceKit] Save clang module validation time
2 parents 88b093e + d0d1711 commit 3841250

File tree

21 files changed

+298
-1
lines changed

21 files changed

+298
-1
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import Foo
2+
3+
func test() {
4+
5+
}
6+
7+
// UNSUPPORTED: OS=windows-msvc
8+
9+
// -----------------------------------------------------------------------------
10+
// Test that modifications for frameworks in '-Fsystem' doesn't affect the result.
11+
12+
// RUN: %empty-directory(%t/ModuleCache)
13+
// RUN: %empty-directory(%t/System/Frameworks)
14+
// RUN: cp -R %S/../Inputs/build_session/Frameworks/Foo.framework %t/System/Frameworks/
15+
// RUN: cp -R %S/../Inputs/build_session/Frameworks/FooHelper.framework %t/System/Frameworks/
16+
// RUN: %sourcekitd-test \
17+
// RUN: -shell -- echo '## ONE' == \
18+
// RUN: -req=complete -pos=4:1 %s -- %s -D ONE -Fsystem %t/System/Frameworks -module-cache-path %t/ModuleCache == \
19+
// RUN: -shell -- cp -R %S/../Inputs/build_session/Frameworks_modified/Foo.framework %t/System/Frameworks/ == \
20+
// RUN: -shell -- cp -R %S/../Inputs/build_session/Frameworks_modified/FooHelper.framework %t/System/Frameworks/ == \
21+
// RUN: -shell -- echo '## TWO' == \
22+
// RUN: -req=complete -pos=4:1 %s -- %s -D TWO -Fsystem %t/System/Frameworks -module-cache-path %t/ModuleCache \
23+
// RUN: | tee %t.response | %FileCheck %s --check-prefix=CHECK_SYSTEM
24+
// RUN: sleep 2
25+
// RUN: %sourcekitd-test \
26+
// RUN: -shell -- echo '## THREE' == \
27+
// RUN: -req=complete -pos=4:1 %s -- %s -D TWO -Fsystem %t/System/Frameworks -module-cache-path %t/ModuleCache \
28+
// RUN: | %FileCheck %s --check-prefix=CHECK_SYSTEM_2
29+
30+
// CHECK_SYSTEM-LABEL: ## ONE
31+
// CHECK_SYSTEM-DAG: key.description: "fooFunc(arg: Int32)"
32+
// CHECK_SYSTEM-DAG: key.description: "fooSubFunc(arg: Int32)"
33+
// CHECK_SYSTEM-DAG: key.description: "fooHelperFunc(arg: Int32)"
34+
// CHECK_SYSTEM-DAG: key.description: "fooHelperSubFunc(arg: Int32)"
35+
36+
// CHECK_SYSTEM-LABEL: ## TWO
37+
// CHECK_SYSTEM-DAG: key.description: "fooFunc(arg: Int32)"
38+
// CHECK_SYSTEM-DAG: key.description: "fooSubFunc(arg: Int32)"
39+
// CHECK_SYSTEM-DAG: key.description: "fooHelperFunc(arg: Int32)"
40+
// CHECK_SYSTEM-DAG: key.description: "fooHelperSubFunc(arg: Int32)"
41+
42+
// CHECK_SYSTEM_2-LABEL: ## THREE
43+
// CHECK_SYSTEM_2-NOT: fooFunc(
44+
// CHECK_SYSTEM_2-NOT: fooSubFunc(
45+
// CHECK_SYSTEM_2-NOT: fooHelperFunc(
46+
// CHECK_SYSTEM_2-NOT: fooHelperSubFunc(
47+
// CHECK_SYSTEM_2-DAG: key.description: "fooFunc_mod(arg: Int32)"
48+
// CHECK_SYSTEM_2-DAG: key.description: "fooSubFunc_mod(arg: Int32)"
49+
// CHECK_SYSTEM_2-DAG: key.description: "fooHelperFunc_mod(arg: Int32)"
50+
// CHECK_SYSTEM_2-DAG: key.description: "fooHelperSubFunc_mod(arg: Int32)"
51+
// CHECK_SYSTEM_2-NOT: fooFunc(
52+
// CHECK_SYSTEM_2-NOT: fooSubFunc(
53+
// CHECK_SYSTEM_2-NOT: fooHelperFunc(
54+
// CHECK_SYSTEM_2-NOT: fooHelperSubFunc(
55+
56+
// -----------------------------------------------------------------------------
57+
// Test that modifications for frameworks in '-F' are immidiately propagated
58+
// while modifications for frameworks in '-Fsystem' are not.
59+
60+
// RUN: %empty-directory(%t/ModuleCache)
61+
// RUN: %empty-directory(%t/Frameworks)
62+
// RUN: %empty-directory(%t/System/Frameworks)
63+
// RUN: cp -R %S/../Inputs/build_session/Frameworks/Foo.framework %t/Frameworks/
64+
// RUN: cp -R %S/../Inputs/build_session/Frameworks/FooHelper.framework %t/System/Frameworks/
65+
// RUN: %sourcekitd-test \
66+
// RUN: -shell -- echo '## ONE' == \
67+
// RUN: -req=complete -pos=4:1 %s -- %s -D ONE -F %t/Frameworks -Fsystem %t/System/Frameworks -module-cache-path %t/ModuleCache == \
68+
// RUN: -shell -- cp -R %S/../Inputs/build_session/Frameworks_modified/Foo.framework %t/Frameworks/ == \
69+
// RUN: -shell -- cp -R %S/../Inputs/build_session/Frameworks_modified/FooHelper.framework %t/System/Frameworks/ == \
70+
// RUN: -shell -- echo '## TWO' == \
71+
// RUN: -req=complete -pos=4:1 %s -- %s -D TWO -F %t/Frameworks -Fsystem %t/System/Frameworks -module-cache-path %t/ModuleCache \
72+
// RUN: | %FileCheck %s --check-prefix=CHECK_USER
73+
74+
// CHECK_USER-LABEL: ## ONE
75+
// CHECK_USER-DAG: key.description: "fooFunc(arg: Int32)"
76+
// CHECK_USER-DAG: key.description: "fooSubFunc(arg: Int32)"
77+
// CHECK_USER-DAG: key.description: "fooHelperFunc(arg: Int32)"
78+
// CHECK_USER-DAG: key.description: "fooHelperSubFunc(arg: Int32)"
79+
80+
// CHECK_USER-LABEL: ## TWO
81+
// CHECK_USER-NOT: fooFunc(
82+
// CHECK_USER-NOT: fooSubFunc(
83+
// CHECK_USER-DAG: key.description: "fooFunc_mod(arg: Int32)"
84+
// CHECK_USER-DAG: key.description: "fooSubFunc_mod(arg: Int32)"
85+
// CHECK_USER-DAG: key.description: "fooHelperFunc(arg: Int32)"
86+
// CHECK_USER-DAG: key.description: "fooHelperSubFunc(arg: Int32)"
87+
// CHECK_USER-NOT: fooFunc(
88+
// CHECK_USER-NOT: fooSubFunc(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#if !defined(__FOOSUB_H__)
2+
#define __FOOSUB_H__ 1
3+
4+
int fooSubFunc(int arg);
5+
6+
#endif /* ! __FOOSUB_H__ */
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Foo.h
2+
Copyright (c) 1815, Napoleon Bonaparte. All rights reserved.
3+
*/
4+
#if !defined(__FOO_H__)
5+
#define __FOO_H__ 1
6+
7+
#import <FooSub/FooSub.h>
8+
#import <FooHelper/FooHelper.h>
9+
10+
int fooFunc(int arg);
11+
12+
#endif /* ! __FOO_H__ */
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
framework module Foo {
2+
umbrella header "Foo.h"
3+
export *
4+
framework module FooSub {
5+
umbrella header "FooSub.h"
6+
export *
7+
}
8+
}
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int fooHelperSubFunc(int arg);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#import <FooHelperSub/FooHelperSub.h>
2+
3+
int fooHelperFunc(int arg);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int fooHelperExplicitFunc(int a);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
framework module FooHelper {
2+
umbrella header "FooHelper.h"
3+
4+
framework module FooHelperSub {
5+
umbrella header "FooHelperSub.h"
6+
}
7+
8+
explicit module FooHelperExplicit {
9+
header "FooHelperExplicit.h"
10+
}
11+
}
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#if !defined(__FOOSUB_H__)
2+
#define __FOOSUB_H__ 1
3+
4+
int fooSubFunc_mod(int arg);
5+
6+
#endif /* ! __FOOSUB_H__ */
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Foo.h
2+
Copyright (c) 1815, Napoleon Bonaparte. All rights reserved.
3+
*/
4+
#if !defined(__FOO_H__)
5+
#define __FOO_H__ 1
6+
7+
#import <FooSub/FooSub.h>
8+
#import <FooHelper/FooHelper.h>
9+
10+
int fooFunc_mod(int arg);
11+
12+
#endif /* ! __FOO_H__ */

0 commit comments

Comments
 (0)