if (Callee) {
handleCall(Callee, E->arguments());
}
- return !Info.hasValue();
+ return !Info.has_value();
}
bool VisitCXXConstructExpr(CXXConstructExpr *E) {
if (Callee) {
handleCall(Callee, E->arguments());
}
- return !Info.hasValue();
+ return !Info.has_value();
}
// The expanded parameter pack to be resolved
std::stable_partition(Completion.Includes.begin(),
Completion.Includes.end(),
[](const CodeCompletion::IncludeCandidate &I) {
- return !I.Insertion.hasValue();
+ return !I.Insertion.has_value();
});
}
}
#endif
// Make sure exactly one of the Sources is set.
- unsigned SourceCount = External.File.hasValue() +
- External.Server.hasValue() + *External.IsNone;
+ unsigned SourceCount = External.File.has_value() +
+ External.Server.has_value() + *External.IsNone;
if (SourceCount != 1) {
diag(Error, "Exactly one of File, Server or None must be set.",
BlockRange);
template <> struct MappingTraits<VariantEntry> {
static void mapping(IO &IO, VariantEntry &Variant) {
- if (IO.mapTag("!Symbol", Variant.Symbol.hasValue())) {
+ if (IO.mapTag("!Symbol", Variant.Symbol.has_value())) {
if (!IO.outputting())
Variant.Symbol.emplace();
MappingTraits<Symbol>::mapping(IO, *Variant.Symbol);
- } else if (IO.mapTag("!Refs", Variant.Refs.hasValue())) {
+ } else if (IO.mapTag("!Refs", Variant.Refs.has_value())) {
if (!IO.outputting())
Variant.Refs.emplace();
MappingTraits<RefBundle>::mapping(IO, *Variant.Refs);
- } else if (IO.mapTag("!Relations", Variant.Relation.hasValue())) {
+ } else if (IO.mapTag("!Relations", Variant.Relation.has_value())) {
if (!IO.outputting())
Variant.Relation.emplace();
MappingTraits<Relation>::mapping(IO, *Variant.Relation);
- } else if (IO.mapTag("!Source", Variant.Source.hasValue())) {
+ } else if (IO.mapTag("!Source", Variant.Source.has_value())) {
if (!IO.outputting())
Variant.Source.emplace();
MappingTraits<IncludeGraphNode>::mapping(IO, *Variant.Source);
- } else if (IO.mapTag("!Cmd", Variant.Cmd.hasValue())) {
+ } else if (IO.mapTag("!Cmd", Variant.Cmd.has_value())) {
if (!IO.outputting())
Variant.Cmd.emplace();
MappingTraits<CompileCommandYAML>::mapping(
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
ASSERT_EQ(Results.size(), 1u);
ASSERT_TRUE(Results[0].Index.External);
- EXPECT_FALSE(Results[0].Index.External.getValue()->File.hasValue());
- EXPECT_FALSE(Results[0].Index.External.getValue()->MountPoint.hasValue());
- EXPECT_FALSE(Results[0].Index.External.getValue()->Server.hasValue());
+ EXPECT_FALSE(Results[0].Index.External.getValue()->File.has_value());
+ EXPECT_FALSE(Results[0].Index.External.getValue()->MountPoint.has_value());
+ EXPECT_FALSE(Results[0].Index.External.getValue()->Server.has_value());
EXPECT_THAT(*Results[0].Index.External.getValue()->IsNone, testing::Eq(true));
}
EXPECT_TRUE(ProduceFS->status("y"));
EXPECT_TRUE(ProduceFS->status("main"));
- EXPECT_TRUE(StatCache.lookup(testPath("x")).hasValue());
- EXPECT_TRUE(StatCache.lookup(testPath("y")).hasValue());
+ EXPECT_TRUE(StatCache.lookup(testPath("x")).has_value());
+ EXPECT_TRUE(StatCache.lookup(testPath("y")).has_value());
// Main file is not cached.
- EXPECT_FALSE(StatCache.lookup(testPath("main")).hasValue());
+ EXPECT_FALSE(StatCache.lookup(testPath("main")).has_value());
llvm::vfs::Status S("fake", llvm::sys::fs::UniqueID(123, 456),
std::chrono::system_clock::now(), 0, 0, 1024,
FS.Files[testPath("x/compile_flags.txt")] = "-DFOO";
DirectoryBasedGlobalCompilationDatabase CDB(FS);
auto Commands = CDB.getCompileCommand(testPath("x/y.cpp"));
- ASSERT_TRUE(Commands.hasValue());
+ ASSERT_TRUE(Commands.has_value());
EXPECT_THAT(Commands.getValue().CommandLine, Contains("-DFOO"));
// Make sure we pick the right working directory.
EXPECT_EQ(testPath("x"), Commands.getValue().Directory);
FS.Files[Invalid];
Optional<Path> PathResult =
getCorrespondingHeaderOrSource(FooCpp, FS.view(llvm::None));
- EXPECT_TRUE(PathResult.hasValue());
+ EXPECT_TRUE(PathResult.has_value());
ASSERT_EQ(PathResult.getValue(), FooH);
PathResult = getCorrespondingHeaderOrSource(FooH, FS.view(llvm::None));
- EXPECT_TRUE(PathResult.hasValue());
+ EXPECT_TRUE(PathResult.has_value());
ASSERT_EQ(PathResult.getValue(), FooCpp);
// Test with header file in capital letters and different extension, source
FS.Files[FooC];
FS.Files[FooHH];
PathResult = getCorrespondingHeaderOrSource(FooC, FS.view(llvm::None));
- EXPECT_TRUE(PathResult.hasValue());
+ EXPECT_TRUE(PathResult.has_value());
ASSERT_EQ(PathResult.getValue(), FooHH);
// Test with both capital letters
FS.Files[Foo2C];
FS.Files[Foo2HH];
PathResult = getCorrespondingHeaderOrSource(Foo2C, FS.view(llvm::None));
- EXPECT_TRUE(PathResult.hasValue());
+ EXPECT_TRUE(PathResult.has_value());
ASSERT_EQ(PathResult.getValue(), Foo2HH);
// Test with source file as capital letter and .hxx header file
FS.Files[Foo3C];
FS.Files[Foo3HXX];
PathResult = getCorrespondingHeaderOrSource(Foo3C, FS.view(llvm::None));
- EXPECT_TRUE(PathResult.hasValue());
+ EXPECT_TRUE(PathResult.has_value());
ASSERT_EQ(PathResult.getValue(), Foo3HXX);
// Test if asking for a corresponding file that doesn't exist returns an empty
// string.
PathResult = getCorrespondingHeaderOrSource(Invalid, FS.view(llvm::None));
- EXPECT_FALSE(PathResult.hasValue());
+ EXPECT_FALSE(PathResult.has_value());
}
MATCHER_P(declNamed, Name, "") {
auto &RawPlusOne = RawHandlers.MethodHandlers["plusOne"];
RawPlusOne(1, capture(Reply));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(2));
RawPlusOne("foo", capture(Reply));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(
Reply.getValue(),
llvm::FailedWithMessage(
auto &RawFail = RawHandlers.MethodHandlers["fail"];
RawFail(2, capture(Reply));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::FailedWithMessage("X=2"));
auto &RawNotify = RawHandlers.NotificationHandlers["notify"];
auto &RawCmdPlusOne = RawHandlers.CommandHandlers["cmdPlusOne"];
RawCmdPlusOne(1, capture(Reply));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(2));
// None of this generated any outgoing traffic.
llvm::Optional<llvm::Expected<Foo>> Reply;
Echo(Foo{2}, capture(Reply));
EXPECT_THAT(RawOutgoing.take("echo"), ElementsAre(llvm::json::Value(2)));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(Foo{2}));
// JSON response is integer, can't be parsed as string.
WrongSignature(Foo{2}, capture(WrongTypeReply));
EXPECT_THAT(RawOutgoing.take("wrongSignature"),
ElementsAre(llvm::json::Value(2)));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(WrongTypeReply.getValue(),
llvm::FailedWithMessage(
HasSubstr("failed to decode wrongSignature reply")));
Fail(Foo{2}, capture(Reply));
EXPECT_THAT(RawOutgoing.take("fail"), ElementsAre(llvm::json::Value(2)));
- ASSERT_TRUE(Reply.hasValue());
+ ASSERT_TRUE(Reply.has_value());
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::FailedWithMessage("Params=2"));
}
TidyProvider Provider = provideClangTidyFiles(FS);
auto BaseOptions = getTidyOptionsForFile(Provider, testPath("File.cpp"));
- ASSERT_TRUE(BaseOptions.Checks.hasValue());
+ ASSERT_TRUE(BaseOptions.Checks.has_value());
EXPECT_EQ(*BaseOptions.Checks, "llvm-*");
EXPECT_EQ(BaseOptions.CheckOptions.lookup("TestKey").Value, "1");
auto Sub1Options = getTidyOptionsForFile(Provider, testPath("sub1/File.cpp"));
- ASSERT_TRUE(Sub1Options.Checks.hasValue());
+ ASSERT_TRUE(Sub1Options.Checks.has_value());
EXPECT_EQ(*Sub1Options.Checks, "misc-*");
EXPECT_EQ(Sub1Options.CheckOptions.lookup("TestKey").Value, "2");
auto Sub2Options =
getTidyOptionsForFile(Provider, testPath("sub1/sub2/File.cpp"));
- ASSERT_TRUE(Sub2Options.Checks.hasValue());
+ ASSERT_TRUE(Sub2Options.Checks.has_value());
EXPECT_EQ(*Sub2Options.Checks, "misc-*,bugprone-*");
EXPECT_EQ(Sub2Options.CheckOptions.lookup("TestKey").Value, "3");
}
FamilySequences.emplace_back(Sequences.top().first.Rule, *Push.Seq);
for (const GSS::Node *Base : Push.LastPop->parents()) {
auto NextState = Lang.Table.getGoToState(Base->State, F.Symbol);
- assert(NextState.hasValue() && "goto must succeed after reduce!");
+ assert(NextState.has_value() && "goto must succeed after reduce!");
FamilyBases.emplace_back(*NextState, Base);
}
const GSS::Node *Head = Heads->back();
llvm::Optional<RuleID> RID;
for (RuleID R : Lang.Table.getReduceRules(Head->State)) {
- if (RID.hasValue())
+ if (RID.has_value())
return false;
RID = R;
}
const ForestNode *Parsed =
&Params.Forest.createSequence(Rule.Target, *RID, TempSequence);
auto NextState = Lang.Table.getGoToState(Base->State, Rule.Target);
- assert(NextState.hasValue() && "goto must succeed after reduce!");
+ assert(NextState.has_value() && "goto must succeed after reduce!");
Heads->push_back(Params.GSStack.addNode(*NextState, Parsed, {Base}));
return true;
}
// The parse was successful if we're in state `_ := start-symbol .`
auto AcceptState = Lang.Table.getGoToState(StartState, StartSymbol);
- assert(AcceptState.hasValue() && "goto must succeed after start symbol!");
+ assert(AcceptState.has_value() && "goto must succeed after start symbol!");
auto SearchForAccept = [&](llvm::ArrayRef<const GSS::Node *> Heads) {
const ForestNode *Result = nullptr;
for (const auto *Head : Heads) {
void CheckSymbolInfo(SymbolInfo *Expected, SymbolInfo *Actual) {
CheckBaseInfo(Expected, Actual);
- EXPECT_EQ(Expected->DefLoc.hasValue(), Actual->DefLoc.hasValue());
- if (Expected->DefLoc && Actual->DefLoc.hasValue()) {
+ EXPECT_EQ(Expected->DefLoc.has_value(), Actual->DefLoc.has_value());
+ if (Expected->DefLoc && Actual->DefLoc.has_value()) {
EXPECT_EQ(Expected->DefLoc->LineNumber, Actual->DefLoc->LineNumber);
EXPECT_EQ(Expected->DefLoc->Filename, Actual->DefLoc->Filename);
}
EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
EXPECT_EQ("user2", *Options.User);
- ASSERT_TRUE(Options.ExtraArgs.hasValue());
+ ASSERT_TRUE(Options.ExtraArgs.has_value());
EXPECT_EQ("arg1,arg2,arg3,arg4", llvm::join(Options.ExtraArgs->begin(),
Options.ExtraArgs->end(), ","));
- ASSERT_TRUE(Options.ExtraArgsBefore.hasValue());
+ ASSERT_TRUE(Options.ExtraArgsBefore.has_value());
EXPECT_EQ("arg-before1,arg-before2,arg-before3,arg-before4",
llvm::join(Options.ExtraArgsBefore->begin(),
Options.ExtraArgsBefore->end(), ","));
- ASSERT_TRUE(Options.UseColor.hasValue());
+ ASSERT_TRUE(Options.UseColor.has_value());
EXPECT_TRUE(*Options.UseColor);
}
CHECK_VAL(TestCheck.getIntLocal("IntExpected"), 1);
CHECK_VAL(TestCheck.getIntGlobal("GlobalIntExpected"), 1);
- EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid1").hasValue());
- EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid2").hasValue());
- EXPECT_FALSE(TestCheck.getIntGlobal("GlobalIntInvalid").hasValue());
+ EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid1").has_value());
+ EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid2").has_value());
+ EXPECT_FALSE(TestCheck.getIntGlobal("GlobalIntInvalid").has_value());
ASSERT_EQ(TestCheck.getIntLocal("DefaultedIntInvalid", 1), 1);
CHECK_VAL(TestCheck.getIntLocal<bool>("BoolITrueValue"), true);
/*IgnoreCase*/ true),
Colours::Violet);
- EXPECT_FALSE(TestCheck.getIntLocal<Colours>("ValidWrongCase").hasValue());
- EXPECT_FALSE(TestCheck.getIntLocal<Colours>("NearMiss").hasValue());
- EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalInvalid").hasValue());
+ EXPECT_FALSE(TestCheck.getIntLocal<Colours>("ValidWrongCase").has_value());
+ EXPECT_FALSE(TestCheck.getIntLocal<Colours>("NearMiss").has_value());
+ EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalInvalid").has_value());
EXPECT_FALSE(
- TestCheck.getIntGlobal<Colours>("GlobalValidWrongCase").hasValue());
- EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalNearMiss").hasValue());
+ TestCheck.getIntGlobal<Colours>("GlobalValidWrongCase").has_value());
+ EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalNearMiss").has_value());
- EXPECT_FALSE(TestCheck.getIntLocal<Colours>("Invalid").hasValue());
+ EXPECT_FALSE(TestCheck.getIntLocal<Colours>("Invalid").has_value());
EXPECT_THAT(
DiagConsumer.take(),
UnorderedElementsAre(
ClangTidyOptions File3Options =
FileOpt.getOptions("ProjectRoot/SubDir1/SubDir2/SubDir3/File.cpp");
- ASSERT_TRUE(File1Options.Checks.hasValue());
+ ASSERT_TRUE(File1Options.Checks.has_value());
EXPECT_EQ(*File1Options.Checks, "-*,clang-diagnostic-*,readability-*");
- ASSERT_TRUE(File2Options.Checks.hasValue());
+ ASSERT_TRUE(File2Options.Checks.has_value());
EXPECT_EQ(*File2Options.Checks, "bugprone-*,misc-*,clang-diagnostic-*");
// 2 and 3 should use the same config so these should also be the same.
}
void setSwiftPrivate(llvm::Optional<bool> Private) {
- SwiftPrivateSpecified = Private.hasValue();
+ SwiftPrivateSpecified = Private.has_value();
SwiftPrivate = Private ? *Private : 0;
}
bool isArgumentConstructedDirectly(unsigned Index) const {
// This assumes that the object was not yet removed from the state.
return ExprEngine::getObjectUnderConstruction(
- getState(), {getOriginExpr(), Index}, getLocationContext()).hasValue();
+ getState(), {getOriginExpr(), Index}, getLocationContext())
+ .has_value();
}
/// Some calls have parameter numbering mismatched from argument numbering.
bool isConstrainedFalse() const { return Val && !Val.getValue(); }
/// Return true if the constrained is perfectly constrained.
- bool isConstrained() const {
- return Val.hasValue();
- }
+ bool isConstrained() const { return Val.has_value(); }
/// Return true if the constrained is underconstrained and we do not know
/// if the constraint is true of value.
- bool isUnderconstrained() const {
- return !Val.hasValue();
- }
+ bool isUnderconstrained() const { return !Val.has_value(); }
};
class ConstraintManager {
assert(!isDirectory() && "not a file");
assert(Contents && "contents not initialized");
if (auto *Directives = Contents->DepDirectives.load()) {
- if (Directives->hasValue())
+ if (Directives->has_value())
return ArrayRef<dependency_directives_scan::Directive>(
Directives->getValue());
}
// Overwrite existing if the new member has more info.
// The preference of . vs :: vs -> is fairly arbitrary.
if (/*Inserted*/ R.second ||
- std::make_tuple(M.ArgTypes.hasValue(), M.ResultType != nullptr,
- M.Operator) > std::make_tuple(O.ArgTypes.hasValue(),
+ std::make_tuple(M.ArgTypes.has_value(), M.ResultType != nullptr,
+ M.Operator) > std::make_tuple(O.ArgTypes.has_value(),
O.ResultType != nullptr,
O.Operator))
O = std::move(M);
/// false - otherwise.
bool isOrderedRegion() const {
if (const SharingMapTy *Top = getTopOfStackOrNull())
- return Top->OrderedRegion.hasValue();
+ return Top->OrderedRegion.has_value();
return false;
}
/// Returns optional parameter for the ordered region.
/// 'ordered' clause), false - otherwise.
bool isParentOrderedRegion() const {
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
- return Parent->OrderedRegion.hasValue();
+ return Parent->OrderedRegion.has_value();
return false;
}
/// Returns optional parameter for the ordered region.
/// Return true if any expression is dependent.
bool dependent() const;
/// Returns true if the initializer forms non-rectangular loop.
- bool doesInitDependOnLC() const { return InitDependOnLC.hasValue(); }
+ bool doesInitDependOnLC() const { return InitDependOnLC.has_value(); }
/// Returns true if the condition forms non-rectangular loop.
- bool doesCondDependOnLC() const { return CondDependOnLC.hasValue(); }
+ bool doesCondDependOnLC() const { return CondDependOnLC.has_value(); }
/// Returns index of the loop we depend on (starting from 1), or 0 otherwise.
unsigned getLoopDependentIdx() const {
return InitDependOnLC.value_or(CondDependOnLC.value_or(0));
Expr *MaxExpr = nullptr;
Expr *LBExpr = TestIsLessOp.getValue() ? LB : UB;
Expr *UBExpr = TestIsLessOp.getValue() ? UB : LB;
- bool LBNonRect = TestIsLessOp.getValue() ? InitDependOnLC.hasValue()
- : CondDependOnLC.hasValue();
- bool UBNonRect = TestIsLessOp.getValue() ? CondDependOnLC.hasValue()
- : InitDependOnLC.hasValue();
+ bool LBNonRect = TestIsLessOp.getValue() ? InitDependOnLC.has_value()
+ : CondDependOnLC.has_value();
+ bool UBNonRect = TestIsLessOp.getValue() ? CondDependOnLC.has_value()
+ : InitDependOnLC.has_value();
Expr *Lower =
LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
Expr *Upper =
// without this file existing on disk.
if (!U.Size || (!U.ModTime && IncludeTimestamps)) {
PP->Diag(U.FileNameLoc, diag::err_module_no_size_mtime_for_header)
- << WritingModule->getFullModuleName() << U.Size.hasValue()
- << U.FileName;
+ << WritingModule->getFullModuleName() << U.Size.has_value()
+ << U.FileName;
continue;
}
}
bool PathSensitiveBugReport::isInteresting(SVal V) const {
- return getInterestingnessKind(V).hasValue();
+ return getInterestingnessKind(V).has_value();
}
bool PathSensitiveBugReport::isInteresting(SymbolRef sym) const {
- return getInterestingnessKind(sym).hasValue();
+ return getInterestingnessKind(sym).has_value();
}
bool PathSensitiveBugReport::isInteresting(const MemRegion *R) const {
- return getInterestingnessKind(R).hasValue();
+ return getInterestingnessKind(R).has_value();
}
bool PathSensitiveBugReport::isInteresting(const LocationContext *LC) const {
)
)matcher";
Diagnostics Error;
- EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
+ EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
}
{
Code = R"matcher(decl(decl()
, decl()))matcher";
Diagnostics Error;
- EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
+ EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
}
{
Code = R"matcher(decl(decl(),
decl()))matcher";
Diagnostics Error;
- EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
+ EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
}
{
Code = "namedDecl(hasName(\"n\"\n))";
Diagnostics Error;
- EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
+ EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
}
{
return NoopAnalysis(C, false);
}));
EXPECT_EQ(BlockStates.size(), 2u);
- EXPECT_TRUE(BlockStates[0].hasValue());
- EXPECT_TRUE(BlockStates[1].hasValue());
+ EXPECT_TRUE(BlockStates[0].has_value());
+ EXPECT_TRUE(BlockStates[1].has_value());
}
struct NonConvergingLattice {
EXPECT_EQ("\n=============== ExpansionRanges ===============\n",
dumpExpansionRanges(*Ctx));
- EXPECT_FALSE(Ctx->getExpandedText(at(2, 1)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(2, 1)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(2, 1)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(2, 1)).has_value());
- EXPECT_FALSE(Ctx->getExpandedText(at(2, 3)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(2, 3)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(2, 3)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(2, 3)).has_value());
- EXPECT_FALSE(Ctx->getExpandedText(at(3, 3)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(3, 3)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(3, 3)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(3, 3)).has_value());
}
TEST_F(MacroExpansionContextTest, NoneForNonExpansionLocations) {
// zz
// That's the beginning of the definition of EMPTY.
- EXPECT_FALSE(Ctx->getExpandedText(at(2, 11)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(2, 11)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(2, 11)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(2, 11)).has_value());
// The space before the first expansion of EMPTY.
- EXPECT_FALSE(Ctx->getExpandedText(at(3, 9)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(3, 9)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(3, 9)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(3, 9)).has_value());
// The beginning of the first expansion of EMPTY.
- EXPECT_TRUE(Ctx->getExpandedText(at(3, 10)).hasValue());
- EXPECT_TRUE(Ctx->getOriginalText(at(3, 10)).hasValue());
+ EXPECT_TRUE(Ctx->getExpandedText(at(3, 10)).has_value());
+ EXPECT_TRUE(Ctx->getOriginalText(at(3, 10)).has_value());
// Pointing inside of the token EMPTY, but not at the beginning.
// FIXME: We only deal with begin locations.
- EXPECT_FALSE(Ctx->getExpandedText(at(3, 11)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(3, 11)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(3, 11)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(3, 11)).has_value());
// Same here.
- EXPECT_FALSE(Ctx->getExpandedText(at(3, 12)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(3, 12)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(3, 12)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(3, 12)).has_value());
// The beginning of the last expansion of EMPTY.
- EXPECT_TRUE(Ctx->getExpandedText(at(4, 1)).hasValue());
- EXPECT_TRUE(Ctx->getOriginalText(at(4, 1)).hasValue());
+ EXPECT_TRUE(Ctx->getExpandedText(at(4, 1)).has_value());
+ EXPECT_TRUE(Ctx->getOriginalText(at(4, 1)).has_value());
// Same as for the 3:11 case.
- EXPECT_FALSE(Ctx->getExpandedText(at(4, 2)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(4, 2)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(4, 2)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(4, 2)).has_value());
}
TEST_F(MacroExpansionContextTest, EmptyExpansions) {
EXPECT_EQ("Hi", Ctx->getOriginalText(at(5, 3)).getValue());
// There was no macro expansion at 7:3, we should expect None.
- EXPECT_FALSE(Ctx->getExpandedText(at(7, 3)).hasValue());
- EXPECT_FALSE(Ctx->getOriginalText(at(7, 3)).hasValue());
+ EXPECT_FALSE(Ctx->getExpandedText(at(7, 3)).has_value());
+ EXPECT_FALSE(Ctx->getOriginalText(at(7, 3)).has_value());
}
TEST_F(MacroExpansionContextTest, UnbalacedParenthesis) {
llvm::json::Object Obj({});
EXPECT_FALSE(
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
- .hasValue());
+ .has_value());
}
TEST(DarwinSDKInfo, VersionMappingParseError) {
llvm::json::Object Obj({{"test", "1.2"}});
EXPECT_FALSE(
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
- .hasValue());
+ .has_value());
}
TEST(DarwinSDKInfoTest, ParseAndTestMappingMacCatalyst) {
std::future_status::ready)
<< "The expected result state wasn't reached before the time-out.";
std::unique_lock<std::mutex> L(TestConsumer.Mtx);
- EXPECT_TRUE(TestConsumer.result().hasValue());
+ EXPECT_TRUE(TestConsumer.result().has_value());
if (TestConsumer.result()) {
EXPECT_TRUE(*TestConsumer.result());
}
/*RelativePath=*/nullptr, /*RequestingModule=*/nullptr,
/*SuggestedModule=*/nullptr, /*IsMapped=*/nullptr, &IsFrameworkFound);
- EXPECT_TRUE(FoundFile.hasValue());
+ EXPECT_TRUE(FoundFile.has_value());
EXPECT_TRUE(IsFrameworkFound);
auto &FE = FoundFile.getValue();
auto FI = Search.getExistingFileInfo(FE);
/*SuggestedModule=*/nullptr, &IsMapped,
/*IsFrameworkFound=*/nullptr);
- EXPECT_TRUE(FoundFile.hasValue());
+ EXPECT_TRUE(FoundFile.has_value());
EXPECT_TRUE(IsMapped);
auto &FE = FoundFile.getValue();
auto FI = Search.getExistingFileInfo(FE);
EXPECT_EQ("TestUnion", CRecordType->getDecl()->getName());
auto D = getByName("d").getAs<nonloc::CompoundVal>();
- ASSERT_TRUE(D.hasValue());
+ ASSERT_TRUE(D.has_value());
auto Begin = D->begin();
ASSERT_NE(D->end(), Begin);
++Begin;
ASSERT_EQ(D->end(), Begin);
auto LD = D->begin()->getAs<nonloc::LazyCompoundVal>();
- ASSERT_TRUE(LD.hasValue());
+ ASSERT_TRUE(LD.has_value());
auto LDT = LD->getType(Context);
ASSERT_FALSE(LDT.isNull());
const auto *DElaboratedType = dyn_cast<ElaboratedType>(LDT);