mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
co-authored by
Jon Ross-Perkins
parent
16bbdbbdb8
commit
94cf343b05
@@ -184,7 +184,7 @@ class TokenizedBuffer::Lexer {
|
||||
}
|
||||
|
||||
auto LexNumericLiteral(llvm::StringRef& source_text) -> LexResult {
|
||||
llvm::Optional<LexedNumericLiteral> literal =
|
||||
std::optional<LexedNumericLiteral> literal =
|
||||
LexedNumericLiteral::Lex(source_text);
|
||||
if (!literal) {
|
||||
return LexResult::NoMatch();
|
||||
@@ -235,7 +235,7 @@ class TokenizedBuffer::Lexer {
|
||||
}
|
||||
|
||||
auto LexStringLiteral(llvm::StringRef& source_text) -> LexResult {
|
||||
llvm::Optional<LexedStringLiteral> literal =
|
||||
std::optional<LexedStringLiteral> literal =
|
||||
LexedStringLiteral::Lex(source_text);
|
||||
if (!literal) {
|
||||
return LexResult::NoMatch();
|
||||
@@ -360,7 +360,7 @@ class TokenizedBuffer::Lexer {
|
||||
return LexResult::NoMatch();
|
||||
}
|
||||
|
||||
llvm::Optional<TokenKind> kind;
|
||||
std::optional<TokenKind> kind;
|
||||
switch (word.front()) {
|
||||
case 'i':
|
||||
kind = TokenKind::IntegerTypeLiteral();
|
||||
@@ -621,7 +621,7 @@ auto TokenizedBuffer::GetTokenText(Token token) const -> llvm::StringRef {
|
||||
token_info.kind == TokenKind::RealLiteral()) {
|
||||
const auto& line_info = GetLineInfo(token_info.token_line);
|
||||
int64_t token_start = line_info.start + token_info.column;
|
||||
llvm::Optional<LexedNumericLiteral> relexed_token =
|
||||
std::optional<LexedNumericLiteral> relexed_token =
|
||||
LexedNumericLiteral::Lex(source_->text().substr(token_start));
|
||||
CARBON_CHECK(relexed_token) << "Could not reform numeric literal token.";
|
||||
return relexed_token->text();
|
||||
@@ -632,7 +632,7 @@ auto TokenizedBuffer::GetTokenText(Token token) const -> llvm::StringRef {
|
||||
if (token_info.kind == TokenKind::StringLiteral()) {
|
||||
const auto& line_info = GetLineInfo(token_info.token_line);
|
||||
int64_t token_start = line_info.start + token_info.column;
|
||||
llvm::Optional<LexedStringLiteral> relexed_token =
|
||||
std::optional<LexedStringLiteral> relexed_token =
|
||||
LexedStringLiteral::Lex(source_->text().substr(token_start));
|
||||
CARBON_CHECK(relexed_token) << "Could not reform string literal token.";
|
||||
return relexed_token->text();
|
||||
|
||||
Reference in New Issue
Block a user