aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/lli/lli.cpp4
-rw-r--r--llvm/tools/llvm-cov/CoverageExporterJson.cpp4
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp4
-rw-r--r--llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp4
-rw-r--r--llvm/tools/llvm-ifs/llvm-ifs.cpp32
-rw-r--r--llvm/tools/llvm-mca/Views/InstructionInfoView.cpp4
-rw-r--r--llvm/tools/llvm-objdump/XCOFFDump.cpp4
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp12
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp4
-rw-r--r--llvm/tools/llvm-profgen/ProfiledBinary.cpp17
-rw-r--r--llvm/tools/llvm-sim/llvm-sim.cpp9
-rw-r--r--llvm/tools/obj2yaml/dwarf2yaml.cpp28
-rw-r--r--llvm/tools/obj2yaml/dxcontainer2yaml.cpp4
13 files changed, 63 insertions, 67 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index f2e3886..2bc7391 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.getValue());
+ builder.setRelocationModel(RM.value());
if (auto CM = codegen::getExplicitCodeModel())
- builder.setCodeModel(CM.getValue());
+ builder.setCodeModel(CM.value());
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 d341abe..2e161f5 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").getValue();
- const StringRef FilenameB = ObjB->getString("filename").getValue();
+ const StringRef FilenameA = ObjA->getString("filename").value();
+ const StringRef FilenameB = ObjB->getString("filename").value();
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 f38eb00..46782c9 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.hasValue())
+ if (Color)
Snippets[I + 1] = Highlight(Snippets[I + 1], CurSeg->Col,
CurSeg->Col + Snippets[I + 1].size());
}
- if (Color.hasValue() && Segments.empty())
+ if (Color && 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 049cc68..0ad6645 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.hasValue(); }
+bool Operand::isTied() const { return TiedToIndex.has_value(); }
-bool Operand::isVariable() const { return VariableIndex.hasValue(); }
+bool Operand::isVariable() const { return VariableIndex.has_value(); }
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 f9b6a8c..6909bd1 100644
--- a/llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -533,34 +533,33 @@ int main(int argc, char *argv[]) {
<< "Triple should be defined when output format is TBD";
return -1;
}
- return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()),
+ return writeTbdStub(llvm::Triple(Stub.Target.Triple.value()),
Stub.Symbols, "TBD", Out);
}
case FileFormat::IFS: {
Stub.IfsVersion = IfsVersionCurrent;
- if (Config.InputFormat.getValue() == FileFormat::ELF &&
+ if (Config.InputFormat.value() == FileFormat::ELF &&
Config.HintIfsTarget) {
std::error_code HintEC(1, std::generic_category());
IFSTarget HintTarget = parseTriple(*Config.HintIfsTarget);
- if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue())
+ if (Stub.Target.Arch.value() != HintTarget.Arch.value())
fatalError(make_error<StringError>(
"Triple hint does not match the actual architecture", HintEC));
- if (Stub.Target.Endianness.getValue() !=
- HintTarget.Endianness.getValue())
+ if (Stub.Target.Endianness.value() != HintTarget.Endianness.value())
fatalError(make_error<StringError>(
"Triple hint does not match the actual endianness", HintEC));
- if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue())
+ if (Stub.Target.BitWidth.value() != HintTarget.BitWidth.value())
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.getValue();
+ Stub.Target.Triple = Config.HintIfsTarget.value();
} else {
stripIFSTarget(Stub, Config.StripIfsTarget, Config.StripIfsArch,
Config.StripIfsEndianness, Config.StripIfsBitwidth);
}
Error IFSWriteError =
- writeIFS(Config.Output.getValue(), Stub, Config.WriteIfChanged);
+ writeIFS(Config.Output.value(), Stub, Config.WriteIfChanged);
if (IFSWriteError)
fatalError(std::move(IFSWriteError));
break;
@@ -589,29 +588,28 @@ int main(int argc, char *argv[]) {
}
if (Config.OutputIfs) {
Stub.IfsVersion = IfsVersionCurrent;
- if (Config.InputFormat.getValue() == FileFormat::ELF &&
+ if (Config.InputFormat.value() == FileFormat::ELF &&
Config.HintIfsTarget) {
std::error_code HintEC(1, std::generic_category());
IFSTarget HintTarget = parseTriple(*Config.HintIfsTarget);
- if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue())
+ if (Stub.Target.Arch.value() != HintTarget.Arch.value())
fatalError(make_error<StringError>(
"Triple hint does not match the actual architecture", HintEC));
- if (Stub.Target.Endianness.getValue() !=
- HintTarget.Endianness.getValue())
+ if (Stub.Target.Endianness.value() != HintTarget.Endianness.value())
fatalError(make_error<StringError>(
"Triple hint does not match the actual endianness", HintEC));
- if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue())
+ if (Stub.Target.BitWidth.value() != HintTarget.BitWidth.value())
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.getValue();
+ Stub.Target.Triple = Config.HintIfsTarget.value();
} else {
stripIFSTarget(Stub, Config.StripIfsTarget, Config.StripIfsArch,
Config.StripIfsEndianness, Config.StripIfsBitwidth);
}
Error IFSWriteError =
- writeIFS(Config.OutputIfs.getValue(), Stub, Config.WriteIfChanged);
+ writeIFS(Config.OutputIfs.value(), Stub, Config.WriteIfChanged);
if (IFSWriteError)
fatalError(std::move(IFSWriteError));
}
@@ -628,8 +626,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.getValue()),
- Stub.Symbols, "TBD", Out);
+ return writeTbdStub(llvm::Triple(*Stub.Target.Triple), 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 28915e5..d3f9738 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.hasValue()) {
- double RT = IIVDEntry.RThroughput.getValue();
+ if (IIVDEntry.RThroughput) {
+ double RT = IIVDEntry.RThroughput.value();
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 159741b..befc9c0 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.getValue()) +
- ") " + SymbolName)
+ Result = ("(idx: " + Twine(SymbolInfo.XCOFFSymInfo.Index.value()) + ") " +
+ 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 42c3820..e95e745 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.hasValue()) {
- if (Status.getValue() == MCDisassembler::Fail) {
+ if (Status) {
+ if (*Status == 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.getValue()), SymName);
+ SymName = getXCOFFSymbolDescription(createSymbolInfo(O, *SymRef),
+ SymName);
outs() << ' ' << SymName;
outs() << ") ";
@@ -2247,8 +2247,8 @@ static void printRawClangAST(const ObjectFile *Obj) {
if (!ClangASTSection)
return;
- StringRef ClangASTContents = unwrapOrError(
- ClangASTSection.getValue().getContents(), Obj->getFileName());
+ StringRef ClangASTContents =
+ unwrapOrError(ClangASTSection->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 11387ac..9c65864 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.hasValue() &&
+ if (ProfileIsProbeBased &&
ProfileIsProbeBased != FunctionSamples::ProfileIsProbeBased)
exitWithError(
"cannot merge probe-based profile with non-probe-based profile");
ProfileIsProbeBased = FunctionSamples::ProfileIsProbeBased;
- if (ProfileIsCS.hasValue() && ProfileIsCS != FunctionSamples::ProfileIsCS)
+ if (ProfileIsCS && 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 adf7770..aaf7a00 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -100,26 +100,25 @@ BinarySizeContextTracker::getFuncSizeForContext(const SampleContext &Context) {
PrevNode = CurrNode;
CurrNode =
CurrNode->getChildContext(ChildFrame.Location, ChildFrame.FuncName);
- if (CurrNode && CurrNode->getFunctionSize().hasValue())
- Size = CurrNode->getFunctionSize().getValue();
+ if (CurrNode && CurrNode->getFunctionSize())
+ Size = CurrNode->getFunctionSize().value();
}
// 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.hasValue()) {
+ if (!Size) {
if (!CurrNode)
CurrNode = PrevNode;
- while (!Size.hasValue() && CurrNode &&
- !CurrNode->getAllChildContext().empty()) {
+ while (!Size && CurrNode && !CurrNode->getAllChildContext().empty()) {
CurrNode = &CurrNode->getAllChildContext().begin()->second;
- if (CurrNode->getFunctionSize().hasValue())
- Size = CurrNode->getFunctionSize().getValue();
+ if (CurrNode->getFunctionSize())
+ Size = CurrNode->getFunctionSize().value();
}
}
- assert(Size.hasValue() && "We should at least find one context size.");
- return Size.getValue();
+ assert(Size && "We should at least find one context size.");
+ return Size.value();
}
void BinarySizeContextTracker::trackInlineesOptimizedAway(
diff --git a/llvm/tools/llvm-sim/llvm-sim.cpp b/llvm/tools/llvm-sim/llvm-sim.cpp
index 26e370f..2b717d7 100644
--- a/llvm/tools/llvm-sim/llvm-sim.cpp
+++ b/llvm/tools/llvm-sim/llvm-sim.cpp
@@ -85,14 +85,13 @@ exportToFile(const StringRef FilePath,
Optional<unsigned> End =
getPositionInModule((*C.back()).Inst, LLVMInstNum);
- assert(Start.hasValue() &&
+ assert(Start &&
"Could not find instruction number for first instruction");
- assert(End.hasValue() &&
- "Could not find instruction number for last instruction");
+ assert(End && "Could not find instruction number for last instruction");
J.object([&] {
- J.attribute("start", Start.getValue());
- J.attribute("end", End.getValue());
+ J.attribute("start", Start.value());
+ J.attribute("end", End.value());
});
}
J.arrayEnd();
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index c0c23ea..4436cef 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.getValue().getForm();
+ auto Form = FormValue->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.getValue().getAsAddress())
- NewValue.Value = Val.getValue();
+ if (auto Val = FormValue->getAsAddress())
+ NewValue.Value = Val.value();
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.getValue().getAsReferenceUVal())
- NewValue.Value = Val.getValue();
+ if (auto Val = FormValue->getAsReferenceUVal())
+ NewValue.Value = Val.value();
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.getValue().getAsBlock()) {
- auto BlockData = Val.getValue();
+ if (auto Val = FormValue->getAsBlock()) {
+ auto BlockData = Val.value();
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.getValue().getAsUnsignedConstant())
- NewValue.Value = Val.getValue();
+ if (auto Val = FormValue->getAsUnsignedConstant())
+ NewValue.Value = Val.value();
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.getValue().getAsUnsignedConstant()) {
- NewValue.Value = Val.getValue();
+ if (auto Val = FormValue->getAsUnsignedConstant()) {
+ NewValue.Value = Val.value();
NewEntry.Values.push_back(NewValue);
- Form = static_cast<dwarf::Form>(Val.getValue());
+ Form = static_cast<dwarf::Form>(Val.value());
}
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.getValue().getAsCStringOffset())
- NewValue.Value = Val.getValue();
+ if (auto Val = FormValue->getAsCStringOffset())
+ NewValue.Value = Val.value();
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 a57b8cf..122ae7d 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.hasValue() && "Since we are iterating and found a DXIL part, "
- "this should never not have a value");
+ assert(DXIL && "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{