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

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


Author: Kazu Hirata
Date: 2022-12-09T23:06:32-08:00
New Revision: 7edc552d0ae4d0b2e3525bc64d428e7b3bc96db0

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

LOG: [Format] Use std::optional in ContinuationIndenter.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/ContinuationIndenter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 6c8f7eb6e2902..04244c1468278 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -21,6 +21,7 @@
 #include "clang/Format/Format.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Debug.h"
+#include <optional>
 
 #define DEBUG_TYPE "format-indenter"
 
@@ -149,7 +150,7 @@ static bool opensProtoMessageField(const FormatToken &LessTok,
 // Returns the delimiter of a raw string literal, or std::nullopt if TokenText
 // is not the text of a raw string literal. The delimiter could be the empty
 // string.  For example, the delimiter of R"deli(cont)deli" is deli.
-static llvm::Optional<StringRef> getRawStringDelimiter(StringRef TokenText) {
+static std::optional<StringRef> getRawStringDelimiter(StringRef TokenText) {
   if (TokenText.size() < 5 // The smallest raw string possible is 'R"()"'.
       || !TokenText.startswith("R\"") || !TokenText.endswith("\"")) {
     return std::nullopt;


        


More information about the cfe-commits mailing list