mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Fix clients like this:
delete ParseBytecodeFile(InputFilename, 0, &ErrorMessage); llvm_shutdown(); delete ParseBytecodeFile(InputFilename, 0, &ErrorMessage); The primitive type objects failed to ressurect themselves after shutdown, leading to crashes in clients that used them after llvm_shutdown(). This solution isn't wonderful, because we clearly have static ctors. However, the code it replaces was just as bad, so it's not a regression. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c99ef085b9
commit
d1f711fa6d
@ -347,34 +347,21 @@ const Type *StructType::getTypeAtIndex(const Value *V) const {
|
|||||||
// Primitive 'Type' data
|
// Primitive 'Type' data
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#define DeclarePrimType(TY, Str) \
|
const Type *Type::VoidTy = new Type("void", Type::VoidTyID);
|
||||||
namespace { \
|
const Type *Type::FloatTy = new Type("float", Type::FloatTyID);
|
||||||
struct VISIBILITY_HIDDEN TY##Type : public Type { \
|
const Type *Type::DoubleTy = new Type("double", Type::DoubleTyID);
|
||||||
TY##Type() : Type(Str, Type::TY##TyID) {} \
|
const Type *Type::LabelTy = new Type("label", Type::LabelTyID);
|
||||||
}; \
|
|
||||||
} \
|
|
||||||
static ManagedStatic<TY##Type> The##TY##Ty; \
|
|
||||||
const Type *Type::TY##Ty = &*The##TY##Ty
|
|
||||||
|
|
||||||
#define DeclareIntegerType(TY, BitWidth) \
|
namespace {
|
||||||
namespace { \
|
struct BuiltinIntegerType : public IntegerType {
|
||||||
struct VISIBILITY_HIDDEN TY##Type : public IntegerType { \
|
BuiltinIntegerType(unsigned W) : IntegerType(W) {}
|
||||||
TY##Type() : IntegerType(BitWidth) {} \
|
};
|
||||||
}; \
|
}
|
||||||
} \
|
const IntegerType *Type::Int1Ty = new BuiltinIntegerType(1);
|
||||||
static ManagedStatic<TY##Type> The##TY##Ty; \
|
const IntegerType *Type::Int8Ty = new BuiltinIntegerType(8);
|
||||||
const IntegerType *Type::TY##Ty = &*The##TY##Ty
|
const IntegerType *Type::Int16Ty = new BuiltinIntegerType(16);
|
||||||
|
const IntegerType *Type::Int32Ty = new BuiltinIntegerType(32);
|
||||||
DeclarePrimType(Void, "void");
|
const IntegerType *Type::Int64Ty = new BuiltinIntegerType(64);
|
||||||
DeclarePrimType(Float, "float");
|
|
||||||
DeclarePrimType(Double, "double");
|
|
||||||
DeclarePrimType(Label, "label");
|
|
||||||
DeclareIntegerType(Int1, 1);
|
|
||||||
DeclareIntegerType(Int8, 8);
|
|
||||||
DeclareIntegerType(Int16, 16);
|
|
||||||
DeclareIntegerType(Int32, 32);
|
|
||||||
DeclareIntegerType(Int64, 64);
|
|
||||||
#undef DeclarePrimType
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
Reference in New Issue
Block a user