diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/AST/Decl.h | 11 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclBase.h | 17 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 6 | ||||
-rw-r--r-- | clang/include/clang/Basic/DiagnosticParseKinds.td | 1 | ||||
-rw-r--r-- | clang/include/clang/Parse/Parser.h | 4 |
5 files changed, 24 insertions, 15 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 0e396c27b23..da3459a0166 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -554,17 +554,16 @@ public: /// function. The variant that accepts a FunctionDecl pointer will /// set that function declaration to the actual declaration /// containing the body (if there is one). - CompoundStmt *getBody(ASTContext &Context, - const FunctionDecl *&Definition) const; + Stmt *getBody(ASTContext &Context, const FunctionDecl *&Definition) const; - virtual CompoundStmt *getBody(ASTContext &Context) const { + virtual Stmt *getBody(ASTContext &Context) const { const FunctionDecl* Definition; return getBody(Context, Definition); } /// \brief If the function has a body that is immediately available, /// return it. - CompoundStmt *getBodyIfAvailable() const; + Stmt *getBodyIfAvailable() const; /// isThisDeclarationADefinition - Returns whether this specific /// declaration of the function is also a definition. This does not @@ -574,7 +573,7 @@ public: /// CodeGenModule.cpp uses it, and I don't know if this would break it. bool isThisDeclarationADefinition() const { return Body; } - void setBody(CompoundStmt *B) { Body = (Stmt*) B; } + void setBody(Stmt *B) { Body = B; } void setLazyBody(uint64_t Offset) { Body = Offset; } /// Whether this function is virtual, either by explicit marking, or by @@ -1148,7 +1147,7 @@ public: SourceLocation getCaretLocation() const { return getLocation(); } CompoundStmt *getBody() const { return (CompoundStmt*) Body; } - CompoundStmt *getBody(ASTContext &C) const { return (CompoundStmt*) Body; } + Stmt *getBody(ASTContext &C) const { return (Stmt*) Body; } void setBody(CompoundStmt *B) { Body = (Stmt*) B; } // Iterator access to formal parameters. diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index f9bb7a44506..7d88cf228fc 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -281,11 +281,18 @@ public: // be defined inside or outside a function etc). bool isDefinedOutsideFunctionOrMethod() const; - // getBody - If this Decl represents a declaration for a body of code, - // such as a function or method definition, this method returns the top-level - // Stmt* of that body. Otherwise this method returns null. - virtual CompoundStmt* getBody(ASTContext &Context) const { return 0; } - + /// getBody - If this Decl represents a declaration for a body of code, + /// such as a function or method definition, this method returns the + /// top-level Stmt* of that body. Otherwise this method returns null. + virtual Stmt* getBody(ASTContext &Context) const { return 0; } + + /// getCompoundBody - Returns getBody(), dyn_casted to a CompoundStmt. + CompoundStmt* getCompoundBody(ASTContext &Context) const; + + /// getBodyRBrace - Gets the right brace of the body, if a body exists. + /// This works whether the body is a CompoundStmt or a CXXTryStmt. + SourceLocation getBodyRBrace(ASTContext &Context) const; + // global temp stats (until we have a per-module visitor) static void addDeclKind(Kind k); static bool CollectingStats(bool Enable = false); diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 989fdab597f..e8c554b67bc 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -242,11 +242,11 @@ public: return ImplementationControl(DeclImplementation); } - virtual CompoundStmt *getBody(ASTContext &C) const { - return (CompoundStmt*) Body; + virtual Stmt *getBody(ASTContext &C) const { + return (Stmt*) Body; } CompoundStmt *getBody() { return (CompoundStmt*)Body; } - void setBody(CompoundStmt *B) { Body = (Stmt*) B; } + void setBody(Stmt *B) { Body = B; } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return D->getKind() == ObjCMethod; } diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index e5d7a1d1bdd..9481ce53171 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -205,6 +205,7 @@ def err_expected_member_or_base_name : Error< def ext_ellipsis_exception_spec : Extension< "exception specification of '...' is a Microsoft extension">; def err_expected_catch : Error<"expected catch">; +def err_expected_lbrace_or_comma : Error<"expected '{' or ','">; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index dcf4c5affb4..fdb2327d4b3 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -795,6 +795,7 @@ private: // C++ 6: Statements and Blocks OwningStmtResult ParseCXXTryBlock(); + OwningStmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc); OwningStmtResult ParseCXXCatchBlock(); //===--------------------------------------------------------------------===// @@ -815,7 +816,8 @@ private: bool RequireSemi = true); DeclGroupPtrTy ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D); DeclPtrTy ParseFunctionStatementBody(DeclPtrTy Decl); - + DeclPtrTy ParseFunctionTryBlock(DeclPtrTy Decl); + bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, TemplateParameterLists *TemplateParams, AccessSpecifier AS); |