diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp b/gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp index bdbe06c4969..899d3fa83cc 100644 --- a/gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp +++ b/gnu/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp @@ -325,30 +325,27 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, case Stmt::IfStmtClass: { IfStmt *IS = cast<IfStmt>(S); - if (!IS->isConstexpr()) + if (!(IS->isConstexpr() || IS->isObjCAvailabilityCheck())) break; + unsigned Diag = IS->isConstexpr() ? diag::note_protected_by_constexpr_if + : diag::note_protected_by_if_available; + if (VarDecl *Var = IS->getConditionVariable()) BuildScopeInformation(Var, ParentScope); // Cannot jump into the middle of the condition. unsigned NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, - diag::note_protected_by_constexpr_if, 0, - IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); BuildScopeInformation(IS->getCond(), NewParentScope); // Jumps into either arm of an 'if constexpr' are not allowed. NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, - diag::note_protected_by_constexpr_if, 0, - IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); BuildScopeInformation(IS->getThen(), NewParentScope); if (Stmt *Else = IS->getElse()) { NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, - diag::note_protected_by_constexpr_if, 0, - IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); BuildScopeInformation(Else, NewParentScope); } return; @@ -553,10 +550,8 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, // order to avoid blowing out the stack. while (true) { Stmt *Next; - if (CaseStmt *CS = dyn_cast<CaseStmt>(SubStmt)) - Next = CS->getSubStmt(); - else if (DefaultStmt *DS = dyn_cast<DefaultStmt>(SubStmt)) - Next = DS->getSubStmt(); + if (SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt)) + Next = SC->getSubStmt(); else if (LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt)) Next = LS->getSubStmt(); else |
