Don't use Optional::hasValue (NFC)
diff --git a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
index b107dd7..6c5d86a 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
@@ -53,7 +53,7 @@
}
void ClangTidyProfiling::storeProfileData() {
- assert(Storage.hasValue() && "We should have a filename.");
+ assert(Storage && "We should have a filename.");
llvm::SmallString<256> OutputDirectory(Storage->StoreFilename);
llvm::sys::path::remove_filename(OutputDirectory);
@@ -80,7 +80,7 @@
ClangTidyProfiling::~ClangTidyProfiling() {
TG.emplace("clang-tidy", "clang-tidy checks profiling", Records);
- if (!Storage.hasValue())
+ if (!Storage)
printUserFriendlyTable(llvm::errs());
else
storeProfileData();
diff --git a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
index 89c24ce..8cc494a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1683,7 +1683,7 @@
if (CalledFn->getParamDecl(Idx) == PassedToParam)
TargetIdx.emplace(Idx);
- assert(TargetIdx.hasValue() && "Matched, but didn't find index?");
+ assert(TargetIdx && "Matched, but didn't find index?");
TargetParams[PassedParamOfThisFn].insert(
{CalledFn->getCanonicalDecl(), *TargetIdx});
}
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
index 1249712..830abda 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
@@ -67,7 +67,7 @@
if (!PointeeType->isIncompleteType()) {
uint64_t PointeeSize = Ctx.getTypeSize(PointeeType);
- if (ComparedBits.hasValue() && *ComparedBits >= PointeeSize &&
+ if (ComparedBits && *ComparedBits >= PointeeSize &&
!Ctx.hasUniqueObjectRepresentations(PointeeQualifiedType)) {
diag(CE->getBeginLoc(),
"comparing object representation of type %0 which does not have a "
diff --git a/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
index ab6b172..07fb19f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
@@ -65,7 +65,7 @@
// `runDataflowAnalysis` doesn't guarantee that the exit block is visited;
// for example, when it is unreachable.
// FIXME: Diagnose violations even when the exit block is unreachable.
- if (!ExitBlockState.hasValue())
+ if (!ExitBlockState)
return llvm::None;
return std::move(ExitBlockState->Lattice);
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 242790f..c038788 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -258,7 +258,7 @@
auto HPTOpt =
Options.get<IdentifierNamingCheck::HungarianPrefixType>(StyleString);
- if (HPTOpt.hasValue() && !HungarianNotation.checkOptionValid(I))
+ if (HPTOpt && !HungarianNotation.checkOptionValid(I))
configurationDiag("invalid identifier naming option '%0'") << StyleString;
memcpy(&StyleString[StyleSize], "IgnoredRegexp", 13);
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index e481b59..3bade14 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -493,7 +493,7 @@
Opts.CodeComplete.EnableSnippets = Params.capabilities.CompletionSnippets;
Opts.CodeComplete.IncludeFixIts = Params.capabilities.CompletionFixes;
- if (!Opts.CodeComplete.BundleOverloads.hasValue())
+ if (!Opts.CodeComplete.BundleOverloads)
Opts.CodeComplete.BundleOverloads = Params.capabilities.HasSignatureHelp;
Opts.CodeComplete.DocumentationFormat =
Params.capabilities.CompletionDocumentationFormat;
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index eff596d..fa6c70b 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -97,7 +97,7 @@
if (FIndex)
FIndex->updateMain(Path, AST);
- assert(AST.getDiagnostics().hasValue() &&
+ assert(AST.getDiagnostics() &&
"We issue callback only with fresh preambles");
std::vector<Diag> Diagnostics = *AST.getDiagnostics();
if (ServerCallbacks)
@@ -672,7 +672,7 @@
}
Effect = T.takeError();
}
- assert(Effect.hasValue() && "Expected at least one selection");
+ assert(Effect && "Expected at least one selection");
if (*Effect && (*Effect)->FormatEdits) {
// Format tweaks that require it centrally here.
for (auto &It : (*Effect)->ApplyEdits) {
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index 276e7a3..eaf570d 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -835,7 +835,7 @@
continue;
// Skip injected class name when no class scope is not explicitly set.
// E.g. show injected A::A in `using A::A^` but not in "A^".
- if (Result.Declaration && !Context.getCXXScopeSpecifier().hasValue() &&
+ if (Result.Declaration && !Context.getCXXScopeSpecifier() &&
isInjectedClass(*Result.Declaration))
continue;
// We choose to never append '::' to completion results in clangd.
@@ -1439,7 +1439,7 @@
HeuristicPrefix = guessCompletionPrefix(SemaCCInput.ParseInput.Contents,
SemaCCInput.Offset);
populateContextWords(SemaCCInput.ParseInput.Contents);
- if (Opts.Index && SpecFuzzyFind && SpecFuzzyFind->CachedReq.hasValue()) {
+ if (Opts.Index && SpecFuzzyFind && SpecFuzzyFind->CachedReq) {
assert(!SpecFuzzyFind->Result.valid());
SpecReq = speculativeFuzzyFindRequestForCompletion(
*SpecFuzzyFind->CachedReq, HeuristicPrefix);
diff --git a/clang-tools-extra/clangd/IncludeFixer.cpp b/clang-tools-extra/clangd/IncludeFixer.cpp
index c419d20..a057c43 100644
--- a/clang-tools-extra/clangd/IncludeFixer.cpp
+++ b/clang-tools-extra/clangd/IncludeFixer.cpp
@@ -544,7 +544,7 @@
}
std::vector<Fix> IncludeFixer::fixUnresolvedName() const {
- assert(LastUnresolvedName.hasValue());
+ assert(LastUnresolvedName);
auto &Unresolved = *LastUnresolvedName;
vlog("Trying to fix unresolved name \"{0}\" in scopes: [{1}]",
Unresolved.Name, llvm::join(Unresolved.Scopes, ", "));
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index aed4ac0..01127fa 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -34,7 +34,7 @@
assert(O);
auto *V = O->get(Prop);
// Field is missing or null.
- if (!V || V->getAsNull().hasValue())
+ if (!V || V->getAsNull())
return true;
return fromJSON(*V, Out, P.field(Prop));
}
@@ -608,7 +608,7 @@
Diag["codeActions"] = D.codeActions;
if (!D.code.empty())
Diag["code"] = D.code;
- if (D.codeDescription.hasValue())
+ if (D.codeDescription)
Diag["codeDescription"] = *D.codeDescription;
if (!D.source.empty())
Diag["source"] = D.source;
@@ -926,7 +926,7 @@
llvm::json::Value toJSON(const Hover &H) {
llvm::json::Object Result{{"contents", toJSON(H.contents)}};
- if (H.range.hasValue())
+ if (H.range)
Result["range"] = toJSON(*H.range);
return std::move(Result);
@@ -1024,7 +1024,7 @@
}
llvm::json::Value toJSON(const ParameterInformation &PI) {
- assert((PI.labelOffsets.hasValue() || !PI.labelString.empty()) &&
+ assert((PI.labelOffsets || !PI.labelString.empty()) &&
"parameter information label is required");
llvm::json::Object Result;
if (PI.labelOffsets)
diff --git a/clang-tools-extra/clangd/SemanticSelection.cpp b/clang-tools-extra/clangd/SemanticSelection.cpp
index 2bead7a..55f5816 100644
--- a/clang-tools-extra/clangd/SemanticSelection.cpp
+++ b/clang-tools-extra/clangd/SemanticSelection.cpp
@@ -121,7 +121,7 @@
}
auto SR = toHalfOpenFileRange(SM, LangOpts, Node->ASTNode.getSourceRange());
- if (!SR.hasValue() || SM.getFileID(SR->getBegin()) != SM.getMainFileID()) {
+ if (!SR || SM.getFileID(SR->getBegin()) != SM.getMainFileID()) {
continue;
}
Range R;
diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
index b9809a2..e35dcf5 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
@@ -820,7 +820,7 @@
tooling::Replacement createFunctionDefinition(const NewFunction &ExtractedFunc,
const SourceManager &SM) {
FunctionDeclKind DeclKind = InlineDefinition;
- if (ExtractedFunc.ForwardDeclarationPoint.hasValue())
+ if (ExtractedFunc.ForwardDeclarationPoint)
DeclKind = OutOfLineDefinition;
std::string FunctionDef = ExtractedFunc.renderDeclaration(
DeclKind, *ExtractedFunc.SemanticDC, *ExtractedFunc.SyntacticDC, SM);
diff --git a/clang-tools-extra/clangd/tool/Check.cpp b/clang-tools-extra/clangd/tool/Check.cpp
index 492da45..748510f 100644
--- a/clang-tools-extra/clangd/tool/Check.cpp
+++ b/clang-tools-extra/clangd/tool/Check.cpp
@@ -130,7 +130,7 @@
Inputs.ClangTidyProvider = Opts.ClangTidyProvider;
Inputs.Opts.PreambleParseForwardingFunctions =
Opts.PreambleParseForwardingFunctions;
- if (Contents.hasValue()) {
+ if (Contents) {
Inputs.Contents = *Contents;
log("Imaginary source file contents:\n{0}", Inputs.Contents);
} else {
diff --git a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
index 8284312..d5f9745 100644
--- a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
+++ b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
@@ -304,7 +304,7 @@
MayTakeTrivial = false;
}
// Is this the best branch so far? (Including if it's #if 1).
- if (TookTrivial || !C.Taken.hasValue() || BranchScore > Best) {
+ if (TookTrivial || !C.Taken || BranchScore > Best) {
Best = BranchScore;
C.Taken = I;
}
diff --git a/clang-tools-extra/pseudo/lib/Forest.cpp b/clang-tools-extra/pseudo/lib/Forest.cpp
index dce3c3a..3fd36d7 100644
--- a/clang-tools-extra/pseudo/lib/Forest.cpp
+++ b/clang-tools-extra/pseudo/lib/Forest.cpp
@@ -90,7 +90,7 @@
Result += llvm::formatv("[{0,3}, {1,3}) ", P->startTokenIndex(), End);
Result += LineDec.Prefix;
Result += LineDec.First;
- if (ElidedParent.hasValue()) {
+ if (ElidedParent) {
Result += G.symbolName(*ElidedParent);
Result += "~";
}
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index 00f66d8..a01b326 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -216,7 +216,7 @@
}
bool isForeign() const {
- assert(Foreign.hasValue() && "Foreign must be set before querying");
+ assert(Foreign && "Foreign must be set before querying");
return *Foreign;
}
void setForeign(bool B) const { Foreign = B; }
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index ca6cb08..1bd2f1b 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2073,7 +2073,7 @@
}
// If the file is still not found, just go with the vanilla diagnostic
- assert(!File.hasValue() && "expected missing file");
+ assert(!File && "expected missing file");
Diag(FilenameTok, diag::err_pp_file_not_found)
<< OriginalFilename << FilenameRange;
if (IsFrameworkFound) {
diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
index 7b9b27e..de94cb7 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -120,7 +120,7 @@
.Case("none", CIMK_None)
.Default(None);
- assert(K.hasValue() && "Invalid c++ member function inlining mode.");
+ assert(K && "Invalid c++ member function inlining mode.");
return *K >= Param;
}
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index 558bc3b..326a3b1 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -1037,7 +1037,7 @@
CallInlinePolicy CIP = mayInlineCallKind(Call, Pred, Opts, CallOpts);
if (CIP != CIP_Allowed) {
if (CIP == CIP_DisallowedAlways) {
- assert(!MayInline.hasValue() || MayInline.getValue());
+ assert(!MayInline || *MayInline);
Engine.FunctionSummaries->markShouldNotInline(D);
}
return false;
diff --git a/flang/include/flang/Lower/IterationSpace.h b/flang/include/flang/Lower/IterationSpace.h
index 4c6f3a1..3537757 100644
--- a/flang/include/flang/Lower/IterationSpace.h
+++ b/flang/include/flang/Lower/IterationSpace.h
@@ -500,7 +500,7 @@
}
void attachLoopCleanup(std::function<void(fir::FirOpBuilder &builder)> fn) {
- if (!loopCleanup.hasValue()) {
+ if (!loopCleanup) {
loopCleanup = fn;
return;
}
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index dea8d3d..de36822 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2064,7 +2064,7 @@
return;
}
- if (lbounds.hasValue()) {
+ if (lbounds) {
// Array of POINTER entities, with elemental assignment.
if (!Fortran::lower::isWholePointer(assign.lhs))
fir::emitFatalError(toLocation(), "pointer assignment to non-pointer");
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index bc073a1..104859d 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -2590,7 +2590,7 @@
return *allocatedResult;
}
- if (!resultType.hasValue())
+ if (!resultType)
return mlir::Value{}; // subroutine call
// For now, Fortran return values are implemented with a single MLIR
// function return value.
@@ -6410,7 +6410,7 @@
mem = copyNeeded ? copyNextArrayCtorSection(exv, buffPos, buffSize, mem,
eleSz, eleTy, eleRefTy, resTy)
: fir::getBase(exv);
- if (fir::isa_char(seqTy.getEleTy()) && !charLen.hasValue()) {
+ if (fir::isa_char(seqTy.getEleTy()) && !charLen) {
charLen = builder.createTemporary(loc, builder.getI64Type());
mlir::Value castLen =
builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv));
@@ -6492,7 +6492,7 @@
mem = copyNeeded ? copyNextArrayCtorSection(exv, buffPos, buffSize, mem,
eleSz, eleTy, eleRefTy, resTy)
: fir::getBase(exv);
- if (fir::isa_char(seqTy.getEleTy()) && !charLen.hasValue()) {
+ if (fir::isa_char(seqTy.getEleTy()) && !charLen) {
charLen = builder.createTemporary(loc, builder.getI64Type());
mlir::Value castLen =
builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv));
diff --git a/flang/lib/Lower/IO.cpp b/flang/lib/Lower/IO.cpp
index a738f8b..f5a8da0 100644
--- a/flang/lib/Lower/IO.cpp
+++ b/flang/lib/Lower/IO.cpp
@@ -1852,7 +1852,7 @@
if constexpr (hasIOCtrl) { // READ or WRITE
if (isInternal) {
// descriptor or scalar variable; maybe explicit format; scratch area
- if (descRef.hasValue()) {
+ if (descRef) {
mlir::Value desc = builder.createBox(loc, *descRef);
ioArgs.push_back(
builder.createConvert(loc, ioFuncTy.getInput(ioArgs.size()), desc));
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index f1777af..eeda5620 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -2493,7 +2493,7 @@
return mlir::emitError(loc, "invalid coordinate/check failed");
// check if the i-th coordinate relates to an array
- if (dims.hasValue()) {
+ if (dims) {
arrIdx.push_back(nxtOpnd);
int dimsLeft = *dims;
if (dimsLeft > 1) {
@@ -2529,7 +2529,7 @@
offs.push_back(nxtOpnd);
}
- if (dims.hasValue())
+ if (dims)
offs.append(arrIdx.rbegin(), arrIdx.rend());
mlir::Value base = operands[0];
mlir::Value retval = genGEP(loc, ty, rewriter, base, offs);
diff --git a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
index e207921..c88d431 100644
--- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
@@ -199,7 +199,7 @@
// to call.
int dropFront = 0;
if constexpr (std::is_same_v<std::decay_t<A>, fir::CallOp>) {
- if (!callOp.getCallee().hasValue()) {
+ if (!callOp.getCallee()) {
newInTys.push_back(fnTy.getInput(0));
newOpers.push_back(callOp.getOperand(0));
dropFront = 1;
@@ -327,7 +327,7 @@
newCall = rewriter->create<A>(loc, newResTys, newOpers);
}
LLVM_DEBUG(llvm::dbgs() << "replacing call with " << newCall << '\n');
- if (wrap.hasValue())
+ if (wrap)
replaceOp(callOp, (*wrap)(newCall.getOperation()));
else
replaceOp(callOp, newCall.getResults());
diff --git a/flang/lib/Optimizer/Support/InternalNames.cpp b/flang/lib/Optimizer/Support/InternalNames.cpp
index 01bd3ac..8e37df2 100644
--- a/flang/lib/Optimizer/Support/InternalNames.cpp
+++ b/flang/lib/Optimizer/Support/InternalNames.cpp
@@ -38,7 +38,7 @@
static std::string doModulesHost(llvm::ArrayRef<llvm::StringRef> mods,
llvm::Optional<llvm::StringRef> host) {
std::string result = doModules(mods);
- if (host.hasValue())
+ if (host)
result.append("F").append(host->lower());
return result;
}
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 2843a9d..63a392e2 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -620,7 +620,7 @@
// Parses LIB environment which contains a list of search paths.
void LinkerDriver::addLibSearchPaths() {
Optional<std::string> envOpt = Process::GetEnv("LIB");
- if (!envOpt.hasValue())
+ if (!envOpt)
return;
StringRef env = saver().save(*envOpt);
while (!env.empty()) {
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 7b5a588..0d46c8d 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -208,7 +208,7 @@
using namespace sys::fs;
Optional<MemoryBufferRef> buffer = readFile(path);
- if (!buffer.hasValue())
+ if (!buffer)
return;
MemoryBufferRef mbref = *buffer;
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 1bce8de..9ded809 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -697,7 +697,7 @@
const InputFile *f) {
Optional<unsigned> attr =
attributes.getAttributeValue(ARMBuildAttrs::ABI_VFP_args);
- if (!attr.hasValue())
+ if (!attr)
// If an ABI tag isn't present then it is implicitly given the value of 0
// which maps to ARMBuildAttrs::BaseAAPCS. However many assembler files,
// including some in glibc that don't use FP args (and should have value 3)
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 0f4c908..3be4290 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1350,7 +1350,7 @@
// Assign headers specified by linker script
for (size_t id : getPhdrIndices(sec)) {
ret[id]->add(sec);
- if (!phdrsCommands[id].flags.hasValue())
+ if (!phdrsCommands[id].flags)
ret[id]->p_flags |= sec->getPhdrFlags();
}
}
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index 3764c92..32bd1ef 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -234,7 +234,7 @@
void LinkerDriver::addFile(StringRef path) {
Optional<MemoryBufferRef> buffer = readFile(path);
- if (!buffer.hasValue())
+ if (!buffer)
return;
MemoryBufferRef mbref = *buffer;
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index 04ec342..84389f1 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -44,7 +44,7 @@
void InputFile::checkArch(Triple::ArchType arch) const {
bool is64 = arch == Triple::wasm64;
- if (is64 && !config->is64.hasValue()) {
+ if (is64 && !config->is64) {
fatal(toString(this) +
": must specify -mwasm64 to process wasm64 object files");
} else if (config->is64.value_or(false) != is64) {
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index e0d07e5..ecc808a 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -754,7 +754,7 @@
const std::string &funcName = commandExportWrapperNames.back();
auto func = make<SyntheticFunction>(*f->getSignature(), funcName);
- if (f->function->getExportName().hasValue())
+ if (f->function->getExportName())
func->setExportName(f->function->getExportName()->str());
else
func->setExportName(f->getName().str());
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 172674d..b434056 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -52,7 +52,7 @@
bool BreakpointIDList::AddBreakpointID(const char *bp_id_str) {
auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str);
- if (!bp_id.hasValue())
+ if (!bp_id)
return false;
m_breakpoint_ids.push_back(*bp_id);
@@ -76,7 +76,7 @@
bool BreakpointIDList::FindBreakpointID(const char *bp_id_str,
size_t *position) const {
auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str);
- if (!bp_id.hasValue())
+ if (!bp_id)
return false;
return FindBreakpointID(*bp_id, position);
@@ -89,7 +89,7 @@
for (const char *str : string_array) {
auto bp_id = BreakpointID::ParseCanonicalReference(str);
- if (bp_id.hasValue())
+ if (bp_id)
m_breakpoint_ids.push_back(*bp_id);
}
result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -163,7 +163,7 @@
BreakpointSP breakpoint_sp;
auto bp_id = BreakpointID::ParseCanonicalReference(bp_id_str);
- if (bp_id.hasValue())
+ if (bp_id)
breakpoint_sp = target->GetBreakpointByID(bp_id->GetBreakpointID());
if (!breakpoint_sp) {
new_args.Clear();
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 5ba28d2c..4081e87 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -304,7 +304,7 @@
Thread *thread = m_exe_ctx.GetThreadPtr();
uint32_t frame_idx = UINT32_MAX;
- if (m_options.relative_frame_offset.hasValue()) {
+ if (m_options.relative_frame_offset) {
// The one and only argument is a signed relative frame index
frame_idx = thread->GetSelectedFrameIndex();
if (frame_idx == UINT32_MAX)
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index c6f1cbe..aad3cc4 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1313,7 +1313,7 @@
uint64_t completed, uint64_t total,
llvm::Optional<lldb::user_id_t> debugger_id) {
// Check if this progress is for a specific debugger.
- if (debugger_id.hasValue()) {
+ if (debugger_id) {
// It is debugger specific, grab it and deliver the event if the debugger
// still exists.
DebuggerSP debugger_sp = FindDebuggerWithID(*debugger_id);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index aa10c43..78b8bf1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -858,7 +858,7 @@
// The line and column of the user expression inside the transformed source
// code.
unsigned user_expr_line, user_expr_column;
- if (m_user_expression_start_pos.hasValue())
+ if (m_user_expression_start_pos)
AbsPosToLineColumnPos(*m_user_expression_start_pos, m_transformed_text,
user_expr_line, user_expr_column);
else
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index bef88a6..fd67353 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -319,7 +319,7 @@
// we use the version of Foundation to make assumptions about the ObjC runtime
// on a target
uint32_t AppleObjCRuntime::GetFoundationVersion() {
- if (!m_Foundation_major.hasValue()) {
+ if (!m_Foundation_major) {
const ModuleList &modules = m_process->GetTarget().GetImages();
for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 0a28aa0..924d5b6 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6003,7 +6003,7 @@
}
llvm::VersionTuple ObjectFileMachO::GetSDKVersion() {
- if (!m_sdk_versions.hasValue()) {
+ if (!m_sdk_versions) {
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t load_cmd_offset = offset;
@@ -6032,7 +6032,7 @@
offset = load_cmd_offset + lc.cmdsize;
}
- if (!m_sdk_versions.hasValue()) {
+ if (!m_sdk_versions) {
offset = MachHeaderSizeFromMagic(m_header.magic);
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t load_cmd_offset = offset;
@@ -6069,7 +6069,7 @@
}
}
- if (!m_sdk_versions.hasValue())
+ if (!m_sdk_versions)
m_sdk_versions = llvm::VersionTuple();
}
diff --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
index b1f032e..0fc975b 100644
--- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -28,7 +28,7 @@
}
lldb::addr_t NativeProcessELF::GetSharedLibraryInfoAddress() {
- if (!m_shared_library_info_addr.hasValue()) {
+ if (!m_shared_library_info_addr) {
if (GetAddressByteSize() == 8)
m_shared_library_info_addr =
GetELFImageInfoAddress<llvm::ELF::Elf64_Ehdr, llvm::ELF::Elf64_Phdr,
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
index 7c57711..ecf363a 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -236,7 +236,7 @@
}
llvm::Optional<LinuxProcStatus> proc_status = GetLinuxProcStatus();
- if (proc_status.hasValue()) {
+ if (proc_status) {
return proc_status->GetPid();
}
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 8cacd7b..58e581f 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -511,7 +511,7 @@
symbol.GetAddress().GetFileAddress())) {
auto record = StackWinRecord::parse(
*LineIterator(*m_objfile_sp, Record::StackWin, entry->data));
- assert(record.hasValue());
+ assert(record);
return record->ParameterSize;
}
return llvm::createStringError(llvm::inconvertibleErrorCode(),
@@ -655,7 +655,7 @@
LineIterator It(*m_objfile_sp, Record::StackCFI, bookmark),
End(*m_objfile_sp);
llvm::Optional<StackCFIRecord> init_record = StackCFIRecord::parse(*It);
- assert(init_record.hasValue() && init_record->Size.hasValue() &&
+ assert(init_record && init_record->Size &&
"Record already parsed successfully in ParseUnwindData!");
auto plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindLLDB);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 0217186..4e586d0 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -1453,7 +1453,7 @@
CVTagRecord tag = CVTagRecord::create(cvt);
- if (!parent.hasValue()) {
+ if (!parent) {
clang::QualType qt = GetOrCreateType(tid);
CompleteType(qt);
continue;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index d260b5f..e0f646b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1540,7 +1540,7 @@
return false;
// Ensure that <typename...> != <typename>.
- if (pack_parameter.hasValue() != instantiation_values.hasParameterPack())
+ if (pack_parameter.has_value() != instantiation_values.hasParameterPack())
return false;
// Compare the first pack parameter that was found with the first pack
diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp
index 059f810..eee6895 100644
--- a/lldb/source/Utility/SelectHelper.cpp
+++ b/lldb/source/Utility/SelectHelper.cpp
@@ -84,7 +84,7 @@
static void updateMaxFd(llvm::Optional<lldb::socket_t> &vold,
lldb::socket_t vnew) {
- if (!vold.hasValue())
+ if (!vold)
vold = vnew;
else
vold = std::max(*vold, vnew);
@@ -123,7 +123,7 @@
updateMaxFd(max_fd, fd);
}
- if (!max_fd.hasValue()) {
+ if (!max_fd) {
error.SetErrorString("no valid file descriptors");
return error;
}
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index 635a71f..fbf2e9c 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -132,7 +132,7 @@
uint32_t getRegister() const { return RegNum; }
int32_t getOffset() const { return Offset; }
uint32_t getAddressSpace() const {
- assert(Kind == RegPlusOffset && AddrSpace.hasValue());
+ assert(Kind == RegPlusOffset && AddrSpace);
return *AddrSpace;
}
int32_t getConstant() const { return Offset; }
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 2e0c6a4..2b387db 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -300,7 +300,7 @@
void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept) {
#ifndef NDEBUG
Optional<StringRef> ExceptStr = convertExceptionBehaviorToStr(NewExcept);
- assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
+ assert(ExceptStr && "Garbage strict exception behavior!");
#endif
DefaultConstrainedExcept = NewExcept;
}
@@ -309,7 +309,7 @@
void setDefaultConstrainedRounding(RoundingMode NewRounding) {
#ifndef NDEBUG
Optional<StringRef> RoundingStr = convertRoundingModeToStr(NewRounding);
- assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
+ assert(RoundingStr && "Garbage strict rounding mode!");
#endif
DefaultConstrainedRounding = NewRounding;
}
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index a19eb61..9d6799b 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -193,7 +193,7 @@
assert(isa<CallInst>(Inst) &&
"Can only get a name from a call instruction");
- assert(CalleeName.hasValue() && "CalleeName has not been set");
+ assert(CalleeName && "CalleeName has not been set");
return *CalleeName;
}
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 5226816..bd100a2 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -7587,7 +7587,7 @@
// See if this is a constant length copy
auto LenVRegAndVal = getIConstantVRegValWithLookThrough(Len, MRI);
// FIXME: support dynamically sized G_MEMCPY_INLINE
- assert(LenVRegAndVal.hasValue() &&
+ assert(LenVRegAndVal &&
"inline memcpy with dynamic size is not yet supported");
uint64_t KnownLen = LenVRegAndVal->Value.getZExtValue();
if (KnownLen == 0) {
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 6cb5006..e4fb7b2 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -468,7 +468,7 @@
if (!LowPc)
return Flags;
- assert(LowPc.hasValue() && "low_pc attribute is not an address.");
+ assert(LowPc && "low_pc attribute is not an address.");
if (!RelocMgr.isLiveSubprogram(DIE, MyInfo))
return Flags;
diff --git a/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp b/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
index 1554a6ec..a3dbb39 100644
--- a/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
@@ -49,7 +49,7 @@
ContinuationRecordBuilder::~ContinuationRecordBuilder() = default;
void ContinuationRecordBuilder::begin(ContinuationRecordKind RecordKind) {
- assert(!Kind.hasValue());
+ assert(!Kind);
Kind = RecordKind;
Buffer.clear();
SegmentWriter.setOffset(0);
@@ -76,7 +76,7 @@
template <typename RecordType>
void ContinuationRecordBuilder::writeMemberType(RecordType &Record) {
- assert(Kind.hasValue());
+ assert(Kind);
uint32_t OriginalOffset = SegmentWriter.getOffset();
CVMemberRecord CVMR;
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp b/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
index 0c4a023..5fb8d49 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
@@ -24,7 +24,7 @@
Mapping(Writer, Container) {}
Error SymbolSerializer::visitSymbolBegin(CVSymbol &Record) {
- assert(!CurrentSymbol.hasValue() && "Already in a symbol mapping!");
+ assert(!CurrentSymbol && "Already in a symbol mapping!");
Writer.setOffset(0);
@@ -39,7 +39,7 @@
}
Error SymbolSerializer::visitSymbolEnd(CVSymbol &Record) {
- assert(CurrentSymbol.hasValue() && "Not in a symbol mapping!");
+ assert(CurrentSymbol && "Not in a symbol mapping!");
if (auto EC = Mapping.visitSymbolEnd(Record))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
index ec7c4e1..495b250 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
@@ -525,7 +525,7 @@
}
void SymbolGroupIterator::scanToNextDebugS() {
- assert(SectionIter.hasValue());
+ assert(SectionIter);
auto End = Value.File->obj().section_end();
auto &Iter = *SectionIter;
assert(!isEnd());
@@ -551,7 +551,7 @@
return Index == Count;
}
- assert(SectionIter.hasValue());
+ assert(SectionIter);
return *SectionIter == Value.File->obj().section_end();
}
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index bf0491d..c5534a7 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1971,7 +1971,7 @@
const DenseSet<GlobalValue::GUID> *S) {
#if !defined(NDEBUG)
auto PrevCount = getEntryCount();
- assert(!PrevCount.hasValue() || PrevCount->getType() == Count.getType());
+ assert(!PrevCount || PrevCount->getType() == Count.getType());
#endif
auto ImportGUIDs = getImportGUIDs();
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 7e564c6..5deb3a5 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -617,7 +617,7 @@
#define END_REGISTER_VP_INTRINSIC(VPID) break;
#include "llvm/IR/VPIntrinsics.def"
}
- assert(CCArgIdx.hasValue() && "Unexpected vector-predicated comparison");
+ assert(CCArgIdx && "Unexpected vector-predicated comparison");
return IsFP ? getFPPredicateFromMD(getArgOperand(*CCArgIdx))
: getIntPredicateFromMD(getArgOperand(*CCArgIdx));
}
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 6f42954..f64ee2a 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1335,7 +1335,7 @@
// We also support reading a content as array of bytes using the ContentArray
// key. obj2yaml never prints this field.
- assert(!IO.outputting() || !Section.ContentBuf.hasValue());
+ assert(!IO.outputting() || !Section.ContentBuf);
IO.mapOptional("ContentArray", Section.ContentBuf);
if (Section.ContentBuf) {
if (Section.Content)
diff --git a/llvm/lib/Target/Mips/MipsTargetStreamer.h b/llvm/lib/Target/Mips/MipsTargetStreamer.h
index 44615b9..2f4b6eb 100644
--- a/llvm/lib/Target/Mips/MipsTargetStreamer.h
+++ b/llvm/lib/Target/Mips/MipsTargetStreamer.h
@@ -178,7 +178,7 @@
MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; }
const MipsABIInfo &getABI() const {
- assert(ABI.hasValue() && "ABI hasn't been set!");
+ assert(ABI && "ABI hasn't been set!");
return *ABI;
}
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 136aaed..eb43154 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -182,7 +182,7 @@
Value *OutlinableRegion::findCorrespondingValueIn(const OutlinableRegion &Other,
Value *V) {
Optional<unsigned> GVN = Candidate->getGVN(V);
- assert(GVN.hasValue() && "No GVN for incoming value");
+ assert(GVN && "No GVN for incoming value");
Optional<unsigned> CanonNum = Candidate->getCanonicalNum(*GVN);
Optional<unsigned> FirstGVN = Other.Candidate->fromCanonicalNum(*CanonNum);
Optional<Value *> FoundValueOpt = Other.Candidate->fromGVN(*FirstGVN);
@@ -1196,7 +1196,7 @@
// Collect the canonical numbers of the values in the PHINode.
unsigned GVN = OGVN.getValue();
OGVN = Cand.getCanonicalNum(GVN);
- assert(OGVN.hasValue() && "No GVN found for incoming value?");
+ assert(OGVN && "No GVN found for incoming value?");
PHIGVNs.push_back(*OGVN);
// Find the incoming block and use the canonical numbering as well to define
@@ -1225,7 +1225,7 @@
}
GVN = OGVN.getValue();
OGVN = Cand.getCanonicalNum(GVN);
- assert(OGVN.hasValue() && "No GVN found for incoming block?");
+ assert(OGVN && "No GVN found for incoming block?");
PHIGVNs.push_back(*OGVN);
}
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index e687641..60c9266 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -4582,7 +4582,7 @@
// We have empty reaching kernels, therefore we cannot tell if the
// associated call site can be folded. At this moment, SimplifiedValue
// must be none.
- assert(!SimplifiedValue.hasValue() && "SimplifiedValue should be none");
+ assert(!SimplifiedValue && "SimplifiedValue should be none");
}
return SimplifiedValue == SimplifiedValueBefore ? ChangeStatus::UNCHANGED
@@ -4625,7 +4625,7 @@
return indicatePessimisticFixpoint();
if (CallerKernelInfoAA.ReachingKernelEntries.empty()) {
- assert(!SimplifiedValue.hasValue() &&
+ assert(!SimplifiedValue &&
"SimplifiedValue should keep none at this point");
return ChangeStatus::UNCHANGED;
}
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index f762a0a..4dac144 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1607,7 +1607,7 @@
BlockFrequencyInfo NBFI(F, NBPI, LI);
#ifndef NDEBUG
auto BFIEntryCount = F.getEntryCount();
- assert(BFIEntryCount.hasValue() && (BFIEntryCount->getCount() > 0) &&
+ assert(BFIEntryCount && (BFIEntryCount->getCount() > 0) &&
"Invalid BFI Entrycount");
#endif
auto SumCount = APFloat::getZero(APFloat::IEEEdouble());
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 2c2c3c2..e4ea6da 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -468,7 +468,7 @@
int64_t RawValue = std::numeric_limits<int64_t>::min())
: LabelID(LabelID_.value_or(~0u)), EmitStr(EmitStr),
NumElements(NumElements), Flags(Flags), RawValue(RawValue) {
- assert((!LabelID_.hasValue() || LabelID != ~0u) &&
+ assert((!LabelID_ || LabelID != ~0u) &&
"This value is reserved for non-labels");
}
MatchTableRecord(const MatchTableRecord &Other) = default;
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 92cc4d6..36b16f5 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1162,7 +1162,7 @@
pivot(*maybeRow, column);
} else {
Optional<unsigned> row = findAnyPivotRow(column);
- assert(row.hasValue() && "Pivot should always exist for a constraint!");
+ assert(row && "Pivot should always exist for a constraint!");
pivot(*row, column);
}
}
@@ -1181,7 +1181,7 @@
// long as we get the unknown to row orientation and remove it.
unsigned column = con.back().pos;
Optional<unsigned> row = findAnyPivotRow(column);
- assert(row.hasValue() && "Pivot should always exist for a constraint!");
+ assert(row && "Pivot should always exist for a constraint!");
pivot(*row, column);
}
removeLastConstraintRowOrientation();
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index c8f7daa..8a33ae0 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -1272,7 +1272,7 @@
auto srcMemSizeVal = srcMemSize.getValue();
auto dstMemSizeVal = dstMemSize.getValue();
- assert(sliceMemEstimate.hasValue() && "expected value");
+ assert(sliceMemEstimate && "expected value");
auto fusedMem = dstMemSizeVal + sliceMemEstimate.getValue();
LLVM_DEBUG(llvm::dbgs() << " src mem: " << srcMemSizeVal << "\n"
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index 7220cd6..aa20e08 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -1440,7 +1440,7 @@
// This iterates through loops in the desired order.
for (unsigned j = 0; j < maxLoopDepth; ++j) {
unsigned permIndex = loopPermMapInv[j];
- assert(depComps[permIndex].lb.hasValue());
+ assert(depComps[permIndex].lb);
int64_t depCompLb = depComps[permIndex].lb.getValue();
if (depCompLb > 0)
break;
diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index ad6af0f..5f9eee5 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -1791,7 +1791,7 @@
auto ubConst = fac.getConstantBound(IntegerPolyhedron::UB, d);
// For a static memref and an affine map with no symbols, this is
// always bounded.
- assert(ubConst.hasValue() && "should always have an upper bound");
+ assert(ubConst && "should always have an upper bound");
if (ubConst.getValue() < 0)
// This is due to an invalid map that maps to a negative space.
return memrefType;
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
index 754cc85..9b4831e 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
@@ -104,7 +104,7 @@
Optional<const FuncAnalysisState *> maybeState =
state.getDialectState<FuncAnalysisState>(
func::FuncDialect::getDialectNamespace());
- assert(maybeState.hasValue() && "FuncAnalysisState does not exist");
+ assert(maybeState && "FuncAnalysisState does not exist");
return **maybeState;
}
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
index bb6f053..acdb59a 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
@@ -82,7 +82,7 @@
Optional<const FuncAnalysisState *> maybeState =
state.getDialectState<FuncAnalysisState>(
func::FuncDialect::getDialectNamespace());
- assert(maybeState.hasValue() && "FuncAnalysisState does not exist");
+ assert(maybeState && "FuncAnalysisState does not exist");
return **maybeState;
}
diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
index 774b1f3..c017dc9 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -306,7 +306,7 @@
auto ratio = shapeRatio(superVectorType, subVectorType);
// Sanity check.
- assert((ratio.hasValue() || !mustDivide) &&
+ assert((ratio || !mustDivide) &&
"vector.transfer operation in which super-vector size is not an"
" integer multiple of sub-vector size");
diff --git a/mlir/lib/Tools/lsp-server-support/Protocol.cpp b/mlir/lib/Tools/lsp-server-support/Protocol.cpp
index 79b3025..b8a00b9 100644
--- a/mlir/lib/Tools/lsp-server-support/Protocol.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Protocol.cpp
@@ -781,7 +781,7 @@
//===----------------------------------------------------------------------===//
llvm::json::Value mlir::lsp::toJSON(const ParameterInformation &value) {
- assert((value.labelOffsets.hasValue() || !value.labelString.empty()) &&
+ assert((value.labelOffsets || !value.labelString.empty()) &&
"parameter information label is required");
llvm::json::Object result;
if (value.labelOffsets)
diff --git a/mlir/test/lib/IR/TestSymbolUses.cpp b/mlir/test/lib/IR/TestSymbolUses.cpp
index a7f4d90..9a3621f 100644
--- a/mlir/test/lib/IR/TestSymbolUses.cpp
+++ b/mlir/test/lib/IR/TestSymbolUses.cpp
@@ -52,7 +52,7 @@
// Test the functionality of getSymbolUses.
symbolUses = SymbolTable::getSymbolUses(symbol, &module.getBodyRegion());
- assert(symbolUses.hasValue() && "expected no unknown operations");
+ assert(symbolUses && "expected no unknown operations");
for (SymbolTable::SymbolUse symbolUse : *symbolUses) {
// Check that we can resolve back to our symbol.
if (SymbolTable::lookupNearestSymbolFrom(
diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
index e6fdc11..99d3563 100644
--- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
+++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
@@ -718,7 +718,7 @@
static const char stmtFmt[] = "$_state.addAttribute(\"{0}\", {0});";
// Add the type conversion attributes to the op definition and builders.
if (isFunctionAttribute(arg.kind)) {
- assert(arg.defaultFn.hasValue());
+ assert(arg.defaultFn);
std::string enumName = convertOperandKindToEnumName(arg.kind);
static const char typeFmt[] = "{0}::{1}";
static const char defFmt[] = "DefaultValuedAttr<{0}, \"{1}\">:${2}";
@@ -861,7 +861,7 @@
for (LinalgOperandDef &arg : opConfig.structuredOp->args) {
if (arg.kind != LinalgOperandDefKind::IndexAttr)
continue;
- assert(arg.indexAttrMap.hasValue());
+ assert(arg.indexAttrMap);
for (auto &en :
llvm::enumerate(arg.indexAttrMap->affineMap().getResults())) {
if (auto symbol = en.value().dyn_cast<AffineSymbolExpr>()) {
@@ -958,7 +958,7 @@
for (LinalgOperandDef &arg : opConfig.structuredOp->args) {
if (arg.kind != LinalgOperandDefKind::IndexAttr)
continue;
- assert(arg.indexAttrMap.hasValue());
+ assert(arg.indexAttrMap);
// Verify index attribute. Paramters:
// {0}: Attribute name
// {1}: Attribute size
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index d55e199..115ff8c 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -1745,7 +1745,7 @@
if (leaf.isAttrMatcher()) {
Optional<StringRef> constraint =
staticVerifierEmitter.getAttrConstraintFn(leaf.getAsConstraint());
- assert(constraint.hasValue() && "attribute constraint was not uniqued");
+ assert(constraint && "attribute constraint was not uniqued");
return *constraint;
}
assert(leaf.isOperandMatcher());