Author: Kazu Hirata Date: 2022-06-20T23:35:53-07:00 New Revision: ed8fceaa09cd66324c6efc1070f962731a62e2dc
URL: https://github.com/llvm/llvm-project/commit/ed8fceaa09cd66324c6efc1070f962731a62e2dc DIFF: https://github.com/llvm/llvm-project/commit/ed8fceaa09cd66324c6efc1070f962731a62e2dc.diff LOG: Don't use Optional::getValue (NFC) Added: Modified: clang-tools-extra/clang-doc/BitcodeWriter.cpp clang-tools-extra/clang-doc/HTMLGenerator.cpp clang-tools-extra/clang-doc/MDGenerator.cpp clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp clang-tools-extra/clangd/ConfigYAML.cpp clang-tools-extra/clangd/Diagnostics.cpp clang-tools-extra/clangd/GlobalCompilationDatabase.cpp clang-tools-extra/clangd/index/YAMLSerialization.cpp clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp flang/include/flang/Lower/IterationSpace.h flang/lib/Lower/Bridge.cpp flang/lib/Lower/ComponentPath.cpp flang/lib/Lower/ConvertExpr.cpp flang/lib/Lower/CustomIntrinsicCall.cpp flang/lib/Optimizer/CodeGen/CodeGen.cpp flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp lld/COFF/Driver.cpp lld/ELF/InputFiles.cpp lldb/source/Commands/CommandObjectMemory.cpp lldb/source/Core/IOHandler.cpp lldb/source/Core/ValueObject.cpp lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp lldb/source/Plugins/ABI/X86/ABIX86.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Target/TraceInstructionDumper.cpp lldb/source/Utility/UriParser.cpp polly/lib/Exchange/JSONExporter.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp b/clang-tools-extra/clang-doc/BitcodeWriter.cpp index 33a7814e1f483..f02906e5498a4 100644 --- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp +++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp @@ -478,7 +478,7 @@ void ClangDocBitcodeWriter::emitBlock(const EnumInfo &I) { for (const auto &CI : I.Description) emitBlock(CI); if (I.DefLoc) - emitRecord(I.DefLoc.getValue(), ENUM_DEFLOCATION); + emitRecord(*I.DefLoc, ENUM_DEFLOCATION); for (const auto &L : I.Loc) emitRecord(L, ENUM_LOCATION); emitRecord(I.Scoped, ENUM_SCOPED); @@ -496,7 +496,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo &I) { for (const auto &CI : I.Description) emitBlock(CI); if (I.DefLoc) - emitRecord(I.DefLoc.getValue(), RECORD_DEFLOCATION); + emitRecord(*I.DefLoc, RECORD_DEFLOCATION); for (const auto &L : I.Loc) emitRecord(L, RECORD_LOCATION); emitRecord(I.TagType, RECORD_TAG_TYPE); @@ -543,7 +543,7 @@ void ClangDocBitcodeWriter::emitBlock(const FunctionInfo &I) { emitRecord(I.Access, FUNCTION_ACCESS); emitRecord(I.IsMethod, FUNCTION_IS_METHOD); if (I.DefLoc) - emitRecord(I.DefLoc.getValue(), FUNCTION_DEFLOCATION); + emitRecord(*I.DefLoc, FUNCTION_DEFLOCATION); for (const auto &L : I.Loc) emitRecord(L, FUNCTION_LOCATION); emitBlock(I.Parent, FieldId::F_parent); diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp index 4ab962be7864d..3e5a5331b7906 100644 --- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp +++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp @@ -312,7 +312,7 @@ genReference(const Reference &Type, StringRef CurrentDirectory, if (!JumpToSection) return std::make_unique<TextNode>(Type.Name); else - return genLink(Type.Name, "#" + JumpToSection.getValue()); + return genLink(Type.Name, "#" + *JumpToSection); } llvm::SmallString<64> Path = Type.getRelativeFilePath(CurrentDirectory); llvm::sys::path::append(Path, Type.getFileBaseName() + ".html"); @@ -320,7 +320,7 @@ genReference(const Reference &Type, StringRef CurrentDirectory, // Paths in HTML must be in posix-style llvm::sys::path::native(Path, llvm::sys::path::Style::posix); if (JumpToSection) - Path += ("#" + JumpToSection.getValue()).str(); + Path += ("#" + *JumpToSection).str(); return genLink(Type.Name, Path); } @@ -440,7 +440,7 @@ writeFileDefinition(const Location &L, return std::make_unique<TagNode>( HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) + " of file " + L.Filename); - SmallString<128> FileURL(RepositoryUrl.getValue()); + SmallString<128> FileURL(*RepositoryUrl); llvm::sys::path::append(FileURL, llvm::sys::path::Style::posix, L.Filename); auto Node = std::make_unique<TagNode>(HTMLTag::TAG_P); Node->Children.emplace_back(std::make_unique<TextNode>("Defined at line ")); @@ -580,7 +580,7 @@ genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList) { SpanBody->Children.emplace_back(genReference(Index, InfoPath)); else SpanBody->Children.emplace_back( - genReference(Index, InfoPath, Index.JumpToSection.getValue().str())); + genReference(Index, InfoPath, Index.JumpToSection->str())); } if (Index.Children.empty()) return Out; diff --git a/clang-tools-extra/clang-doc/MDGenerator.cpp b/clang-tools-extra/clang-doc/MDGenerator.cpp index 58c2de96b298c..b04ad58b3c521 100644 --- a/clang-tools-extra/clang-doc/MDGenerator.cpp +++ b/clang-tools-extra/clang-doc/MDGenerator.cpp @@ -58,7 +58,7 @@ static void writeFileDefinition(const ClangDocContext &CDCtx, const Location &L, << "*"; } else { OS << "*Defined at [" << L.Filename << "#" << std::to_string(L.LineNumber) - << "](" << StringRef{CDCtx.RepositoryUrl.getValue()} + << "](" << StringRef{*CDCtx.RepositoryUrl} << llvm::sys::path::relative_path(L.Filename) << "#" << std::to_string(L.LineNumber) << ")" << "*"; @@ -139,7 +139,7 @@ static void genMarkdown(const ClangDocContext &CDCtx, const EnumInfo &I, Members << "| " << N << " |\n"; writeLine(Members.str(), OS); if (I.DefLoc) - writeFileDefinition(CDCtx, I.DefLoc.getValue(), OS); + writeFileDefinition(CDCtx, *I.DefLoc, OS); for (const auto &C : I.Description) writeDescription(C, OS); @@ -167,7 +167,7 @@ static void genMarkdown(const ClangDocContext &CDCtx, const FunctionInfo &I, Stream.str() + ")"), OS); if (I.DefLoc) - writeFileDefinition(CDCtx, I.DefLoc.getValue(), OS); + writeFileDefinition(CDCtx, *I.DefLoc, OS); for (const auto &C : I.Description) writeDescription(C, OS); @@ -227,7 +227,7 @@ static void genMarkdown(const ClangDocContext &CDCtx, const RecordInfo &I, llvm::raw_ostream &OS) { writeHeader(getTagType(I.TagType) + " " + I.Name, 1, OS); if (I.DefLoc) - writeFileDefinition(CDCtx, I.DefLoc.getValue(), OS); + writeFileDefinition(CDCtx, *I.DefLoc, OS); if (!I.Description.empty()) { for (const auto &C : I.Description) diff --git a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp index 8cc494ac10910..399e393a36fdd 100644 --- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp @@ -1328,7 +1328,7 @@ approximateImplicitConversion(const TheCheck &Check, QualType LType, if (AfterFirstStdConv) { LLVM_DEBUG(llvm::dbgs() << "--- approximateImplicitConversion. Standard " "Pre-Conversion found!\n"); - ImplicitSeq.AfterFirstStandard = AfterFirstStdConv.getValue(); + ImplicitSeq.AfterFirstStandard = *AfterFirstStdConv; WorkType = ImplicitSeq.AfterFirstStandard; } @@ -1348,7 +1348,7 @@ approximateImplicitConversion(const TheCheck &Check, QualType LType, if (ConversionOperatorResult) { LLVM_DEBUG(llvm::dbgs() << "--- approximateImplicitConversion. Found " "conversion operator.\n"); - ImplicitSeq.update(ConversionOperatorResult.getValue()); + ImplicitSeq.update(*ConversionOperatorResult); WorkType = ImplicitSeq.getTypeAfterUserDefinedConversion(); FoundConversionOperator = true; } @@ -1363,7 +1363,7 @@ approximateImplicitConversion(const TheCheck &Check, QualType LType, if (ConvCtorResult) { LLVM_DEBUG(llvm::dbgs() << "--- approximateImplicitConversion. Found " "converting constructor.\n"); - ImplicitSeq.update(ConvCtorResult.getValue()); + ImplicitSeq.update(*ConvCtorResult); WorkType = ImplicitSeq.getTypeAfterUserDefinedConversion(); FoundConvertingCtor = true; } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp index d6af020326eb0..26ee7ca6eca57 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp @@ -59,9 +59,7 @@ getVirtualKeywordRange(const CXXDestructorDecl &Destructor, /// Range ends with \c StartOfNextToken so that any whitespace after \c /// virtual is included. SourceLocation StartOfNextToken = - Lexer::findNextToken(VirtualEndLoc, SM, LangOpts) - .getValue() - .getLocation(); + Lexer::findNextToken(VirtualEndLoc, SM, LangOpts)->getLocation(); return CharSourceRange::getCharRange(VirtualBeginLoc, StartOfNextToken); } diff --git a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp index f2d8fe51707bb..99853985d931f 100644 --- a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp @@ -552,7 +552,7 @@ void SuspiciousCallArgumentCheck::storeOptions( SmallString<32> Key = HeuristicToString[Idx]; Key.append(BK == BoundKind::DissimilarBelow ? "DissimilarBelow" : "SimilarAbove"); - Options.store(Opts, Key, getBound(H, BK).getValue()); + Options.store(Opts, Key, *getBound(H, BK)); }; for (std::size_t Idx = 0; Idx < HeuristicCount; ++Idx) { @@ -783,7 +783,7 @@ bool SuspiciousCallArgumentCheck::areNamesSimilar(StringRef Arg, BoundKind BK) const { int8_t Threshold = -1; if (Optional<int8_t> GotBound = getBound(H, BK)) - Threshold = GotBound.getValue(); + Threshold = *GotBound; switch (H) { case Heuristic::Equality: diff --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp index cec60756a3431..65e409d025b0a 100644 --- a/clang-tools-extra/clangd/ConfigYAML.cpp +++ b/clang-tools-extra/clangd/ConfigYAML.cpp @@ -176,7 +176,7 @@ class Parser { parse(External, N); } else if (N.getType() == Node::NK_Scalar || N.getType() == Node::NK_BlockScalar) { - parse(External, scalarValue(N, "External").getValue()); + parse(External, *scalarValue(N, "External")); } else { error("External must be either a scalar or a mapping.", N); return; diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp index 316bc7d1ac666..e70d45769fe46 100644 --- a/clang-tools-extra/clangd/Diagnostics.cpp +++ b/clang-tools-extra/clangd/Diagnostics.cpp @@ -196,7 +196,7 @@ bool tryMoveToMainFile(Diag &D, FullSourceLoc DiagLoc) { return false; // Add a note that will point to real diagnostic. - auto FE = SM.getFileEntryRefForID(SM.getFileID(DiagLoc)).getValue(); + auto FE = *SM.getFileEntryRefForID(SM.getFileID(DiagLoc)); D.Notes.emplace(D.Notes.begin()); Note &N = D.Notes.front(); N.AbsFile = std::string(FE.getFileEntry().tryGetRealPathName()); diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp index 2684b0de53bdb..824a7027b4d89 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -407,7 +407,7 @@ DirectoryBasedGlobalCompilationDatabase::lookupCDB( std::string Storage; std::vector<llvm::StringRef> SearchDirs; if (Opts.CompileCommandsDir) // FIXME: unify this case with config. - SearchDirs = {Opts.CompileCommandsDir.getValue()}; + SearchDirs = {*Opts.CompileCommandsDir}; else { WithContext WithProvidedContext(Opts.ContextProvider(Request.FileName)); const auto &Spec = Config::current().CompileFlags.CDBSearch; @@ -415,7 +415,7 @@ DirectoryBasedGlobalCompilationDatabase::lookupCDB( case Config::CDBSearchSpec::NoCDBSearch: return llvm::None; case Config::CDBSearchSpec::FixedDir: - Storage = Spec.FixedCDBPath.getValue(); + Storage = *Spec.FixedCDBPath; SearchDirs = {Storage}; break; case Config::CDBSearchSpec::Ancestors: @@ -672,8 +672,7 @@ class DirectoryBasedGlobalCompilationDatabase::BroadcastThread::Filter { std::vector<SearchPath> SearchPaths(AllFiles.size()); for (unsigned I = 0; I < AllFiles.size(); ++I) { if (Parent.Opts.CompileCommandsDir) { // FIXME: unify with config - SearchPaths[I].setPointer( - &Dirs[Parent.Opts.CompileCommandsDir.getValue()]); + SearchPaths[I].setPointer(&Dirs[*Parent.Opts.CompileCommandsDir]); continue; } if (ExitEarly()) // loading config may be slow @@ -689,7 +688,7 @@ class DirectoryBasedGlobalCompilationDatabase::BroadcastThread::Filter { SearchPaths[I].setPointer(addParents(AllFiles[I])); break; case Config::CDBSearchSpec::FixedDir: - SearchPaths[I].setPointer(&Dirs[Spec.FixedCDBPath.getValue()]); + SearchPaths[I].setPointer(&Dirs[*Spec.FixedCDBPath]); break; } } diff --git a/clang-tools-extra/clangd/index/YAMLSerialization.cpp b/clang-tools-extra/clangd/index/YAMLSerialization.cpp index 6d6db8261b6c3..79c9e1dfd9918 100644 --- a/clang-tools-extra/clangd/index/YAMLSerialization.cpp +++ b/clang-tools-extra/clangd/index/YAMLSerialization.cpp @@ -446,7 +446,7 @@ llvm::Expected<IndexFileIn> readYAML(llvm::StringRef Data, if (Variant.Relation) Relations.insert(*Variant.Relation); if (Variant.Source) { - auto &IGN = Variant.Source.getValue(); + auto &IGN = *Variant.Source; auto Entry = Sources.try_emplace(IGN.URI).first; Entry->getValue() = std::move(IGN); // Fixup refs to refer to map keys which will live on diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp index e35dcf55a4455..adfc42a851b02 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp @@ -779,7 +779,7 @@ llvm::Expected<NewFunction> getExtractedFunction(ExtractionZone &ExtZone, toHalfOpenFileRange(SM, LangOpts, FirstOriginalDecl->getSourceRange()); if (!DeclPos) return error("Declaration is inside a macro"); - ExtractedFunc.ForwardDeclarationPoint = DeclPos.getValue().getBegin(); + ExtractedFunc.ForwardDeclarationPoint = DeclPos->getBegin(); ExtractedFunc.ForwardDeclarationSyntacticDC = ExtractedFunc.SemanticDC; } @@ -834,7 +834,7 @@ tooling::Replacement createForwardDeclaration(const NewFunction &ExtractedFunc, std::string FunctionDecl = ExtractedFunc.renderDeclaration( ForwardDeclaration, *ExtractedFunc.SemanticDC, *ExtractedFunc.ForwardDeclarationSyntacticDC, SM); - SourceLocation DeclPoint = ExtractedFunc.ForwardDeclarationPoint.getValue(); + SourceLocation DeclPoint = *ExtractedFunc.ForwardDeclarationPoint; return tooling::Replacement(SM, DeclPoint, 0, FunctionDecl); } diff --git a/clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp b/clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp index 2f8f8f7863409..f2f2cf674fa7a 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp @@ -45,7 +45,7 @@ static std::string getTypeStr(const QualType &OrigT, const Decl &D, // `nullable` form for the method parameter. if (PropertyAttributes & ObjCPropertyAttribute::kind_nullability) { if (auto Kind = AttributedType::stripOuterNullability(T)) { - switch (Kind.getValue()) { + switch (*Kind) { case NullabilityKind::Nullable: Prefix = "nullable "; break; @@ -238,7 +238,7 @@ ObjCMemberwiseInitializer::paramsForSelection(const SelectionTree::Node *N) { // Base case: selected a single ivar or property. if (const auto *D = N->ASTNode.get<Decl>()) { if (auto Param = MethodParameter::parameterFor(*D)) { - Params.push_back(Param.getValue()); + Params.push_back(*Param); return Params; } } @@ -256,7 +256,7 @@ ObjCMemberwiseInitializer::paramsForSelection(const SelectionTree::Node *N) { continue; if (auto P = MethodParameter::parameterFor(*D)) if (Names.insert(P->Name).second) - Params.push_back(P.getValue()); + Params.push_back(*P); } return Params; } diff --git a/flang/include/flang/Lower/IterationSpace.h b/flang/include/flang/Lower/IterationSpace.h index 35377579c2a23..055882c5770d1 100644 --- a/flang/include/flang/Lower/IterationSpace.h +++ b/flang/include/flang/Lower/IterationSpace.h @@ -504,7 +504,7 @@ class ExplicitIterSpace { loopCleanup = fn; return; } - std::function<void(fir::FirOpBuilder &)> oldFn = loopCleanup.getValue(); + std::function<void(fir::FirOpBuilder &)> oldFn = *loopCleanup; loopCleanup = [=](fir::FirOpBuilder &builder) { oldFn(builder); fn(builder); diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index de36822e81d3d..3ac788e0e6945 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -2071,7 +2071,7 @@ class FirConverter : public Fortran::lower::AbstractConverter { Fortran::lower::createArrayOfPointerAssignment( *this, assign.lhs, assign.rhs, explicitIterSpace, implicitIterSpace, - lbounds.getValue(), ubounds, localSymbols, stmtCtx); + *lbounds, ubounds, localSymbols, stmtCtx); return; } diff --git a/flang/lib/Lower/ComponentPath.cpp b/flang/lib/Lower/ComponentPath.cpp index f6ba5f6c0769b..d20ea23153102 100644 --- a/flang/lib/Lower/ComponentPath.cpp +++ b/flang/lib/Lower/ComponentPath.cpp @@ -57,6 +57,5 @@ void Fortran::lower::ComponentPath::setPC(bool isImplicit) { Fortran::lower::ComponentPath::ExtendRefFunc Fortran::lower::ComponentPath::getExtendCoorRef() const { - return hasExtendCoorRef() ? extendCoorRef.getValue() - : [](mlir::Value v) { return v; }; + return hasExtendCoorRef() ? *extendCoorRef : [](mlir::Value v) { return v; }; } diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp index 104859d448817..d064fe59e8807 100644 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -3998,8 +3998,7 @@ class ArrayExprLowering { std::size_t offset = explicitSpace->argPosition(oldInnerArg); explicitSpace->setInnerArg(offset, fir::getBase(lexv)); fir::ExtendedValue exv = arrayModifyToExv( - builder, loc, explicitSpace->getLhsLoad(0).getValue(), - modifyOp.getResult(0)); + builder, loc, *explicitSpace->getLhsLoad(0), modifyOp.getResult(0)); genScalarUserDefinedAssignmentCall(builder, loc, userAssignment, exv, elementalExv); } else { @@ -4149,7 +4148,7 @@ class ArrayExprLowering { mlir::Value origVal) { mlir::Value val = builder.createConvert(loc, eleTy, origVal); if (isBoundsSpec()) { - auto lbs = lbounds.getValue(); + auto lbs = *lbounds; if (lbs.size() > 0) { // Rebox the value with user-specified shift. auto shiftTy = fir::ShiftType::get(eleTy.getContext(), lbs.size()); @@ -6414,7 +6413,7 @@ class ArrayExprLowering { charLen = builder.createTemporary(loc, builder.getI64Type()); mlir::Value castLen = builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv)); - builder.create<fir::StoreOp>(loc, castLen, charLen.getValue()); + builder.create<fir::StoreOp>(loc, castLen, *charLen); } } stmtCtx.finalize(/*popScope=*/true); @@ -6428,7 +6427,7 @@ class ArrayExprLowering { // Convert to extended value. if (fir::isa_char(seqTy.getEleTy())) { - auto len = builder.create<fir::LoadOp>(loc, charLen.getValue()); + auto len = builder.create<fir::LoadOp>(loc, *charLen); return {fir::CharArrayBoxValue{mem, len, extents}, /*needCopy=*/false}; } return {fir::ArrayBoxValue{mem, extents}, /*needCopy=*/false}; @@ -6496,7 +6495,7 @@ class ArrayExprLowering { charLen = builder.createTemporary(loc, builder.getI64Type()); mlir::Value castLen = builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv)); - builder.create<fir::StoreOp>(loc, castLen, charLen.getValue()); + builder.create<fir::StoreOp>(loc, castLen, *charLen); } } mem = builder.createConvert(loc, fir::HeapType::get(resTy), mem); diff --git a/flang/lib/Lower/CustomIntrinsicCall.cpp b/flang/lib/Lower/CustomIntrinsicCall.cpp index 8ab91ea70f8f5..1127e2841b04f 100644 --- a/flang/lib/Lower/CustomIntrinsicCall.cpp +++ b/flang/lib/Lower/CustomIntrinsicCall.cpp @@ -89,7 +89,7 @@ static void prepareMinOrMaxArguments( const Fortran::lower::OperandPrepare &prepareOtherArgument, Fortran::lower::AbstractConverter &converter) { assert(retTy && "MIN and MAX must have a return type"); - mlir::Type resultType = retTy.getValue(); + mlir::Type resultType = *retTy; mlir::Location loc = converter.getCurrentLocation(); if (fir::isa_char(resultType)) TODO(loc, @@ -123,7 +123,7 @@ lowerMinOrMax(fir::FirOpBuilder &builder, mlir::Location loc, assert(numOperands >= 2 && !isPresentCheck(0) && !isPresentCheck(1) && "min/max must have at least two non-optional args"); assert(retTy && "MIN and MAX must have a return type"); - mlir::Type resultType = retTy.getValue(); + mlir::Type resultType = *retTy; llvm::SmallVector<fir::ExtendedValue> args; args.push_back(getOperand(0)); args.push_back(getOperand(1)); @@ -136,7 +136,7 @@ lowerMinOrMax(fir::FirOpBuilder &builder, mlir::Location loc, // Argument is dynamically optional. extremum = builder - .genIfOp(loc, {resultType}, isPresentRuntimeCheck.getValue(), + .genIfOp(loc, {resultType}, *isPresentRuntimeCheck, /*withElseRegion=*/true) .genThen([&]() { llvm::SmallVector<fir::ExtendedValue> args; diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index eeda562094943..ad59bd734fd05 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -2818,7 +2818,7 @@ struct SelectCaseOpConversion : public FIROpConversion<fir::SelectCaseOp> { caseOp.getSuccessorOperands(adaptor.getOperands(), t); llvm::Optional<mlir::ValueRange> cmpOps = *caseOp.getCompareOperands(adaptor.getOperands(), t); - mlir::Value caseArg = *(cmpOps.getValue().begin()); + mlir::Value caseArg = *(cmpOps->begin()); mlir::Attribute attr = cases[t]; if (attr.isa<fir::PointIntervalAttr>()) { auto cmp = rewriter.create<mlir::LLVM::ICmpOp>( @@ -2847,7 +2847,7 @@ struct SelectCaseOpConversion : public FIROpConversion<fir::SelectCaseOp> { rewriter.setInsertionPointToEnd(thisBlock); rewriter.create<mlir::LLVM::CondBrOp>(loc, cmp, newBlock1, newBlock2); rewriter.setInsertionPointToEnd(newBlock1); - mlir::Value caseArg0 = *(cmpOps.getValue().begin() + 1); + mlir::Value caseArg0 = *(cmpOps->begin() + 1); auto cmp0 = rewriter.create<mlir::LLVM::ICmpOp>( loc, mlir::LLVM::ICmpPredicate::sle, selector, caseArg0); genCondBrOp(loc, cmp0, dest, destOps, rewriter, newBlock2); diff --git a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp index 7375b6c6bbe32..61572017e9bd7 100644 --- a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp +++ b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp @@ -105,7 +105,7 @@ class MemDataFlowOpt : public fir::MemRefDataFlowOptBase<MemDataFlowOpt> { auto maybeStore = lsf.findStoreToForward( loadOp, getSpecificUsers<fir::StoreOp>(loadOp.getMemref())); if (maybeStore) { - auto storeOp = maybeStore.getValue(); + auto storeOp = *maybeStore; LLVM_DEBUG(llvm::dbgs() << "FlangMemDataFlowOpt: In " << f.getName() << " erasing load " << loadOp << " with value from " << storeOp << '\n'); diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 63a392e2970d5..ffa900d42f2de 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1729,7 +1729,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) { if (!icfLevel) icfLevel = doGC ? ICFLevel::All : ICFLevel::None; config->doGC = doGC; - config->doICF = icfLevel.getValue(); + config->doICF = *icfLevel; config->tailMerge = (tailMerge == 1 && config->doICF != ICFLevel::None) || tailMerge == 2; config->ltoDebugPassManager = ltoDebugPM; diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 9ded809fdefe3..d81ac07e0f122 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -705,7 +705,7 @@ static void updateARMVFPArgs(const ARMAttributeParser &attributes, // as a clash. return; - unsigned vfpArgs = attr.getValue(); + unsigned vfpArgs = *attr; ARMVFPArgKind arg; switch (vfpArgs) { case ARMBuildAttrs::BaseAAPCS: diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index ab54578898a17..117b5f468d4d7 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1750,8 +1750,7 @@ class CommandObjectMemoryRegion : public CommandObjectParsed { result.AppendMessageWithFormat(", "); else print_comma = true; - result.AppendMessageWithFormat("0x%" PRIx64, - dirty_page_list.getValue()[i]); + result.AppendMessageWithFormat("0x%" PRIx64, (*dirty_page_list)[i]); } result.AppendMessageWithFormat(".\n"); } diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index 44b5a7e9c8a40..db388ab482750 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -436,7 +436,7 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) { } if (got_line) { - line = got_line.getValue(); + line = *got_line; if (m_data_recorder) m_data_recorder->Record(line, true); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 38918e4d9a921..d80139ab18400 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -265,7 +265,7 @@ CompilerType ValueObject::MaybeCalculateCompleteType() { process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) { if (llvm::Optional<CompilerType> complete_type = runtime->GetRuntimeType(compiler_type)) { - m_override_type = complete_type.getValue(); + m_override_type = *complete_type; if (m_override_type.IsValid()) return m_override_type; } diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp index f060d0362c679..2cd490ad0c75d 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp @@ -80,8 +80,7 @@ static void addPartialRegisters( uint32_t partial_reg_size, lldb::Encoding encoding, lldb::Format format) { for (auto it : llvm::enumerate(full_reg_indices)) { llvm::Optional<uint32_t> full_reg_index = it.value(); - if (!full_reg_index || - regs[full_reg_index.getValue()].byte_size != full_reg_size) + if (!full_reg_index || regs[*full_reg_index].byte_size != full_reg_size) return; lldb_private::DynamicRegisterInfo::Register partial_reg{ @@ -97,7 +96,7 @@ static void addPartialRegisters( LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, - {full_reg_index.getValue()}, + {*full_reg_index}, {}}; addSupplementaryRegister(regs, partial_reg); } diff --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp b/lldb/source/Plugins/ABI/X86/ABIX86.cpp index 7cdba0c5fe573..2cd653fe2c5e8 100644 --- a/lldb/source/Plugins/ABI/X86/ABIX86.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIX86.cpp @@ -60,7 +60,7 @@ addPartialRegisters(std::vector<DynamicRegisterInfo::Register> ®s, uint32_t subreg_size, uint32_t subreg_offset = 0) { for (const RegData *subreg : subregs) { assert(subreg); - uint32_t base_index = subreg->base_index.getValue(); + uint32_t base_index = *subreg->base_index; DynamicRegisterInfo::Register &full_reg = regs[base_index]; if (full_reg.byte_size != base_size) continue; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index fd673535edeeb..dfa2d4c05126d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -333,7 +333,7 @@ uint32_t AppleObjCRuntime::GetFoundationVersion() { } return LLDB_INVALID_MODULE_VERSION; } else - return m_Foundation_major.getValue(); + return *m_Foundation_major; } void AppleObjCRuntime::GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 924d5b694ca68..0155ff8901b8a 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -6073,7 +6073,7 @@ llvm::VersionTuple ObjectFileMachO::GetSDKVersion() { m_sdk_versions = llvm::VersionTuple(); } - return m_sdk_versions.getValue(); + return *m_sdk_versions; } bool ObjectFileMachO::GetIsDynamicLinkEditor() { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 65795581b1c90..0dc669d7e8c73 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -117,7 +117,7 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) { sdk_path.Printf("%s/Developer/Platforms/MacOSX.platform/Developer/" "SDKs/MacOSX%u.%u.sdk", fspec.GetPath().c_str(), version.getMajor(), - version.getMinor().getValue()); + *version.getMinor()); if (FileSystem::Instance().Exists(fspec)) return ConstString(sdk_path.GetString()); } diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 429c68a9dc78e..5324a2c0bf51e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -849,7 +849,7 @@ bool NativeProcessLinux::MonitorClone(NativeThreadLinux &parent, auto tgid_ret = getPIDForTID(child_pid); if (tgid_ret != child_pid) { // A new thread should have PGID matching our process' PID. - assert(!tgid_ret || tgid_ret.getValue() == GetID()); + assert(!tgid_ret || *tgid_ret == GetID()); NativeThreadLinux &child_thread = AddThread(child_pid, /*resume*/ true); ThreadWasCreated(child_thread); diff --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp index 0fc975b89f229..cbaa1fc7a2b12 100644 --- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp +++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp @@ -39,7 +39,7 @@ lldb::addr_t NativeProcessELF::GetSharedLibraryInfoAddress() { llvm::ELF::Elf32_Dyn>(); } - return m_shared_library_info_addr.getValue(); + return *m_shared_library_info_addr; } template <typename ELF_EHDR, typename ELF_PHDR, typename ELF_DYN> diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 591d6988be576..9f159f6188997 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -2865,7 +2865,7 @@ GDBRemoteCommunicationClient::GetCurrentProcessAndThreadIDs( if (!pid_tid) break; - ids.push_back(pid_tid.getValue()); + ids.push_back(*pid_tid); ch = response.GetChar(); // Skip the command separator } while (ch == ','); // Make sure we got a comma separator } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 4b93ac35eb591..6f137d09fee4f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -244,7 +244,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer( else if (name.equals("port")) { // Make the Optional valid so we can use its value port = 0; - value.getAsInteger(0, port.getValue()); + value.getAsInteger(0, *port); } } diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 60b8466b74a5c..c91c111d8df3a 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -297,7 +297,7 @@ Status ProcessMinidump::DoLoadCore() { GetTarget().GetDebugger().GetID()); pid = 1; } - SetID(pid.getValue()); + SetID(*pid); return error; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp index 4db946c41221e..de98403421e0b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp @@ -107,7 +107,7 @@ bool NameToDIE::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, if (str.empty()) return false; if (llvm::Optional<DIERef> die_ref = DIERef::Decode(data, offset_ptr)) - m_map.Append(ConstString(str), die_ref.getValue()); + m_map.Append(ConstString(str), *die_ref); else return false; } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp index 4e586d0825d9c..daca3988f7646 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -560,7 +560,7 @@ clang::DeclContext *PdbAstBuilder::GetOrCreateDeclContextForUid(PdbSymUid uid) { auto option = GetOrCreateDeclForUid(uid); if (!option) return nullptr; - clang::Decl *decl = FromCompilerDecl(option.getValue()); + clang::Decl *decl = FromCompilerDecl(*option); if (!decl) return nullptr; diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index 891ee15af9477..b50ed5cc3c705 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -987,7 +987,7 @@ uint32_t SymbolFileNativePDB::ResolveSymbolContext( llvm::Optional<uint16_t> modi = m_index->GetModuleIndexForVa(file_addr); if (!modi) return 0; - CompUnitSP cu_sp = GetCompileUnitAtIndex(modi.getValue()); + CompUnitSP cu_sp = GetCompileUnitAtIndex(*modi); if (!cu_sp) return 0; @@ -1861,7 +1861,7 @@ size_t SymbolFileNativePDB::ParseVariablesForContext(const SymbolContext &sc) { CompilerDecl SymbolFileNativePDB::GetDeclForUID(lldb::user_id_t uid) { if (auto decl = m_ast->GetOrCreateDeclForUid(uid)) - return decl.getValue(); + return *decl; else return CompilerDecl(); } diff --git a/lldb/source/Target/TraceInstructionDumper.cpp b/lldb/source/Target/TraceInstructionDumper.cpp index fd809f263ea25..1bb99c41ef722 100644 --- a/lldb/source/Target/TraceInstructionDumper.cpp +++ b/lldb/source/Target/TraceInstructionDumper.cpp @@ -37,7 +37,7 @@ TraceInstructionDumper::TraceInstructionDumper( m_cursor_up->SetForwards(m_options.forwards); if (m_options.skip) { - uint64_t to_skip = m_options.skip.getValue(); + uint64_t to_skip = *m_options.skip; if (m_cursor_up->Seek((m_options.forwards ? 1 : -1) * to_skip, TraceCursor::SeekType::Current) < to_skip) { // This happens when the skip value was more than the number of diff --git a/lldb/source/Utility/UriParser.cpp b/lldb/source/Utility/UriParser.cpp index cfb9009898d20..b7771d57aefdb 100644 --- a/lldb/source/Utility/UriParser.cpp +++ b/lldb/source/Utility/UriParser.cpp @@ -20,7 +20,7 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, const URI &U) { OS << U.scheme << "://[" << U.hostname << ']'; if (U.port) - OS << ':' << U.port.getValue(); + OS << ':' << *U.port; return OS << U.path; } diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index 57c997e27d6ea..e92055bfb9af6 100644 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -397,7 +397,7 @@ importAccesses(Scop &S, const json::Object &JScop, const DataLayout &DL, << StatementIdx << ".\n"; return false; } - StringRef Accesses = JsonMemoryAccess->getString("relation").getValue(); + StringRef Accesses = *JsonMemoryAccess->getString("relation"); isl_map *NewAccessMap = isl_map_read_from_str(S.getIslCtx().get(), Accesses.str().c_str()); @@ -566,7 +566,7 @@ static bool areArraysEqual(ScopArrayInfo *SAI, const json::Object &Array) { return false; } - if (SAI->getName() != Array.getString("name").getValue()) + if (SAI->getName() != *Array.getString("name")) return false; if (SAI->getNumberOfDimensions() != Array.getArray("sizes")->size()) @@ -662,7 +662,7 @@ static bool importArrays(Scop &S, const json::Object &JScop) { const json::Array &SizesArray = *Array.getArray("sizes"); std::vector<unsigned> DimSizes; for (unsigned i = 0; i < SizesArray.size(); i++) { - auto Size = std::stoi(SizesArray[i].getAsString().getValue().str()); + auto Size = std::stoi(SizesArray[i].getAsString()->str()); // Check if the size if positive. if (Size <= 0) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits