std::string buf;
raw_string_ostream os(buf);
+ assert(unwrap(Ty) != nullptr && "Expecting non-null Type");
unwrap(Ty)->print(os);
os.flush();
std::string buf;
raw_string_ostream os(buf);
+ assert(unwrap(Val) != nullptr && "Expecting non-null Value");
unwrap(Val)->print(os);
os.flush();
}
const char *LLVMGetSection(LLVMValueRef Global) {
- return unwrap<GlobalValue>(Global)->getSection().c_str();
+ return unwrap<GlobalValue>(Global)->getSection();
}
void LLVMSetSection(LLVMValueRef Global, const char *Section) {
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
const char *Name) {
auto *PTy = cast<PointerType>(unwrap(Ty));
- return wrap(new GlobalAlias(
- PTy->getElementType(), GlobalValue::ExternalLinkage, Name,
- unwrap<Constant>(Aliasee), unwrap(M), PTy->getAddressSpace()));
+ return wrap(GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(),
+ GlobalValue::ExternalLinkage, Name,
+ unwrap<GlobalObject>(Aliasee), unwrap(M)));
}
/*--.. Operations on functions .............................................--*/