++It;
}
- if (AreSafeFunctionsWanted.hasValue())
+ if (AreSafeFunctionsWanted)
UseSafeFunctions = AreSafeFunctionsWanted.getValue();
}
void ClangdLSPServer::onDocumentDidChange(
const DidChangeTextDocumentParams &Params) {
auto WantDiags = WantDiagnostics::Auto;
- if (Params.wantDiagnostics.hasValue())
+ if (Params.wantDiagnostics)
WantDiags = Params.wantDiagnostics.getValue() ? WantDiagnostics::Yes
: WantDiagnostics::No;
clang::clangd::trace::Span Tracer("Completion results callback");
CB(std::move(Result));
}
- if (SpecFuzzyFind && SpecFuzzyFind->NewReq.hasValue()) {
+ if (SpecFuzzyFind && SpecFuzzyFind->NewReq) {
std::lock_guard<std::mutex> Lock(CachedCompletionFuzzyFindRequestMutex);
CachedCompletionFuzzyFindRequestByFile[File] =
SpecFuzzyFind->NewReq.getValue();
namespace clangd {
void FeatureModule::initialize(const Facilities &F) {
- assert(!Fac.hasValue() && "Initialized twice");
+ assert(!Fac && "Initialized twice");
Fac.emplace(F);
}
FeatureModule::Facilities &FeatureModule::facilities() {
- assert(Fac.hasValue() && "Not initialized yet");
+ assert(Fac && "Not initialized yet");
return *Fac;
}
}
MATCHER_P(hasArg, Flag, "") {
- if (!arg.hasValue()) {
+ if (!arg) {
*result_listener << "command is null";
return false;
}
for (auto &A : Params.Table.getActions(Head->State, Lookahead)) {
if (A.kind() != LRTable::Action::Reduce)
continue;
- if (RID.hasValue())
+ if (RID)
return false;
RID = A.getReduceRule();
}
- if (!RID.hasValue())
+ if (!RID)
return true; // no reductions available, but we've processed the head!
const auto &Rule = Params.G.lookupRule(*RID);
const GSS::Node *Base = Head;
void CheckSymbolInfo(SymbolInfo *Expected, SymbolInfo *Actual) {
CheckBaseInfo(Expected, Actual);
EXPECT_EQ(Expected->DefLoc.hasValue(), Actual->DefLoc.hasValue());
- if (Expected->DefLoc.hasValue() && Actual->DefLoc.hasValue()) {
+ if (Expected->DefLoc && Actual->DefLoc.hasValue()) {
EXPECT_EQ(Expected->DefLoc->LineNumber, Actual->DefLoc->LineNumber);
EXPECT_EQ(Expected->DefLoc->Filename, Actual->DefLoc->Filename);
}
assert(Call != nullptr && "Did not find node \"foo\"");
auto Hint = Aliaser->createAlias(*Result.Context, *Call, "::foo::bar",
{"b", "some_alias"});
- if (Hint.hasValue())
+ if (Hint)
diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue();
diag(Call->getBeginLoc(), "insert call") << FixItHint::CreateInsertion(
auto Hint =
Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func");
- if (Hint.hasValue())
+ if (Hint)
diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue();
diag(Call->getBeginLoc(), "insert call")
void setSwiftPrivate(llvm::Optional<bool> Private) {
SwiftPrivateSpecified = Private.hasValue();
- SwiftPrivate = Private.hasValue() ? *Private : 0;
+ SwiftPrivate = Private ? *Private : 0;
}
friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &);
auto &Size0 = MUC0.NumBytes;
auto &Size1 = MUC1.NumBytes;
if (OrigAlignment0 == OrigAlignment1 && SrcValOffset0 != SrcValOffset1 &&
- Size0.hasValue() && Size1.hasValue() && *Size0 == *Size1 &&
- OrigAlignment0 > *Size0 && SrcValOffset0 % *Size0 == 0 &&
- SrcValOffset1 % *Size1 == 0) {
+ Size0 && Size1 && *Size0 == *Size1 && OrigAlignment0 > *Size0 &&
+ SrcValOffset0 % *Size0 == 0 && SrcValOffset1 % *Size1 == 0) {
int64_t OffAlign0 = SrcValOffset0 % OrigAlignment0.value();
int64_t OffAlign1 = SrcValOffset1 % OrigAlignment1.value();
Optional<int> Count =
getOptionalIntLoopAttribute(LoopID, "llvm.loop.unroll.count");
- if (Count.hasValue())
+ if (Count)
return Count.getValue() == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
if (getBooleanLoopAttribute(LoopID, "llvm.loop.unroll.enable"))
auto L1DCache = llvm::TargetTransformInfo::CacheLevel::L1D;
auto L2DCache = llvm::TargetTransformInfo::CacheLevel::L2D;
if (FirstCacheLevelSize == -1) {
- if (TTI->getCacheSize(L1DCache).hasValue())
+ if (TTI->getCacheSize(L1DCache))
FirstCacheLevelSize = TTI->getCacheSize(L1DCache).getValue();
else
FirstCacheLevelSize = static_cast<int>(FirstCacheLevelDefaultSize);
}
if (SecondCacheLevelSize == -1) {
- if (TTI->getCacheSize(L2DCache).hasValue())
+ if (TTI->getCacheSize(L2DCache))
SecondCacheLevelSize = TTI->getCacheSize(L2DCache).getValue();
else
SecondCacheLevelSize = static_cast<int>(SecondCacheLevelDefaultSize);
}
if (FirstCacheLevelAssociativity == -1) {
- if (TTI->getCacheAssociativity(L1DCache).hasValue())
+ if (TTI->getCacheAssociativity(L1DCache))
FirstCacheLevelAssociativity =
TTI->getCacheAssociativity(L1DCache).getValue();
else
static_cast<int>(FirstCacheLevelDefaultAssociativity);
}
if (SecondCacheLevelAssociativity == -1) {
- if (TTI->getCacheAssociativity(L2DCache).hasValue())
+ if (TTI->getCacheAssociativity(L2DCache))
SecondCacheLevelAssociativity =
TTI->getCacheAssociativity(L2DCache).getValue();
else