]> granicus.if.org Git - clang/commitdiff
SEH: Use the SEHTryEpilogueStack instead of a separate bool
authorReid Kleckner <reid@kleckner.net>
Thu, 12 Feb 2015 23:40:45 +0000 (23:40 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 12 Feb 2015 23:40:45 +0000 (23:40 +0000)
We don't need a bool to track this now that we have a stack for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
lib/CodeGen/CGException.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h

index 60ab2effbebf16f9a989f880f30af6d8cfafbef7..90cf5ee65dff8942f82d1f305ec6f9a6dbe9e995 100644 (file)
@@ -3326,7 +3326,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
                            llvm::Attribute::AlwaysInline);
 
   // Disable inlining inside SEH __try blocks.
-  if (IsSEHTryScope)
+  if (isSEHTryScope())
     Attrs =
         Attrs.addAttribute(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
                            llvm::Attribute::NoInline);
index a76b3d82abbba18f5496f7a666c22d04b4e983f5..61f538b0eece304c4ef551b3141de201bb342bb3 100644 (file)
@@ -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(const SEHTryStmt &S) {
   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);
 }
index 43dd7a05de148b0029ff6418057a86cefd5c5ba3..79425d4c21ee75df492fee467095b70c3abdca7a 100644 (file)
@@ -40,7 +40,7 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext)
       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),
index 67188dfa0a135b45c6eebc6e3b29934696afbe0a..12f066bf171af6f33602c48db2a5e308049091d2 100644 (file)
@@ -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.