diff options
Diffstat (limited to 'llvm/lib/Transforms')
4 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 2d5eb0ac4e2..906de7e4fda 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -256,7 +256,9 @@ class GlobalsMetadata { NamedMDNode *Globals = M.getNamedMetadata("llvm.asan.globals"); if (!Globals) return; - for (auto MDN : Globals->operands()) { + for (const Value *MDV : Globals->operands()) { + const MDNode *MDN = cast<MDNode>(MDV); + // Metadata node contains the global and the fields of "Entry". assert(MDN->getNumOperands() == 5); Value *V = MDN->getOperand(0); diff --git a/llvm/lib/Transforms/Instrumentation/DebugIR.cpp b/llvm/lib/Transforms/Instrumentation/DebugIR.cpp index 5234341b32e..7a0ed81eed6 100644 --- a/llvm/lib/Transforms/Instrumentation/DebugIR.cpp +++ b/llvm/lib/Transforms/Instrumentation/DebugIR.cpp @@ -474,7 +474,7 @@ bool getSourceInfoFromDI(const Module &M, std::string &Directory, if (!CUNode || CUNode->getNumOperands() == 0) return false; - DICompileUnit CU(CUNode->getOperand(0)); + DICompileUnit CU(cast<MDNode>(CUNode->getOperand(0))); if (!CU.Verify()) return false; diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 0baa1c494e5..72b49a6cce3 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -417,7 +417,7 @@ namespace { std::string GCOVProfiler::mangleName(DICompileUnit CU, const char *NewStem) { if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) { for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) { - MDNode *N = GCov->getOperand(i); + MDNode *N = GCov->getOperandAsMDNode(i); if (N->getNumOperands() != 2) continue; MDString *GCovFile = dyn_cast<MDString>(N->getOperand(0)); MDNode *CompileUnit = dyn_cast<MDNode>(N->getOperand(1)); @@ -479,7 +479,7 @@ void GCOVProfiler::emitProfileNotes() { // this pass over the original .o's as they're produced, or run it after // LTO, we'll generate the same .gcno files. - DICompileUnit CU(CU_Nodes->getOperand(i)); + DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); std::error_code EC; raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None); std::string EdgeDestinations; @@ -565,7 +565,7 @@ bool GCOVProfiler::emitProfileArcs() { bool Result = false; bool InsertIndCounterIncrCode = false; for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - DICompileUnit CU(CU_Nodes->getOperand(i)); + DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); DIArray SPs = CU.getSubprograms(); SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP; for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { @@ -846,7 +846,7 @@ Function *GCOVProfiler::insertCounterWriteout( NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu"); if (CU_Nodes) { for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) { - DICompileUnit CU(CU_Nodes->getOperand(i)); + DICompileUnit CU(CU_Nodes->getOperandAsMDNode(i)); std::string FilenameGcda = mangleName(CU, "gcda"); uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i]; Builder.CreateCall3(StartFile, diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index eb325eb9417..04a0d917224 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -305,7 +305,7 @@ bool ObjCARCContract::doInitialization(Module &M) { if (NamedMDNode *NMD = M.getNamedMetadata("clang.arc.retainAutoreleasedReturnValueMarker")) if (NMD->getNumOperands() == 1) { - const MDNode *N = NMD->getOperand(0); + const MDNode *N = NMD->getOperandAsMDNode(0); if (N->getNumOperands() == 1) if (const MDString *S = dyn_cast<MDString>(N->getOperand(0))) RetainRVMarker = S; |

