Update LLVM and switch to std::optional. (#2424)

LLVM's bazel build has changed a bit, so this updates the tree for that.

LLVM is also moving `llvm::Optional` to match the standard API, but it seemed simpler to just switch to `std::optional`.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Chandler Carruth
2022-12-01 09:22:43 -08:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 16bbdbbdb8
commit 94cf343b05
22 changed files with 85 additions and 70 deletions
+3 -3
View File
@@ -5,10 +5,10 @@
#include "toolchain/parser/parse_tree.h"
#include <cstdlib>
#include <optional>
#include "common/check.h"
#include "common/error.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "toolchain/lexer/tokenized_buffer.h"
@@ -188,7 +188,7 @@ auto ParseTree::Print(llvm::raw_ostream& output, bool preorder) const -> void {
output << "]\n";
}
auto ParseTree::Verify() const -> llvm::Optional<Error> {
auto ParseTree::Verify() const -> std::optional<Error> {
llvm::SmallVector<ParseTree::Node> nodes;
// Traverse the tree in postorder.
for (Node n : postorder()) {
@@ -259,7 +259,7 @@ auto ParseTree::Verify() const -> llvm::Optional<Error> {
"TokenizedBuffer has {1} tokens.",
node_impls_.size(), tokens_->size()));
}
return llvm::None;
return std::nullopt;
}
auto ParseTree::Node::Print(llvm::raw_ostream& output) const -> void {