[clang] 7d3178d - [Format] Use std::optional in Format.cpp (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 23:08:04 PST 2022


Author: Kazu Hirata
Date: 2022-12-09T23:07:59-08:00
New Revision: 7d3178d76aa8d67bfbacd45794ef5740823a43c0

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

LOG: [Format] Use std::optional in Format.cpp (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    clang/lib/Format/Format.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 983246d6cca5..b71add7f2e28 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -46,6 +46,7 @@
 #include <algorithm>
 #include <memory>
 #include <mutex>
+#include <optional>
 #include <string>
 #include <unordered_map>
 
@@ -3455,7 +3456,7 @@ reformat(const FormatStyle &Style, StringRef Code,
                                NextStartColumn, LastStartColumn);
   if (!Env)
     return {};
-  llvm::Optional<std::string> CurrentCode;
+  std::optional<std::string> CurrentCode;
   tooling::Replacements Fixes;
   unsigned Penalty = 0;
   for (size_t I = 0, E = Passes.size(); I < E; ++I) {


        


More information about the cfe-commits mailing list