diff options
author | Tareq A. Siraj <tareq.a.sriaj@intel.com> | 2013-04-16 19:37:38 +0000 |
---|---|---|
committer | Tareq A. Siraj <tareq.a.sriaj@intel.com> | 2013-04-16 19:37:38 +0000 |
commit | 6afcf8875d4e447645cd7bf3733dd8e2eb8455dc (patch) | |
tree | 492ea5c7e442ea915d1f9feeafc8b24624942d96 /lib/Parse/ParsePragma.cpp | |
parent | 596eea7cc26979c952a0b177d024787a99b299df (diff) |
Sema for Captured Statements
Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic
analysis. Currently captures all variables by reference.
TODO: templates
Author: Ben Langmuir <ben.langmuir@intel.com>
Differential Revision: http://llvm-reviews.chandlerc.com/D433
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179618 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParsePragma.cpp')
-rw-r--r-- | lib/Parse/ParsePragma.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index 038636d108..96328e2fb6 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -15,6 +15,7 @@ #include "clang/Lex/Preprocessor.h" #include "clang/Parse/ParseDiagnostic.h" #include "clang/Parse/Parser.h" +#include "clang/Sema/Scope.h" using namespace clang; /// \brief Handle the annotation token produced for #pragma unused(...) @@ -132,7 +133,21 @@ StmtResult Parser::HandlePragmaCaptured() return StmtError(); } - return StmtEmpty(); + SourceLocation Loc = Tok.getLocation(); + + ParseScope CapturedRegionScope(this, Scope::FnScope | Scope::DeclScope); + Actions.ActOnCapturedRegionStart(Loc, getCurScope(), + sema::CapturedRegionScopeInfo::CR_Default); + + StmtResult R = ParseCompoundStatement(); + CapturedRegionScope.Exit(); + + if (R.isInvalid()) { + Actions.ActOnCapturedRegionError(); + return StmtError(); + } + + return Actions.ActOnCapturedRegionEnd(R.get()); } namespace { |