//===--- CGException.cpp - Emit LLVM Code for C++ exceptions --------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This contains code dealing with C++ exception related code generation.////===----------------------------------------------------------------------===//#include"clang/AST/StmtCXX.h"#include"llvm/Intrinsics.h"#include"llvm/Support/CallSite.h"#include"CodeGenFunction.h"#include"CGException.h"usingnamespaceclang;usingnamespaceCodeGen;/// Push an entry of the given size onto this protected-scope stack.char*EHScopeStack::allocate(size_tSize){if(!StartOfBuffer){unsignedCapacity=1024;while(Capacity<Size)Capacity*=2;StartOfBuffer=newchar[Capacity];StartOfData=EndOfBuffer=StartOfBuffer+Capacity;}elseif(static_cast<size_t>(StartOfData-StartOfBuffer)<Size){unsignedCurrentCapacity=EndOfBuffer-StartOfBuffer;unsignedUsedCapacity=CurrentCapacity-(StartOfData-StartOfBuffer);unsignedNewCapacity=CurrentCapacity;do{NewCapacity*=2;}while(NewCapacity<UsedCapacity+Size);char*NewStartOfBuffer=newchar[NewCapacity];char*NewEndOfBuffer=NewStartOfBuffer+NewCapacity;char