Metadata/gc2stack compile fixes to accomodate LLVM API changes.

This commit is contained in:
David Nadlinger
2012-07-04 22:47:01 +02:00
parent a3a511ca55
commit ebbbfdd4ac
5 changed files with 44 additions and 41 deletions

View File

@@ -9,6 +9,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/SmallString.h"
#include "aggregate.h"
#include "declaration.h"
@@ -96,11 +97,12 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol()
mdVals[CD_BodyType] = llvm::UndefValue::get(bodyType);
mdVals[CD_Finalize] = LLConstantInt::get(LLType::getInt1Ty(gIR->context()), hasDestructor);
mdVals[CD_CustomDelete] = LLConstantInt::get(LLType::getInt1Ty(gIR->context()), hasCustomDelete);
// Construct the metadata
llvm::MetadataBase* metadata = llvm::MDNode::get(gIR->context(), mdVals, CD_NumFields);
// Insert it into the module
std::string metaname = CD_PREFIX + initname;
llvm::NamedMDNode::Create(gIR->context(), metaname, &metadata, 1, gIR->module);
// Construct the metadata and insert it into the module.
llvm::SmallString<64> name;
llvm::NamedMDNode* node = gIR->module->getOrInsertNamedMetadata(
llvm::Twine(CD_PREFIX, initname).toStringRef(name));
node->addOperand(llvm::MDNode::get(gIR->context(),
llvm::makeArrayRef(mdVals, CD_NumFields)));
}
#endif // USE_METADATA