diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-21 16:41:36 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-21 16:41:36 +0000 |
commit | a0fd8652f3302d0f39ed9849b521ee5b76597b0a (patch) | |
tree | b2fd4be9481d12209c0590794585a0fc1469c427 /include/clang | |
parent | c994bb2b800d4aef4c42b5a58f33cb7816dbf7f0 (diff) |
Parser support for C++ try-catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61312 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 2 | ||||
-rw-r--r-- | include/clang/Parse/Action.h | 19 | ||||
-rw-r--r-- | include/clang/Parse/DeclSpec.h | 5 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 16 |
4 files changed, 36 insertions, 6 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index df21d8d30e..510f3ff916 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -605,6 +605,8 @@ DIAG(err_expected_member_or_base_name, ERROR, "expected class member or base class name") DIAG(ext_ellipsis_exception_spec, EXTENSION, "exception specification of '...' is a Microsoft extension") +DIAG(err_expected_catch, ERROR, + "expected catch") /// C++ Templates DIAG(err_expected_template, ERROR, diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 3031206dd6..249f1224c7 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -478,7 +478,24 @@ public: StmtTy *SynchBody) { return 0; } - + + // C++ Statements + virtual DeclTy *ActOnExceptionDeclarator(Scope *S, Declarator &D) { + return 0; + } + + virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, + DeclTy *ExceptionDecl, + StmtArg HandlerBlock) { + return StmtEmpty(); + } + + virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc, + StmtArg TryBlock, + MultiStmtArg Handlers) { + return StmtEmpty(); + } + //===--------------------------------------------------------------------===// // Expression Parsing Callbacks. //===--------------------------------------------------------------------===// diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index 4a97fd60ed..8b2033bfbe 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -646,7 +646,8 @@ public: BlockContext, // Declaration within a block in a function. ForContext, // Declaration within first part of a for loop. ConditionContext, // Condition declaration in a C++ if/switch/while/for. - TemplateParamContext // Within a template parameter list. + TemplateParamContext,// Within a template parameter list. + CXXCatchContext // C++ catch exception-declaration }; /// DeclaratorKind - The kind of declarator this represents. @@ -762,7 +763,7 @@ public: /// parameter lists. bool mayOmitIdentifier() const { return Context == TypeNameContext || Context == PrototypeContext || - Context == TemplateParamContext; + Context == TemplateParamContext || Context == CXXCatchContext; } /// mayHaveIdentifier - Return true if the identifier is either optional or diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index df6eca6432..fb1ebcf36e 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -724,13 +724,23 @@ private: OwningStmtResult ParseReturnStatement(); OwningStmtResult ParseAsmStatement(bool &msAsm); OwningStmtResult FuzzyParseMicrosoftAsmStatement(); + bool ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names, + llvm::SmallVectorImpl<ExprTy*> &Constraints, + llvm::SmallVectorImpl<ExprTy*> &Exprs); + + //===--------------------------------------------------------------------===// + // C++ 6: Statements and Blocks + + OwningStmtResult ParseCXXTryBlock(); + OwningStmtResult ParseCXXCatchBlock(); + + //===--------------------------------------------------------------------===// + // Objective-C Statements + OwningStmtResult ParseObjCAtStatement(SourceLocation atLoc); OwningStmtResult ParseObjCTryStmt(SourceLocation atLoc); OwningStmtResult ParseObjCThrowStmt(SourceLocation atLoc); OwningStmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc); - bool ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names, - llvm::SmallVectorImpl<ExprTy*> &Constraints, - llvm::SmallVectorImpl<ExprTy*> &Exprs); //===--------------------------------------------------------------------===// |