diff options
author | Anders Carlsson <andersca@mac.com> | 2011-02-20 00:20:27 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-02-20 00:20:27 +0000 |
commit | c1cfdf8647a499b6b3024f4bd14a236cddb23988 (patch) | |
tree | 07b87aed1f31e66a219553c3ed564299e3ae7c8f | |
parent | da4b7cf09ebfd4e4098b516081fa9dae2f5c99e0 (diff) |
Add a LangOptions::areExceptionsEnabled and start using it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/LangOptions.h | 4 | ||||
-rw-r--r-- | lib/Analysis/CFG.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGException.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 1 |
7 files changed, 13 insertions, 10 deletions
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 868a0bec91..f4db55ae06 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -238,6 +238,10 @@ public: void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) { SignedOverflowBehavior = (unsigned)V; } + + bool areExceptionsEnabled() const { + return Exceptions; + } }; /// Floating point control options diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 1ae5d40f4d..a0ec5febbe 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -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; } diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index fc239a536f..8e88beb3cf 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -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, diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 8b37e9af3c..e295267896 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -166,7 +166,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, Fn->setSection(Section); } - if (!CGM.getLangOptions().Exceptions) + if (!CGM.getLangOptions().areExceptionsEnabled()) Fn->setDoesNotThrow(); return Fn; diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 0e717e26ab..6181965748 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -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 diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 96716ad9cc..f1b72863ca 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -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(); } diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index c19de38dc9..67ef41448e 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -582,7 +582,6 @@ public: /// we prefer to insert allocas. llvm::AssertingVH<llvm::Instruction> AllocaInsertPt; - bool Exceptions; bool CatchUndefined; const CodeGen::CGBlockInfo *BlockInfo; |