Skip to content

Commit 5cf6684

Browse files
author
Igor S. Gerasimov
committed
Use FalloffFunctionKind instead FunModes
1 parent b92b4bb commit 5cf6684

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def err_thread_unsupported : Error<
715715

716716
def warn_falloff_nonvoid : Warning<
717717
"non-void "
718-
"%enum_select<FunModes>{%Function{function}|%Block{block}|%Lambda{lambda}|%Coroutine{coroutine}}0"
718+
"%enum_select<FalloffFunctionKind>{%Function{function}|%Block{block}|%Lambda{lambda}|%Coroutine{coroutine}}0"
719719
" does not return a value%select{| in all control paths}1">,
720720
InGroup<ReturnType>;
721721
def err_falloff_nonvoid : Error<

clang/lib/Sema/AnalysisBasedWarnings.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ struct CheckFallThroughDiagnostics {
547547
unsigned diag_FallThrough_HasNoReturn = 0;
548548
unsigned diag_FallThrough_ReturnsNonVoid = 0;
549549
unsigned diag_NeverFallThroughOrReturn = 0;
550-
unsigned FunMode; // TODO: use diag::FunModes
550+
unsigned FunKind; // TODO: use diag::FalloffFunctionKind
551551
SourceLocation FuncLoc;
552552

553553
static CheckFallThroughDiagnostics MakeForFunction(const Decl *Func) {
@@ -570,45 +570,45 @@ struct CheckFallThroughDiagnostics {
570570
if (!isVirtualMethod && !isTemplateInstantiation)
571571
D.diag_NeverFallThroughOrReturn = diag::warn_suggest_noreturn_function;
572572

573-
D.FunMode = diag::FunModes::Function;
573+
D.FunKind = diag::FalloffFunctionKind::Function;
574574
return D;
575575
}
576576

577577
static CheckFallThroughDiagnostics MakeForCoroutine(const Decl *Func) {
578578
CheckFallThroughDiagnostics D;
579579
D.FuncLoc = Func->getLocation();
580580
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
581-
D.FunMode = diag::FunModes::Coroutine;
581+
D.FunKind = diag::FalloffFunctionKind::Coroutine;
582582
return D;
583583
}
584584

585585
static CheckFallThroughDiagnostics MakeForBlock() {
586586
CheckFallThroughDiagnostics D;
587587
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
588588
D.diag_FallThrough_ReturnsNonVoid = diag::err_falloff_nonvoid;
589-
D.FunMode = diag::FunModes::Block;
589+
D.FunKind = diag::FalloffFunctionKind::Block;
590590
return D;
591591
}
592592

593593
static CheckFallThroughDiagnostics MakeForLambda() {
594594
CheckFallThroughDiagnostics D;
595595
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
596596
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
597-
D.FunMode = diag::FunModes::Lambda;
597+
D.FunKind = diag::FalloffFunctionKind::Lambda;
598598
return D;
599599
}
600600

601601
bool checkDiagnostics(DiagnosticsEngine &D, bool ReturnsVoid,
602602
bool HasNoReturn) const {
603-
if (FunMode == diag::FunModes::Function) {
603+
if (FunKind == diag::FalloffFunctionKind::Function) {
604604
return (ReturnsVoid ||
605605
D.isIgnored(diag::warn_falloff_nonvoid, FuncLoc)) &&
606606
(!HasNoReturn ||
607607
D.isIgnored(diag::warn_noreturn_has_return_expr, FuncLoc)) &&
608608
(!ReturnsVoid ||
609609
D.isIgnored(diag::warn_suggest_noreturn_block, FuncLoc));
610610
}
611-
if (FunMode == diag::FunModes::Coroutine) {
611+
if (FunKind == diag::FalloffFunctionKind::Coroutine) {
612612
return (ReturnsVoid ||
613613
D.isIgnored(diag::warn_falloff_nonvoid, FuncLoc)) &&
614614
(!HasNoReturn);
@@ -673,11 +673,11 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
673673
case AlwaysFallThrough:
674674
if (HasNoReturn) {
675675
if (CD.diag_FallThrough_HasNoReturn)
676-
S.Diag(RBrace, CD.diag_FallThrough_HasNoReturn) << CD.FunMode;
676+
S.Diag(RBrace, CD.diag_FallThrough_HasNoReturn) << CD.FunKind;
677677
} else if (!ReturnsVoid && CD.diag_FallThrough_ReturnsNonVoid) {
678678
bool NotInAllControlPaths = FallThroughType == MaybeFallThrough;
679679
S.Diag(RBrace, CD.diag_FallThrough_ReturnsNonVoid)
680-
<< CD.FunMode << NotInAllControlPaths;
680+
<< CD.FunKind << NotInAllControlPaths;
681681
}
682682
break;
683683
case NeverFallThroughOrReturn:

clang/lib/Sema/SemaStmt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,7 +3591,7 @@ StmtResult Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc,
35913591
if (auto *CurBlock = dyn_cast<BlockScopeInfo>(CurCap)) {
35923592
if (CurBlock->FunctionType->castAs<FunctionType>()->getNoReturnAttr()) {
35933593
Diag(ReturnLoc, diag::err_noreturn_has_return_expr)
3594-
<< diag::FunModes::Block;
3594+
<< diag::FalloffFunctionKind::Block;
35953595
return StmtError();
35963596
}
35973597
} else if (auto *CurRegion = dyn_cast<CapturedRegionScopeInfo>(CurCap)) {
@@ -3603,7 +3603,7 @@ StmtResult Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc,
36033603
->castAs<FunctionType>()
36043604
->getNoReturnAttr()) {
36053605
Diag(ReturnLoc, diag::err_noreturn_has_return_expr)
3606-
<< diag::FunModes::Lambda;
3606+
<< diag::FalloffFunctionKind::Lambda;
36073607
return StmtError();
36083608
}
36093609
}

0 commit comments

Comments
 (0)