瀏覽代碼

Consistently use llvm::Optional, not std::optional (#1118)

Jon Meow 4 年之前
父節點
當前提交
4a98acc3ea

+ 0 - 2
toolchain/lexer/lex_helpers.h

@@ -5,8 +5,6 @@
 #ifndef TOOLCHAIN_LEXER_LEX_HELPERS_H_
 #define TOOLCHAIN_LEXER_LEX_HELPERS_H_
 
-#include <optional>
-
 #include "toolchain/diagnostics/diagnostic_emitter.h"
 
 namespace Carbon {

+ 1 - 0
toolchain/semantics/BUILD

@@ -22,5 +22,6 @@ cc_test(
         "//toolchain/parser:parse_tree",
         "//toolchain/source:source_buffer",
         "@com_google_googletest//:gtest_main",
+        "@llvm-project//llvm:Support",
     ],
 )

+ 4 - 5
toolchain/semantics/semantics_test.cpp

@@ -7,8 +7,7 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-#include <optional>
-
+#include "llvm/ADT/Optional.h"
 #include "toolchain/diagnostics/diagnostic_emitter.h"
 #include "toolchain/lexer/tokenized_buffer.h"
 #include "toolchain/parser/parse_tree.h"
@@ -26,9 +25,9 @@ class ParseTreeTest : public ::testing::Test {
     return Semantics::Analyze(*parse_tree, consumer);
   }
 
-  std::optional<SourceBuffer> source_buffer;
-  std::optional<TokenizedBuffer> tokenized_buffer;
-  std::optional<ParseTree> parse_tree;
+  llvm::Optional<SourceBuffer> source_buffer;
+  llvm::Optional<TokenizedBuffer> tokenized_buffer;
+  llvm::Optional<ParseTree> parse_tree;
   DiagnosticConsumer& consumer = ConsoleDiagnosticConsumer();
 };
 

+ 1 - 1
toolchain/source/source_buffer.cpp

@@ -12,11 +12,11 @@
 #include <cerrno>
 #include <cstdint>
 #include <limits>
-#include <optional>
 #include <system_error>
 #include <variant>
 
 #include "common/check.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Error.h"