From 9e184e65cfc0d515e0e3676b4e4141864b425da7 Mon Sep 17 00:00:00 2001 From: Vsevolod Livinskiy Date: Thu, 6 Nov 2014 16:52:42 +0300 Subject: [PATCH 1/2] Fix for rev.221167 --- cbackend.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cbackend.cpp b/cbackend.cpp index 5de99366..0be67aca 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -152,7 +152,11 @@ namespace { incorporateValue(Aliasee); } +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) llvm::SmallVector, 4> MDForInst; +#else // LLVM 3.6+ + llvm::SmallVector, 4> MDForInst; +#endif // Get types from functions. for (llvm::Module::const_iterator FI = M.begin(), E = M.end(); FI != E; ++FI) { @@ -178,7 +182,11 @@ namespace { // Incorporate types hiding in metadata. I.getAllMetadataOtherThanDebugLoc(MDForInst); for (unsigned i = 0, e = MDForInst.size(); i != e; ++i) +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) incorporateMDNode(MDForInst[i].second); +#else // LLVM 3.6+ + incorporateMDNode(llvm::cast(MDForInst[i].second)); +#endif MDForInst.clear(); } } @@ -187,7 +195,11 @@ namespace { E = M.named_metadata_end(); I != E; ++I) { const llvm::NamedMDNode *NMD = I; for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) incorporateMDNode(NMD->getOperand(i)); +#else // LLVM 3.6+ + incorporateMDNode(llvm::cast(NMD->getOperand(i))); +#endif } } From fcc1090595a6b68dafdaacd7e53b1e30ef287f9a Mon Sep 17 00:00:00 2001 From: Vsevolod Livinskiy Date: Thu, 6 Nov 2014 17:06:37 +0300 Subject: [PATCH 2/2] Fix for rev.221375 --- module.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module.cpp b/module.cpp index 2e25fde4..1e71cb8c 100644 --- a/module.cpp +++ b/module.cpp @@ -168,7 +168,11 @@ lStripUnusedDebugInfo(llvm::Module *module) { // loop over the compile units that contributed to the final module if (llvm::NamedMDNode *cuNodes = module->getNamedMetadata("llvm.dbg.cu")) { for (unsigned i = 0, ie = cuNodes->getNumOperands(); i != ie; ++i) { +#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4) || defined(LLVM_3_5) llvm::MDNode *cuNode = cuNodes->getOperand(i); +#else // LLVM 3.6+ + llvm::MDNode *cuNode = llvm::cast(cuNodes->getOperand(i)); +#endif llvm::DICompileUnit cu(cuNode); llvm::DIArray subprograms = cu.getSubprograms(); std::vector usedSubprograms;