From 97afce08cbbb1390cf8ddab8bf398f3ff5b39676 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 25 Jun 2022 22:26:24 -0700 Subject: [PATCH] [clang] Don't use Optional::hasValue (NFC) This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only. --- clang/include/clang/Analysis/PathDiagnostic.h | 4 ++-- clang/include/clang/Sema/Sema.h | 16 ++++++++-------- .../Core/PathSensitive/SMTConstraintManager.h | 2 +- clang/lib/AST/AttrImpl.cpp | 6 +++--- clang/lib/ASTMatchers/Dynamic/Parser.cpp | 4 ++-- clang/lib/ASTMatchers/Dynamic/Registry.cpp | 4 ++-- clang/lib/Analysis/BodyFarm.cpp | 4 ++-- .../lib/Analysis/FlowSensitive/ControlFlowContext.cpp | 2 +- .../FlowSensitive/TypeErasedDataflowAnalysis.cpp | 10 +++++----- clang/lib/Analysis/PathDiagnostic.cpp | 4 ++-- clang/lib/Analysis/UninitializedValues.cpp | 4 ++-- clang/lib/Basic/Targets/RISCV.cpp | 2 +- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++-- clang/lib/Driver/ToolChains/AVR.cpp | 2 +- clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 6 +++--- clang/lib/Frontend/CompilerInvocation.cpp | 8 ++++---- clang/lib/Frontend/InitPreprocessor.cpp | 4 ++-- clang/lib/Lex/DependencyDirectivesScanner.cpp | 2 +- clang/lib/Lex/MacroInfo.cpp | 2 +- clang/lib/Lex/PPMacroExpansion.cpp | 2 +- clang/lib/Lex/PreprocessingRecord.cpp | 2 +- clang/lib/Parse/ParseOpenMP.cpp | 2 +- clang/lib/Sema/SemaCUDA.cpp | 2 +- clang/lib/Sema/SemaChecking.cpp | 2 +- clang/lib/Sema/SemaDecl.cpp | 6 +++--- clang/lib/Sema/SemaDeclAttr.cpp | 4 ++-- clang/lib/Sema/SemaExprCXX.cpp | 4 ++-- clang/lib/Sema/SemaOpenMP.cpp | 18 +++++++++--------- .../Checkers/BasicObjCFoundationChecks.cpp | 2 +- clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp | 4 ++-- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 8 ++++---- clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp | 6 +++--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 4 ++-- .../StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp | 2 +- clang/lib/Support/RISCVVIntrinsicUtils.cpp | 4 ++-- clang/lib/Tooling/Core/Replacement.cpp | 4 ++-- clang/tools/driver/driver.cpp | 4 ++-- clang/tools/libclang/CIndex.cpp | 12 ++++++------ .../DirectoryWatcher/DirectoryWatcherTest.cpp | 6 +++--- clang/unittests/Tooling/RefactoringTest.cpp | 8 ++++---- clang/utils/TableGen/RISCVVEmitter.cpp | 10 +++++----- 42 files changed, 104 insertions(+), 104 deletions(-) diff --git a/clang/include/clang/Analysis/PathDiagnostic.h b/clang/include/clang/Analysis/PathDiagnostic.h index 47cb549..9877f1e 100644 --- a/clang/include/clang/Analysis/PathDiagnostic.h +++ b/clang/include/clang/Analysis/PathDiagnostic.h @@ -544,8 +544,8 @@ public: /// flag may have been previously set, at which point it will not /// be reset unless one specifies to do so. void setPrunable(bool isPrunable, bool override = false) { - if (IsPrunable.hasValue() && !override) - return; + if (IsPrunable && !override) + return; IsPrunable = isPrunable; } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index ba4d0bb..8b8b1b2 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1766,9 +1766,9 @@ public: template friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) { - if (Diag.ImmediateDiag.hasValue()) + if (Diag.ImmediateDiag) *Diag.ImmediateDiag << Value; - else if (Diag.PartialDiagId.hasValue()) + else if (Diag.PartialDiagId) Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second << Value; return Diag; @@ -1780,26 +1780,26 @@ public: template ::value>::type> const SemaDiagnosticBuilder &operator<<(T &&V) const { - if (ImmediateDiag.hasValue()) + if (ImmediateDiag) *ImmediateDiag << std::move(V); - else if (PartialDiagId.hasValue()) + else if (PartialDiagId) S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V); return *this; } friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const PartialDiagnostic &PD) { - if (Diag.ImmediateDiag.hasValue()) + if (Diag.ImmediateDiag) PD.Emit(*Diag.ImmediateDiag); - else if (Diag.PartialDiagId.hasValue()) + else if (Diag.PartialDiagId) Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD; return Diag; } void AddFixItHint(const FixItHint &Hint) const { - if (ImmediateDiag.hasValue()) + if (ImmediateDiag) ImmediateDiag->AddFixItHint(Hint); - else if (PartialDiagId.hasValue()) + else if (PartialDiagId) S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint); } diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h index 250ba4f..61cab28 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h @@ -341,7 +341,7 @@ protected: addStateConstraints(NewState); Optional res = Solver->check(); - if (!res.hasValue()) + if (!res) Cached[hash] = ConditionTruthVal(); else Cached[hash] = ConditionTruthVal(res.getValue()); diff --git a/clang/lib/AST/AttrImpl.cpp b/clang/lib/AST/AttrImpl.cpp index 7b8acfc..c1e7435 100644 --- a/clang/lib/AST/AttrImpl.cpp +++ b/clang/lib/AST/AttrImpl.cpp @@ -168,7 +168,7 @@ OMPDeclareTargetDeclAttr::getActiveAttr(const ValueDecl *VD) { llvm::Optional OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) { llvm::Optional ActiveAttr = getActiveAttr(VD); - if (ActiveAttr.hasValue()) + if (ActiveAttr) return ActiveAttr.getValue()->getMapType(); return llvm::None; } @@ -176,7 +176,7 @@ OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) { llvm::Optional OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) { llvm::Optional ActiveAttr = getActiveAttr(VD); - if (ActiveAttr.hasValue()) + if (ActiveAttr) return ActiveAttr.getValue()->getDevType(); return llvm::None; } @@ -184,7 +184,7 @@ OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) { llvm::Optional OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) { llvm::Optional ActiveAttr = getActiveAttr(VD); - if (ActiveAttr.hasValue()) + if (ActiveAttr) return ActiveAttr.getValue()->getRange().getBegin(); return llvm::None; } diff --git a/clang/lib/ASTMatchers/Dynamic/Parser.cpp b/clang/lib/ASTMatchers/Dynamic/Parser.cpp index ec14f7a..6470df2 100644 --- a/clang/lib/ASTMatchers/Dynamic/Parser.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Parser.cpp @@ -397,9 +397,9 @@ bool Parser::parseIdentifierPrefixImpl(VariantValue *Value) { assert(NamedValue.isMatcher()); llvm::Optional Result = NamedValue.getMatcher().getSingleMatcher(); - if (Result.hasValue()) { + if (Result) { llvm::Optional Bound = Result->tryBind(BindID); - if (Bound.hasValue()) { + if (Bound) { *Value = VariantMatcher::SingleMatcher(*Bound); return true; } diff --git a/clang/lib/ASTMatchers/Dynamic/Registry.cpp b/clang/lib/ASTMatchers/Dynamic/Registry.cpp index 72629d0..42193e6 100644 --- a/clang/lib/ASTMatchers/Dynamic/Registry.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Registry.cpp @@ -797,9 +797,9 @@ VariantMatcher Registry::constructBoundMatcher(MatcherCtor Ctor, if (Out.isNull()) return Out; llvm::Optional Result = Out.getSingleMatcher(); - if (Result.hasValue()) { + if (Result) { llvm::Optional Bound = Result->tryBind(BindID); - if (Bound.hasValue()) { + if (Bound) { return VariantMatcher::SingleMatcher(*Bound); } } diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp index 3587cf4..8de6927 100644 --- a/clang/lib/Analysis/BodyFarm.cpp +++ b/clang/lib/Analysis/BodyFarm.cpp @@ -697,7 +697,7 @@ static Stmt *create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D) Stmt *BodyFarm::getBody(const FunctionDecl *D) { Optional &Val = Bodies[D]; - if (Val.hasValue()) + if (Val) return Val.getValue(); Val = nullptr; @@ -872,7 +872,7 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) { return nullptr; Optional &Val = Bodies[D]; - if (Val.hasValue()) + if (Val) return Val.getValue(); Val = nullptr; diff --git a/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp b/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp index c0b8119..fe9907a 100644 --- a/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp +++ b/clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp @@ -33,7 +33,7 @@ buildStmtToBasicBlockMap(const CFG &Cfg) { for (const CFGElement &Element : *Block) { auto Stmt = Element.getAs(); - if (!Stmt.hasValue()) + if (!Stmt) continue; StmtToBlock[Stmt.getValue().getStmt()] = Block; diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp index 68e897e..ddd9daa 100644 --- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -50,7 +50,7 @@ public: auto BlockIT = CFCtx.getStmtToBlock().find(&ignoreCFGOmittedNodes(S)); assert(BlockIT != CFCtx.getStmtToBlock().end()); const auto &State = BlockToState[BlockIT->getSecond()->getBlockID()]; - assert(State.hasValue()); + assert(State); return &State.getValue().Env; } @@ -209,7 +209,7 @@ static TypeErasedDataflowAnalysisState computeBlockInputState( // loop back edge to `Block`. const llvm::Optional &MaybePredState = BlockStates[Pred->getBlockID()]; - if (!MaybePredState.hasValue()) + if (!MaybePredState) continue; TypeErasedDataflowAnalysisState PredState = MaybePredState.getValue(); @@ -222,14 +222,14 @@ static TypeErasedDataflowAnalysisState computeBlockInputState( } } - if (MaybeState.hasValue()) { + if (MaybeState) { Analysis.joinTypeErased(MaybeState->Lattice, PredState.Lattice); MaybeState->Env.join(PredState.Env, Analysis); } else { MaybeState = std::move(PredState); } } - if (!MaybeState.hasValue()) { + if (!MaybeState) { // FIXME: Consider passing `Block` to `Analysis.typeErasedInitialElement()` // to enable building analyses like computation of dominators that // initialize the state of each basic block differently. @@ -367,7 +367,7 @@ runTypeErasedDataflowAnalysis(const ControlFlowContext &CFCtx, TypeErasedDataflowAnalysisState NewBlockState = transferBlock(CFCtx, BlockStates, *Block, InitEnv, Analysis); - if (OldBlockState.hasValue() && + if (OldBlockState && Analysis.isEqualTypeErased(OldBlockState.getValue().Lattice, NewBlockState.Lattice) && OldBlockState->Env.equivalentTo(NewBlockState.Env, Analysis)) { diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index 90c4624..8a73050 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -319,7 +319,7 @@ static Optional comparePath(const PathPieces &X, const PathPieces &Y) { for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) { Optional b = comparePiece(**X_I, **Y_I); - if (b.hasValue()) + if (b) return b.getValue(); } @@ -396,7 +396,7 @@ static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y) { return (*XI) < (*YI); } Optional b = comparePath(X.path, Y.path); - assert(b.hasValue()); + assert(b); return b.getValue(); } diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index 811146e..800943a 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -148,7 +148,7 @@ public: Value getValue(const CFGBlock *block, const CFGBlock *dstBlock, const VarDecl *vd) { const Optional &idx = declToIndex.getValueIndex(vd); - assert(idx.hasValue()); + assert(idx); return getValueVector(block)[idx.getValue()]; } }; @@ -209,7 +209,7 @@ void CFGBlockValues::resetScratch() { ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) { const Optional &idx = declToIndex.getValueIndex(vd); - assert(idx.hasValue()); + assert(idx); return scratch[idx.getValue()]; } diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 098bf21..32dd2ba 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -251,7 +251,7 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const { .Case("riscv64", Is64Bit) .Case("64bit", Is64Bit) .Default(None); - if (Result.hasValue()) + if (Result) return Result.getValue(); if (ISAInfo->isSupportedExtensionFeature(Feature)) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 17b8e6b..34d8b3a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2826,12 +2826,12 @@ bool CodeGenModule::isProfileInstrExcluded(llvm::Function *Fn, CodeGenOptions::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr(); // First, check the function name. Optional V = ProfileList.isFunctionExcluded(Fn->getName(), Kind); - if (V.hasValue()) + if (V) return *V; // Next, check the source location. if (Loc.isValid()) { Optional V = ProfileList.isLocationExcluded(Loc, Kind); - if (V.hasValue()) + if (V) return *V; } // If location is unknown, this may be a compiler-generated function. Assume diff --git a/clang/lib/Driver/ToolChains/AVR.cpp b/clang/lib/Driver/ToolChains/AVR.cpp index 2547d13..1e86655 100644 --- a/clang/lib/Driver/ToolChains/AVR.cpp +++ b/clang/lib/Driver/ToolChains/AVR.cpp @@ -475,7 +475,7 @@ void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA, D.Diag(diag::warn_drv_avr_stdlib_not_linked); } - if (SectionAddressData.hasValue()) { + if (SectionAddressData) { std::string DataSectionArg = std::string("-Tdata=0x") + llvm::utohexstr(SectionAddressData.getValue()); CmdArgs.push_back(Args.MakeArgString(DataSectionArg)); diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index dc99010..f52bb8a 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2086,7 +2086,7 @@ void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const { } bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - if (BiarchSibling.hasValue()) { + if (BiarchSibling) { M = BiarchSibling.getValue(); return true; } diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp index 589bf8d..1ca041f 100644 --- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp +++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -725,11 +725,11 @@ static bool getLiteralInfo(SourceRange literalRange, break; } - if (!UpperU.hasValue() && !UpperL.hasValue()) + if (!UpperU && !UpperL) UpperU = UpperL = true; - else if (UpperU.hasValue() && !UpperL.hasValue()) + else if (UpperU && !UpperL) UpperL = UpperU; - else if (UpperL.hasValue() && !UpperU.hasValue()) + else if (UpperL && !UpperU) UpperU = UpperL; Info.U = *UpperU ? "U" : "u"; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index c0eed3a..abef4cf 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1951,7 +1951,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, << "-fdiagnostics-hotness-threshold="; } else { Opts.DiagnosticsHotnessThreshold = *ResultOrErr; - if ((!Opts.DiagnosticsHotnessThreshold.hasValue() || + if ((!Opts.DiagnosticsHotnessThreshold || Opts.DiagnosticsHotnessThreshold.getValue() > 0) && !UsingProfile) Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo) @@ -1968,7 +1968,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, << "-fdiagnostics-misexpect-tolerance="; } else { Opts.DiagnosticsMisExpectTolerance = *ResultOrErr; - if ((!Opts.DiagnosticsMisExpectTolerance.hasValue() || + if ((!Opts.DiagnosticsMisExpectTolerance || Opts.DiagnosticsMisExpectTolerance.getValue() > 0) && !UsingProfile) Diags.Report(diag::warn_drv_diagnostics_misexpect_requires_pgo) @@ -2578,10 +2578,10 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts, for (const auto &ModuleFile : Opts.ModuleFiles) GenerateArg(Args, OPT_fmodule_file, ModuleFile, SA); - if (Opts.AuxTargetCPU.hasValue()) + if (Opts.AuxTargetCPU) GenerateArg(Args, OPT_aux_target_cpu, *Opts.AuxTargetCPU, SA); - if (Opts.AuxTargetFeatures.hasValue()) + if (Opts.AuxTargetFeatures) for (const auto &Feature : *Opts.AuxTargetFeatures) GenerateArg(Args, OPT_aux_target_feature, Feature, SA); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 1032cb2..fe3736c 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -831,11 +831,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI, VersionTuple tuple = LangOpts.ObjCRuntime.getVersion(); unsigned minor = 0; - if (tuple.getMinor().hasValue()) + if (tuple.getMinor()) minor = tuple.getMinor().getValue(); unsigned subminor = 0; - if (tuple.getSubminor().hasValue()) + if (tuple.getSubminor()) subminor = tuple.getSubminor().getValue(); Builder.defineMacro("__OBJFW_RUNTIME_ABI__", diff --git a/clang/lib/Lex/DependencyDirectivesScanner.cpp b/clang/lib/Lex/DependencyDirectivesScanner.cpp index d858384..be7b7d6 100644 --- a/clang/lib/Lex/DependencyDirectivesScanner.cpp +++ b/clang/lib/Lex/DependencyDirectivesScanner.cpp @@ -549,7 +549,7 @@ Scanner::tryLexIdentifierOrSkipLine(const char *&First, const char *const End) { StringRef Scanner::lexIdentifier(const char *&First, const char *const End) { Optional Id = tryLexIdentifierOrSkipLine(First, End); - assert(Id.hasValue() && "expected identifier token"); + assert(Id && "expected identifier token"); return Id.getValue(); } diff --git a/clang/lib/Lex/MacroInfo.cpp b/clang/lib/Lex/MacroInfo.cpp index 4a8127d..19ab9bc 100644 --- a/clang/lib/Lex/MacroInfo.cpp +++ b/clang/lib/Lex/MacroInfo.cpp @@ -209,7 +209,7 @@ MacroDirective::DefInfo MacroDirective::getDefinition() { } VisibilityMacroDirective *VisMD = cast(MD); - if (!isPublic.hasValue()) + if (!isPublic) isPublic = VisMD->isPublic(); } diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 49e1473..bf46e542 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1325,7 +1325,7 @@ already_lexed: // The last ')' has been reached; return the value if one found or // a diagnostic and a dummy value. - if (Result.hasValue()) { + if (Result) { OS << Result.getValue(); // For strict conformance to __has_cpp_attribute rules, use 'L' // suffix for dated literals. diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index 432068b..673ef63 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -114,7 +114,7 @@ bool PreprocessingRecord::isEntityInFileID(iterator PPEI, FileID FID) { // deserializing it. Optional IsInFile = ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID); - if (IsInFile.hasValue()) + if (IsInFile) return IsInFile.getValue(); // The external source did not provide a definite answer, go and deserialize diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 1fa82a1..dbb0ca6 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -1873,7 +1873,7 @@ void Parser::ParseOMPDeclareTargetClauses( if (IsDeviceTypeClause) { Optional DevTypeData = parseOpenMPSimpleClause(*this, OMPC_device_type); - if (DevTypeData.hasValue()) { + if (DevTypeData) { if (DeviceTypeLoc.isValid()) { // We already saw another device_type clause, diagnose it. Diag(DevTypeData.getValue().Loc, diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp index a3b15fe..8f8144d 100644 --- a/clang/lib/Sema/SemaCUDA.cpp +++ b/clang/lib/Sema/SemaCUDA.cpp @@ -444,7 +444,7 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, // If no target was inferred, mark this member as __host__ __device__; // it's the least restrictive option that can be invoked from any target. bool NeedsH = true, NeedsD = true; - if (InferredTarget.hasValue()) { + if (InferredTarget) { if (InferredTarget.getValue() == CFT_Device) NeedsH = false; else if (InferredTarget.getValue() == CFT_Host) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 28cfdfc..4635bcc 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -1873,7 +1873,7 @@ static ExprResult SemaBuiltinLaunder(Sema &S, CallExpr *TheCall) { return 2; return llvm::Optional{}; }(); - if (DiagSelect.hasValue()) { + if (DiagSelect) { S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg) << DiagSelect.getValue() << TheCall->getSourceRange(); return ExprError(); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 2e06207..da138bc 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -15444,7 +15444,7 @@ void Sema::AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction( // (3.1) If the allocation function takes an argument of type // std​::​align_­val_­t, the storage will have the alignment // specified by the value of this argument. - if (AlignmentParam.hasValue() && !FD->hasAttr()) { + if (AlignmentParam && !FD->hasAttr()) { FD->addAttr(AllocAlignAttr::CreateImplicit( Context, ParamIdx(AlignmentParam.getValue(), FD), FD->getLocation())); } @@ -19102,12 +19102,12 @@ Sema::FunctionEmissionStatus Sema::getEmissionStatus(FunctionDecl *FD, // #pragma omp declare target to(*) device_type(*). // Therefore DevTy having no value does not imply host. The emission status // will be checked again at the end of compilation unit with Final = true. - if (DevTy.hasValue()) + if (DevTy) if (*DevTy == OMPDeclareTargetDeclAttr::DT_Host) return FunctionEmissionStatus::OMPDiscarded; // If we have an explicit value for the device type, or we are in a target // declare context, we need to emit all extern and used symbols. - if (isInOpenMPDeclareTargetContext() || DevTy.hasValue()) + if (isInOpenMPDeclareTargetContext() || DevTy) if (IsEmittedForExternalSymbol()) return FunctionEmissionStatus::Emitted; // Device mode only emits what it must, if it wasn't tagged yet and needed, diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 73a4be5..05fcc32 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2680,8 +2680,8 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { auto Major = Version.getMajor(); auto NewMajor = Major >= 9 ? Major - 7 : 0; if (NewMajor >= 2) { - if (Version.getMinor().hasValue()) { - if (Version.getSubminor().hasValue()) + if (Version.getMinor()) { + if (Version.getSubminor()) return VersionTuple(NewMajor, Version.getMinor().getValue(), Version.getSubminor().getValue()); else diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index bb1cf4b..1e7975e 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2274,10 +2274,10 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, // How many bytes do we want to allocate here? llvm::Optional AllocationSize; - if (!ArraySize.hasValue() && !AllocType->isDependentType()) { + if (!ArraySize && !AllocType->isDependentType()) { // For non-array operator new, we only want to allocate one element. AllocationSize = SingleEltSize; - } else if (KnownArraySize.hasValue() && !AllocType->isDependentType()) { + } else if (KnownArraySize && !AllocType->isDependentType()) { // For array operator new, only deal with static array size case. bool Overflow; AllocationSize = llvm::APInt(SizeTyWidth, *KnownArraySize) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7395e67..2546b80 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -828,7 +828,7 @@ public: /// Returns optional parameter for the ordered region. std::pair getOrderedRegionParam() const { if (const SharingMapTy *Top = getTopOfStackOrNull()) - if (Top->OrderedRegion.hasValue()) + if (Top->OrderedRegion) return Top->OrderedRegion.getValue(); return std::make_pair(nullptr, nullptr); } @@ -843,7 +843,7 @@ public: std::pair getParentOrderedRegionParam() const { if (const SharingMapTy *Parent = getSecondOnStackOrNull()) - if (Parent->OrderedRegion.hasValue()) + if (Parent->OrderedRegion) return Parent->OrderedRegion.getValue(); return std::make_pair(nullptr, nullptr); } @@ -7761,7 +7761,7 @@ bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) { bool IsConstZero = Result && !Result->getBoolValue(); // != with increment is treated as <; != with decrement is treated as > - if (!TestIsLessOp.hasValue()) + if (!TestIsLessOp) TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract); if (UB && (IsConstZero || (TestIsLessOp.getValue() @@ -22180,7 +22180,7 @@ void Sema::ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, auto *VD = cast(ND); llvm::Optional ActiveAttr = OMPDeclareTargetDeclAttr::getActiveAttr(VD); - if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getDevType() != DTCI.DT && + if (ActiveAttr && ActiveAttr.getValue()->getDevType() != DTCI.DT && ActiveAttr.getValue()->getLevel() == Level) { Diag(Loc, diag::err_omp_device_type_mismatch) << OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DTCI.DT) @@ -22188,18 +22188,18 @@ void Sema::ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, ActiveAttr.getValue()->getDevType()); return; } - if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getMapType() != MT && + if (ActiveAttr && ActiveAttr.getValue()->getMapType() != MT && ActiveAttr.getValue()->getLevel() == Level) { Diag(Loc, diag::err_omp_declare_target_to_and_link) << ND; return; } - if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getLevel() == Level) + if (ActiveAttr && ActiveAttr.getValue()->getLevel() == Level) return; Expr *IndirectE = nullptr; bool IsIndirect = false; - if (DTCI.Indirect.hasValue()) { + if (DTCI.Indirect) { IndirectE = DTCI.Indirect.getValue(); if (!IndirectE) IsIndirect = true; @@ -22294,12 +22294,12 @@ void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, llvm::Optional ActiveAttr = OMPDeclareTargetDeclAttr::getActiveAttr(VD); unsigned Level = DeclareTargetNesting.size(); - if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getLevel() >= Level) + if (ActiveAttr && ActiveAttr.getValue()->getLevel() >= Level) return; DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back(); Expr *IndirectE = nullptr; bool IsIndirect = false; - if (DTCI.Indirect.hasValue()) { + if (DTCI.Indirect) { IndirectE = DTCI.Indirect.getValue(); if (!IndirectE) IsIndirect = true; diff --git a/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index 970bfd2..330ca90b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -766,7 +766,7 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg, continue; // Generate only one error node to use for all bug reports. - if (!errorNode.hasValue()) + if (!errorNode) errorNode = C.generateNonFatalErrorNode(); if (!errorNode.getValue()) diff --git a/clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp index 0e27377..dbfdff4 100644 --- a/clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp @@ -272,12 +272,12 @@ ProgramStateRef GTestChecker::assumeValuesEqual(SVal Val1, SVal Val2, CheckerContext &C) { auto DVal1 = Val1.getAs(); auto DVal2 = Val2.getAs(); - if (!DVal1.hasValue() || !DVal2.hasValue()) + if (!DVal1 || !DVal2) return State; auto ValuesEqual = C.getSValBuilder().evalEQ(State, *DVal1, *DVal2).getAs(); - if (!ValuesEqual.hasValue()) + if (!ValuesEqual) return State; State = C.getConstraintManager().assume(State, *ValuesEqual, true); diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 552d042..92d7cef 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1238,7 +1238,7 @@ void MallocChecker::checkKernelMalloc(const CallEvent &Call, ProgramStateRef State = C.getState(); llvm::Optional MaybeState = performKernelMalloc(Call, C, State); - if (MaybeState.hasValue()) + if (MaybeState) State = MaybeState.getValue(); else State = MallocMemAux(C, Call, Call.getArgExpr(0), UndefinedVal(), State, @@ -3571,13 +3571,13 @@ void MallocChecker::printState(raw_ostream &Out, ProgramStateRef State, const RefState *RefS = State->get(I.getKey()); AllocationFamily Family = RefS->getAllocationFamily(); Optional CheckKind = getCheckIfTracked(Family); - if (!CheckKind.hasValue()) - CheckKind = getCheckIfTracked(Family, true); + if (!CheckKind) + CheckKind = getCheckIfTracked(Family, true); I.getKey()->dumpToStream(Out); Out << " : "; I.getData().dump(Out); - if (CheckKind.hasValue()) + if (CheckKind) Out << " (" << CheckNames[*CheckKind].getName() << ")"; Out << NL; } diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp index de94cb7..79d19a3 100644 --- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -77,7 +77,7 @@ AnalyzerOptions::getExplorationStrategy() const { .Case("bfs_block_dfs_contents", ExplorationStrategyKind::BFSBlockDFSContents) .Default(None); - assert(K.hasValue() && "User mode is invalid."); + assert(K && "User mode is invalid."); return K.getValue(); } @@ -88,7 +88,7 @@ CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const { .Case("small", CTUPhase1InliningKind::Small) .Case("all", CTUPhase1InliningKind::All) .Default(None); - assert(K.hasValue() && "CTU inlining mode is invalid."); + assert(K && "CTU inlining mode is invalid."); return K.getValue(); } @@ -100,7 +100,7 @@ IPAKind AnalyzerOptions::getIPAMode() const { .Case("dynamic", IPAK_DynamicDispatch) .Case("dynamic-bifurcate", IPAK_DynamicDispatchBifurcate) .Default(None); - assert(K.hasValue() && "IPA Mode is invalid."); + assert(K && "IPA Mode is invalid."); return K.getValue(); } diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 339a675..5b72c91 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -2949,7 +2949,7 @@ PathDiagnosticPieceRef ConditionBRVisitor::VisitTrueTest( PathDiagnosticLocation Loc(Cond, SM, LCtx); auto event = std::make_shared(Loc, Message); - if (shouldPrune.hasValue()) + if (shouldPrune) event->setPrunable(shouldPrune.getValue()); return event; } @@ -3279,7 +3279,7 @@ void FalsePositiveRefutationBRVisitor::finalizeVisitor( // And check for satisfiability Optional IsSAT = RefutationSolver->check(); - if (!IsSAT.hasValue()) + if (!IsSAT) return; if (!IsSAT.getValue()) diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 326a3b1..5f8a845 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -1015,7 +1015,7 @@ bool ExprEngine::shouldInlineCall(const CallEvent &Call, const Decl *D, // Check if this function has been marked as non-inlinable. Optional MayInline = Engine.FunctionSummaries->mayInline(D); - if (MayInline.hasValue()) { + if (MayInline) { if (!MayInline.getValue()) return false; diff --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp index ebfe1a1..0d7ca0e 100644 --- a/clang/lib/Support/RISCVVIntrinsicUtils.cpp +++ b/clang/lib/Support/RISCVVIntrinsicUtils.cpp @@ -114,7 +114,7 @@ bool RVVType::verifyType() const { return false; if (isScalar()) return true; - if (!Scale.hasValue()) + if (!Scale) return false; if (isFloat() && ElementBitwidth == 8) return false; @@ -799,7 +799,7 @@ RVVType::computeTypes(BasicType BT, int Log2LMUL, unsigned NF, RVVTypes Types; for (const PrototypeDescriptor &Proto : Prototype) { auto T = computeType(BT, Log2LMUL, Proto); - if (!T.hasValue()) + if (!T) return llvm::None; // Record legal type index Types.push_back(T.getValue()); diff --git a/clang/lib/Tooling/Core/Replacement.cpp b/clang/lib/Tooling/Core/Replacement.cpp index 30e1923..aca2afce 100644 --- a/clang/lib/Tooling/Core/Replacement.cpp +++ b/clang/lib/Tooling/Core/Replacement.cpp @@ -179,9 +179,9 @@ static std::string getReplacementErrString(replacement_error Err) { std::string ReplacementError::message() const { std::string Message = getReplacementErrString(Err); - if (NewReplacement.hasValue()) + if (NewReplacement) Message += "\nNew replacement: " + NewReplacement->toString(); - if (ExistingReplacement.hasValue()) + if (ExistingReplacement) Message += "\nExisting replacement: " + ExistingReplacement->toString(); return Message; } diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index fa1f09b..0e21106 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -406,7 +406,7 @@ int clang_main(int Argc, char **Argv) { if (ClangCLMode) { // Arguments in "CL" are prepended. llvm::Optional OptCL = llvm::sys::Process::GetEnv("CL"); - if (OptCL.hasValue()) { + if (OptCL) { SmallVector PrependedOpts; getCLEnvVarOptions(OptCL.getValue(), Saver, PrependedOpts); @@ -415,7 +415,7 @@ int clang_main(int Argc, char **Argv) { } // Arguments in "_CL_" are appended. llvm::Optional Opt_CL_ = llvm::sys::Process::GetEnv("_CL_"); - if (Opt_CL_.hasValue()) { + if (Opt_CL_) { SmallVector AppendedOpts; getCLEnvVarOptions(Opt_CL_.getValue(), Saver, AppendedOpts); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index cba265b..75052d6 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -536,7 +536,7 @@ bool CursorVisitor::VisitChildren(CXCursor Cursor) { TLEnd = CXXUnit->top_level_end(); TL != TLEnd; ++TL) { const Optional V = handleDeclForVisitation(*TL); - if (!V.hasValue()) + if (!V) continue; return V.getValue(); } @@ -641,7 +641,7 @@ bool CursorVisitor::VisitDeclContext(DeclContext *DC) { if (OMD->isSynthesizedAccessorStub()) continue; const Optional V = handleDeclForVisitation(D); - if (!V.hasValue()) + if (!V) continue; return V.getValue(); } @@ -675,7 +675,7 @@ Optional CursorVisitor::handleDeclForVisitation(const Decl *D) { } const Optional V = shouldVisitCursor(Cursor); - if (!V.hasValue()) + if (!V) return None; if (!V.getValue()) return false; @@ -1074,7 +1074,7 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) { I != E; ++I) { CXCursor Cursor = MakeCXCursor(*I, TU, RegionOfInterest); const Optional &V = shouldVisitCursor(Cursor); - if (!V.hasValue()) + if (!V) continue; if (!V.getValue()) return false; @@ -8178,13 +8178,13 @@ static CXVersion convertVersion(VersionTuple In) { Out.Major = In.getMajor(); Optional Minor = In.getMinor(); - if (Minor.hasValue()) + if (Minor) Out.Minor = *Minor; else return Out; Optional Subminor = In.getSubminor(); - if (Subminor.hasValue()) + if (Subminor) Out.Subminor = *Subminor; return Out; diff --git a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp index 5b76480..73bfbe5 100644 --- a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -259,11 +259,11 @@ void checkEventualResultWithTimeout(VerifyingConsumer &TestConsumer) { << "The expected result state wasn't reached before the time-out."; std::unique_lock L(TestConsumer.Mtx); EXPECT_TRUE(TestConsumer.result().hasValue()); - if (TestConsumer.result().hasValue()) { + if (TestConsumer.result()) { EXPECT_TRUE(*TestConsumer.result()); } - if ((TestConsumer.result().hasValue() && !TestConsumer.result().getValue()) || - !TestConsumer.result().hasValue()) + if ((TestConsumer.result() && !TestConsumer.result().getValue()) || + !TestConsumer.result()) TestConsumer.printUnmetExpectations(llvm::outs()); } } // namespace diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp index c71a724..f0edff6 100644 --- a/clang/unittests/Tooling/RefactoringTest.cpp +++ b/clang/unittests/Tooling/RefactoringTest.cpp @@ -118,18 +118,18 @@ static bool checkReplacementError(llvm::Error &&Error, OS << "Unexpected error code: " << int(RE.get()) << "\n"; if (ExpectedExisting != RE.getExistingReplacement()) { OS << "Expected Existing != Actual Existing.\n"; - if (ExpectedExisting.hasValue()) + if (ExpectedExisting) OS << "Expected existing replacement: " << ExpectedExisting->toString() << "\n"; - if (RE.getExistingReplacement().hasValue()) + if (RE.getExistingReplacement()) OS << "Actual existing replacement: " << RE.getExistingReplacement()->toString() << "\n"; } if (ExpectedNew != RE.getNewReplacement()) { OS << "Expected New != Actual New.\n"; - if (ExpectedNew.hasValue()) + if (ExpectedNew) OS << "Expected new replacement: " << ExpectedNew->toString() << "\n"; - if (RE.getNewReplacement().hasValue()) + if (RE.getNewReplacement()) OS << "Actual new replacement: " << RE.getNewReplacement()->toString() << "\n"; } diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index 7987d89..068e6a0 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -217,7 +217,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) { for (int Log2LMUL : Log2LMULs) { auto T = RVVType::computeType(BasicType::Int8, Log2LMUL, PrototypeDescriptor::Mask); - if (T.hasValue()) + if (T) printType(T.getValue()); } // Print RVV int/float types. @@ -225,7 +225,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) { BasicType BT = ParseBasicType(I); for (int Log2LMUL : Log2LMULs) { auto T = RVVType::computeType(BT, Log2LMUL, PrototypeDescriptor::Vector); - if (T.hasValue()) { + if (T) { printType(T.getValue()); auto UT = RVVType::computeType( BT, Log2LMUL, @@ -240,7 +240,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) { for (int Log2LMUL : Log2LMULs) { auto T = RVVType::computeType(BasicType::Float16, Log2LMUL, PrototypeDescriptor::Vector); - if (T.hasValue()) + if (T) printType(T.getValue()); } OS << "#endif\n"; @@ -249,7 +249,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) { for (int Log2LMUL : Log2LMULs) { auto T = RVVType::computeType(BasicType::Float32, Log2LMUL, PrototypeDescriptor::Vector); - if (T.hasValue()) + if (T) printType(T.getValue()); } OS << "#endif\n"; @@ -258,7 +258,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) { for (int Log2LMUL : Log2LMULs) { auto T = RVVType::computeType(BasicType::Float64, Log2LMUL, PrototypeDescriptor::Vector); - if (T.hasValue()) + if (T) printType(T.getValue()); } OS << "#endif\n\n"; -- 2.7.4