From 3403feb1d0d32e956e3045dfd5072a3d1d9adb88 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 13 Nov 2012 18:51:45 +0000 Subject: [PATCH] Simplify function try/catch scope handling. Based on post-commit review feedback for r167766 by Richard Smith. llvm-svn: 167856 --- clang/include/clang/Sema/Scope.h | 11 +---------- clang/lib/Parse/ParseStmt.cpp | 6 +++--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/clang/include/clang/Sema/Scope.h b/clang/include/clang/Sema/Scope.h index 1329f97..855485d 100644 --- a/clang/include/clang/Sema/Scope.h +++ b/clang/include/clang/Sema/Scope.h @@ -84,18 +84,9 @@ public: /// TryScope - This is the scope of a C++ try statement. TryScope = 0x1000, - /// CatchScope - This is the scope of a C++ catch statement. - CatchScope = 0x2000, - /// FnTryCatchScope - This is the scope for a function-level C++ try or /// catch scope. - FnTryCatchScope = 0x4000, - - /// FnTryScope - This is the scope of a function-level C++ try scope. - FnTryScope = TryScope | FnTryCatchScope, - - /// FnCatchScope - This is the scope of a function-level C++ catch scope. - FnCatchScope = CatchScope | FnTryCatchScope + FnTryCatchScope = 0x2000 }; private: /// The parent scope for this scope. This is null for the translation-unit diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 5883115..a4e0c98 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -2123,8 +2123,8 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc, bool FnTry) { // FIXME: Possible draft standard bug: attribute-specifier should be allowed? StmtResult TryBlock(ParseCompoundStatement(/*isStmtExpr=*/false, - Scope::DeclScope | - (FnTry ? Scope::FnTryScope : Scope::TryScope))); + Scope::DeclScope | Scope::TryScope | + (FnTry ? Scope::FnTryCatchScope : 0))); if (TryBlock.isInvalid()) return TryBlock; @@ -2197,7 +2197,7 @@ StmtResult Parser::ParseCXXCatchBlock(bool FnCatch) { // The name in a catch exception-declaration is local to the handler and // shall not be redeclared in the outermost block of the handler. ParseScope CatchScope(this, Scope::DeclScope | Scope::ControlScope | - (FnCatch ? Scope::FnCatchScope : Scope::CatchScope)); + (FnCatch ? Scope::FnTryCatchScope : 0)); // exception-declaration is equivalent to '...' or a parameter-declaration // without default arguments. -- 2.7.4