r213971 - Revert r213437
Warren Hunt
whunt at google.com
Fri Jul 25 13:52:52 PDT 2014
Author: whunt
Date: Fri Jul 25 15:52:51 2014
New Revision: 213971
URL: http://llvm.org/viewvc/llvm-project?rev=213971&view=rev
Log:
Revert r213437
We no longer plan to use __except_hander3 and rather use custom
personality functions per __try block.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/Sema/Scope.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Stmt.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/Scope.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Fri Jul 25 15:52:51 2014
@@ -1892,24 +1892,22 @@ class SEHTryStmt : public Stmt {
bool IsCXXTry;
SourceLocation TryLoc;
Stmt *Children[2];
- int HandlerIndex;
- int HandlerParentIndex;
enum { TRY = 0, HANDLER = 1 };
SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try'
- SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler,
- int HandlerIndex, int HandlerParentIndex);
+ SourceLocation TryLoc,
+ Stmt *TryBlock,
+ Stmt *Handler);
friend class ASTReader;
friend class ASTStmtReader;
explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) { }
public:
- static SEHTryStmt *Create(const ASTContext &C, bool isCXXTry,
+ static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
SourceLocation TryLoc, Stmt *TryBlock,
- Stmt *Handler, int HandlerIndex,
- int HandlerParentIndex);
+ Stmt *Handler);
SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
@@ -1936,9 +1934,6 @@ public:
static bool classof(const Stmt *T) {
return T->getStmtClass() == SEHTryStmtClass;
}
-
- int getHandlerIndex() const { return HandlerIndex; }
- int getHandlerParentIndex() const { return HandlerParentIndex; }
};
/// Represents a __leave statement.
Modified: cfe/trunk/include/clang/Sema/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Scope.h?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Scope.h (original)
+++ cfe/trunk/include/clang/Sema/Scope.h Fri Jul 25 15:52:51 2014
@@ -135,14 +135,6 @@ private:
/// scopes seen as a component.
unsigned short MSLocalManglingNumber;
- /// \brief SEH __try blocks get uniquely numbered within a function. This
- /// variable holds the index for an SEH try block.
- short SEHTryIndex;
-
- /// \brief SEH __try blocks get uniquely numbered within a function. This
- /// variable holds the next free index at a function's scope.
- short SEHTryIndexPool;
-
/// PrototypeDepth - This is the number of function prototype scopes
/// enclosing this scope, including this scope.
unsigned short PrototypeDepth;
@@ -155,7 +147,6 @@ private:
/// pointer is non-null and points to it. This is used for label processing.
Scope *FnParent;
Scope *MSLocalManglingParent;
- Scope *SEHTryParent;
/// BreakParent/ContinueParent - This is a direct link to the innermost
/// BreakScope/ContinueScope which contains the contents of this scope
@@ -294,14 +285,6 @@ public:
return 1;
}
- int getSEHTryIndex() {
- return SEHTryIndex;
- }
-
- int getSEHTryParentIndex() const {
- return SEHTryParent ? SEHTryParent->SEHTryIndex : -1;
- }
-
/// isDeclScope - Return true if this is the scope that the specified decl is
/// declared in.
bool isDeclScope(Decl *D) {
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Jul 25 15:52:51 2014
@@ -3169,9 +3169,9 @@ public:
StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
SourceLocation TryLoc, Stmt *TryBlock,
- Stmt *Handler, int HandlerIndex,
- int HandlerParentIndex);
- StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr,
+ Stmt *Handler);
+ StmtResult ActOnSEHExceptBlock(SourceLocation Loc,
+ Expr *FilterExpr,
Stmt *Block);
StmtResult ActOnSEHFinallyBlock(SourceLocation Loc, Stmt *Block);
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope);
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Fri Jul 25 15:52:51 2014
@@ -956,20 +956,22 @@ Expr* ReturnStmt::getRetValue() {
return cast_or_null<Expr>(RetExpr);
}
-SEHTryStmt::SEHTryStmt(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock,
- Stmt *Handler, int HandlerIndex, int HandlerParentIndex)
- : Stmt(SEHTryStmtClass), IsCXXTry(IsCXXTry), TryLoc(TryLoc),
- HandlerIndex(HandlerIndex), HandlerParentIndex(HandlerParentIndex) {
- Children[TRY] = TryBlock;
+SEHTryStmt::SEHTryStmt(bool IsCXXTry,
+ SourceLocation TryLoc,
+ Stmt *TryBlock,
+ Stmt *Handler)
+ : Stmt(SEHTryStmtClass),
+ IsCXXTry(IsCXXTry),
+ TryLoc(TryLoc)
+{
+ Children[TRY] = TryBlock;
Children[HANDLER] = Handler;
}
-SEHTryStmt *SEHTryStmt::Create(const ASTContext &C, bool IsCXXTry,
+SEHTryStmt* SEHTryStmt::Create(const ASTContext &C, bool IsCXXTry,
SourceLocation TryLoc, Stmt *TryBlock,
- Stmt *Handler, int HandlerIndex,
- int HandlerParentIndex) {
- return new (C) SEHTryStmt(IsCXXTry, TryLoc, TryBlock, Handler, HandlerIndex,
- HandlerParentIndex);
+ Stmt *Handler) {
+ return new(C) SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
}
SEHExceptStmt* SEHTryStmt::getExceptHandler() const {
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Jul 25 15:52:51 2014
@@ -424,27 +424,11 @@ StmtResult Parser::ParseSEHTryBlock() {
/// seh-finally-block
///
StmtResult Parser::ParseSEHTryBlockCommon(SourceLocation TryLoc) {
- if (Tok.isNot(tok::l_brace))
+ if(Tok.isNot(tok::l_brace))
return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
- int SEHTryIndex, SEHTryParentIndex;
- StmtResult TryBlock;
- {
- assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
-
- // Enter a scope to hold everything within the compound stmt. Compound
- // statements can always hold declarations.
- ParseScope CompoundScope(this, Scope::DeclScope | Scope::SEHTryScope);
- SEHTryIndex = getCurScope()->getSEHTryIndex();
- SEHTryParentIndex = getCurScope()->getSEHTryParentIndex();
-
- // Parse the statements in the body.
- TryBlock = ParseCompoundStatementBody();
- }
-
- //StmtResult TryBlock(ParseCompoundStatement(/*isStmtExpr=*/false,
- // Scope::DeclScope | Scope::SEHTryScope));
-
+ StmtResult TryBlock(ParseCompoundStatement(/*isStmtExpr=*/false,
+ Scope::DeclScope | Scope::SEHTryScope));
if(TryBlock.isInvalid())
return TryBlock;
@@ -466,9 +450,7 @@ StmtResult Parser::ParseSEHTryBlockCommo
return Actions.ActOnSEHTryBlock(false /* IsCXXTry */,
TryLoc,
TryBlock.get(),
- Handler.get(),
- SEHTryIndex,
- SEHTryParentIndex);
+ Handler.get());
}
/// ParseSEHExceptBlock - Handle __except
@@ -1977,21 +1959,9 @@ StmtResult Parser::ParseCXXTryBlockCommo
return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
// FIXME: Possible draft standard bug: attribute-specifier should be allowed?
- int SEHTryIndex, SEHTryParentIndex;
- StmtResult TryBlock;
- {
- assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
-
- // Enter a scope to hold everything within the compound stmt. Compound
- // statements can always hold declarations.
- ParseScope CompoundScope(this, Scope::DeclScope | Scope::TryScope |
- (FnTry ? Scope::FnTryCatchScope : 0));
- SEHTryIndex = getCurScope()->getSEHTryIndex();
- SEHTryParentIndex = getCurScope()->getSEHTryParentIndex();
-
- // Parse the statements in the body.
- TryBlock = ParseCompoundStatementBody();
- }
+ StmtResult TryBlock(ParseCompoundStatement(/*isStmtExpr=*/false,
+ Scope::DeclScope | Scope::TryScope |
+ (FnTry ? Scope::FnTryCatchScope : 0)));
if (TryBlock.isInvalid())
return TryBlock;
@@ -2016,9 +1986,7 @@ StmtResult Parser::ParseCXXTryBlockCommo
return Actions.ActOnSEHTryBlock(true /* IsCXXTry */,
TryLoc,
TryBlock.get(),
- Handler.get(),
- SEHTryIndex,
- SEHTryParentIndex);
+ Handler.get());
}
else {
StmtVector Handlers;
Modified: cfe/trunk/lib/Sema/Scope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Scope.cpp?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Scope.cpp (original)
+++ cfe/trunk/lib/Sema/Scope.cpp Fri Jul 25 15:52:51 2014
@@ -39,9 +39,6 @@ void Scope::Init(Scope *parent, unsigned
BlockParent = parent->BlockParent;
TemplateParamParent = parent->TemplateParamParent;
MSLocalManglingParent = parent->MSLocalManglingParent;
- SEHTryParent = parent->SEHTryParent;
- if (parent->Flags & SEHTryScope)
- SEHTryParent = parent;
if ((Flags & (FnScope | ClassScope | BlockScope | TemplateParamScope |
FunctionPrototypeScope | AtCatchScope | ObjCMethodScope)) ==
0)
@@ -50,17 +47,13 @@ void Scope::Init(Scope *parent, unsigned
Depth = 0;
PrototypeDepth = 0;
PrototypeIndex = 0;
- SEHTryParent = MSLocalManglingParent = FnParent = BlockParent = nullptr;
+ MSLocalManglingParent = FnParent = BlockParent = nullptr;
TemplateParamParent = nullptr;
MSLocalManglingNumber = 1;
}
// If this scope is a function or contains breaks/continues, remember it.
if (flags & FnScope) FnParent = this;
- SEHTryIndexPool = 0;
- SEHTryIndex = -1;
- if (flags & SEHTryScope)
- SEHTryIndex = FnParent ? FnParent->SEHTryIndexPool++ : -1;
// The MS mangler uses the number of scopes that can hold declarations as
// part of an external name.
if (Flags & (ClassScope | FnScope)) {
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Fri Jul 25 15:52:51 2014
@@ -3249,15 +3249,16 @@ StmtResult Sema::ActOnCXXTryBlock(Source
return CXXTryStmt::Create(Context, TryLoc, TryBlock, Handlers);
}
-StmtResult Sema::ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc,
- Stmt *TryBlock, Stmt *Handler,
- int HandlerIndex, int HandlerParentIndex) {
+StmtResult
+Sema::ActOnSEHTryBlock(bool IsCXXTry,
+ SourceLocation TryLoc,
+ Stmt *TryBlock,
+ Stmt *Handler) {
assert(TryBlock && Handler);
getCurFunction()->setHasBranchProtectedScope();
- return SEHTryStmt::Create(Context, IsCXXTry, TryLoc, TryBlock, Handler,
- HandlerIndex, HandlerParentIndex);
+ return SEHTryStmt::Create(Context,IsCXXTry,TryLoc,TryBlock,Handler);
}
StmtResult
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=213971&r1=213970&r2=213971&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Jul 25 15:52:51 2014
@@ -1665,10 +1665,8 @@ public:
}
StmtResult RebuildSEHTryStmt(bool IsCXXTry, SourceLocation TryLoc,
- Stmt *TryBlock, Stmt *Handler, int HandlerIndex,
- int HandlerParentIndex) {
- return getSema().ActOnSEHTryBlock(IsCXXTry, TryLoc, TryBlock, Handler,
- HandlerIndex, HandlerParentIndex);
+ Stmt *TryBlock, Stmt *Handler) {
+ return getSema().ActOnSEHTryBlock(IsCXXTry, TryLoc, TryBlock, Handler);
}
StmtResult RebuildSEHExceptStmt(SourceLocation Loc, Expr *FilterExpr,
@@ -6380,9 +6378,8 @@ StmtResult TreeTransform<Derived>::Trans
Handler.get() == S->getHandler())
return S;
- return getDerived().RebuildSEHTryStmt(
- S->getIsCXXTry(), S->getTryLoc(), TryBlock.get(), Handler.get(),
- S->getHandlerIndex(), S->getHandlerParentIndex());
+ return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
+ TryBlock.get(), Handler.get());
}
template <typename Derived>
More information about the cfe-commits
mailing list