diff options
author | Mike Stump <mrs@apple.com> | 2009-04-29 19:03:13 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-04-29 19:03:13 +0000 |
commit | 19c30c00e5e01e4608a43c7deb504f343f09e46d (patch) | |
tree | 562016df236e451dc15aca58efc9e30c47bf89f2 /lib/Sema/SemaStmt.cpp | |
parent | c887d13b07d72c8e67d1a73a82d3167e866f50e5 (diff) |
Sema and CodeGen support for attributes on blocks. Radar 6441502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 311496c720..e44aeb7557 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -707,6 +707,12 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { Action::OwningStmtResult Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { + if (CurBlock->TheDecl->hasAttr<NoReturnAttr>()) { + Diag(ReturnLoc, diag::err_noreturn_block_has_return_expr) + << getCurFunctionOrMethodDecl()->getDeclName(); + return StmtError(); + } + // If this is the first return we've seen in the block, infer the type of // the block from it. if (CurBlock->ReturnType == 0) { |