Skip to content

Commit 95f213f

Browse files
authored
[clang] Add unreachable after fully covered switches, avoid GCC warnings. NFC. (#159330)
This avoids the following warnings: ../../clang/lib/AST/ExprConstant.cpp: In member function ‘bool {anonymous}::IntExprEvaluator::VisitBuiltinCallExpr(const clang::CallExpr*, unsigned int)’: ../../clang/lib/AST/ExprConstant.cpp:14104:3: warning: this statement may fall through [-Wimplicit-fallthrough=] 14104 | } | ^ ../../clang/lib/AST/ExprConstant.cpp:14105:3: note: here 14105 | case Builtin::BIstrlen: | ^~~~ ../../clang/lib/Driver/ToolChains/CommonArgs.cpp: In function ‘std::string clang::driver::tools::complexRangeKindToStr(clang::LangOptionsBase::ComplexRangeKind ’: ../../clang/lib/Driver/ToolChains/CommonArgs.cpp:3523:1: warning: control reaches end of non-void function [-Wreturn-type] 3523 | } | ^
1 parent 1c5fcb1 commit 95f213f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14102,6 +14102,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1410214102
return Success(Result, E);
1410314103
}
1410414104
}
14105+
llvm_unreachable("Fully covered switch above");
1410514106
}
1410614107
case Builtin::BIstrlen:
1410714108
case Builtin::BIwcslen:

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3520,6 +3520,7 @@ std::string tools::complexRangeKindToStr(LangOptions::ComplexRangeKind Range) {
35203520
return "none";
35213521
break;
35223522
}
3523+
llvm_unreachable("Fully covered switch above");
35233524
}
35243525

35253526
std::string

0 commit comments

Comments
 (0)