@@ -446,20 +446,18 @@ class EvaluateIfConfigCondition :
446
446
Str, SourceLoc (), nullptr ).getValue ();
447
447
auto thisVersion = version::Version::getCurrentCompilerVersion ();
448
448
return thisVersion >= Val;
449
- } else if (KindName == " swift" ) {
449
+ } else if (( KindName == " swift" ) || (KindName == " compiler " ) ) {
450
450
auto PUE = cast<PrefixUnaryExpr>(Arg);
451
451
auto Str = extractExprSource (Ctx.SourceMgr , PUE->getArg ());
452
452
auto Val = version::Version::parseVersionString (
453
453
Str, SourceLoc (), nullptr ).getValue ();
454
- auto thisVersion = Ctx.LangOpts .EffectiveLanguageVersion ;
455
- return thisVersion >= Val;
456
- } else if (KindName == " compiler" ) {
457
- auto PUE = cast<PrefixUnaryExpr>(Arg);
458
- auto Str = extractExprSource (Ctx.SourceMgr , PUE->getArg ());
459
- auto Val = version::Version::parseVersionString (
460
- Str, SourceLoc (), nullptr ).getValue ();
461
- auto thisVersion = version::Version::getCurrentLanguageVersion ();
462
- return thisVersion >= Val;
454
+ if (KindName == " swift" ) {
455
+ return Ctx.LangOpts .EffectiveLanguageVersion >= Val;
456
+ } else if (KindName == " compiler" ) {
457
+ return version::Version::getCurrentLanguageVersion () >= Val;
458
+ } else {
459
+ llvm_unreachable (" unsupported version conditional" );
460
+ }
463
461
} else if (KindName == " canImport" ) {
464
462
auto Str = extractExprSource (Ctx.SourceMgr , Arg);
465
463
return Ctx.canImportModule ({ Ctx.getIdentifier (Str) , E->getLoc () });
0 commit comments