From 4a98acc3ea18d72c4d9035597889f1ab7660dcf6 Mon Sep 17 00:00:00 2001 From: Jon Meow <46229924+jonmeow@users.noreply.github.com> Date: Thu, 3 Mar 2022 15:45:42 -0800 Subject: [PATCH] Consistently use llvm::Optional, not std::optional (#1118) --- toolchain/lexer/lex_helpers.h | 2 -- toolchain/semantics/BUILD | 1 + toolchain/semantics/semantics_test.cpp | 9 ++++----- toolchain/source/source_buffer.cpp | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/toolchain/lexer/lex_helpers.h b/toolchain/lexer/lex_helpers.h index e9b53a79e681..f45c5af27b20 100644 --- a/toolchain/lexer/lex_helpers.h +++ b/toolchain/lexer/lex_helpers.h @@ -5,8 +5,6 @@ #ifndef TOOLCHAIN_LEXER_LEX_HELPERS_H_ #define TOOLCHAIN_LEXER_LEX_HELPERS_H_ -#include - #include "toolchain/diagnostics/diagnostic_emitter.h" namespace Carbon { diff --git a/toolchain/semantics/BUILD b/toolchain/semantics/BUILD index acbdfbdfd61b..eede08fd1f32 100644 --- a/toolchain/semantics/BUILD +++ b/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", ], ) diff --git a/toolchain/semantics/semantics_test.cpp b/toolchain/semantics/semantics_test.cpp index 4f700e2f9096..ecae3b4ad01d 100644 --- a/toolchain/semantics/semantics_test.cpp +++ b/toolchain/semantics/semantics_test.cpp @@ -7,8 +7,7 @@ #include #include -#include - +#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 source_buffer; - std::optional tokenized_buffer; - std::optional parse_tree; + llvm::Optional source_buffer; + llvm::Optional tokenized_buffer; + llvm::Optional parse_tree; DiagnosticConsumer& consumer = ConsoleDiagnosticConsumer(); }; diff --git a/toolchain/source/source_buffer.cpp b/toolchain/source/source_buffer.cpp index 238a9bdf0ad8..3babd50c6d48 100644 --- a/toolchain/source/source_buffer.cpp +++ b/toolchain/source/source_buffer.cpp @@ -12,11 +12,11 @@ #include #include #include -#include #include #include #include "common/check.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/Support/Error.h"