]> granicus.if.org Git - clang/commitdiff
Add a LangOptions::areExceptionsEnabled and start using it.
authorAnders Carlsson <andersca@mac.com>
Sun, 20 Feb 2011 00:20:27 +0000 (00:20 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 20 Feb 2011 00:20:27 +0000 (00:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.h
lib/Analysis/CFG.cpp
lib/CodeGen/CGClass.cpp
lib/CodeGen/CGDeclCXX.cpp
lib/CodeGen/CGException.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h

index 868a0bec9144990b7ec2742021a6a67f9e1dcacd..f4db55ae062641a981562805bcb73771cd193023 100644 (file)
@@ -238,6 +238,10 @@ public:
   void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) {
     SignedOverflowBehavior = (unsigned)V;
   }
+
+  bool areExceptionsEnabled() const {
+    return Exceptions;
+  }
 };
 
 /// Floating point control options
index 1ae5d40f4d19b796fe4e16def7f2d7ee89cf3de4..a0ec5febbeff05a66db097526d4393273d14314f 100644 (file)
@@ -1089,7 +1089,7 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) {
   bool AddEHEdge = false;
 
   // Languages without exceptions are assumed to not throw.
-  if (Context->getLangOptions().Exceptions) {
+  if (Context->getLangOptions().areExceptionsEnabled()) {
     if (BuildOpts.AddEHEdges)
       AddEHEdge = true;
   }
index fc239a536f9164721c0ce6463183ac2997474330..8e88beb3cf0dc39b7a55fdf37448d0c9b2814a8a 100644 (file)
@@ -406,7 +406,8 @@ static void EmitBaseInitializer(CodeGenFunction &CGF,
 
   CGF.EmitAggExpr(BaseInit->getInit(), AggSlot);
   
-  if (CGF.Exceptions && !BaseClassDecl->hasTrivialDestructor())
+  if (CGF.CGM.getLangOptions().areExceptionsEnabled() && 
+      !BaseClassDecl->hasTrivialDestructor())
     CGF.EHStack.pushCleanup<CallBaseDtor>(EHCleanup, BaseClassDecl,
                                           isBaseVirtual);
 }
@@ -604,7 +605,7 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
     
     EmitAggMemberInitializer(CGF, LHS, ArrayIndexVar, MemberInit, FieldType, 0);
     
-    if (!CGF.Exceptions)
+    if (!CGF.CGM.getLangOptions().areExceptionsEnabled())
       return;
 
     // FIXME: If we have an array of classes w/ non-trivial destructors, 
index 8b37e9af3c6d830d5f1c60359b2d45e3ea4c992c..e295267896eb577e44c83f15ca0d5b3e1f3d93e3 100644 (file)
@@ -166,7 +166,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM,
       Fn->setSection(Section);
   }
 
-  if (!CGM.getLangOptions().Exceptions)
+  if (!CGM.getLangOptions().areExceptionsEnabled())
     Fn->setDoesNotThrow();
 
   return Fn;
index 0e717e26ab374a08c75a66bed72bb598fd9a2785..6181965748cc5944e291035d2b540ac243405389 100644 (file)
@@ -439,7 +439,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) {
 }
 
 void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
-  if (!Exceptions)
+  if (!CGM.getLangOptions().areExceptionsEnabled())
     return;
   
   const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D);
@@ -467,7 +467,7 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
 }
 
 void CodeGenFunction::EmitEndEHSpec(const Decl *D) {
-  if (!Exceptions)
+  if (!CGM.getLangOptions().areExceptionsEnabled())
     return;
   
   const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D);
@@ -541,7 +541,7 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
   assert(EHStack.requiresLandingPad());
   assert(!EHStack.empty());
 
-  if (!Exceptions)
+  if (!CGM.getLangOptions().areExceptionsEnabled())
     return 0;
 
   // Check the innermost scope for a cached landing pad.  If this is
index 96716ad9ccf989cd8393d396ea265cb4ffa50718..f1b72863caca972859b4f2dcbf07ea0c2bb57616 100644 (file)
@@ -39,8 +39,7 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm)
     CXXThisDecl(0), CXXThisValue(0), CXXVTTDecl(0), CXXVTTValue(0),
     OutermostConditional(0), TerminateLandingPad(0), TerminateHandler(0),
     TrapBB(0) {
-      
-  Exceptions = getContext().getLangOptions().Exceptions;
+
   CatchUndefined = getContext().getLangOptions().CatchUndefined;
   CGM.getCXXABI().getMangleContext().startNewFunction();
 }
index c19de38dc9b13cd35072b60dad3a98b83181c176..67ef41448e8de03c473496dfec02aa4924894264 100644 (file)
@@ -582,7 +582,6 @@ public:
   /// we prefer to insert allocas.
   llvm::AssertingVH<llvm::Instruction> AllocaInsertPt;
 
-  bool Exceptions;
   bool CatchUndefined;
 
   const CodeGen::CGBlockInfo *BlockInfo;