@@ -315,6 +315,8 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
315
315
const llvm::Triple &triple = ctx.LangOpts .Target ;
316
316
SearchPathOptions &searchPathOpts = ctx.SearchPathOpts ;
317
317
318
+ auto languageVersion = swift::version::Version::getCurrentLanguageVersion ();
319
+
318
320
// Construct the invocation arguments for the current target.
319
321
// Add target-independent options first.
320
322
invocationArgStrs.insert (
@@ -332,9 +334,11 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
332
334
// Don't emit LLVM IR.
333
335
" -fsyntax-only" ,
334
336
335
- // enable block support
337
+ // Enable block support.
336
338
" -fblocks" ,
337
339
340
+ languageVersion.preprocessorDefinition (" __swift__" , {10000 , 100 , 1 }),
341
+
338
342
" -fretain-comments-from-system-headers" ,
339
343
340
344
SHIMS_INCLUDE_FLAG, searchPathOpts.RuntimeResourcePath ,
@@ -396,7 +400,8 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
396
400
auto V = version::Version::getCurrentCompilerVersion ();
397
401
if (!V.empty ()) {
398
402
invocationArgStrs.insert (invocationArgStrs.end (), {
399
- V.preprocessorDefinition (),
403
+ V.preprocessorDefinition (" __SWIFT_COMPILER_VERSION" ,
404
+ {1000000000 , /* ignored*/ 0 , 1000000 , 1000 , 1 }),
400
405
});
401
406
}
402
407
} else {
0 commit comments