[llvm] cdad39b - [llvm][docs] Replace `Optional<T>` with `std::optional<T>`

Jan Svoboda via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 13:18:17 PDT 2025


Author: Jan Svoboda
Date: 2025-04-17T13:18:11-07:00
New Revision: cdad39b7e007aa2a597f6fbeda28a6b269406916

URL: https://github.com/llvm/llvm-project/commit/cdad39b7e007aa2a597f6fbeda28a6b269406916
DIFF: https://github.com/llvm/llvm-project/commit/cdad39b7e007aa2a597f6fbeda28a6b269406916.diff

LOG: [llvm][docs] Replace `Optional<T>` with `std::optional<T>`

The `llvm::Optional` template is no more. Remove it from the error-handling section of LLVM the programmer's manual and the ASTImporter documentation.

Added: 
    

Modified: 
    clang/docs/LibASTImporter.rst
    llvm/docs/ProgrammersManual.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/LibASTImporter.rst b/clang/docs/LibASTImporter.rst
index 515eff7ebe330..f5d40928d01e8 100644
--- a/clang/docs/LibASTImporter.rst
+++ b/clang/docs/LibASTImporter.rst
@@ -468,7 +468,7 @@ Note, there may be several 
diff erent ASTImporter objects which import into the s
         cxxRecordDecl(hasName("Y"), isDefinition()), ToUnit);
     ToYDef->dump();
     // An error is set for "ToYDef" in the shared state.
-    Optional<ASTImportError> OptErr =
+    std::optional<ASTImportError> OptErr =
         ImporterState->getImportDeclErrorIfAny(ToYDef);
     assert(OptErr);
 

diff  --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index e2829eb5a8846..bb729597cc5a3 100644
--- a/llvm/docs/ProgrammersManual.rst
+++ b/llvm/docs/ProgrammersManual.rst
@@ -590,14 +590,14 @@ semantics.  For example:
 
 This third form works with any type that can be assigned to from ``T&&``. This
 can be useful if the ``Expected<T>`` value needs to be stored an already-declared
-``Optional<T>``. For example:
+``std::optional<T>``. For example:
 
 .. code-block:: c++
 
   Expected<StringRef> extractClassName(StringRef Definition);
   struct ClassData {
     StringRef Definition;
-    Optional<StringRef> LazyName;
+    std::optional<StringRef> LazyName;
     ...
     Error initialize() {
       if (auto Err = extractClassName(Path).moveInto(LazyName))


        


More information about the llvm-commits mailing list