[PATCH] D140332: [ADT] Alias llvm::Optional to std::optional

Benjamin Kramer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 11:53:36 PST 2022


bkramer created this revision.
bkramer added reviewers: MaskRay, kazu, kparzysz.
Herald added subscribers: kadircet, Moerafaat, zero9178, steakhal, bzcheeseman, awarzynski, sdasgup3, carlosgalvezp, wenzhicui, wrengr, jeroen.dobbelaere, ChuanqiXu, cota, StephenFan, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, martong, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, mehdi_amini, arphaman, kbarton, hiraditya, nemanjai, qcolombet, MatzeB.
Herald added a reviewer: rriddle.
Herald added a reviewer: ftynse.
Herald added a reviewer: bondhugula.
Herald added a reviewer: ThomasRaoux.
Herald added a reviewer: NoQ.
Herald added a reviewer: njames93.
Herald added projects: Flang, All.
bkramer requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, stephenneuendorffer, nicolasvasilache, jdoerfert.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: herhut.
Herald added a reviewer: dcaballe.
Herald added projects: clang, LLDB, MLIR, LLVM, clang-tools-extra.

This avoids the continuous API churn when upgrading things to use
std::optional and makes trivial string replace upgrades possible.

The needed tweaks are mostly trivial, the one nasty bit is Clang's usage
of OptionalStorage. To keep this working old Optional stays around as
clang::CustomizableOptional, with the default Storage removed.
Optional<File/DirectoryEntryRef> is replaced with a typedef.

I tested this with GCC 7.5, the oldest supported GCC I had around.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140332

Files:
  clang-tools-extra/clang-move/Move.cpp
  clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
  clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
  clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
  clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
  clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
  clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp
  clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h
  clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
  clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp
  clang-tools-extra/clangd/ConfigCompile.cpp
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/index/IndexAction.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
  clang-tools-extra/include-cleaner/lib/Record.cpp
  clang-tools-extra/modularize/CoverageChecker.cpp
  clang-tools-extra/modularize/PreprocessorTracker.cpp
  clang-tools-extra/pp-trace/PPCallbacksTracker.cpp
  clang-tools-extra/pp-trace/PPCallbacksTracker.h
  clang/include/clang/Basic/CustomizableOptional.h
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/DirectoryEntry.h
  clang/include/clang/Basic/FileEntry.h
  clang/include/clang/Basic/FileManager.h
  clang/include/clang/Basic/LLVM.h
  clang/include/clang/Basic/Module.h
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/Lex/DirectoryLookup.h
  clang/include/clang/Lex/HeaderSearch.h
  clang/include/clang/Lex/ModuleMap.h
  clang/include/clang/Lex/PPCallbacks.h
  clang/include/clang/Lex/PreprocessingRecord.h
  clang/include/clang/Lex/Preprocessor.h
  clang/include/clang/Serialization/ModuleManager.h
  clang/include/clang/Tooling/Core/Replacement.h
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/include/clang/Tooling/Inclusions/StandardLibrary.h
  clang/lib/ARCMigrate/ObjCMT.cpp
  clang/lib/Basic/FileManager.cpp
  clang/lib/Basic/SourceManager.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/MacroPPCallbacks.cpp
  clang/lib/CodeGen/MacroPPCallbacks.h
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/DependencyFile.cpp
  clang/lib/Frontend/DependencyGraph.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Frontend/ModuleDependencyCollector.cpp
  clang/lib/Frontend/PrecompiledPreamble.cpp
  clang/lib/Frontend/PrintPreprocessedOutput.cpp
  clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Lex/PPCallbacks.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPLexerChange.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Lex/PreprocessingRecord.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ModuleManager.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CXIndexDataConsumer.cpp
  clang/tools/libclang/CXIndexDataConsumer.h
  clang/tools/libclang/Indexing.cpp
  clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
  clang/unittests/Basic/FileManagerTest.cpp
  clang/unittests/Lex/PPCallbacksTest.cpp
  clang/unittests/Lex/PPDependencyDirectivesTest.cpp
  flang/include/flang/Lower/Runtime.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Symbol/Type.cpp
  llvm/include/llvm/ADT/Optional.h
  llvm/include/llvm/ADT/STLForwardCompat.h
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/AsmParser/LLParser.h
  llvm/include/llvm/BinaryFormat/Dwarf.h
  llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
  llvm/include/llvm/IR/Function.h
  llvm/include/llvm/Object/Archive.h
  llvm/include/llvm/Support/raw_ostream.h
  llvm/include/llvm/Testing/Support/SupportHelpers.h
  llvm/include/llvm/Transforms/Scalar/Float2Int.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/CodeGen/RegAllocGreedy.h
  llvm/unittests/ADT/CMakeLists.txt
  llvm/unittests/ADT/OptionalTest.cpp
  llvm/unittests/Support/TypeTraitsTest.cpp
  mlir/include/mlir/Bindings/Python/PybindAdaptors.h
  mlir/include/mlir/IR/Visitors.h
  mlir/include/mlir/Support/LLVM.h
  mlir/lib/Bindings/Python/PybindUtils.h
  mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140332.484030.patch
Type: text/x-patch
Size: 165190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221219/ebfea0d7/attachment-0001.bin>


More information about the cfe-commits mailing list