Skip to content

Commit 9eda39c

Browse files
committed
NFC: Clean up code duplication in Decl.cpp.
1 parent 83b1b47 commit 9eda39c

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

lib/AST/Decl.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5944,25 +5944,13 @@ EnumCaseDecl *EnumCaseDecl::create(SourceLoc CaseLoc,
59445944
}
59455945

59465946
bool EnumDecl::hasPotentiallyUnavailableCaseValue() const {
5947-
switch (static_cast<AssociatedValueCheck>(Bits.EnumDecl.HasAssociatedValues)) {
5948-
case AssociatedValueCheck::Unchecked:
5949-
this->hasOnlyCasesWithoutAssociatedValues();
5950-
LLVM_FALLTHROUGH;
5951-
default:
5952-
return static_cast<bool>(Bits.EnumDecl.HasAnyUnavailableValues);
5953-
}
5947+
(void)this->hasOnlyCasesWithoutAssociatedValues(); // Prime the cache
5948+
return static_cast<bool>(Bits.EnumDecl.HasAnyUnavailableValues);
59545949
}
59555950

59565951
bool EnumDecl::hasCasesUnavailableDuringLowering() const {
5957-
switch (
5958-
static_cast<AssociatedValueCheck>(Bits.EnumDecl.HasAssociatedValues)) {
5959-
case AssociatedValueCheck::Unchecked:
5960-
this->hasOnlyCasesWithoutAssociatedValues();
5961-
LLVM_FALLTHROUGH;
5962-
default:
5963-
return static_cast<bool>(
5964-
Bits.EnumDecl.HasAnyUnavailableDuringLoweringValues);
5965-
}
5952+
(void)this->hasOnlyCasesWithoutAssociatedValues(); // Prime the cache
5953+
return static_cast<bool>(Bits.EnumDecl.HasAnyUnavailableDuringLoweringValues);
59665954
}
59675955

59685956
bool EnumDecl::hasOnlyCasesWithoutAssociatedValues() const {

0 commit comments

Comments
 (0)