[lld] 5413bf1 - Don't use Optional::hasValue (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 11:34:15 PDT 2022
Author: Kazu Hirata
Date: 2022-06-20T11:33:56-07:00
New Revision: 5413bf1bac2abb9e06901686cdc959e92940143a
URL: https://github.com/llvm/llvm-project/commit/5413bf1bac2abb9e06901686cdc959e92940143a
DIFF: https://github.com/llvm/llvm-project/commit/5413bf1bac2abb9e06901686cdc959e92940143a.diff
LOG: Don't use Optional::hasValue (NFC)
Added:
Modified:
clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/IncludeFixer.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/SemanticSelection.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
clang-tools-extra/clangd/tool/Check.cpp
clang-tools-extra/pseudo/lib/DirectiveTree.cpp
clang-tools-extra/pseudo/lib/Forest.cpp
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
clang/lib/Lex/PPDirectives.cpp
clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
flang/include/flang/Lower/IterationSpace.h
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Lower/IO.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/lib/Optimizer/Support/InternalNames.cpp
lld/COFF/Driver.cpp
lld/ELF/Driver.cpp
lld/ELF/InputFiles.cpp
lld/ELF/LinkerScript.cpp
lld/wasm/Driver.cpp
lld/wasm/InputFiles.cpp
lld/wasm/Writer.cpp
lldb/source/Breakpoint/BreakpointIDList.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Utility/SelectHelper.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/IR/IRBuilder.h
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
llvm/lib/IR/Function.cpp
llvm/lib/IR/IntrinsicInst.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/lib/Target/Mips/MipsTargetStreamer.h
llvm/lib/Transforms/IPO/IROutliner.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
mlir/lib/Analysis/Presburger/Simplex.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
mlir/lib/Dialect/Affine/Utils/Utils.cpp
mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
mlir/lib/Tools/lsp-server-support/Protocol.cpp
mlir/test/lib/IR/TestSymbolUses.cpp
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
index b107dd7385c65..6c5d86a69821b 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
@@ -53,7 +53,7 @@ void ClangTidyProfiling::printAsJSON(llvm::raw_ostream &OS) {
}
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(llvm::Optional<StorageParams> Storage)
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 89c24ce7dd457..8cc494ac10910 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1683,7 +1683,7 @@ class PassedToSameFunction {
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 12497122bd887..830abda449b29 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
@@ -67,7 +67,7 @@ void SuspiciousMemoryComparisonCheck::check(
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 ab6b172014324..07fb19ff81ac1 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
@@ -65,7 +65,7 @@ analyzeFunction(const FunctionDecl &FuncDecl, ASTContext &ASTCtx) {
// `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 242790f1e5291..c0387886d9410 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -258,7 +258,7 @@ IdentifierNamingCheck::FileStyle IdentifierNamingCheck::getFileStyleFromOptions(
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 e481b59a22864..3bade14f86b91 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -493,7 +493,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
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 eff596dd65d79..fa6c70b4acbc4 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -97,7 +97,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
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 @@ void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
}
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 276e7a3704d4c..eaf570da88da8 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -835,7 +835,7 @@ struct CompletionRecorder : public CodeCompleteConsumer {
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 @@ class CodeCompleteFlow {
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 c419d20f29d2d..a057c438d7a93 100644
--- a/clang-tools-extra/clangd/IncludeFixer.cpp
+++ b/clang-tools-extra/clangd/IncludeFixer.cpp
@@ -544,7 +544,7 @@ IncludeFixer::unresolvedNameRecorder() {
}
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 aed4ac09d4869..01127fa9ae9e8 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -34,7 +34,7 @@ bool mapOptOrNull(const llvm::json::Value &Params, llvm::StringLiteral Prop,
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 @@ llvm::json::Value toJSON(const Diagnostic &D) {
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 MarkupContent &MC) {
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 CompletionList &L) {
}
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 2bead7af2d86e..55f5816ed90b8 100644
--- a/clang-tools-extra/clangd/SemanticSelection.cpp
+++ b/clang-tools-extra/clangd/SemanticSelection.cpp
@@ -121,7 +121,7 @@ llvm::Expected<SelectionRange> getSemanticRanges(ParsedAST &AST, Position Pos) {
}
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 b9809a2808faa..e35dcf55a4455 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 replaceWithFuncCall(const NewFunction &ExtractedFunc,
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 492da45aed754..748510f91bcc9 100644
--- a/clang-tools-extra/clangd/tool/Check.cpp
+++ b/clang-tools-extra/clangd/tool/Check.cpp
@@ -130,7 +130,7 @@ class Checker {
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 82843125329b8..d5f97455685ed 100644
--- a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
+++ b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
@@ -304,7 +304,7 @@ class BranchChooser {
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 dce3c3a7b70a9..3fd36d781beba 100644
--- a/clang-tools-extra/pseudo/lib/Forest.cpp
+++ b/clang-tools-extra/pseudo/lib/Forest.cpp
@@ -90,7 +90,7 @@ std::string ForestNode::dumpRecursive(const Grammar &G,
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 00f66d8e4d3e3..a01b32669ce3f 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -216,7 +216,7 @@ class CallEvent {
}
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 ca6cb08302108..1bd2f1b9c770b 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2073,7 +2073,7 @@ Optional<FileEntryRef> Preprocessor::LookupHeaderIncludeOrImport(
}
// 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 7b9b27ec2558b..de94cb7c978da 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -120,7 +120,7 @@ AnalyzerOptions::mayInlineCXXMemberFunction(
.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 558bc3b5ecfe1..326a3b1fb665f 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -1037,7 +1037,7 @@ bool ExprEngine::shouldInlineCall(const CallEvent &Call, const Decl *D,
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 4c6f3a1fe1ca4..35377579c2a23 100644
--- a/flang/include/flang/Lower/IterationSpace.h
+++ b/flang/include/flang/Lower/IterationSpace.h
@@ -500,7 +500,7 @@ class ExplicitIterSpace {
}
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 dea8d3d3063f6..de36822e81d3d 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2064,7 +2064,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
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 bc073a1d95279..104859d448817 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -2590,7 +2590,7 @@ class ScalarExprLowering {
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 @@ class ArrayExprLowering {
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 @@ class ArrayExprLowering {
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 a738f8b87a382..f5a8da0ca93bc 100644
--- a/flang/lib/Lower/IO.cpp
+++ b/flang/lib/Lower/IO.cpp
@@ -1852,7 +1852,7 @@ void genBeginDataTransferCallArgs(
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 f1777afd4299b..eeda562094943 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -2493,7 +2493,7 @@ struct CoordinateOpConversion
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 @@ struct CoordinateOpConversion
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 e20792115f423..c88d4317d29a9 100644
--- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
@@ -199,7 +199,7 @@ class TargetRewrite : public fir::TargetRewriteBase<TargetRewrite> {
// 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 @@ class TargetRewrite : public fir::TargetRewriteBase<TargetRewrite> {
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 01bd3acc72288..8e37df2f7df0c 100644
--- a/flang/lib/Optimizer/Support/InternalNames.cpp
+++ b/flang/lib/Optimizer/Support/InternalNames.cpp
@@ -38,7 +38,7 @@ static std::string doModules(llvm::ArrayRef<llvm::StringRef> mods) {
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 2843a9dde09bc..63a392e2970d5 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -620,7 +620,7 @@ void LinkerDriver::addWinSysRootLibSearchPaths() {
// 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 7b5a588fa3e5c..0d46c8d73bbd6 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -208,7 +208,7 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
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 1bce8de193bb7..9ded809fdefe3 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -697,7 +697,7 @@ static void updateARMVFPArgs(const ARMAttributeParser &attributes,
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 0f4c908efdd20..3be42904b7fe0 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1350,7 +1350,7 @@ SmallVector<PhdrEntry *, 0> LinkerScript::createPhdrs() {
// 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 3764c921ff45f..32bd1ef3344e3 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -234,7 +234,7 @@ std::vector<MemoryBufferRef> static getArchiveMembers(MemoryBufferRef mb) {
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 04ec342fe5422..84389f1a06d78 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -44,7 +44,7 @@ namespace wasm {
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 e0d07e5e6228f..ecc808aae6ca2 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -754,7 +754,7 @@ void Writer::createCommandExportWrappers() {
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 172674dc2dd2d..b434056993640 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -52,7 +52,7 @@ bool BreakpointIDList::AddBreakpointID(BreakpointID bp_id) {
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(BreakpointID &bp_id,
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 @@ void BreakpointIDList::InsertStringArray(
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 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
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 5ba28d2c602e7..4081e87f2ddb9 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -304,7 +304,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
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 c6f1cbe581dac..aad3cc412baf0 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1313,7 +1313,7 @@ void Debugger::ReportProgress(uint64_t progress_id, const std::string &message,
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 aa10c43a0c68e..78b8bf11220ae 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -858,7 +858,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
// 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 bef88a67573ae..fd673535edeeb 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -319,7 +319,7 @@ bool AppleObjCRuntime::AppleIsModuleObjCLibrary(const ModuleSP &module_sp) {
// 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 0a28aa0d8bccc..924d5b694ca68 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::GetMinimumOSVersion() {
}
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 @@ llvm::VersionTuple ObjectFileMachO::GetSDKVersion() {
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 @@ llvm::VersionTuple ObjectFileMachO::GetSDKVersion() {
}
}
- 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 b1f032e0cc02e..0fc975b89f229 100644
--- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -28,7 +28,7 @@ NativeProcessELF::GetAuxValue(enum AuxVector::EntryType type) {
}
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 7c577115c7c0f..ecf363aa2e73d 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -236,7 +236,7 @@ llvm::Optional<lldb::pid_t> MinidumpParser::GetPid() {
}
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 8cacd7bc3fcc5..58e581fce728d 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -511,7 +511,7 @@ SymbolFileBreakpad::GetParameterStackSize(Symbol &symbol) {
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 @@ SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark,
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 0217186cf87a3..4e586d0825d9c 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -1453,7 +1453,7 @@ void PdbAstBuilder::ParseAllNamespacesPlusChildrenOf(
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 d260b5f537a2b..e0f646b15641a 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1540,7 +1540,7 @@ static bool ClassTemplateAllowsToInstantiationArgs(
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 059f810e21949..eee6895296be6 100644
--- a/lldb/source/Utility/SelectHelper.cpp
+++ b/lldb/source/Utility/SelectHelper.cpp
@@ -84,7 +84,7 @@ bool SelectHelper::FDIsSetError(lldb::socket_t fd) const {
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 @@ lldb_private::Status SelectHelper::Select() {
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 635a71fc94de4..fbf2e9c1590de 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -132,7 +132,7 @@ class UnwindLocation {
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 2e0c6a40bfdc8..2b387db47ed25 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -300,7 +300,7 @@ class IRBuilderBase {
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 @@ class IRBuilderBase {
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 a19eb6114ff84..9d6799b48a2df 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -193,7 +193,7 @@ StringRef IRInstructionData::getCalleeName() const {
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 5226816defae2..bd100a2975040 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -7587,7 +7587,7 @@ LegalizerHelper::lowerMemcpyInline(MachineInstr &MI) {
// 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 6cb5006a7dc9f..e4fb7b22806a2 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -468,7 +468,7 @@ unsigned DWARFLinker::shouldKeepSubprogramDIE(
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 1554a6eced8aa..a3dbb3954d5ce 100644
--- a/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
@@ -49,7 +49,7 @@ ContinuationRecordBuilder::ContinuationRecordBuilder()
ContinuationRecordBuilder::~ContinuationRecordBuilder() = default;
void ContinuationRecordBuilder::begin(ContinuationRecordKind RecordKind) {
- assert(!Kind.hasValue());
+ assert(!Kind);
Kind = RecordKind;
Buffer.clear();
SegmentWriter.setOffset(0);
@@ -76,7 +76,7 @@ void ContinuationRecordBuilder::begin(ContinuationRecordKind RecordKind) {
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 0c4a02388d75a..5fb8d497b9573 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
@@ -24,7 +24,7 @@ SymbolSerializer::SymbolSerializer(BumpPtrAllocator &Allocator,
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::visitSymbolBegin(CVSymbol &Record) {
}
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 ec7c4e1e3353c..495b25077737a 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
@@ -525,7 +525,7 @@ SymbolGroupIterator &SymbolGroupIterator::operator++() {
}
void SymbolGroupIterator::scanToNextDebugS() {
- assert(SectionIter.hasValue());
+ assert(SectionIter);
auto End = Value.File->obj().section_end();
auto &Iter = *SectionIter;
assert(!isEnd());
@@ -551,7 +551,7 @@ bool SymbolGroupIterator::isEnd() const {
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 bf0491d2397d2..c5534a79eb549 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1971,7 +1971,7 @@ void Function::setEntryCount(ProfileCount Count,
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 7e564c624b4bb..5deb3a5a634e6 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -617,7 +617,7 @@ CmpInst::Predicate VPCmpIntrinsic::getPredicate() const {
#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 6f429540713e9..f64ee2a8d0445 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1335,7 +1335,7 @@ static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
// 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 44615b987e3c8..2f4b6eb37aa11 100644
--- a/llvm/lib/Target/Mips/MipsTargetStreamer.h
+++ b/llvm/lib/Target/Mips/MipsTargetStreamer.h
@@ -178,7 +178,7 @@ class MipsTargetStreamer : public MCTargetStreamer {
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 136aaed0c8df9..eb43154906394 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -182,7 +182,7 @@ static void getSortedConstantKeys(std::vector<Value *> &SortedKeys,
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 @@ static Optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
// 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 @@ static Optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
}
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 e687641395cfd..60c9266c669b6 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -4582,7 +4582,7 @@ struct AAFoldRuntimeCallCallSiteReturned : AAFoldRuntimeCall {
// 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 @@ struct AAFoldRuntimeCallCallSiteReturned : AAFoldRuntimeCall {
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 f762a0adb8464..4dac144b4b1e9 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1607,7 +1607,7 @@ static void fixFuncEntryCount(PGOUseFunc &Func, LoopInfo &LI,
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 2c2c3c21c3dfe..e4ea6daee9deb 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -468,7 +468,7 @@ struct MatchTableRecord {
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 92cc4d643d54b..36b16f51ae9c5 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1162,7 +1162,7 @@ void Simplex::undoLastConstraint() {
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 @@ void LexSimplexBase::undoLastConstraint() {
// 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 c8f7daafeda97..8a33ae02f99b2 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -1272,7 +1272,7 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
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 7220cd6fc3b3e..aa20e084f1e82 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -1440,7 +1440,7 @@ static bool checkLoopInterchangeDependences(
// 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 ad6af0f72f200..5f9eee572cbbe 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -1791,7 +1791,7 @@ MemRefType mlir::normalizeMemRefType(MemRefType memrefType, OpBuilder b,
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 754cc85a7c2fd..9b4831e80e3c9 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
@@ -104,7 +104,7 @@ getFuncAnalysisState(const AnalysisState &state) {
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 bb6f0532af705..acdb59a155980 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
@@ -82,7 +82,7 @@ getFuncAnalysisState(const AnalysisState &state) {
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 774b1f3617161..c017dc9473f8a 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -306,7 +306,7 @@ bool matcher::operatesOnSuperVectorsOf(Operation &op,
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 79b30252353e5..b8a00b9d271c1 100644
--- a/mlir/lib/Tools/lsp-server-support/Protocol.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Protocol.cpp
@@ -781,7 +781,7 @@ bool mlir::lsp::fromJSON(const llvm::json::Value &value,
//===----------------------------------------------------------------------===//
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 a7f4d90386269..9a3621f1f1b3b 100644
--- a/mlir/test/lib/IR/TestSymbolUses.cpp
+++ b/mlir/test/lib/IR/TestSymbolUses.cpp
@@ -52,7 +52,7 @@ struct SymbolUsesPass
// 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 e6fdc11231a6e..99d356381c907 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 LogicalResult generateNamedGenericOpOds(LinalgOpConfig &opConfig,
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 @@ exprs.push_back(getAffineConstantExpr(cst{1}, context));
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 @@ std::string {0}::getLibraryCallName() {{
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 d55e199f25a91..115ff8cfea3aa 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -1745,7 +1745,7 @@ StringRef StaticMatcherHelper::getVerifierName(DagLeaf leaf) {
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());
More information about the llvm-commits
mailing list