[PATCH] D139286: [LLVM] Fix Bug introduced from "llvm::Optional => std::optional"

Qfrost via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 4 22:53:35 PST 2022


Qfrost911 updated this revision to Diff 479986.
Qfrost911 added a comment.

Adjust clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139286/new/

https://reviews.llvm.org/D139286

Files:
  llvm/examples/Kaleidoscope/Chapter8/toy.cpp


Index: llvm/examples/Kaleidoscope/Chapter8/toy.cpp
===================================================================
--- llvm/examples/Kaleidoscope/Chapter8/toy.cpp
+++ llvm/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -26,6 +26,7 @@
 #include <cstdlib>
 #include <map>
 #include <memory>
+#include <optional>
 #include <string>
 #include <system_error>
 #include <utility>
@@ -416,7 +417,7 @@
     return nullptr;
 
   return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
-                                      std::move(Else));
+                                     std::move(Else));
 }
 
 /// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression
@@ -462,7 +463,7 @@
     return nullptr;
 
   return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End),
-                                       std::move(Step), std::move(Body));
+                                      std::move(Step), std::move(Body));
 }
 
 /// varexpr ::= 'var' identifier ('=' expression)?
@@ -666,7 +667,7 @@
     return LogErrorP("Invalid number of operands for operator");
 
   return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0,
-                                         BinaryPrecedence);
+                                        BinaryPrecedence);
 }
 
 /// definition ::= 'def' prototype expression
@@ -686,7 +687,7 @@
   if (auto E = ParseExpression()) {
     // Make an anonymous proto.
     auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
-                                                 std::vector<std::string>());
+                                                std::vector<std::string>());
     return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
   }
   return nullptr;
@@ -1243,7 +1244,7 @@
   auto Features = "";
 
   TargetOptions opt;
-  auto RM = Optional<Reloc::Model>();
+  std::optional<Reloc::Model> RM;
   auto TheTargetMachine =
       Target->createTargetMachine(TargetTriple, CPU, Features, opt, RM);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139286.479986.patch
Type: text/x-patch
Size: 2003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221205/90437fab/attachment.bin>


More information about the llvm-commits mailing list