Skip to content

Commit ab6c3eb

Browse files
committed
Only functions that never return on *any* path (throw or call noreturn):
1 parent 21f0d36 commit ab6c3eb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,15 +1971,8 @@ static bool isKnownToAlwaysThrowCFG(const FunctionDecl *FD, Sema &S) {
19711971
FunctionDecl *NonConstFD = const_cast<FunctionDecl *>(FD);
19721972
AnalysisDeclContext AC(nullptr, NonConstFD);
19731973

1974-
switch (CheckFallThrough(AC)) {
1975-
case NeverFallThrough:
1976-
case NeverFallThroughOrReturn:
1977-
return true;
1978-
case AlwaysFallThrough:
1979-
case UnknownFallThrough:
1980-
case MaybeFallThrough:
1981-
return false;
1982-
}
1974+
auto FT = CheckFallThrough(AC);
1975+
return FT == NeverFallThroughOrReturn;
19831976
}
19841977

19851978
bool clang::inferNoReturnAttr(Sema &S, const Decl *D, bool FirstPass) {

0 commit comments

Comments
 (0)