r228982 - SEH: Use the SEHTryEpilogueStack instead of a separate bool

Reid Kleckner reid at kleckner.net
Thu Feb 12 15:40:45 PST 2015


Author: rnk
Date: Thu Feb 12 17:40:45 2015
New Revision: 228982

URL: http://llvm.org/viewvc/llvm-project?rev=228982&view=rev
Log:
SEH: Use the SEHTryEpilogueStack instead of a separate bool

We don't need a bool to track this now that we have a stack for it.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGException.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=228982&r1=228981&r2=228982&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Feb 12 17:40:45 2015
@@ -3326,7 +3326,7 @@ RValue CodeGenFunction::EmitCall(const C
                            llvm::Attribute::AlwaysInline);
 
   // Disable inlining inside SEH __try blocks.
-  if (IsSEHTryScope)
+  if (isSEHTryScope())
     Attrs =
         Attrs.addAttribute(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
                            llvm::Attribute::NoInline);

Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=228982&r1=228981&r2=228982&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Thu Feb 12 17:40:45 2015
@@ -21,7 +21,6 @@
 #include "clang/AST/StmtObjC.h"
 #include "llvm/IR/CallSite.h"
 #include "llvm/IR/Intrinsics.h"
-#include "llvm/Support/SaveAndRestore.h"
 
 using namespace clang;
 using namespace CodeGen;
@@ -1708,17 +1707,15 @@ void CodeGenFunction::EmitSEHTryStmt(con
   EnterSEHTryStmt(S, FI);
   {
     JumpDest TryExit = getJumpDestInCurrentScope("__try.__leave");
-    SEHTryEpilogueStack.push_back(&TryExit);
 
-    // Disable inlining inside SEH __try scopes.
-    SaveAndRestore<bool> Saver(IsSEHTryScope, true);
+    SEHTryEpilogueStack.push_back(&TryExit);
     EmitStmt(S.getTryBlock());
+    SEHTryEpilogueStack.pop_back();
 
     if (!TryExit.getBlock()->use_empty())
       EmitBlock(TryExit.getBlock(), /*IsFinished=*/true);
     else
       delete TryExit.getBlock();
-    SEHTryEpilogueStack.pop_back();
   }
   ExitSEHTryStmt(S, FI);
 }

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=228982&r1=228981&r2=228982&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Feb 12 17:40:45 2015
@@ -40,7 +40,7 @@ CodeGenFunction::CodeGenFunction(CodeGen
       CurFn(nullptr), CapturedStmtInfo(nullptr),
       SanOpts(CGM.getLangOpts().Sanitize), IsSanitizerScope(false),
       CurFuncIsThunk(false), AutoreleaseResult(false), SawAsmBlock(false),
-      IsSEHTryScope(false), BlockInfo(nullptr), BlockPointer(nullptr),
+      BlockInfo(nullptr), BlockPointer(nullptr),
       LambdaThisCaptureField(nullptr), NormalCleanupDest(nullptr),
       NextCleanupDestIndex(1), FirstBlockInfo(nullptr), EHResumeBlock(nullptr),
       ExceptionSlot(nullptr), EHSelectorSlot(nullptr),

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=228982&r1=228981&r2=228982&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Feb 12 17:40:45 2015
@@ -263,9 +263,6 @@ public:
   /// potentially set the return value.
   bool SawAsmBlock;
 
-  /// Codegen is currently inside an SEH try block.
-  bool IsSEHTryScope;
-
   const CodeGen::CGBlockInfo *BlockInfo;
   llvm::Value *BlockPointer;
 
@@ -365,6 +362,9 @@ public:
     llvm::BasicBlock *ResumeBB;
   };
 
+  /// Returns true inside SEH __try blocks.
+  bool isSEHTryScope() const { return !SEHTryEpilogueStack.empty(); }
+
   /// pushFullExprCleanup - Push a cleanup to be run at the end of the
   /// current full-expression.  Safe against the possibility that
   /// we're currently inside a conditionally-evaluated expression.





More information about the cfe-commits mailing list