mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Make GlobalVariable constructor assert when an initializer is of
incorrect type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2b5f45fed
commit
8243976b69
@ -76,7 +76,11 @@ GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link,
|
||||
const std::string &Name, Module *ParentModule)
|
||||
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, Link, Name),
|
||||
isConstantGlobal(constant) {
|
||||
if (Initializer) Operands.push_back(Use((Value*)Initializer, this));
|
||||
if (Initializer) {
|
||||
assert(Initializer->getType() == Ty &&
|
||||
"Initializer should be the same type as the GlobalVariable!");
|
||||
Operands.push_back(Use((Value*)Initializer, this));
|
||||
}
|
||||
|
||||
LeakDetector::addGarbageObject(this);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user