Skip to content

Commit 1a6f86b

Browse files
committed
Parse: Use InInactiveClauseEnvironment instead of looking at the Scope
We have two ways of knowing if we're inside of an inactive #if clause. Refactor the only two places that called getScopeInfo().isInactiveConfigBlock() to check InInactiveClauseEnvironment instead. This removes the last remaining usage of Scope that's not related to parse-time name lookup.
1 parent a0dccc5 commit 1a6f86b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3813,7 +3813,7 @@ void Parser::setLocalDiscriminator(ValueDecl *D) {
38133813
return;
38143814

38153815
if (auto TD = dyn_cast<TypeDecl>(D))
3816-
if (!getScopeInfo().isInactiveConfigBlock())
3816+
if (!InInactiveClauseEnvironment)
38173817
SF.LocalTypeDecls.insert(TD);
38183818

38193819
const Identifier name = D->getBaseIdentifier();

lib/Parse/ParseIfConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ ParserResult<IfConfigDecl> Parser::parseIfConfig(
635635
// Don't evaluate if it's in '-parse' mode, etc.
636636
shouldEvaluatePoundIfDecls() &&
637637
// If it's in inactive #if ... #endif block, there's no point to do it.
638-
!getScopeInfo().isInactiveConfigBlock() &&
638+
!InInactiveClauseEnvironment &&
639639
// If this directive contains code completion location, 'isActive' is
640640
// determined solely by which block has the completion token.
641641
!codeCompletionClauseLoc.isValid();

0 commit comments

Comments
 (0)