forked from OSchip/llvm-project
Avoid snowballing errors into additional warnings. To do better, we'd
need an error term for the CFG. I suspect we'll always have to cope with getCFG returning 0, though, I'd love to see even that possibility removed. llvm-svn: 93411
This commit is contained in:
parent
37463a7a58
commit
29ce3a3114
|
@ -1329,11 +1329,14 @@ static void MarkLive(CFGBlock *e, llvm::BitVector &live) {
|
|||
|
||||
/// CheckUnreachable - Check for unreachable code.
|
||||
void Sema::CheckUnreachable(AnalysisContext &AC) {
|
||||
// We avoid checking when there are errors, as the CFG won't faithfully match
|
||||
// the users code.
|
||||
if (getDiagnostics().hasErrorOccurred())
|
||||
return;
|
||||
if (Diags.getDiagnosticLevel(diag::warn_unreachable) == Diagnostic::Ignored)
|
||||
return;
|
||||
|
||||
CFG *cfg = AC.getCFG();
|
||||
// FIXME: They should never return 0, fix that, delete this code.
|
||||
if (cfg == 0)
|
||||
return;
|
||||
|
||||
|
@ -1363,7 +1366,6 @@ void Sema::CheckUnreachable(AnalysisContext &AC) {
|
|||
/// will return.
|
||||
Sema::ControlFlowKind Sema::CheckFallThrough(AnalysisContext &AC) {
|
||||
CFG *cfg = AC.getCFG();
|
||||
// FIXME: They should never return 0, fix that, delete this code.
|
||||
if (cfg == 0)
|
||||
// FIXME: This should be NeverFallThrough
|
||||
return NeverFallThroughOrReturn;
|
||||
|
|
Loading…
Reference in New Issue