LLVM trunk build fail fix (MDNode interface change)

This commit is contained in:
Anton Mitrokhin
2014-11-13 12:02:58 +03:00
parent 4351fc600b
commit 5cb50eca30
2 changed files with 2 additions and 16 deletions

14
opt.cpp
View File

@@ -185,11 +185,8 @@ lCopyMetadata(llvm::Value *vto, const llvm::Instruction *from) {
if (!to)
return;
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5)
llvm::SmallVector<std::pair<unsigned int, llvm::MDNode *>, 8> metadata;
#else // LLVM 3.6+
llvm::SmallVector<std::pair<unsigned int, llvm::Value *>, 8> metadata;
#endif
from->getAllMetadata(metadata);
for (unsigned int i = 0; i < metadata.size(); ++i)
to->setMetadata(metadata[i].first, metadata[i].second);
@@ -219,19 +216,12 @@ lCopyMetadata(llvm::Value *vto, const llvm::Instruction *from) {
*/
static bool
lGetSourcePosFromMetadata(const llvm::Instruction *inst, SourcePos *pos) {
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5)
llvm::MDNode *filename = inst->getMetadata("filename");
llvm::MDNode *first_line = inst->getMetadata("first_line");
llvm::MDNode *first_column = inst->getMetadata("first_column");
llvm::MDNode *last_line = inst->getMetadata("last_line");
llvm::MDNode *last_column = inst->getMetadata("last_column");
#else // LLVM 3.6+
llvm::MDNode *filename = inst->getMDNode("filename");
llvm::MDNode *first_line = inst->getMDNode("first_line");
llvm::MDNode *first_column = inst->getMDNode("first_column");
llvm::MDNode *last_line = inst->getMDNode("last_line");
llvm::MDNode *last_column = inst->getMDNode("last_column");
#endif
if (!filename || !first_line || !first_column || !last_line || !last_column)
return false;