StringRef Name;
/// Value of numeric variable, if defined, or None otherwise.
- llvm::Optional<uint64_t> Value;
+ Optional<uint64_t> Value;
public:
/// Constructor for numeric variable \p Name with a known \p Value at parse
StringRef getName() const { return Name; }
/// \returns value of this numeric variable.
- llvm::Optional<uint64_t> getValue() const { return Value; }
+ Optional<uint64_t> getValue() const { return Value; }
/// Sets value of this numeric variable if not defined. \returns whether the
/// variable was already defined.
/// Evaluates the value of this numeric expression, using EvalBinop to
/// perform the binary operation it consists of. \returns None if the numeric
/// variable used is undefined, or the expression value otherwise.
- llvm::Optional<uint64_t> eval() const;
+ Optional<uint64_t> eval() const;
/// \returns the name of the undefined variable used in this expression if
/// any or an empty string otherwise.
/// \returns a string containing the result of the substitution represented
/// by this class instance or None if substitution failed.
- virtual llvm::Optional<std::string> getResult() const = 0;
+ virtual Optional<std::string> getResult() const = 0;
/// \returns the name of the variable used in this substitution if undefined,
/// or an empty string otherwise.
/// \returns the text that the string variable in this substitution matched
/// when defined, or None if the variable is undefined.
- llvm::Optional<std::string> getResult() const override;
+ Optional<std::string> getResult() const override;
/// \returns the name of the string variable used in this substitution if
/// undefined, or an empty string otherwise.
/// \returns a string containing the result of evaluating the numeric
/// expression in this substitution, or None if evaluation failed.
- llvm::Optional<std::string> getResult() const override;
+ Optional<std::string> getResult() const override;
/// \returns the name of the numeric variable used in this substitution if
/// undefined, or an empty string otherwise.
public:
/// \returns the value of string variable \p VarName or None if no such
/// variable has been defined.
- llvm::Optional<StringRef> getPatternVarValue(StringRef VarName);
+ Optional<StringRef> getPatternVarValue(StringRef VarName);
/// Defines string and numeric variables from definitions given on the
/// command line, passed as a vector of [#]VAR=VAL strings in
bool FileCheckNumericVariable::clearValue() {
if (!Value)
return true;
- Value = llvm::None;
+ Value = None;
return false;
}
-llvm::Optional<uint64_t> FileCheckNumExpr::eval() const {
- llvm::Optional<uint64_t> LeftOp = this->LeftOp->getValue();
+Optional<uint64_t> FileCheckNumExpr::eval() const {
+ Optional<uint64_t> LeftOp = this->LeftOp->getValue();
// Variable is undefined.
if (!LeftOp)
- return llvm::None;
+ return None;
return EvalBinop(*LeftOp, RightOp);
}
return StringRef();
}
-llvm::Optional<std::string> FileCheckNumericSubstitution::getResult() const {
- llvm::Optional<uint64_t> EvaluatedValue = NumExpr->eval();
+Optional<std::string> FileCheckNumericSubstitution::getResult() const {
+ Optional<uint64_t> EvaluatedValue = NumExpr->eval();
if (!EvaluatedValue)
- return llvm::None;
+ return None;
return utostr(*EvaluatedValue);
}
-llvm::Optional<std::string> FileCheckStringSubstitution::getResult() const {
+Optional<std::string> FileCheckStringSubstitution::getResult() const {
// Look up the value and escape it so that we can put it into the regex.
- llvm::Optional<StringRef> VarVal = Context->getPatternVarValue(FromStr);
+ Optional<StringRef> VarVal = Context->getPatternVarValue(FromStr);
if (!VarVal)
- return llvm::None;
+ return None;
return Regex::escape(*VarVal);
}
// handled by back-references.
for (const auto &Substitution : Substitutions) {
// Substitute and check for failure (e.g. use of undefined variable).
- llvm::Optional<std::string> Value = Substitution->getResult();
+ Optional<std::string> Value = Substitution->getResult();
if (!Value)
return StringRef::npos;
for (const auto &Substitution : Substitutions) {
SmallString<256> Msg;
raw_svector_ostream OS(Msg);
- llvm::Optional<std::string> MatchedValue = Substitution->getResult();
+ Optional<std::string> MatchedValue = Substitution->getResult();
// Substitution failed or is not known at match time, print the undefined
// variable it uses.
}
}
-llvm::Optional<StringRef>
+Optional<StringRef>
FileCheckPatternContext::getPatternVarValue(StringRef VarName) {
auto VarIter = GlobalVariableTable.find(VarName);
if (VarIter == GlobalVariableTable.end())
- return llvm::None;
+ return None;
return VarIter->second;
}
return StringRef::npos;
}
-StringRef
-llvm::FileCheck::CanonicalizeFile(MemoryBuffer &MB,
- SmallVectorImpl<char> &OutputBuffer) {
+StringRef FileCheck::CanonicalizeFile(MemoryBuffer &MB,
+ SmallVectorImpl<char> &OutputBuffer) {
OutputBuffer.reserve(MB.getBufferSize());
for (const char *Ptr = MB.getBufferStart(), *End = MB.getBufferEnd();
return {StringRef(), StringRef()};
}
-bool llvm::FileCheck::ReadCheckFile(
- SourceMgr &SM, StringRef Buffer, Regex &PrefixRE,
- std::vector<FileCheckString> &CheckStrings) {
+bool FileCheck::ReadCheckFile(SourceMgr &SM, StringRef Buffer, Regex &PrefixRE,
+ std::vector<FileCheckString> &CheckStrings) {
if (PatternContext.defineCmdlineVariables(Req.GlobalDefines, SM))
return true;
return Validator.match(CheckPrefix);
}
-bool llvm::FileCheck::ValidateCheckPrefixes() {
+bool FileCheck::ValidateCheckPrefixes() {
StringSet<> PrefixSet;
for (StringRef Prefix : Req.CheckPrefixes) {
return true;
}
-Regex llvm::FileCheck::buildCheckPrefixRegex() {
+Regex FileCheck::buildCheckPrefixRegex() {
// I don't think there's a way to specify an initial value for cl::list,
// so if nothing was specified, add the default
if (Req.CheckPrefixes.empty())
GlobalNumericVariableTable.erase(Var);
}
-bool llvm::FileCheck::CheckInput(SourceMgr &SM, StringRef Buffer,
- ArrayRef<FileCheckString> CheckStrings,
- std::vector<FileCheckDiag> *Diags) {
+bool FileCheck::CheckInput(SourceMgr &SM, StringRef Buffer,
+ ArrayRef<FileCheckString> CheckStrings,
+ std::vector<FileCheckDiag> *Diags) {
bool ChecksFailed = false;
unsigned i = 0, j = 0, e = CheckStrings.size();