[llvm] 72e8d03 - [Remarks] Use std::optional in YAMLRemarkSerializer.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 21:18:09 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T21:18:04-08:00
New Revision: 72e8d03fe9ef5ce8327f9e9c4e2c7d8ddcdc9d11

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

LOG: [Remarks] Use std::optional in YAMLRemarkSerializer.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: 
    llvm/lib/Remarks/YAMLRemarkSerializer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
index fff2b655e821..a9390d88e79e 100644
--- a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Remarks/YAMLRemarkSerializer.h"
 #include "llvm/Remarks/Remark.h"
 #include "llvm/Support/FileSystem.h"
+#include <optional>
 
 using namespace llvm;
 using namespace llvm::remarks;
@@ -216,7 +217,8 @@ static void emitVersion(raw_ostream &OS) {
   OS.write(Version.data(), Version.size());
 }
 
-static void emitStrTab(raw_ostream &OS, Optional<const StringTable *> StrTab) {
+static void emitStrTab(raw_ostream &OS,
+                       std::optional<const StringTable *> StrTab) {
   // Emit the string table in the section.
   uint64_t StrTabSize = StrTab ? (*StrTab)->SerializedSize : 0;
   // Emit the total size of the string table (the size itself excluded):


        


More information about the llvm-commits mailing list