mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 05:46:06 +00:00
IR: When creating a global variable, assert that its type is valid.
llvm-svn: 304690
This commit is contained in:
parent
08b4728f51
commit
2b9e9e474c
@ -293,6 +293,8 @@ GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link,
|
||||
InitVal != nullptr, Link, Name, AddressSpace),
|
||||
isConstantGlobal(constant),
|
||||
isExternallyInitializedConstant(isExternallyInitialized) {
|
||||
assert(!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) &&
|
||||
"invalid type for global variable");
|
||||
setThreadLocalMode(TLMode);
|
||||
if (InitVal) {
|
||||
assert(InitVal->getType() == Ty &&
|
||||
@ -311,6 +313,8 @@ GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
|
||||
InitVal != nullptr, Link, Name, AddressSpace),
|
||||
isConstantGlobal(constant),
|
||||
isExternallyInitializedConstant(isExternallyInitialized) {
|
||||
assert(!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) &&
|
||||
"invalid type for global variable");
|
||||
setThreadLocalMode(TLMode);
|
||||
if (InitVal) {
|
||||
assert(InitVal->getType() == Ty &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user