aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/FileCheck/FileCheckImpl.h
diff options
context:
space:
mode:
authorDouglas Yung <douglas.yung@sony.com>2022-12-14 10:05:01 -0800
committerDouglas Yung <douglas.yung@sony.com>2022-12-14 10:05:01 -0800
commit547e40a91b1e8e92add955a95a286999107c9196 (patch)
treee2fe8ce0f0c10bf698e2c29a43561ca1d8292c16 /llvm/lib/FileCheck/FileCheckImpl.h
parente898479f2b3d95ccda9e143865eedd615c667e22 (diff)
downloadllvm-547e40a91b1e8e92add955a95a286999107c9196.zip
llvm-547e40a91b1e8e92add955a95a286999107c9196.tar.gz
llvm-547e40a91b1e8e92add955a95a286999107c9196.tar.bz2
Revert "[FileCheck] llvm::Optional => std::optional"
This reverts commit 13fd37c931c26ec07613dcad67b5ab2a593cd416. This change is causing bot failures on some Windows and older GCC bots: - https://lab.llvm.org/buildbot/#/builders/123/builds/14678 - https://lab.llvm.org/buildbot/#/builders/216/builds/14436 - https://lab.llvm.org/staging/#/builders/235/builds/993
Diffstat (limited to 'llvm/lib/FileCheck/FileCheckImpl.h')
-rw-r--r--llvm/lib/FileCheck/FileCheckImpl.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h
index fd3568e..556be6b 100644
--- a/llvm/lib/FileCheck/FileCheckImpl.h
+++ b/llvm/lib/FileCheck/FileCheckImpl.h
@@ -15,13 +15,13 @@
#ifndef LLVM_LIB_FILECHECK_FILECHECKIMPL_H
#define LLVM_LIB_FILECHECK_FILECHECKIMPL_H
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/FileCheck/FileCheck.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/SourceMgr.h"
#include <map>
-#include <optional>
#include <string>
#include <vector>
@@ -266,23 +266,23 @@ private:
ExpressionFormat ImplicitFormat;
/// Value of numeric variable, if defined, or std::nullopt otherwise.
- std::optional<ExpressionValue> Value;
+ Optional<ExpressionValue> Value;
/// The input buffer's string from which Value was parsed, or std::nullopt.
/// See comments on getStringValue for a discussion of the None case.
- std::optional<StringRef> StrValue;
+ Optional<StringRef> StrValue;
/// Line number where this variable is defined, or std::nullopt if defined
/// before input is parsed. Used to determine whether a variable is defined on
/// the same line as a given use.
- std::optional<size_t> DefLineNumber;
+ Optional<size_t> DefLineNumber;
public:
/// Constructor for a variable \p Name with implicit format \p ImplicitFormat
/// defined at line \p DefLineNumber or defined before input is parsed if
/// \p DefLineNumber is None.
explicit NumericVariable(StringRef Name, ExpressionFormat ImplicitFormat,
- std::optional<size_t> DefLineNumber = std::nullopt)
+ Optional<size_t> DefLineNumber = std::nullopt)
: Name(Name), ImplicitFormat(ImplicitFormat),
DefLineNumber(DefLineNumber) {}
@@ -293,20 +293,20 @@ public:
ExpressionFormat getImplicitFormat() const { return ImplicitFormat; }
/// \returns this variable's value.
- std::optional<ExpressionValue> getValue() const { return Value; }
+ Optional<ExpressionValue> getValue() const { return Value; }
/// \returns the input buffer's string from which this variable's value was
/// parsed, or std::nullopt if the value is not yet defined or was not parsed
/// from the input buffer. For example, the value of @LINE is not parsed from
/// the input buffer, and some numeric variables are parsed from the command
/// line instead.
- std::optional<StringRef> getStringValue() const { return StrValue; }
+ Optional<StringRef> getStringValue() const { return StrValue; }
/// Sets value of this numeric variable to \p NewValue, and sets the input
/// buffer string from which it was parsed to \p NewStrValue. See comments on
/// getStringValue for a discussion of when the latter can be None.
void setValue(ExpressionValue NewValue,
- std::optional<StringRef> NewStrValue = std::nullopt) {
+ Optional<StringRef> NewStrValue = std::nullopt) {
Value = NewValue;
StrValue = NewStrValue;
}
@@ -320,7 +320,7 @@ public:
/// \returns the line number where this variable is defined, if any, or
/// std::nullopt if defined before input is parsed.
- std::optional<size_t> getDefLineNumber() const { return DefLineNumber; }
+ Optional<size_t> getDefLineNumber() const { return DefLineNumber; }
};
/// Class representing the use of a numeric variable in the AST of an
@@ -675,14 +675,14 @@ class Pattern {
/// Line number for this CHECK pattern or std::nullopt if it is an implicit
/// pattern. Used to determine whether a variable definition is made on an
/// earlier line to the one with this CHECK.
- std::optional<size_t> LineNumber;
+ Optional<size_t> LineNumber;
/// Ignore case while matching if set to true.
bool IgnoreCase = false;
public:
Pattern(Check::FileCheckType Ty, FileCheckPatternContext *Context,
- std::optional<size_t> Line = std::nullopt)
+ Optional<size_t> Line = std::nullopt)
: Context(Context), CheckTy(Ty), LineNumber(Line) {}
/// \returns the location in source code.
@@ -719,8 +719,8 @@ public:
/// representing the numeric variable defined in this numeric substitution
/// block, or std::nullopt if this block does not define any variable.
static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
- StringRef Expr, std::optional<NumericVariable *> &DefinedNumericVariable,
- bool IsLegacyLineExpr, std::optional<size_t> LineNumber,
+ StringRef Expr, Optional<NumericVariable *> &DefinedNumericVariable,
+ bool IsLegacyLineExpr, Optional<size_t> LineNumber,
FileCheckPatternContext *Context, const SourceMgr &SM);
/// Parses the pattern in \p PatternStr and initializes this Pattern instance
/// accordingly.
@@ -736,7 +736,7 @@ public:
size_t Len;
};
struct MatchResult {
- std::optional<Match> TheMatch;
+ Optional<Match> TheMatch;
Error TheError;
MatchResult(size_t MatchPos, size_t MatchLen, Error E)
: TheMatch(Match{MatchPos, MatchLen}), TheError(std::move(E)) {}
@@ -794,7 +794,7 @@ private:
/// should defining such a variable be invalid.
static Expected<NumericVariable *> parseNumericVariableDefinition(
StringRef &Expr, FileCheckPatternContext *Context,
- std::optional<size_t> LineNumber, ExpressionFormat ImplicitFormat,
+ Optional<size_t> LineNumber, ExpressionFormat ImplicitFormat,
const SourceMgr &SM);
/// Parses \p Name as a (pseudo if \p IsPseudo is true) numeric variable use
/// at line \p LineNumber, or before input is parsed if \p LineNumber is
@@ -803,7 +803,7 @@ private:
/// representing that variable if successful, or an error holding a
/// diagnostic against \p SM otherwise.
static Expected<std::unique_ptr<NumericVariableUse>> parseNumericVariableUse(
- StringRef Name, bool IsPseudo, std::optional<size_t> LineNumber,
+ StringRef Name, bool IsPseudo, Optional<size_t> LineNumber,
FileCheckPatternContext *Context, const SourceMgr &SM);
enum class AllowedOperand { LineVar, LegacyLiteral, Any };
/// Parses \p Expr for use of a numeric operand at line \p LineNumber, or
@@ -817,7 +817,7 @@ private:
/// function will attempt to parse a parenthesized expression.
static Expected<std::unique_ptr<ExpressionAST>>
parseNumericOperand(StringRef &Expr, AllowedOperand AO, bool ConstraintParsed,
- std::optional<size_t> LineNumber,
+ Optional<size_t> LineNumber,
FileCheckPatternContext *Context, const SourceMgr &SM);
/// Parses and updates \p RemainingExpr for a binary operation at line
/// \p LineNumber, or before input is parsed if \p LineNumber is None. The
@@ -831,7 +831,7 @@ private:
static Expected<std::unique_ptr<ExpressionAST>>
parseBinop(StringRef Expr, StringRef &RemainingExpr,
std::unique_ptr<ExpressionAST> LeftOp, bool IsLegacyLineExpr,
- std::optional<size_t> LineNumber, FileCheckPatternContext *Context,
+ Optional<size_t> LineNumber, FileCheckPatternContext *Context,
const SourceMgr &SM);
/// Parses a parenthesized expression inside \p Expr at line \p LineNumber, or
@@ -841,7 +841,7 @@ private:
/// variables. \returns the class representing that operand in the AST of the
/// expression or an error holding a diagnostic against \p SM otherwise.
static Expected<std::unique_ptr<ExpressionAST>>
- parseParenExpr(StringRef &Expr, std::optional<size_t> LineNumber,
+ parseParenExpr(StringRef &Expr, Optional<size_t> LineNumber,
FileCheckPatternContext *Context, const SourceMgr &SM);
/// Parses \p Expr for an argument list belonging to a call to function \p
@@ -853,8 +853,8 @@ private:
/// otherwise.
static Expected<std::unique_ptr<ExpressionAST>>
parseCallExpr(StringRef &Expr, StringRef FuncName,
- std::optional<size_t> LineNumber,
- FileCheckPatternContext *Context, const SourceMgr &SM);
+ Optional<size_t> LineNumber, FileCheckPatternContext *Context,
+ const SourceMgr &SM);
};
//===----------------------------------------------------------------------===//