forked from OSchip/llvm-project
[clang] Don't use Optional::hasValue (NFC)
This patch replaces x.hasValue() with x where x is contextually convertible to bool.
This commit is contained in:
parent
d08f34b592
commit
ca05cc2064
|
@ -53,14 +53,10 @@ public:
|
|||
}
|
||||
|
||||
/// Return true if the constraint is perfectly constrained to 'true'.
|
||||
bool isConstrainedTrue() const {
|
||||
return Val.hasValue() && Val.getValue();
|
||||
}
|
||||
bool isConstrainedTrue() const { return Val && Val.getValue(); }
|
||||
|
||||
/// Return true if the constraint is perfectly constrained to 'false'.
|
||||
bool isConstrainedFalse() const {
|
||||
return Val.hasValue() && !Val.getValue();
|
||||
}
|
||||
bool isConstrainedFalse() const { return Val && !Val.getValue(); }
|
||||
|
||||
/// Return true if the constrained is perfectly constrained.
|
||||
bool isConstrained() const {
|
||||
|
|
|
@ -209,8 +209,8 @@ public:
|
|||
}
|
||||
|
||||
bool isValid() const { return Valid; }
|
||||
bool isScalar() const { return Scale.hasValue() && Scale.getValue() == 0; }
|
||||
bool isVector() const { return Scale.hasValue() && Scale.getValue() != 0; }
|
||||
bool isScalar() const { return Scale && Scale.getValue() == 0; }
|
||||
bool isVector() const { return Scale && Scale.getValue() != 0; }
|
||||
bool isVector(unsigned Width) const {
|
||||
return isVector() && ElementBitwidth == Width;
|
||||
}
|
||||
|
|
|
@ -3325,8 +3325,8 @@ class OffloadingActionBuilder final {
|
|||
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
|
||||
AssociatedOffloadKind);
|
||||
|
||||
if (CompileDeviceOnly && CurPhase == FinalPhase &&
|
||||
BundleOutput.hasValue() && BundleOutput.getValue()) {
|
||||
if (CompileDeviceOnly && CurPhase == FinalPhase && BundleOutput &&
|
||||
BundleOutput.getValue()) {
|
||||
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
|
||||
OffloadAction::DeviceDependences DDep;
|
||||
DDep.add(*CudaDeviceActions[I], *ToolChains.front(), GpuArchList[I],
|
||||
|
|
|
@ -213,8 +213,7 @@ MacroDirective::DefInfo MacroDirective::getDefinition() {
|
|||
isPublic = VisMD->isPublic();
|
||||
}
|
||||
|
||||
return DefInfo(nullptr, UndefLoc,
|
||||
!isPublic.hasValue() || isPublic.getValue());
|
||||
return DefInfo(nullptr, UndefLoc, !isPublic || isPublic.getValue());
|
||||
}
|
||||
|
||||
const MacroDirective::DefInfo
|
||||
|
|
|
@ -2313,9 +2313,9 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
|
|||
Sema::DeclareTargetContextInfo DTCI(DKind, DTLoc);
|
||||
if (HasClauses)
|
||||
ParseOMPDeclareTargetClauses(DTCI);
|
||||
bool HasImplicitMappings =
|
||||
DKind == OMPD_begin_declare_target || !HasClauses ||
|
||||
(DTCI.ExplicitlyMapped.empty() && DTCI.Indirect.hasValue());
|
||||
bool HasImplicitMappings = DKind == OMPD_begin_declare_target ||
|
||||
!HasClauses ||
|
||||
(DTCI.ExplicitlyMapped.empty() && DTCI.Indirect);
|
||||
|
||||
// Skip the last annot_pragma_openmp_end.
|
||||
ConsumeAnyToken();
|
||||
|
|
|
@ -40,9 +40,8 @@ isAnnotationDirectlyAfterStatement(const Stmt *Stmt, unsigned AnnotationBegin,
|
|||
auto NextToken =
|
||||
Lexer::findNextToken(Stmt->getEndLoc(), SourceManager, LangOptions);
|
||||
|
||||
while (NextToken.hasValue() &&
|
||||
SourceManager.getFileOffset(NextToken->getLocation()) <
|
||||
AnnotationBegin) {
|
||||
while (NextToken && SourceManager.getFileOffset(NextToken->getLocation()) <
|
||||
AnnotationBegin) {
|
||||
if (NextToken->isNot(tok::semi))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue