@@ -88,6 +88,17 @@ class ModuleCacheTest : public ::testing::Test {
88
88
}
89
89
)cpp" );
90
90
}
91
+
92
+ std::unique_ptr<CompilerInvocation>
93
+ createInvocationAndEnableFree (ArrayRef<const char *> Args,
94
+ CreateInvocationOptions Opts) {
95
+ std::unique_ptr<CompilerInvocation> Invocation =
96
+ createInvocation (Args, Opts);
97
+ if (Invocation)
98
+ Invocation->getFrontendOpts ().DisableFree = false ;
99
+
100
+ return Invocation;
101
+ }
91
102
};
92
103
93
104
TEST_F (ModuleCacheTest, CachedModuleNewPath) {
@@ -106,7 +117,7 @@ TEST_F(ModuleCacheTest, CachedModuleNewPath) {
106
117
MCPArg.c_str (), " -working-directory" , TestDir.c_str (),
107
118
" test.m" };
108
119
std::shared_ptr<CompilerInvocation> Invocation =
109
- createInvocation (Args, CIOpts);
120
+ createInvocationAndEnableFree (Args, CIOpts);
110
121
ASSERT_TRUE (Invocation);
111
122
CompilerInstance Instance;
112
123
Instance.setDiagnostics (Diags.get ());
@@ -129,7 +140,7 @@ TEST_F(ModuleCacheTest, CachedModuleNewPath) {
129
140
" -Fframeworks" , MCPArg.c_str (), " -working-directory" ,
130
141
TestDir.c_str (), " test.m" };
131
142
std::shared_ptr<CompilerInvocation> Invocation2 =
132
- createInvocation (Args2, CIOpts);
143
+ createInvocationAndEnableFree (Args2, CIOpts);
133
144
ASSERT_TRUE (Invocation2);
134
145
CompilerInstance Instance2 (Instance.getPCHContainerOperations (),
135
146
&Instance.getModuleCache ());
@@ -156,7 +167,7 @@ TEST_F(ModuleCacheTest, CachedModuleNewPathAllowErrors) {
156
167
MCPArg.c_str (), " -working-directory" , TestDir.c_str (),
157
168
" test.m" };
158
169
std::shared_ptr<CompilerInvocation> Invocation =
159
- createInvocation (Args, CIOpts);
170
+ createInvocationAndEnableFree (Args, CIOpts);
160
171
ASSERT_TRUE (Invocation);
161
172
CompilerInstance Instance;
162
173
Instance.setDiagnostics (Diags.get ());
@@ -173,7 +184,7 @@ TEST_F(ModuleCacheTest, CachedModuleNewPathAllowErrors) {
173
184
TestDir.c_str (), " -Xclang" , " -fallow-pcm-with-compiler-errors" ,
174
185
" test.m" };
175
186
std::shared_ptr<CompilerInvocation> Invocation2 =
176
- createInvocation (Args2, CIOpts);
187
+ createInvocationAndEnableFree (Args2, CIOpts);
177
188
ASSERT_TRUE (Invocation2);
178
189
CompilerInstance Instance2 (Instance.getPCHContainerOperations (),
179
190
&Instance.getModuleCache ());
0 commit comments