Author: Kazu Hirata Date: 2022-06-20T20:05:16-07:00 New Revision: 064a08cd955019da9130f1109bfa534e79b8ec7c
URL: https://github.com/llvm/llvm-project/commit/064a08cd955019da9130f1109bfa534e79b8ec7c DIFF: https://github.com/llvm/llvm-project/commit/064a08cd955019da9130f1109bfa534e79b8ec7c.diff LOG: Don't use Optional::hasValue (NFC) Added: Modified: clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp clang-tools-extra/clangd/GlobalCompilationDatabase.cpp clang-tools-extra/clangd/TUScheduler.cpp clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp clang/include/clang/ASTMatchers/Dynamic/VariantValue.h clang/include/clang/Basic/DirectoryEntry.h clang/include/clang/Basic/FileEntry.h clang/include/clang/Lex/Preprocessor.h clang/include/clang/Sema/Sema.h clang/lib/ASTMatchers/Dynamic/Marshallers.h clang/lib/CodeGen/CGExprScalar.cpp clang/lib/CodeGen/CoverageMappingGen.cpp clang/lib/Lex/PPMacroExpansion.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp flang/include/flang/Lower/ComponentPath.h lld/wasm/Writer.cpp lldb/include/lldb/Core/DataFileCache.h lldb/source/API/SBMemoryRegionInfo.cpp lldb/source/Breakpoint/BreakpointID.cpp llvm/include/llvm/Analysis/LazyCallGraph.h llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h llvm/include/llvm/IR/DebugInfoMetadata.h llvm/include/llvm/IR/Function.h llvm/include/llvm/ObjectYAML/ELFYAML.h llvm/include/llvm/Support/Alignment.h llvm/lib/Analysis/ProfileSummaryInfo.cpp llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp llvm/lib/DebugInfo/DWARF/DWARFContext.cpp llvm/lib/IR/LLVMContext.cpp llvm/lib/ObjectYAML/COFFEmitter.cpp llvm/lib/Remarks/RemarkLinker.cpp llvm/lib/Remarks/RemarkParser.cpp llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp mlir/include/mlir/Analysis/DataFlowAnalysis.h mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td mlir/include/mlir/IR/Diagnostics.h mlir/include/mlir/Support/StorageUniquer.h mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp mlir/lib/Dialect/Affine/IR/AffineOps.cpp mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp mlir/lib/IR/AsmPrinter.cpp mlir/lib/IR/MLIRContext.cpp mlir/lib/Support/Timing.cpp mlir/lib/TableGen/Pattern.cpp mlir/test/lib/Dialect/Test/TestDialect.cpp mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp index 4eaf8bc6f392f..f7b4c3ef57938 100644 --- a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp @@ -66,7 +66,7 @@ getFileExtension(StringRef FileName, const FileExtensionsSet &FileExtensions) { bool isFileExtension(StringRef FileName, const FileExtensionsSet &FileExtensions) { - return getFileExtension(FileName, FileExtensions).hasValue(); + return getFileExtension(FileName, FileExtensions).has_value(); } } // namespace utils diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp index ce31f366cf174..2684b0de53bdb 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -530,7 +530,7 @@ class DirectoryBasedGlobalCompilationDatabase::BroadcastThread { bool blockUntilIdle(Deadline Timeout) { std::unique_lock<std::mutex> Lock(Mu); return wait(Lock, CV, Timeout, - [&] { return Queue.empty() && !ActiveTask.hasValue(); }); + [&] { return Queue.empty() && !ActiveTask; }); } ~BroadcastThread() { diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index f60fbfaa479f9..4bdcf0f3c80cd 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -1196,7 +1196,7 @@ std::shared_ptr<const PreambleData> ASTWorker::getPossiblyStalePreamble( void ASTWorker::waitForFirstPreamble() const { std::unique_lock<std::mutex> Lock(Mutex); - PreambleCV.wait(Lock, [this] { return LatestPreamble.hasValue() || Done; }); + PreambleCV.wait(Lock, [this] { return LatestPreamble || Done; }); } tooling::CompileCommand ASTWorker::getCurrentCompileCommand() const { diff --git a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp index 3f340fbd2a3fd..d0c06f80ce6b3 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp @@ -38,7 +38,7 @@ class DumpAST : public Tweak { N = N->Parent) if (dumpable(N->ASTNode)) Node = N->ASTNode; - return Node.hasValue(); + return Node.has_value(); } Expected<Effect> apply(const Selection &Inputs) override; std::string title() const override { diff --git a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h index e1c19eb835bad..240ee9a89b333 100644 --- a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h +++ b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -188,7 +188,7 @@ class VariantMatcher { bool hasTypedMatcher(ASTNodeKind NK) const { if (!Value) return false; - return Value->getTypedMatcher(MatcherOps(NK)).hasValue(); + return Value->getTypedMatcher(MatcherOps(NK)).has_value(); } /// Determines if the contained matcher can be converted to \p Kind. diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 2e67e14784e5d..fe5ec958b37c0 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -299,7 +299,7 @@ class OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr /// DirectoryEntry::getName have been deleted, delete this class and replace /// instances with Optional<DirectoryEntryRef> operator const DirectoryEntry *() const { - return hasValue() ? &getValue().getDirEntry() : nullptr; + return has_value() ? &value().getDirEntry() : nullptr; } }; diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 92a67150ba453..8676604b48364 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -313,7 +313,7 @@ class OptionalFileEntryRefDegradesToFileEntryPtr /// FileEntry::getName have been deleted, delete this class and replace /// instances with Optional<FileEntryRef> operator const FileEntry *() const { - return hasValue() ? &getValue().getFileEntry() : nullptr; + return has_value() ? &value().getFileEntry() : nullptr; } }; diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 9bd4b40a60770..d130aba3ee3a2 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -517,7 +517,7 @@ class Preprocessor { bool hasRecordedPreamble() const { return !ConditionalStack.empty(); } - bool reachedEOFWhileSkipping() const { return SkipInfo.hasValue(); } + bool reachedEOFWhileSkipping() const { return SkipInfo.has_value(); } void clearSkipInfo() { SkipInfo.reset(); } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 90af1005fa5af..12e472a5e4f36 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1742,7 +1742,7 @@ class Sema final { SemaDiagnosticBuilder(const SemaDiagnosticBuilder &) = default; ~SemaDiagnosticBuilder(); - bool isImmediate() const { return ImmediateDiag.hasValue(); } + bool isImmediate() const { return ImmediateDiag.has_value(); } /// Convertible to bool: True if we immediately emitted an error, false if /// we didn't emit an error or we created a deferred error. diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.h b/clang/lib/ASTMatchers/Dynamic/Marshallers.h index 3e9c4f31b84d3..bab36e5db47ec 100644 --- a/clang/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.h @@ -174,7 +174,7 @@ template <> struct ArgTypeTraits<attr::Kind> { return Value.isString(); } static bool hasCorrectValue(const VariantValue& Value) { - return getAttrKind(Value.getString()).hasValue(); + return getAttrKind(Value.getString()).has_value(); } static attr::Kind get(const VariantValue &Value) { @@ -204,7 +204,7 @@ template <> struct ArgTypeTraits<CastKind> { return Value.isString(); } static bool hasCorrectValue(const VariantValue& Value) { - return getCastKind(Value.getString()).hasValue(); + return getCastKind(Value.getString()).has_value(); } static CastKind get(const VariantValue &Value) { @@ -227,7 +227,7 @@ template <> struct ArgTypeTraits<llvm::Regex::RegexFlags> { return Value.isString(); } static bool hasCorrectValue(const VariantValue& Value) { - return getFlags(Value.getString()).hasValue(); + return getFlags(Value.getString()).has_value(); } static llvm::Regex::RegexFlags get(const VariantValue &Value) { @@ -254,7 +254,7 @@ template <> struct ArgTypeTraits<OpenMPClauseKind> { return Value.isString(); } static bool hasCorrectValue(const VariantValue& Value) { - return getClauseKind(Value.getString()).hasValue(); + return getClauseKind(Value.getString()).has_value(); } static OpenMPClauseKind get(const VariantValue &Value) { @@ -285,7 +285,7 @@ template <> struct ArgTypeTraits<UnaryExprOrTypeTrait> { return Value.isString(); } static bool hasCorrectValue(const VariantValue& Value) { - return getUnaryOrTypeTraitKind(Value.getString()).hasValue(); + return getUnaryOrTypeTraitKind(Value.getString()).has_value(); } static UnaryExprOrTypeTrait get(const VariantValue &Value) { diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 6b5b715fd8f9c..98d8e8b4ad88d 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -168,7 +168,7 @@ static llvm::Optional<QualType> getUnwidenedIntegerType(const ASTContext &Ctx, /// Check if \p E is a widened promoted integer. static bool IsWidenedIntegerOp(const ASTContext &Ctx, const Expr *E) { - return getUnwidenedIntegerType(Ctx, E).hasValue(); + return getUnwidenedIntegerType(Ctx, E).has_value(); } /// Check if we can skip the overflow check for \p Op. diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 61137f5d3e3a0..0fe084b628dab 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -130,7 +130,7 @@ class SourceMappingRegion { void setCounter(Counter C) { Count = C; } - bool hasStartLoc() const { return LocStart.hasValue(); } + bool hasStartLoc() const { return LocStart.has_value(); } void setStartLoc(SourceLocation Loc) { LocStart = Loc; } @@ -139,7 +139,7 @@ class SourceMappingRegion { return *LocStart; } - bool hasEndLoc() const { return LocEnd.hasValue(); } + bool hasEndLoc() const { return LocEnd.has_value(); } void setEndLoc(SourceLocation Loc) { assert(Loc.isValid() && "Setting an invalid end location"); @@ -155,7 +155,7 @@ class SourceMappingRegion { void setGap(bool Gap) { GapRegion = Gap; } - bool isBranch() const { return FalseCount.hasValue(); } + bool isBranch() const { return FalseCount.has_value(); } }; /// Spelling locations for the start and end of a source region. diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 31d6aa0dd4d02..49e14732b3c23 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1243,7 +1243,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok, IdentifierInfo *II, } // Get the result value. A result of true means the file exists. - return File.hasValue(); + return File.has_value(); } bool Preprocessor::EvaluateHasInclude(Token &Tok, IdentifierInfo *II) { diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 3087cd1cec63a..9ec33e8981983 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -828,7 +828,7 @@ class PackDeductionScope { /// Determine whether this pack expansion scope has a known, fixed arity. /// This happens if it involves a pack from an outer template that has /// (notionally) already been expanded. - bool hasFixedArity() { return FixedNumExpansions.hasValue(); } + bool hasFixedArity() { return FixedNumExpansions.has_value(); } /// Determine whether the next element of the argument is still part of this /// pack. This is the case unless the pack is already expanded to a fixed diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp index 50eec38404bdf..472eb2223a4ba 100644 --- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp @@ -152,7 +152,7 @@ Optional<SVal> getTaintedPointeeOrPointer(const CheckerContext &C, SVal Arg) { bool isTaintedOrPointsToTainted(const Expr *E, const ProgramStateRef &State, CheckerContext &C) { - return getTaintedPointeeOrPointer(C, C.getSVal(E)).hasValue(); + return getTaintedPointeeOrPointer(C, C.getSVal(E)).has_value(); } /// ArgSet is used to describe arguments relevant for taint detection or diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 8d928d141aca1..4a4694aa29239 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -258,7 +258,7 @@ static bool isVarAnInterestingCondition(const Expr *CondVarExpr, static bool isInterestingExpr(const Expr *E, const ExplodedNode *N, const PathSensitiveBugReport *B) { if (Optional<SVal> V = getSValForVar(E, N)) - return B->getInterestingnessKind(*V).hasValue(); + return B->getInterestingnessKind(*V).has_value(); return false; } diff --git a/flang/include/flang/Lower/ComponentPath.h b/flang/include/flang/Lower/ComponentPath.h index dc5cfa4d24b4d..3b5c3d3c21b09 100644 --- a/flang/include/flang/Lower/ComponentPath.h +++ b/flang/include/flang/Lower/ComponentPath.h @@ -49,7 +49,7 @@ class ComponentPath { bool hasComponents() const { return !suffixComponents.empty(); } void clear(); - bool hasExtendCoorRef() const { return extendCoorRef.hasValue(); } + bool hasExtendCoorRef() const { return extendCoorRef.has_value(); } ExtendRefFunc getExtendCoorRef() const; void resetExtendCoorRef() { extendCoorRef = llvm::None; } void resetPC(); diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index ecc808aae6ca2..fa9802d477d55 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -613,7 +613,7 @@ static bool shouldImport(Symbol *sym) { if (config->allowUndefinedSymbols.count(sym->getName()) != 0) return true; - return sym->importName.hasValue(); + return sym->importName.has_value(); } void Writer::calculateImports() { diff --git a/lldb/include/lldb/Core/DataFileCache.h b/lldb/include/lldb/Core/DataFileCache.h index cf794078ff9e3..2dc69f6ce6b09 100644 --- a/lldb/include/lldb/Core/DataFileCache.h +++ b/lldb/include/lldb/Core/DataFileCache.h @@ -125,7 +125,7 @@ struct CacheSignature { /// that can uniquely identify the file. Some build systems play with /// modification times of file so we can not trust them without using valid /// unique idenifier like the UUID being valid. - bool IsValid() const { return m_uuid.hasValue(); } + bool IsValid() const { return m_uuid.has_value(); } /// Check if two signatures are the same. bool operator==(const CacheSignature &rhs) const { diff --git a/lldb/source/API/SBMemoryRegionInfo.cpp b/lldb/source/API/SBMemoryRegionInfo.cpp index 1a16622b55742..d0f74374476e0 100644 --- a/lldb/source/API/SBMemoryRegionInfo.cpp +++ b/lldb/source/API/SBMemoryRegionInfo.cpp @@ -126,7 +126,7 @@ const char *SBMemoryRegionInfo::GetName() { bool SBMemoryRegionInfo::HasDirtyMemoryPageList() { LLDB_INSTRUMENT_VA(this); - return m_opaque_up->GetDirtyPageList().hasValue(); + return m_opaque_up->GetDirtyPageList().has_value(); } uint32_t SBMemoryRegionInfo::GetNumDirtyPages() { diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp index 9bd22898196e4..245cf7913335d 100644 --- a/lldb/source/Breakpoint/BreakpointID.cpp +++ b/lldb/source/Breakpoint/BreakpointID.cpp @@ -33,7 +33,7 @@ bool BreakpointID::IsRangeIdentifier(llvm::StringRef str) { } bool BreakpointID::IsValidIDExpression(llvm::StringRef str) { - return BreakpointID::ParseCanonicalReference(str).hasValue(); + return BreakpointID::ParseCanonicalReference(str).has_value(); } llvm::ArrayRef<llvm::StringRef> BreakpointID::GetRangeSpecifiers() { diff --git a/llvm/include/llvm/Analysis/LazyCallGraph.h b/llvm/include/llvm/Analysis/LazyCallGraph.h index da73a4835dc31..4cacf8951d6a8 100644 --- a/llvm/include/llvm/Analysis/LazyCallGraph.h +++ b/llvm/include/llvm/Analysis/LazyCallGraph.h @@ -328,7 +328,7 @@ class LazyCallGraph { bool operator!=(const Node &N) const { return !operator==(N); } /// Tests whether the node has been populated with edges. - bool isPopulated() const { return Edges.hasValue(); } + bool isPopulated() const { return Edges.has_value(); } /// Tests whether this is actually a dead node and no longer valid. /// diff --git a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h index 0f3af915da649..e23eebec81dbc 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h @@ -49,7 +49,7 @@ class BaseIndexOffset { SDValue getBase() const { return Base; } SDValue getIndex() { return Index; } SDValue getIndex() const { return Index; } - bool hasValidOffset() const { return Offset.hasValue(); } + bool hasValidOffset() const { return Offset.has_value(); } int64_t getOffset() const { return *Offset; } // Returns true if `Other` and `*this` are both some offset from the same base diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h index fbf2e9c1590de..48df091412bf3 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h @@ -261,7 +261,7 @@ class UnwindRow { UnwindRow() : CFAValue(UnwindLocation::createUnspecified()) {} /// Returns true if the address is valid in this object. - bool hasAddress() const { return Address.hasValue(); } + bool hasAddress() const { return Address.has_value(); } /// Get the address for this row. /// diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index f451e4a7865b9..db1d031a062d8 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -2732,7 +2732,7 @@ class DIExpression : public MDNode { } /// Return whether this is a piece of an aggregate variable. - bool isFragment() const { return getFragmentInfo().hasValue(); } + bool isFragment() const { return getFragmentInfo().has_value(); } /// Return whether this is an implicit location description. bool isImplicit() const; diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index acf7f18b6f044..7945c64c86103 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -288,7 +288,7 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject, /// profile annotations. If IncludeSynthetic is false, only return true /// when the profile data is real. bool hasProfileData(bool IncludeSynthetic = false) const { - return getEntryCount(IncludeSynthetic).hasValue(); + return getEntryCount(IncludeSynthetic).has_value(); } /// Returns the set of GUIDs that needs to be imported to the function for diff --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h b/llvm/include/llvm/ObjectYAML/ELFYAML.h index 4ef0bdd1df688..faff482c9b29c 100644 --- a/llvm/include/llvm/ObjectYAML/ELFYAML.h +++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h @@ -317,7 +317,7 @@ struct BBAddrMapSection : Section { BBAddrMapSection() : Section(ChunkKind::BBAddrMap) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { @@ -331,7 +331,7 @@ struct StackSizesSection : Section { StackSizesSection() : Section(ChunkKind::StackSizes) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { @@ -349,7 +349,7 @@ struct DynamicSection : Section { DynamicSection() : Section(ChunkKind::Dynamic) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Dynamic; } @@ -380,7 +380,7 @@ struct NoteSection : Section { NoteSection() : Section(ChunkKind::Note) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Notes", Notes.hasValue()}}; + return {{"Notes", Notes.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Note; } @@ -391,7 +391,7 @@ struct HashSection : Section { Optional<std::vector<uint32_t>> Chain; std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Bucket", Bucket.hasValue()}, {"Chain", Chain.hasValue()}}; + return {{"Bucket", Bucket.has_value()}, {"Chain", Chain.has_value()}}; }; // The following members are used to override section fields. @@ -462,7 +462,7 @@ struct VerneedSection : Section { VerneedSection() : Section(ChunkKind::Verneed) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Dependencies", VerneedV.hasValue()}}; + return {{"Dependencies", VerneedV.has_value()}}; }; static bool classof(const Chunk *S) { @@ -476,7 +476,7 @@ struct AddrsigSection : Section { AddrsigSection() : Section(ChunkKind::Addrsig) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Symbols", Symbols.hasValue()}}; + return {{"Symbols", Symbols.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Addrsig; } @@ -493,7 +493,7 @@ struct LinkerOptionsSection : Section { LinkerOptionsSection() : Section(ChunkKind::LinkerOptions) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Options", Options.hasValue()}}; + return {{"Options", Options.has_value()}}; }; static bool classof(const Chunk *S) { @@ -507,7 +507,7 @@ struct DependentLibrariesSection : Section { DependentLibrariesSection() : Section(ChunkKind::DependentLibraries) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Libraries", Libs.hasValue()}}; + return {{"Libraries", Libs.has_value()}}; }; static bool classof(const Chunk *S) { @@ -527,7 +527,7 @@ struct CallGraphProfileSection : Section { CallGraphProfileSection() : Section(ChunkKind::CallGraphProfile) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { @@ -541,7 +541,7 @@ struct SymverSection : Section { SymverSection() : Section(ChunkKind::Symver) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Symver; } @@ -562,7 +562,7 @@ struct VerdefSection : Section { VerdefSection() : Section(ChunkKind::Verdef) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Verdef; } @@ -577,7 +577,7 @@ struct GroupSection : Section { GroupSection() : Section(ChunkKind::Group) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Members", Members.hasValue()}}; + return {{"Members", Members.has_value()}}; }; static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Group; } @@ -597,7 +597,7 @@ struct RelocationSection : Section { RelocationSection() : Section(ChunkKind::Relocation) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Relocations", Relocations.hasValue()}}; + return {{"Relocations", Relocations.has_value()}}; }; static bool classof(const Chunk *S) { @@ -611,7 +611,7 @@ struct RelrSection : Section { RelrSection() : Section(ChunkKind::Relr) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { @@ -625,7 +625,7 @@ struct SymtabShndxSection : Section { SymtabShndxSection() : Section(ChunkKind::SymtabShndxSection) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { @@ -644,7 +644,7 @@ struct ARMIndexTableSection : Section { ARMIndexTableSection() : Section(ChunkKind::ARMIndexTable) {} std::vector<std::pair<StringRef, bool>> getEntries() const override { - return {{"Entries", Entries.hasValue()}}; + return {{"Entries", Entries.has_value()}}; }; static bool classof(const Chunk *S) { diff --git a/llvm/include/llvm/Support/Alignment.h b/llvm/include/llvm/Support/Alignment.h index c6ec976d84166..b5a5f18405a61 100644 --- a/llvm/include/llvm/Support/Alignment.h +++ b/llvm/include/llvm/Support/Alignment.h @@ -139,7 +139,7 @@ struct MaybeAlign : public llvm::Optional<Align> { } /// For convenience, returns a valid alignment or 1 if undefined. - Align valueOrOne() const { return hasValue() ? getValue() : Align(); } + Align valueOrOne() const { return value_or(Align()); } }; /// Checks that SizeInBytes is a multiple of the alignment. diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 66303e172a30d..992278f4eef23 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -165,7 +165,7 @@ bool ProfileSummaryInfo::isFunctionColdInCallGraph( bool ProfileSummaryInfo::isFunctionHotnessUnknown(const Function &F) const { assert(hasPartialSampleProfile() && "Expect partial sample profile"); - return !F.getEntryCount().hasValue(); + return !F.getEntryCount(); } template <bool isHot> diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index 1a62224177a18..ffb777ea5a6ab 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -2426,7 +2426,7 @@ bool CombinerHelper::matchConstantOp(const MachineOperand &MOP, int64_t C) { return false; auto *MI = MRI.getVRegDef(MOP.getReg()); auto MaybeCst = isConstantOrConstantSplatVector(*MI, MRI); - return MaybeCst.hasValue() && MaybeCst->getBitWidth() <= 64 && + return MaybeCst && MaybeCst->getBitWidth() <= 64 && MaybeCst->getSExtValue() == C; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 40c9c420ef6b8..2822d96c0f035 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -121,7 +121,7 @@ collectContributionData(DWARFContext::unit_iterator_range Units) { const Optional<StrOffsetsContributionDescriptor> &R) { if (L && R) return L->Base < R->Base; - return R.hasValue(); + return R.has_value(); }); // Uniquify contributions, as it is possible that units (specifically diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 5dfca4abb198b..4a1d5d3dcdf66 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -156,7 +156,7 @@ uint64_t LLVMContext::getDiagnosticsMisExpectTolerance() const { } bool LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI() const { - return !pImpl->DiagnosticsHotnessThreshold.hasValue(); + return !pImpl->DiagnosticsHotnessThreshold.has_value(); } remarks::RemarkStreamer *LLVMContext::getMainRemarkStreamer() { diff --git a/llvm/lib/ObjectYAML/COFFEmitter.cpp b/llvm/lib/ObjectYAML/COFFEmitter.cpp index 8c7f7b27a6732..72d7db665d0e7 100644 --- a/llvm/lib/ObjectYAML/COFFEmitter.cpp +++ b/llvm/lib/ObjectYAML/COFFEmitter.cpp @@ -46,7 +46,7 @@ struct COFFParser { COFF::MaxNumberOfSections16; } - bool isPE() const { return Obj.OptionalHeader.hasValue(); } + bool isPE() const { return Obj.OptionalHeader.has_value(); } bool is64Bit() const { return Obj.Header.Machine == COFF::IMAGE_FILE_MACHINE_AMD64 || Obj.Header.Machine == COFF::IMAGE_FILE_MACHINE_ARM64; diff --git a/llvm/lib/Remarks/RemarkLinker.cpp b/llvm/lib/Remarks/RemarkLinker.cpp index 33b408cf5a1b7..cbe966794c497 100644 --- a/llvm/lib/Remarks/RemarkLinker.cpp +++ b/llvm/lib/Remarks/RemarkLinker.cpp @@ -66,7 +66,7 @@ void RemarkLinker::setExternalFilePrependPath(StringRef PrependPathIn) { } // Discard remarks with no source location. -static bool shouldKeepRemark(const Remark &R) { return R.Loc.hasValue(); } +static bool shouldKeepRemark(const Remark &R) { return R.Loc.has_value(); } Error RemarkLinker::link(StringRef Buffer, Optional<Format> RemarkFormat) { if (!RemarkFormat) { diff --git a/llvm/lib/Remarks/RemarkParser.cpp b/llvm/lib/Remarks/RemarkParser.cpp index f36767efcbf4c..fc0612fb76e27 100644 --- a/llvm/lib/Remarks/RemarkParser.cpp +++ b/llvm/lib/Remarks/RemarkParser.cpp @@ -118,7 +118,7 @@ struct CParser { : createRemarkParser(ParserFormat, Buf))) {} void handleError(Error E) { Err.emplace(toString(std::move(E))); } - bool hasError() const { return Err.hasValue(); } + bool hasError() const { return Err.has_value(); } const char *getMessage() const { return Err ? Err->c_str() : nullptr; }; }; } // namespace diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index e9057dcfd832f..ade23f6435384 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -2427,7 +2427,7 @@ static Optional<std::pair<int, int>> parseVectorKind(StringRef Suffix, } static bool isValidVectorKind(StringRef Suffix, RegKind VectorKind) { - return parseVectorKind(Suffix, VectorKind).hasValue(); + return parseVectorKind(Suffix, VectorKind).has_value(); } static unsigned matchSVEDataVectorRegName(StringRef Name) { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp index be1ab5ae51280..5c507ef70a8c1 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp @@ -124,7 +124,7 @@ class SchedGroup { } // Returns true if no more instructions may be added to this group. - bool isFull() { return MaxSize.hasValue() && Collection.size() >= *MaxSize; } + bool isFull() { return MaxSize && Collection.size() >= *MaxSize; } // Returns true if SU can be added to this SchedGroup. bool canAddSU(SUnit &SU, const SIInstrInfo *TII) { diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp index 1a35bda2415dc..d068baf059986 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp @@ -411,7 +411,7 @@ std::string selectHexagonFS(StringRef CPU, StringRef FS) { } static bool isCPUValid(StringRef CPU) { - return Hexagon::getCpu(CPU).hasValue(); + return Hexagon::getCpu(CPU).has_value(); } namespace { diff --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp index 8bbaf4489509d..33ec3ae5012b0 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp @@ -14,7 +14,7 @@ using namespace llvm; static bool shouldReduceSection(GlobalObject &GO) { return GO.hasSection(); } static bool shouldReduceAlign(GlobalObject &GO) { - return GO.getAlign().hasValue(); + return GO.getAlign().has_value(); } static void reduceGOs(Oracle &O, Module &Program) { diff --git a/mlir/include/mlir/Analysis/DataFlowAnalysis.h b/mlir/include/mlir/Analysis/DataFlowAnalysis.h index 6beb64ba0c2e8..883624dfa4805 100644 --- a/mlir/include/mlir/Analysis/DataFlowAnalysis.h +++ b/mlir/include/mlir/Analysis/DataFlowAnalysis.h @@ -120,7 +120,7 @@ class LatticeElement final : public detail::AbstractLatticeElement { } /// Returns true if the value of this lattice hasn't yet been initialized. - bool isUninitialized() const final { return !optimisticValue.hasValue(); } + bool isUninitialized() const final { return !optimisticValue; } /// Join the information contained in the 'rhs' lattice into this /// lattice. Returns if the state of the current lattice changed. diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td index babde8c6082c6..48743eb66f9c2 100644 --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td @@ -202,7 +202,7 @@ def GenericOp : LinalgStructuredBase_Op<"generic", [AttrSizedOperandSegments]> { }; } std::string getLibraryCallName() { - return library_call().hasValue() ? + return library_call() ? library_call()->str() : "op_has_no_registered_library_name"; } diff --git a/mlir/include/mlir/IR/Diagnostics.h b/mlir/include/mlir/IR/Diagnostics.h index 82bd79390e610..f17ce961023da 100644 --- a/mlir/include/mlir/IR/Diagnostics.h +++ b/mlir/include/mlir/IR/Diagnostics.h @@ -377,7 +377,7 @@ class InFlightDiagnostic { /// Returns true if the diagnostic is still active, i.e. it has a live /// diagnostic. - bool isActive() const { return impl.hasValue(); } + bool isActive() const { return impl.has_value(); } /// Returns true if the diagnostic is still in flight to be reported. bool isInFlight() const { return owner; } diff --git a/mlir/include/mlir/Support/StorageUniquer.h b/mlir/include/mlir/Support/StorageUniquer.h index f167fe490f753..122bad1cdedc6 100644 --- a/mlir/include/mlir/Support/StorageUniquer.h +++ b/mlir/include/mlir/Support/StorageUniquer.h @@ -124,7 +124,7 @@ class StorageUniquer { /// Returns true if this allocator allocated the provided object pointer. bool allocated(const void *ptr) { - return allocator.identifyObject(ptr).hasValue(); + return allocator.identifyObject(ptr).has_value(); } private: diff --git a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h index 24e66f3c92d90..bb365faea6907 100644 --- a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h +++ b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h @@ -116,7 +116,7 @@ class InFlightDiagnostic { /// Returns true if the diagnostic is still active, i.e. it has a live /// diagnostic. - bool isActive() const { return impl.hasValue(); } + bool isActive() const { return impl.has_value(); } /// Returns true if the diagnostic is still in flight to be reported. bool isInFlight() const { return owner; } diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index 5357f028287c8..74e81e961455f 100644 --- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp +++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp @@ -183,7 +183,7 @@ convertElementwiseOpToMMA(Operation *op) { /// Return true if the op is supported as elementwise op on MMAMatrix type. static bool elementwiseSupportsMMAMatrixType(Operation *op) { - return convertElementwiseOpToMMA(op).hasValue(); + return convertElementwiseOpToMMA(op).has_value(); } static bool supportsMMaMatrixType(Operation *op, bool useNvGpu) { diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp index f91c9d6cf9f62..e1e66219d0143 100644 --- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp +++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp @@ -1341,7 +1341,7 @@ bool FlatAffineValueConstraints::findId(Value val, unsigned *pos) const { bool FlatAffineValueConstraints::containsId(Value val) const { return llvm::any_of(values, [&](const Optional<Value> &mayBeId) { - return mayBeId.hasValue() && mayBeId.getValue() == val; + return mayBeId && *mayBeId == val; }); } diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp index 4a1be530a17df..01f651d4f57fa 100644 --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -1785,7 +1785,7 @@ void AffineForOp::getSuccessorRegions( /// Returns true if the affine.for has zero iterations in trivial cases. static bool hasTrivialZeroTripCount(AffineForOp op) { Optional<uint64_t> tripCount = getTrivialConstantTripCount(op); - return tripCount.hasValue() && tripCount.getValue() == 0; + return tripCount && *tripCount == 0; } LogicalResult AffineForOp::fold(ArrayRef<Attribute> operands, diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp index c017dc9473f8a..7e6d56aa622e7 100644 --- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp +++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp @@ -315,5 +315,5 @@ bool matcher::operatesOnSuperVectorsOf(Operation &op, // This could be useful information if we wanted to reshape at the level of // the vector type (but we would have to look at the compute and distinguish // between parallel, reduction and possibly other cases. - return ratio.hasValue(); + return ratio.has_value(); } diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index acf39051f0422..2c8c9b0c640e1 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -236,7 +236,7 @@ OpPrintingFlags &OpPrintingFlags::printValueUsers() { /// Return if the given ElementsAttr should be elided. bool OpPrintingFlags::shouldElideElementsAttr(ElementsAttr attr) const { - return elementsAttrElementLimit.hasValue() && + return elementsAttrElementLimit && *elementsAttrElementLimit < int64_t(attr.getNumElements()) && !attr.isa<SplatElementsAttr>(); } diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp index eae636347271a..2a84362635ac6 100644 --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -596,7 +596,7 @@ ArrayRef<RegisteredOperationName> MLIRContext::getRegisteredOperations() { } bool MLIRContext::isOperationRegistered(StringRef name) { - return RegisteredOperationName::lookup(name, this).hasValue(); + return RegisteredOperationName::lookup(name, this).has_value(); } void Dialect::addType(TypeID typeID, AbstractType &&typeInfo) { diff --git a/mlir/lib/Support/Timing.cpp b/mlir/lib/Support/Timing.cpp index 5732710f36c37..b6ab40e13ebf1 100644 --- a/mlir/lib/Support/Timing.cpp +++ b/mlir/lib/Support/Timing.cpp @@ -65,7 +65,7 @@ TimingManager::~TimingManager() = default; /// Get the root timer of this timing manager. Timer TimingManager::getRootTimer() { auto rt = rootTimer(); - return rt.hasValue() ? Timer(*this, rt.getValue()) : Timer(); + return rt ? Timer(*this, *rt) : Timer(); } /// Get the root timer of this timing manager wrapped in a `TimingScope`. diff --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp index 9574e7081beea..de767d6d3a6a1 100644 --- a/mlir/lib/TableGen/Pattern.cpp +++ b/mlir/lib/TableGen/Pattern.cpp @@ -236,7 +236,7 @@ int SymbolInfoMap::SymbolInfo::getStaticValueCount() const { } std::string SymbolInfoMap::SymbolInfo::getVarName(StringRef name) const { - return alternativeName.hasValue() ? alternativeName.getValue() : name.str(); + return alternativeName ? *alternativeName : name.str(); } std::string SymbolInfoMap::SymbolInfo::getVarTypeStr(StringRef name) const { diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp index f6f003ebeb21a..45d345e0a4f51 100644 --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -616,7 +616,7 @@ static ParseResult parseCustomDirectiveOptionalOperandRef( if (parser.parseInteger(operandCount)) return failure(); bool expectedOptionalOperand = operandCount == 0; - return success(expectedOptionalOperand != optOperand.hasValue()); + return success(expectedOptionalOperand != optOperand.has_value()); } //===----------------------------------------------------------------------===// diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp index 6895cb15fcdb5..3b267537f1bf0 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -765,7 +765,7 @@ static const char *const dialectDynamicTypePrinterDispatch = R"( /// functions from their dialect's print/parse methods. void DefGenerator::emitParsePrintDispatch(ArrayRef<AttrOrTypeDef> defs) { if (llvm::none_of(defs, [](const AttrOrTypeDef &def) { - return def.getMnemonic().hasValue(); + return def.getMnemonic().has_value(); })) { return; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits