diff options
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/lli/lli.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/CoverageExporterJson.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-ifs/llvm-ifs.cpp | 32 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Views/InstructionInfoView.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-objdump/XCOFFDump.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 12 | ||||
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-profgen/ProfiledBinary.cpp | 17 | ||||
-rw-r--r-- | llvm/tools/llvm-sim/llvm-sim.cpp | 9 | ||||
-rw-r--r-- | llvm/tools/obj2yaml/dwarf2yaml.cpp | 28 | ||||
-rw-r--r-- | llvm/tools/obj2yaml/dxcontainer2yaml.cpp | 4 |
13 files changed, 67 insertions, 63 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 2bc7391..f2e3886 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -536,9 +536,9 @@ int main(int argc, char **argv, char * const *envp) { builder.setMCPU(codegen::getCPUStr()); builder.setMAttrs(codegen::getFeatureList()); if (auto RM = codegen::getExplicitRelocModel()) - builder.setRelocationModel(RM.value()); + builder.setRelocationModel(RM.getValue()); if (auto CM = codegen::getExplicitCodeModel()) - builder.setCodeModel(CM.value()); + builder.setCodeModel(CM.getValue()); builder.setErrorStr(&ErrorMsg); builder.setEngineKind(ForceInterpreter ? EngineKind::Interpreter diff --git a/llvm/tools/llvm-cov/CoverageExporterJson.cpp b/llvm/tools/llvm-cov/CoverageExporterJson.cpp index 2e161f5..d341abe 100644 --- a/llvm/tools/llvm-cov/CoverageExporterJson.cpp +++ b/llvm/tools/llvm-cov/CoverageExporterJson.cpp @@ -291,8 +291,8 @@ void CoverageExporterJson::renderRoot(ArrayRef<std::string> SourceFiles) { const json::Object *ObjB = B.getAsObject(); assert(ObjA != nullptr && "Value A was not an Object"); assert(ObjB != nullptr && "Value B was not an Object"); - const StringRef FilenameA = ObjA->getString("filename").value(); - const StringRef FilenameB = ObjB->getString("filename").value(); + const StringRef FilenameA = ObjA->getString("filename").getValue(); + const StringRef FilenameB = ObjB->getString("filename").getValue(); return FilenameA.compare(FilenameB) < 0; }); auto Export = json::Object( diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index 46782c9..f38eb00 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -561,12 +561,12 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L, else Color = None; - if (Color) + if (Color.hasValue()) Snippets[I + 1] = Highlight(Snippets[I + 1], CurSeg->Col, CurSeg->Col + Snippets[I + 1].size()); } - if (Color && Segments.empty()) + if (Color.hasValue() && Segments.empty()) Snippets.back() = Highlight(Snippets.back(), 1, 1 + Snippets.back().size()); if (getOptions().Debug) { diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp index 0ad6645..049cc68 100644 --- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp +++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp @@ -47,9 +47,9 @@ bool Operand::isUse() const { return !IsDef; } bool Operand::isReg() const { return Tracker; } -bool Operand::isTied() const { return TiedToIndex.has_value(); } +bool Operand::isTied() const { return TiedToIndex.hasValue(); } -bool Operand::isVariable() const { return VariableIndex.has_value(); } +bool Operand::isVariable() const { return VariableIndex.hasValue(); } bool Operand::isMemory() const { return isExplicit() && diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp index 6909bd1..f9b6a8c 100644 --- a/llvm/tools/llvm-ifs/llvm-ifs.cpp +++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp @@ -533,33 +533,34 @@ int main(int argc, char *argv[]) { << "Triple should be defined when output format is TBD"; return -1; } - return writeTbdStub(llvm::Triple(Stub.Target.Triple.value()), + return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()), Stub.Symbols, "TBD", Out); } case FileFormat::IFS: { Stub.IfsVersion = IfsVersionCurrent; - if (Config.InputFormat.value() == FileFormat::ELF && + if (Config.InputFormat.getValue() == FileFormat::ELF && Config.HintIfsTarget) { std::error_code HintEC(1, std::generic_category()); IFSTarget HintTarget = parseTriple(*Config.HintIfsTarget); - if (Stub.Target.Arch.value() != HintTarget.Arch.value()) + if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual architecture", HintEC)); - if (Stub.Target.Endianness.value() != HintTarget.Endianness.value()) + if (Stub.Target.Endianness.getValue() != + HintTarget.Endianness.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual endianness", HintEC)); - if (Stub.Target.BitWidth.value() != HintTarget.BitWidth.value()) + if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual bit width", HintEC)); stripIFSTarget(Stub, true, false, false, false); - Stub.Target.Triple = Config.HintIfsTarget.value(); + Stub.Target.Triple = Config.HintIfsTarget.getValue(); } else { stripIFSTarget(Stub, Config.StripIfsTarget, Config.StripIfsArch, Config.StripIfsEndianness, Config.StripIfsBitwidth); } Error IFSWriteError = - writeIFS(Config.Output.value(), Stub, Config.WriteIfChanged); + writeIFS(Config.Output.getValue(), Stub, Config.WriteIfChanged); if (IFSWriteError) fatalError(std::move(IFSWriteError)); break; @@ -588,28 +589,29 @@ int main(int argc, char *argv[]) { } if (Config.OutputIfs) { Stub.IfsVersion = IfsVersionCurrent; - if (Config.InputFormat.value() == FileFormat::ELF && + if (Config.InputFormat.getValue() == FileFormat::ELF && Config.HintIfsTarget) { std::error_code HintEC(1, std::generic_category()); IFSTarget HintTarget = parseTriple(*Config.HintIfsTarget); - if (Stub.Target.Arch.value() != HintTarget.Arch.value()) + if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual architecture", HintEC)); - if (Stub.Target.Endianness.value() != HintTarget.Endianness.value()) + if (Stub.Target.Endianness.getValue() != + HintTarget.Endianness.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual endianness", HintEC)); - if (Stub.Target.BitWidth.value() != HintTarget.BitWidth.value()) + if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue()) fatalError(make_error<StringError>( "Triple hint does not match the actual bit width", HintEC)); stripIFSTarget(Stub, true, false, false, false); - Stub.Target.Triple = Config.HintIfsTarget.value(); + Stub.Target.Triple = Config.HintIfsTarget.getValue(); } else { stripIFSTarget(Stub, Config.StripIfsTarget, Config.StripIfsArch, Config.StripIfsEndianness, Config.StripIfsBitwidth); } Error IFSWriteError = - writeIFS(Config.OutputIfs.value(), Stub, Config.WriteIfChanged); + writeIFS(Config.OutputIfs.getValue(), Stub, Config.WriteIfChanged); if (IFSWriteError) fatalError(std::move(IFSWriteError)); } @@ -626,8 +628,8 @@ int main(int argc, char *argv[]) { << "Triple should be defined when output format is TBD"; return -1; } - return writeTbdStub(llvm::Triple(*Stub.Target.Triple), Stub.Symbols, - "TBD", Out); + return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()), + Stub.Symbols, "TBD", Out); } } return 0; diff --git a/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp b/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp index d3f9738..28915e5 100644 --- a/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp +++ b/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp @@ -70,8 +70,8 @@ void InstructionInfoView::printView(raw_ostream &OS) const { else if (IIVDEntry.Latency < 100) TempStream << ' '; - if (IIVDEntry.RThroughput) { - double RT = IIVDEntry.RThroughput.value(); + if (IIVDEntry.RThroughput.hasValue()) { + double RT = IIVDEntry.RThroughput.getValue(); TempStream << format("%.2f", RT) << ' '; if (RT < 10.0) TempStream << " "; diff --git a/llvm/tools/llvm-objdump/XCOFFDump.cpp b/llvm/tools/llvm-objdump/XCOFFDump.cpp index befc9c0..159741b 100644 --- a/llvm/tools/llvm-objdump/XCOFFDump.cpp +++ b/llvm/tools/llvm-objdump/XCOFFDump.cpp @@ -97,8 +97,8 @@ std::string objdump::getXCOFFSymbolDescription(const SymbolInfoTy &SymbolInfo, std::string Result; // Dummy symbols have no symbol index. if (SymbolInfo.XCOFFSymInfo.Index) - Result = ("(idx: " + Twine(SymbolInfo.XCOFFSymInfo.Index.value()) + ") " + - SymbolName) + Result = ("(idx: " + Twine(SymbolInfo.XCOFFSymInfo.Index.getValue()) + + ") " + SymbolName) .str(); else Result.append(SymbolName.begin(), SymbolName.end()); diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index e95e745..42c3820 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1408,8 +1408,8 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj, // Right now, most targets return None i.e ignore to treat a symbol // separately. But WebAssembly decodes preludes for some symbols. // - if (Status) { - if (*Status == MCDisassembler::Fail) { + if (Status.hasValue()) { + if (Status.getValue() == MCDisassembler::Fail) { outs() << "// Error in decoding " << SymbolName << " : Decoding failed region as bytes.\n"; for (uint64_t I = 0; I < Size; ++I) { @@ -2139,8 +2139,8 @@ void objdump::printSymbol(const ObjectFile *O, const SymbolRef &Symbol, SymName = demangle(SymName); if (SymbolDescription) - SymName = getXCOFFSymbolDescription(createSymbolInfo(O, *SymRef), - SymName); + SymName = getXCOFFSymbolDescription( + createSymbolInfo(O, SymRef.getValue()), SymName); outs() << ' ' << SymName; outs() << ") "; @@ -2247,8 +2247,8 @@ static void printRawClangAST(const ObjectFile *Obj) { if (!ClangASTSection) return; - StringRef ClangASTContents = - unwrapOrError(ClangASTSection->getContents(), Obj->getFileName()); + StringRef ClangASTContents = unwrapOrError( + ClangASTSection.getValue().getContents(), Obj->getFileName()); outs().write(ClangASTContents.data(), ClangASTContents.size()); } diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 9c65864..11387ac 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -777,12 +777,12 @@ mergeSampleProfile(const WeightedFileVector &Inputs, SymbolRemapper *Remapper, } SampleProfileMap &Profiles = Reader->getProfiles(); - if (ProfileIsProbeBased && + if (ProfileIsProbeBased.hasValue() && ProfileIsProbeBased != FunctionSamples::ProfileIsProbeBased) exitWithError( "cannot merge probe-based profile with non-probe-based profile"); ProfileIsProbeBased = FunctionSamples::ProfileIsProbeBased; - if (ProfileIsCS && ProfileIsCS != FunctionSamples::ProfileIsCS) + if (ProfileIsCS.hasValue() && ProfileIsCS != FunctionSamples::ProfileIsCS) exitWithError("cannot merge CS profile with non-CS profile"); ProfileIsCS = FunctionSamples::ProfileIsCS; for (SampleProfileMap::iterator I = Profiles.begin(), E = Profiles.end(); diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index aaf7a00..adf7770 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -100,25 +100,26 @@ BinarySizeContextTracker::getFuncSizeForContext(const SampleContext &Context) { PrevNode = CurrNode; CurrNode = CurrNode->getChildContext(ChildFrame.Location, ChildFrame.FuncName); - if (CurrNode && CurrNode->getFunctionSize()) - Size = CurrNode->getFunctionSize().value(); + if (CurrNode && CurrNode->getFunctionSize().hasValue()) + Size = CurrNode->getFunctionSize().getValue(); } // If we traversed all nodes along the path of the context and haven't // found a size yet, pivot to look for size from sibling nodes, i.e size // of inlinee under different context. - if (!Size) { + if (!Size.hasValue()) { if (!CurrNode) CurrNode = PrevNode; - while (!Size && CurrNode && !CurrNode->getAllChildContext().empty()) { + while (!Size.hasValue() && CurrNode && + !CurrNode->getAllChildContext().empty()) { CurrNode = &CurrNode->getAllChildContext().begin()->second; - if (CurrNode->getFunctionSize()) - Size = CurrNode->getFunctionSize().value(); + if (CurrNode->getFunctionSize().hasValue()) + Size = CurrNode->getFunctionSize().getValue(); } } - assert(Size && "We should at least find one context size."); - return Size.value(); + assert(Size.hasValue() && "We should at least find one context size."); + return Size.getValue(); } void BinarySizeContextTracker::trackInlineesOptimizedAway( diff --git a/llvm/tools/llvm-sim/llvm-sim.cpp b/llvm/tools/llvm-sim/llvm-sim.cpp index 2b717d7..26e370f 100644 --- a/llvm/tools/llvm-sim/llvm-sim.cpp +++ b/llvm/tools/llvm-sim/llvm-sim.cpp @@ -85,13 +85,14 @@ exportToFile(const StringRef FilePath, Optional<unsigned> End = getPositionInModule((*C.back()).Inst, LLVMInstNum); - assert(Start && + assert(Start.hasValue() && "Could not find instruction number for first instruction"); - assert(End && "Could not find instruction number for last instruction"); + assert(End.hasValue() && + "Could not find instruction number for last instruction"); J.object([&] { - J.attribute("start", Start.value()); - J.attribute("end", End.value()); + J.attribute("start", Start.getValue()); + J.attribute("end", End.getValue()); }); } J.arrayEnd(); diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp index 4436cef..c0c23ea 100644 --- a/llvm/tools/obj2yaml/dwarf2yaml.cpp +++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -247,15 +247,15 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) { auto FormValue = DIEWrapper.find(AttrSpec.Attr); if (!FormValue) return; - auto Form = FormValue->getForm(); + auto Form = FormValue.getValue().getForm(); bool indirect = false; do { indirect = false; switch (Form) { case dwarf::DW_FORM_addr: case dwarf::DW_FORM_GNU_addr_index: - if (auto Val = FormValue->getAsAddress()) - NewValue.Value = Val.value(); + if (auto Val = FormValue.getValue().getAsAddress()) + NewValue.Value = Val.getValue(); break; case dwarf::DW_FORM_ref_addr: case dwarf::DW_FORM_ref1: @@ -264,16 +264,16 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) { case dwarf::DW_FORM_ref8: case dwarf::DW_FORM_ref_udata: case dwarf::DW_FORM_ref_sig8: - if (auto Val = FormValue->getAsReferenceUVal()) - NewValue.Value = Val.value(); + if (auto Val = FormValue.getValue().getAsReferenceUVal()) + NewValue.Value = Val.getValue(); break; case dwarf::DW_FORM_exprloc: case dwarf::DW_FORM_block: case dwarf::DW_FORM_block1: case dwarf::DW_FORM_block2: case dwarf::DW_FORM_block4: - if (auto Val = FormValue->getAsBlock()) { - auto BlockData = Val.value(); + if (auto Val = FormValue.getValue().getAsBlock()) { + auto BlockData = Val.getValue(); std::copy(BlockData.begin(), BlockData.end(), std::back_inserter(NewValue.BlockData)); } @@ -288,8 +288,8 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) { case dwarf::DW_FORM_udata: case dwarf::DW_FORM_ref_sup4: case dwarf::DW_FORM_ref_sup8: - if (auto Val = FormValue->getAsUnsignedConstant()) - NewValue.Value = Val.value(); + if (auto Val = FormValue.getValue().getAsUnsignedConstant()) + NewValue.Value = Val.getValue(); break; case dwarf::DW_FORM_string: if (auto Val = dwarf::toString(FormValue)) @@ -297,10 +297,10 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) { break; case dwarf::DW_FORM_indirect: indirect = true; - if (auto Val = FormValue->getAsUnsignedConstant()) { - NewValue.Value = Val.value(); + if (auto Val = FormValue.getValue().getAsUnsignedConstant()) { + NewValue.Value = Val.getValue(); NewEntry.Values.push_back(NewValue); - Form = static_cast<dwarf::Form>(Val.value()); + Form = static_cast<dwarf::Form>(Val.getValue()); } break; case dwarf::DW_FORM_strp: @@ -311,8 +311,8 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) { case dwarf::DW_FORM_strp_sup: case dwarf::DW_FORM_GNU_str_index: case dwarf::DW_FORM_strx: - if (auto Val = FormValue->getAsCStringOffset()) - NewValue.Value = Val.value(); + if (auto Val = FormValue.getValue().getAsCStringOffset()) + NewValue.Value = Val.getValue(); break; case dwarf::DW_FORM_flag_present: NewValue.Value = 1; diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp index 122ae7d..a57b8cf 100644 --- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp +++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp @@ -40,8 +40,8 @@ dumpDXContainer(MemoryBufferRef Source) { Obj->Header.PartOffsets->push_back(P.Offset); if (P.Part.getName() == "DXIL") { Optional<DXContainer::DXILData> DXIL = Container.getDXIL(); - assert(DXIL && "Since we are iterating and found a DXIL part, " - "this should never not have a value"); + assert(DXIL.hasValue() && "Since we are iterating and found a DXIL part, " + "this should never not have a value"); Obj->Parts.push_back(DXContainerYAML::Part{ P.Part.getName().str(), P.Part.Size, DXContainerYAML::DXILProgram{ |