This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6ba4b62af8df: Return None instead of Optional<T>() (NFC) (authored by kazu).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138464/new/ https://reviews.llvm.org/D138464 Files: clang/include/clang/AST/ASTImporterSharedState.h clang/lib/AST/ASTImporter.cpp clang/lib/ASTMatchers/Dynamic/Parser.cpp clang/lib/ASTMatchers/Dynamic/VariantValue.cpp clang/lib/CodeGen/CodeGenAction.cpp clang/lib/Driver/ToolChains/AVR.cpp clang/lib/Driver/ToolChains/Arch/CSKY.cpp llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/lib/CodeGen/SelectOptimize.cpp llvm/lib/DebugInfo/PDB/DIA/DIADataStream.cpp llvm/lib/IR/BasicBlock.cpp llvm/lib/LineEditor/LineEditor.cpp llvm/lib/MC/MCSubtargetInfo.cpp llvm/lib/Object/Archive.cpp llvm/lib/Support/Z3Solver.cpp llvm/lib/TableGen/Record.cpp llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/lib/Target/PowerPC/PPCFastISel.cpp llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
Index: mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp =================================================================== --- mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp +++ mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp @@ -77,7 +77,7 @@ Optional<SmallVector<int64_t, 4>> mlir::shapeRatio(ArrayRef<int64_t> superShape, ArrayRef<int64_t> subShape) { if (superShape.size() < subShape.size()) { - return Optional<SmallVector<int64_t, 4>>(); + return None; } // Starting from the end, compute the integer divisors. Index: mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp =================================================================== --- mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp +++ mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp @@ -157,7 +157,7 @@ if (isInt) { if (kind == CombiningKind::MINF || kind == CombiningKind::MAXF) // Only valid for floating point types. - return Optional<Value>(); + return None; mul = rewriter.create<arith::MulIOp>(loc, x, y); } else { // Float case. @@ -166,7 +166,7 @@ kind == CombiningKind::MAXSI || kind == CombiningKind::OR || kind == CombiningKind::XOR) // Only valid for integer types. - return Optional<Value>(); + return None; // Special case for fused multiply-add. if (acc && acc.getType().isa<VectorType>() && kind == CombiningKind::ADD) { return Optional<Value>(rewriter.create<vector::FMAOp>(loc, x, y, acc)); Index: llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp =================================================================== --- llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp +++ llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp @@ -39,7 +39,7 @@ return wasm::ValType::FUNCREF; if (Type == "externref") return wasm::ValType::EXTERNREF; - return Optional<wasm::ValType>(); + return None; } WebAssembly::BlockType WebAssembly::parseBlockType(StringRef Type) { Index: llvm/lib/Target/PowerPC/PPCFastISel.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCFastISel.cpp +++ llvm/lib/Target/PowerPC/PPCFastISel.cpp @@ -226,7 +226,7 @@ case CmpInst::FCMP_OLE: case CmpInst::FCMP_ONE: default: - return Optional<PPC::Predicate>(); + return None; case CmpInst::FCMP_OEQ: case CmpInst::ICMP_EQ: Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp =================================================================== --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -3535,7 +3535,7 @@ unsigned FirstOne = A.getBitWidth() - A.countLeadingZeros() - 1; unsigned LastOne = A.countTrailingZeros(); if (A.countPopulation() != (FirstOne - LastOne + 1)) - return Optional<std::pair<unsigned,unsigned>>(); + return None; return std::make_pair(FirstOne, LastOne); } Index: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp =================================================================== --- llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -2608,7 +2608,7 @@ } if (Res == std::make_pair(-1, -1)) - return Optional<std::pair<int, int>>(); + return None; return Optional<std::pair<int, int>>(Res); } Index: llvm/lib/TableGen/Record.cpp =================================================================== --- llvm/lib/TableGen/Record.cpp +++ llvm/lib/TableGen/Record.cpp @@ -2648,9 +2648,9 @@ Record::getValueAsOptionalString(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) - return llvm::Optional<StringRef>(); + return llvm::None; if (isa<UnsetInit>(R->getValue())) - return llvm::Optional<StringRef>(); + return llvm::None; if (StringInit *SI = dyn_cast<StringInit>(R->getValue())) return SI->getValue(); Index: llvm/lib/Support/Z3Solver.cpp =================================================================== --- llvm/lib/Support/Z3Solver.cpp +++ llvm/lib/Support/Z3Solver.cpp @@ -878,7 +878,7 @@ if (res == Z3_L_FALSE) return false; - return Optional<bool>(); + return None; } void push() override { return Z3_solver_push(Context.Context, Solver); } Index: llvm/lib/Object/Archive.cpp =================================================================== --- llvm/lib/Object/Archive.cpp +++ llvm/lib/Object/Archive.cpp @@ -1158,7 +1158,7 @@ return MemberOrErr.takeError(); } } - return Optional<Child>(); + return None; } // Returns true if archive file contains no member file. Index: llvm/lib/MC/MCSubtargetInfo.cpp =================================================================== --- llvm/lib/MC/MCSubtargetInfo.cpp +++ llvm/lib/MC/MCSubtargetInfo.cpp @@ -336,16 +336,16 @@ } Optional<unsigned> MCSubtargetInfo::getCacheSize(unsigned Level) const { - return Optional<unsigned>(); + return None; } Optional<unsigned> MCSubtargetInfo::getCacheAssociativity(unsigned Level) const { - return Optional<unsigned>(); + return None; } Optional<unsigned> MCSubtargetInfo::getCacheLineSize(unsigned Level) const { - return Optional<unsigned>(); + return None; } unsigned MCSubtargetInfo::getPrefetchDistance() const { Index: llvm/lib/LineEditor/LineEditor.cpp =================================================================== --- llvm/lib/LineEditor/LineEditor.cpp +++ llvm/lib/LineEditor/LineEditor.cpp @@ -255,7 +255,7 @@ // Either of these may mean end-of-file. if (!Line || LineLen == 0) - return Optional<std::string>(); + return None; // Strip any newlines off the end of the string. while (LineLen > 0 && @@ -301,7 +301,7 @@ char *Res = ::fgets(Buf, sizeof(Buf), Data->In); if (!Res) { if (Line.empty()) - return Optional<std::string>(); + return None; else return Line; } Index: llvm/lib/IR/BasicBlock.cpp =================================================================== --- llvm/lib/IR/BasicBlock.cpp +++ llvm/lib/IR/BasicBlock.cpp @@ -512,7 +512,7 @@ return Optional<uint64_t>(CI->getValue().getZExtValue()); } } - return Optional<uint64_t>(); + return None; } BasicBlock::iterator llvm::skipDebugIntrinsics(BasicBlock::iterator It) { Index: llvm/lib/DebugInfo/PDB/DIA/DIADataStream.cpp =================================================================== --- llvm/lib/DebugInfo/PDB/DIA/DIADataStream.cpp +++ llvm/lib/DebugInfo/PDB/DIA/DIADataStream.cpp @@ -30,11 +30,11 @@ DWORD RecordSize = 0; StreamData->Item(Index, 0, &RecordSize, nullptr); if (RecordSize == 0) - return llvm::Optional<RecordType>(); + return llvm::None; Record.resize(RecordSize); if (S_OK != StreamData->Item(Index, RecordSize, &RecordSize, &Record[0])) - return llvm::Optional<RecordType>(); + return llvm::None; return Record; } Index: llvm/lib/CodeGen/SelectOptimize.cpp =================================================================== --- llvm/lib/CodeGen/SelectOptimize.cpp +++ llvm/lib/CodeGen/SelectOptimize.cpp @@ -949,7 +949,7 @@ TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency); if (auto OC = ICost.getValue()) return Optional<uint64_t>(*OC); - return Optional<uint64_t>(); + return None; } ScaledNumber<uint64_t> Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h =================================================================== --- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -459,7 +459,7 @@ case TargetTransformInfo::CacheLevel::L1D: [[fallthrough]]; case TargetTransformInfo::CacheLevel::L2D: - return llvm::Optional<unsigned>(); + return llvm::None; } llvm_unreachable("Unknown TargetTransformInfo::CacheLevel"); } @@ -470,7 +470,7 @@ case TargetTransformInfo::CacheLevel::L1D: [[fallthrough]]; case TargetTransformInfo::CacheLevel::L2D: - return llvm::Optional<unsigned>(); + return llvm::None; } llvm_unreachable("Unknown TargetTransformInfo::CacheLevel"); Index: clang/lib/Driver/ToolChains/Arch/CSKY.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/CSKY.cpp +++ clang/lib/Driver/ToolChains/Arch/CSKY.cpp @@ -33,7 +33,7 @@ if (ArchKind == llvm::CSKY::ArchKind::INVALID) { D.Diag(clang::diag::err_drv_invalid_arch_name) << A->getAsString(Args); - return llvm::Optional<llvm::StringRef>(); + return llvm::None; } return llvm::Optional<llvm::StringRef>(A->getValue()); } @@ -42,7 +42,7 @@ llvm::CSKY::ArchKind ArchKind = llvm::CSKY::parseCPUArch(A->getValue()); if (ArchKind == llvm::CSKY::ArchKind::INVALID) { D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args); - return llvm::Optional<llvm::StringRef>(); + return llvm::None; } return llvm::Optional<llvm::StringRef>(llvm::CSKY::getArchName(ArchKind)); } Index: clang/lib/Driver/ToolChains/AVR.cpp =================================================================== --- clang/lib/Driver/ToolChains/AVR.cpp +++ clang/lib/Driver/ToolChains/AVR.cpp @@ -345,14 +345,14 @@ for (const auto &MCU : MCUInfo) if (MCU.Name == MCUName) return Optional<StringRef>(MCU.Family); - return Optional<StringRef>(); + return None; } llvm::Optional<unsigned> GetMCUSectionAddressData(StringRef MCUName) { for (const auto &MCU : MCUInfo) if (MCU.Name == MCUName && MCU.DataAddr > 0) return Optional<unsigned>(MCU.DataAddr); - return Optional<unsigned>(); + return None; } const StringRef PossibleAVRLibcLocations[] = { Index: clang/lib/CodeGen/CodeGenAction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenAction.cpp +++ clang/lib/CodeGen/CodeGenAction.cpp @@ -698,7 +698,7 @@ if (Pair.first == Hash) return Pair.second; } - return Optional<FullSourceLoc>(); + return None; } void BackendConsumer::UnsupportedDiagHandler( Index: clang/lib/ASTMatchers/Dynamic/VariantValue.cpp =================================================================== --- clang/lib/ASTMatchers/Dynamic/VariantValue.cpp +++ clang/lib/ASTMatchers/Dynamic/VariantValue.cpp @@ -126,7 +126,7 @@ llvm::Optional<DynTypedMatcher> getSingleMatcher() const override { if (Matchers.size() != 1) - return llvm::Optional<DynTypedMatcher>(); + return llvm::None; return Matchers[0]; } @@ -190,7 +190,7 @@ : Op(Op), Args(std::move(Args)) {} llvm::Optional<DynTypedMatcher> getSingleMatcher() const override { - return llvm::Optional<DynTypedMatcher>(); + return llvm::None; } std::string getTypeAsString() const override { Index: clang/lib/ASTMatchers/Dynamic/Parser.cpp =================================================================== --- clang/lib/ASTMatchers/Dynamic/Parser.cpp +++ clang/lib/ASTMatchers/Dynamic/Parser.cpp @@ -910,10 +910,10 @@ Diagnostics *Error) { VariantValue Value; if (!parseExpression(Code, S, NamedValues, &Value, Error)) - return llvm::Optional<DynTypedMatcher>(); + return llvm::None; if (!Value.isMatcher()) { Error->addError(SourceRange(), Error->ET_ParserNotAMatcher); - return llvm::Optional<DynTypedMatcher>(); + return llvm::None; } llvm::Optional<DynTypedMatcher> Result = Value.getMatcher().getSingleMatcher(); Index: clang/lib/AST/ASTImporter.cpp =================================================================== --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -223,7 +223,7 @@ template<typename T> Expected<Optional<T>> import(Optional<T> From) { if (!From) - return Optional<T>(); + return None; return import(*From); } @@ -10022,7 +10022,7 @@ if (Pos != ImportDeclErrors.end()) return Pos->second; else - return Optional<ASTImportError>(); + return None; } void ASTImporter::setImportDeclError(Decl *From, ASTImportError Error) { Index: clang/include/clang/AST/ASTImporterSharedState.h =================================================================== --- clang/include/clang/AST/ASTImporterSharedState.h +++ clang/include/clang/AST/ASTImporterSharedState.h @@ -70,7 +70,7 @@ if (Pos != ImportErrors.end()) return Pos->second; else - return Optional<ASTImportError>(); + return None; } void setImportDeclError(Decl *To, ASTImportError Error) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits