return F->isMaterializable();
return false;
}
-bool GlobalValue::isDematerializable() const {
- return getParent() && getParent()->isDematerializable(this);
-}
std::error_code GlobalValue::materialize() {
return getParent()->materialize(this);
}
-void GlobalValue::dematerialize() {
- getParent()->dematerialize(this);
-}
/// Override destroyConstantImpl to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
}
void GlobalObject::copyAttributesFrom(const GlobalValue *Src) {
- const auto *GV = cast<GlobalObject>(Src);
- GlobalValue::copyAttributesFrom(GV);
- setAlignment(GV->getAlignment());
- setSection(GV->getSection());
+ GlobalValue::copyAttributesFrom(Src);
+ if (const auto *GV = dyn_cast<GlobalObject>(Src)) {
+ setAlignment(GV->getAlignment());
+ setSection(GV->getSection());
+ }
}
const char *GlobalValue::getSection() const {
}
}
-/// copyAttributesFrom - copy all additional attributes (those not needed to
-/// create a GlobalVariable) from the GlobalVariable Src to this one.
+/// Copy all additional attributes (those not needed to create a GlobalVariable)
+/// from the GlobalVariable Src to this one.
void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) {
- assert(isa<GlobalVariable>(Src) && "Expected a GlobalVariable!");
GlobalObject::copyAttributesFrom(Src);
- const GlobalVariable *SrcVar = cast<GlobalVariable>(Src);
- setThreadLocalMode(SrcVar->getThreadLocalMode());
- setExternallyInitialized(SrcVar->isExternallyInitialized());
+ if (const GlobalVariable *SrcVar = dyn_cast<GlobalVariable>(Src)) {
+ setThreadLocalMode(SrcVar->getThreadLocalMode());
+ setExternallyInitialized(SrcVar->isExternallyInitialized());
+ }
}