[cfe-commits] r167856 - in /cfe/trunk: include/clang/Sema/Scope.h lib/Parse/ParseStmt.cpp

David Blaikie dblaikie at gmail.com
Tue Nov 13 10:51:45 PST 2012


Author: dblaikie
Date: Tue Nov 13 12:51:45 2012
New Revision: 167856

URL: http://llvm.org/viewvc/llvm-project?rev=167856&view=rev
Log:
Simplify function try/catch scope handling.

Based on post-commit review feedback for r167766 by Richard Smith.

Modified:
    cfe/trunk/include/clang/Sema/Scope.h
    cfe/trunk/lib/Parse/ParseStmt.cpp

Modified: cfe/trunk/include/clang/Sema/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Scope.h?rev=167856&r1=167855&r2=167856&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Scope.h (original)
+++ cfe/trunk/include/clang/Sema/Scope.h Tue Nov 13 12:51:45 2012
@@ -84,18 +84,9 @@
     /// 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

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=167856&r1=167855&r2=167856&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Nov 13 12:51:45 2012
@@ -2123,8 +2123,8 @@
   // 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 @@
   // 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.





More information about the cfe-commits mailing list