Don't use Optional::getValue (NFC)
authorKazu Hirata <kazu@google.com>
Tue, 21 Jun 2022 06:35:53 +0000 (23:35 -0700)
committerKazu Hirata <kazu@google.com>
Tue, 21 Jun 2022 06:35:53 +0000 (23:35 -0700)
40 files changed:
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

index 33a7814..f02906e 100644 (file)
@@ -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);
index 4ab962b..3e5a533 100644 (file)
@@ -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;
index 58c2de9..b04ad58 100644 (file)
@@ -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)
index 8cc494a..399e393 100644 (file)
@@ -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;
       }
index d6af020..26ee7ca 100644 (file)
@@ -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);
 }
index f2d8fe5..9985398 100644 (file)
@@ -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:
index cec6075..65e409d 100644 (file)
@@ -176,7 +176,7 @@ private:
         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;
index 316bc7d..e70d457 100644 (file)
@@ -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());
index 2684b0d..824a702 100644 (file)
@@ -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 @@ public:
     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 @@ public:
         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;
       }
     }
index 6d6db82..79c9e1d 100644 (file)
@@ -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
index e35dcf5..adfc42a 100644 (file)
@@ -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);
 }
index 2f8f8f7..f2f2cf6 100644 (file)
@@ -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;
 }
index 3537757..055882c 100644 (file)
@@ -504,7 +504,7 @@ public:
       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);
index de36822..3ac788e 100644 (file)
@@ -2071,7 +2071,7 @@ private:
 
       Fortran::lower::createArrayOfPointerAssignment(
           *this, assign.lhs, assign.rhs, explicitIterSpace, implicitIterSpace,
-          lbounds.getValue(), ubounds, localSymbols, stmtCtx);
+          *lbounds, ubounds, localSymbols, stmtCtx);
       return;
     }
 
index f6ba5f6..d20ea23 100644 (file)
@@ -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; };
 }
index 104859d..d064fe5 100644 (file)
@@ -3998,8 +3998,7 @@ public:
       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 @@ private:
                                       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 @@ private:
         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 @@ private:
 
     // 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 @@ private:
         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);
index 8ab91ea..1127e28 100644 (file)
@@ -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;
index eeda562..ad59bd7 100644 (file)
@@ -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);
index 7375b6c..6157201 100644 (file)
@@ -105,7 +105,7 @@ public:
       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');
index 63a392e..ffa900d 100644 (file)
@@ -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;
index 9ded809..d81ac07 100644 (file)
@@ -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:
index ab54578..117b5f4 100644 (file)
@@ -1750,8 +1750,7 @@ protected:
             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");
       }
index 44b5a7e..db388ab 100644 (file)
@@ -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);
   }
index 38918e4..d80139a 100644 (file)
@@ -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;
     }
index f060d03..2cd490a 100644 (file)
@@ -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);
   }
index 7cdba0c..2cd653f 100644 (file)
@@ -60,7 +60,7 @@ addPartialRegisters(std::vector<DynamicRegisterInfo::Register> &regs,
                     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;
index fd67353..dfa2d4c 100644 (file)
@@ -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,
index 924d5b6..0155ff8 100644 (file)
@@ -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() {
index 6579558..0dc669d 100644 (file)
@@ -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());
   }
index 429c68a..5324a2c 100644 (file)
@@ -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);
index 0fc975b..cbaa1fc 100644 (file)
@@ -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>
index 591d698..9f159f6 100644 (file)
@@ -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
       }
index 4b93ac3..6f137d0 100644 (file)
@@ -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);
     }
   }
 
index 60b8466..c91c111 100644 (file)
@@ -297,7 +297,7 @@ Status ProcessMinidump::DoLoadCore() {
                             GetTarget().GetDebugger().GetID());
     pid = 1;
   }
-  SetID(pid.getValue());
+  SetID(*pid);
 
   return error;
 }
index 4db946c..de98403 100644 (file)
@@ -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;
   }
index 4e586d0..daca398 100644 (file)
@@ -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;
 
index 891ee15..b50ed5c 100644 (file)
@@ -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();
 }
index fd809f2..1bb99c4 100644 (file)
@@ -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
index cfb9009..b7771d5 100644 (file)
@@ -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;
 }
 
index 57c997e..e92055b 100644 (file)
@@ -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) {