[clang] Use true/false instead of 1/0 (NFC)

Identified with modernize-use-bool-literals.
This commit is contained in:
Kazu Hirata 2022-01-09 00:19:47 -08:00
parent 4cd768ed5e
commit 40446663c7
41 changed files with 95 additions and 95 deletions

View File

@ -3291,7 +3291,7 @@ class BaseUsingDecl : public NamedDecl {
protected:
BaseUsingDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
: NamedDecl(DK, DC, L, N), FirstUsingShadow(nullptr, 0) {}
: NamedDecl(DK, DC, L, N), FirstUsingShadow(nullptr, false) {}
private:
void anchor() override;

View File

@ -90,7 +90,7 @@ public:
StoredDeclsList(StoredDeclsList &&RHS) : Data(RHS.Data) {
RHS.Data.setPointer(nullptr);
RHS.Data.setInt(0);
RHS.Data.setInt(false);
}
void MaybeDeallocList() {
@ -114,7 +114,7 @@ public:
Data = RHS.Data;
RHS.Data.setPointer(nullptr);
RHS.Data.setInt(0);
RHS.Data.setInt(false);
return *this;
}
@ -142,7 +142,7 @@ public:
}
void setHasExternalDecls() {
Data.setInt(1);
Data.setInt(true);
}
void remove(NamedDecl *D) {
@ -155,7 +155,7 @@ public:
erase_if([](NamedDecl *ND) { return ND->isFromASTFile(); });
// Don't have any pending external decls any more.
Data.setInt(0);
Data.setInt(false);
}
void replaceExternalDecls(ArrayRef<NamedDecl*> Decls) {
@ -171,7 +171,7 @@ public:
});
// Don't have any pending external decls any more.
Data.setInt(0);
Data.setInt(false);
if (Decls.empty())
return;

View File

@ -498,7 +498,7 @@ private:
TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs,
const ASTTemplateArgumentListInfo *TemplateArgsAsWritten,
SourceLocation POI, MemberSpecializationInfo *MSInfo)
: Function(FD, MSInfo ? 1 : 0), Template(Template, TSK - 1),
: Function(FD, MSInfo ? true : false), Template(Template, TSK - 1),
TemplateArguments(TemplateArgs),
TemplateArgumentsAsWritten(TemplateArgsAsWritten),
PointOfInstantiation(POI) {

View File

@ -275,12 +275,12 @@ public:
friend ASTStmtWriter;
/// \brief No return type requirement was specified.
ReturnTypeRequirement() : TypeConstraintInfo(nullptr, 0) {}
ReturnTypeRequirement() : TypeConstraintInfo(nullptr, false) {}
/// \brief A return type requirement was specified but it was a
/// substitution failure.
ReturnTypeRequirement(SubstitutionDiagnostic *SubstDiag) :
TypeConstraintInfo(SubstDiag, 0) {}
TypeConstraintInfo(SubstDiag, false) {}
/// \brief A 'type constraint' style return type requirement.
/// \param TPL an invented template parameter list containing a single

View File

@ -332,11 +332,11 @@ public:
unsigned amountLength,
bool usesPositionalArg)
: start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {}
UsesPositionalArg(usesPositionalArg), UsesDotPrefix(false) {}
OptionalAmount(bool valid = true)
: start(nullptr),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
UsesPositionalArg(0), UsesDotPrefix(0) {}
UsesPositionalArg(false), UsesDotPrefix(false) {}
explicit OptionalAmount(unsigned Amount)
: start(nullptr), length(0), hs(Constant), amt(Amount),

View File

@ -417,7 +417,7 @@ bool MigrationContext::rewritePropertyAttribute(StringRef fromAttr,
if (tok.is(tok::r_paren))
return false;
while (1) {
while (true) {
if (tok.isNot(tok::raw_identifier)) return false;
if (tok.getRawIdentifier() == fromAttr) {
if (!toAttr.empty()) {

View File

@ -1281,7 +1281,7 @@ StringLiteral::getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
StringOffset = *StartTokenByteOffset;
ByteNo -= StringOffset;
}
while (1) {
while (true) {
assert(TokNo < getNumConcatenated() && "Invalid byte number!");
SourceLocation StrTokLoc = getStrTokenLoc(TokNo);

View File

@ -6037,7 +6037,7 @@ static bool EvaluateArgs(ArrayRef<const Expr *> Args, CallRef Call,
unsigned ASTIdx = Idx.getASTIndex();
if (ASTIdx >= Args.size())
continue;
ForbiddenNullArgs[ASTIdx] = 1;
ForbiddenNullArgs[ASTIdx] = true;
}
}
}

View File

@ -711,8 +711,8 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
CS.setKind(ConversionSpecifier::sArg);
// Disable irrelevant flags
HasAlternativeForm = 0;
HasLeadingZeroes = 0;
HasAlternativeForm = false;
HasLeadingZeroes = false;
// Set the long length modifier for wide characters
if (QT->getPointeeType()->isWideCharType())
@ -878,9 +878,9 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
CS.setKind(ConversionSpecifier::cArg);
LM.setKind(LengthModifier::None);
Precision.setHowSpecified(OptionalAmount::NotSpecified);
HasAlternativeForm = 0;
HasLeadingZeroes = 0;
HasPlusPrefix = 0;
HasAlternativeForm = false;
HasLeadingZeroes = false;
HasPlusPrefix = false;
}
// Test for Floating type first as LongDouble can pass isUnsignedIntegerType
else if (QT->isRealFloatingType()) {
@ -888,12 +888,12 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
}
else if (QT->isSignedIntegerType()) {
CS.setKind(ConversionSpecifier::dArg);
HasAlternativeForm = 0;
HasAlternativeForm = false;
}
else if (QT->isUnsignedIntegerType()) {
CS.setKind(ConversionSpecifier::uArg);
HasAlternativeForm = 0;
HasPlusPrefix = 0;
HasAlternativeForm = false;
HasPlusPrefix = false;
} else {
llvm_unreachable("Unexpected type");
}

View File

@ -2328,7 +2328,7 @@ ItaniumVTableContext::computeVTableRelatedInformation(const CXXRecordDecl *RD) {
return;
ItaniumVTableBuilder Builder(*this, RD, CharUnits::Zero(),
/*MostDerivedClassIsVirtual=*/0, RD);
/*MostDerivedClassIsVirtual=*/false, RD);
Entry = CreateVTableLayout(Builder);
MethodVTableIndices.insert(Builder.vtable_indices_begin(),

View File

@ -551,36 +551,36 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
FPU |= NeonMode;
if (Feature == "+sve") {
FPU |= SveMode;
HasFullFP16 = 1;
HasFullFP16 = true;
}
if (Feature == "+sve2") {
FPU |= SveMode;
HasFullFP16 = 1;
HasSVE2 = 1;
HasFullFP16 = true;
HasSVE2 = true;
}
if (Feature == "+sve2-aes") {
FPU |= SveMode;
HasFullFP16 = 1;
HasSVE2 = 1;
HasSVE2AES = 1;
HasFullFP16 = true;
HasSVE2 = true;
HasSVE2AES = true;
}
if (Feature == "+sve2-sha3") {
FPU |= SveMode;
HasFullFP16 = 1;
HasSVE2 = 1;
HasSVE2SHA3 = 1;
HasFullFP16 = true;
HasSVE2 = true;
HasSVE2SHA3 = true;
}
if (Feature == "+sve2-sm4") {
FPU |= SveMode;
HasFullFP16 = 1;
HasSVE2 = 1;
HasSVE2SM4 = 1;
HasFullFP16 = true;
HasSVE2 = true;
HasSVE2SM4 = true;
}
if (Feature == "+sve2-bitperm") {
FPU |= SveMode;
HasFullFP16 = 1;
HasSVE2 = 1;
HasSVE2BitPerm = 1;
HasFullFP16 = true;
HasSVE2 = true;
HasSVE2BitPerm = true;
}
if (Feature == "+f32mm") {
FPU |= SveMode;

View File

@ -3690,7 +3690,7 @@ void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) {
// Seek non-virtual primary base root.
while (1) {
while (true) {
const ASTRecordLayout &BRL = CGM.getContext().getASTRecordLayout(PBase);
const CXXRecordDecl *PBT = BRL.getPrimaryBase();
if (PBT && !BRL.isPrimaryBaseVirtual())

View File

@ -847,7 +847,7 @@ static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
static bool hasUnalignedAtomics(llvm::Triple::ArchType arch) {
// FIXME: Allow unaligned atomic load/store on x86. (It is not
// currently supported by the backend.)
return 0;
return false;
}
/// Return the maximum size that permits atomic accesses for the given

View File

@ -1178,7 +1178,7 @@ bool CodeGenModule::HasLTOVisibilityPublicStd(const CXXRecordDecl *RD) {
return false;
const DeclContext *DC = RD;
while (1) {
while (true) {
auto *D = cast<Decl>(DC);
DC = DC->getParent();
if (isa<TranslationUnitDecl>(DC->getRedeclContext())) {

View File

@ -740,7 +740,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
#include "clang/Basic/Sanitizers.def"
#undef SANITIZER
} while (0);
} while (false);
if (D) {
bool NoSanitizeCoverage = false;
@ -2694,7 +2694,7 @@ void CodeGenFunction::emitAlignmentAssumptionCheck(
SanitizerScope SanScope(this);
if (!OffsetValue)
OffsetValue = Builder.getInt1(0); // no offset.
OffsetValue = Builder.getInt1(false); // no offset.
llvm::Constant *StaticData[] = {EmitCheckSourceLocation(Loc),
EmitCheckSourceLocation(SecondaryLoc),

View File

@ -610,7 +610,7 @@ void CodeGenModule::Release() {
if (Context.getLangOpts().SemanticInterposition)
// Require various optimization to respect semantic interposition.
getModule().setSemanticInterposition(1);
getModule().setSemanticInterposition(true);
if (CodeGenOpts.EmitCodeView) {
// Indicate that we want CodeView in the metadata.

View File

@ -1606,7 +1606,7 @@ static bool isSIMDVectorType(ASTContext &Context, QualType Ty) {
static bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty) {
const RecordType *RT = Ty->getAs<RecordType>();
if (!RT)
return 0;
return false;
const RecordDecl *RD = RT->getDecl();
// If this is a C++ record, check the bases first.

View File

@ -704,7 +704,7 @@ static bool getLiteralInfo(SourceRange literalRange,
}
};
while (1) {
while (true) {
if (Suff::has("u", text)) {
UpperU = false;
} else if (Suff::has("U", text)) {

View File

@ -86,11 +86,11 @@ void DefinitionBlockSeparator::separateBlocks(
return false;
};
bool IsDefBlock = 0;
bool IsDefBlock = false;
if (HasEnumOnLine()) {
// We have no scope opening/closing information for enum.
IsDefBlock = 1;
IsDefBlock = true;
OpeningLineIndex = I;
TargetLine = CurrentLine;
TargetToken = CurrentLine->First;
@ -112,7 +112,7 @@ void DefinitionBlockSeparator::separateBlocks(
AnnotatedLine *OpeningLine = Lines[OpeningLineIndex];
// Closing a function definition.
if (LikelyDefinition(OpeningLine)) {
IsDefBlock = 1;
IsDefBlock = true;
if (OpeningLineIndex > 0) {
OpeningLineIndex -=
Style.Language == FormatStyle::LK_CSharp &&

View File

@ -2251,7 +2251,7 @@ void UnwrappedLineParser::parseTryCatch() {
parseStructuralElement();
--Line->Level;
}
while (1) {
while (true) {
if (FormatTok->is(tok::at))
nextToken();
if (!(FormatTok->isOneOf(tok::kw_catch, Keywords.kw___except,

View File

@ -1414,7 +1414,7 @@ static bool compileModuleAndReadASTBehindLock(
StringRef Dir = llvm::sys::path::parent_path(ModuleFileName);
llvm::sys::fs::create_directories(Dir);
while (1) {
while (true) {
llvm::LockFileManager Locked(ModuleFileName);
switch (Locked) {
case llvm::LockFileManager::LFS_Error:

View File

@ -792,7 +792,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
bool IsStartOfLine = false;
char Buffer[256];
while (1) {
while (true) {
// Two lines joined with line continuation ('\' as last character on the
// line) must be emitted as one line even though Tok.getLine() returns two
// different values. In this situation Tok.isAtStartOfLine() is false even

View File

@ -44,7 +44,7 @@ static const enum raw_ostream::Colors savedColor =
/// Add highlights to differences in template strings.
static void applyTemplateHighlighting(raw_ostream &OS, StringRef Str,
bool &Normal, bool Bold) {
while (1) {
while (true) {
size_t Pos = Str.find(ToggleHighlight);
OS << Str.slice(0, Pos);
if (Pos == StringRef::npos)

View File

@ -803,7 +803,7 @@ bool Parser::ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2,
// We always want this function to consume at least one token if the first
// token isn't T and if not at EOF.
bool isFirstTokenConsumed = true;
while (1) {
while (true) {
// If we found one of the tokens, stop and return true.
if (Tok.is(T1) || Tok.is(T2)) {
if (ConsumeFinalToken) {
@ -1159,7 +1159,7 @@ bool Parser::ConsumeAndStoreInitializer(CachedTokens &Toks,
unsigned AngleCount = 0;
unsigned KnownTemplateCount = 0;
while (1) {
while (true) {
switch (Tok.getKind()) {
case tok::comma:
// If we might be in a template, perform a tentative parse to check.

View File

@ -3080,7 +3080,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
ParsedAttributesWithRange attrs(AttrFactory);
// We use Sema's policy to get bool macros right.
PrintingPolicy Policy = Actions.getPrintingPolicy();
while (1) {
while (true) {
bool isInvalid = false;
bool isStorageClass = false;
const char *PrevSpec = nullptr;
@ -4271,7 +4271,7 @@ void Parser::ParseStructDeclaration(
// Read struct-declarators until we find the semicolon.
bool FirstDeclarator = true;
SourceLocation CommaLoc;
while (1) {
while (true) {
ParsingFieldDeclarator DeclaratorInfo(*this, DS);
DeclaratorInfo.D.setCommaLoc(CommaLoc);
@ -5580,7 +5580,7 @@ void Parser::ParseTypeQualifierListOpt(
SourceLocation EndLoc;
while (1) {
while (true) {
bool isInvalid = false;
const char *PrevSpec = nullptr;
unsigned DiagID = 0;
@ -6272,7 +6272,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
if (D.hasName() && !D.getNumTypeObjects())
MaybeParseCXX11Attributes(D);
while (1) {
while (true) {
if (Tok.is(tok::l_paren)) {
bool IsFunctionDeclaration = D.isFunctionDeclaratorAFunctionDeclaration();
// Enter function-declaration scope, limiting any declarators to the

View File

@ -2905,7 +2905,7 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
// member-declarator
// member-declarator-list ',' member-declarator
while (1) {
while (true) {
InClassInitStyle HasInClassInit = ICIS_NoInit;
bool HasStaticInitializer = false;
if (Tok.isOneOf(tok::equal, tok::l_brace) && PureSpecLoc.isInvalid()) {

View File

@ -400,7 +400,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
SourceLocation ColonLoc;
auto SavedType = PreferredType;
while (1) {
while (true) {
// Every iteration may rely on a preferred type for the whole expression.
PreferredType = SavedType;
// If this token has a lower precedence than we are allowed to parse (e.g.
@ -1853,7 +1853,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// parsed, see if there are any postfix-expression pieces here.
SourceLocation Loc;
auto SavedType = PreferredType;
while (1) {
while (true) {
// Each iteration relies on preferred type for the whole expression.
PreferredType = SavedType;
switch (Tok.getKind()) {
@ -2558,7 +2558,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
Comps.back().LocStart = Comps.back().LocEnd = ConsumeToken();
// FIXME: This loop leaks the index expressions on error.
while (1) {
while (true) {
if (Tok.is(tok::period)) {
// offsetof-member-designator: offsetof-member-designator '.' identifier
Comps.push_back(Sema::OffsetOfComponent());
@ -3358,7 +3358,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
SmallVectorImpl<SourceLocation> &CommaLocs,
llvm::function_ref<void()> ExpressionStarts) {
bool SawError = false;
while (1) {
while (true) {
if (ExpressionStarts)
ExpressionStarts();
@ -3418,7 +3418,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
bool
Parser::ParseSimpleExpressionList(SmallVectorImpl<Expr*> &Exprs,
SmallVectorImpl<SourceLocation> &CommaLocs) {
while (1) {
while (true) {
ExprResult Expr = ParseAssignmentExpression();
if (Expr.isInvalid())
return true;

View File

@ -472,7 +472,7 @@ ExprResult Parser::ParseBraceInitializer() {
return PreferredType;
};
while (1) {
while (true) {
PreferredType.enterFunctionArgument(Tok.getLocation(), RunSignatureHelp);
// Handle Microsoft __if_exists/if_not_exists if necessary.

View File

@ -134,7 +134,7 @@ Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
SmallVector<SourceLocation, 8> ClassLocs;
SmallVector<ObjCTypeParamList *, 8> ClassTypeParams;
while (1) {
while (true) {
MaybeSkipAttributes(tok::objc_class);
if (expectIdentifier()) {
SkipUntil(tok::semi);
@ -598,7 +598,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
SourceRange AtEnd;
while (1) {
while (true) {
// If this is a method prototype, parse it.
if (Tok.isOneOf(tok::minus, tok::plus)) {
if (Decl *methodPrototype =
@ -848,7 +848,7 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
BalancedDelimiterTracker T(*this, tok::l_paren);
T.consumeOpen();
while (1) {
while (true) {
if (Tok.is(tok::code_completion)) {
cutOffParsing();
Actions.CodeCompleteObjCPropertyFlags(getCurScope(), DS);
@ -1149,7 +1149,7 @@ void Parser::ParseObjCTypeQualifierList(ObjCDeclSpec &DS,
assert(Context == DeclaratorContext::ObjCParameter ||
Context == DeclaratorContext::ObjCResult);
while (1) {
while (true) {
if (Tok.is(tok::code_completion)) {
cutOffParsing();
Actions.CodeCompleteObjCPassingType(
@ -1401,7 +1401,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
Scope::FunctionDeclarationScope | Scope::DeclScope);
AttributePool allParamAttrs(AttrFactory);
while (1) {
while (true) {
ParsedAttributes paramAttrs(AttrFactory);
Sema::ObjCArgInfo ArgInfo;
@ -1531,7 +1531,7 @@ ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &Protocols,
SmallVector<IdentifierLocPair, 8> ProtocolIdents;
while (1) {
while (true) {
if (Tok.is(tok::code_completion)) {
cutOffParsing();
Actions.CodeCompleteObjCProtocolReferences(ProtocolIdents);
@ -2050,7 +2050,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
// Parse the list of forward declarations.
while (1) {
while (true) {
ConsumeToken(); // the ','
if (expectIdentifier()) {
SkipUntil(tok::semi);
@ -3179,7 +3179,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
ExprVector KeyExprs;
if (Tok.is(tok::colon)) {
while (1) {
while (true) {
// Each iteration parses a single keyword argument.
KeyIdents.push_back(selIdent);
KeyLocs.push_back(Loc);
@ -3599,7 +3599,7 @@ ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
unsigned nColons = 0;
if (Tok.isNot(tok::r_paren)) {
while (1) {
while (true) {
if (TryConsumeToken(tok::coloncolon)) { // Handle :: in C++.
++nColons;
KeyIdents.push_back(nullptr);

View File

@ -1068,7 +1068,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
SourceLocation LabelLoc = ConsumeToken();
SmallVector<Decl *, 8> DeclsInGroup;
while (1) {
while (true) {
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
break;

View File

@ -508,7 +508,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
TokLoc = Tok.getLocation();
++NumTokensRead;
SkippedStartOfLine = false;
} while (1);
} while (true);
if (BraceNesting && BraceCount != savedBraceCount) {
// __asm without closing brace (this can happen at EOF).
@ -681,7 +681,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
/// asm-qualifier
/// asm-qualifier-list asm-qualifier
bool Parser::parseGNUAsmQualifierListOpt(GNUAsmQualifiers &AQ) {
while (1) {
while (true) {
const GNUAsmQualifiers::AQ A = getGNUAsmQualifier(Tok);
if (A == GNUAsmQualifiers::AQ_unspecified) {
if (Tok.isNot(tok::l_paren)) {
@ -810,7 +810,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
}
// Parse the asm-string list for clobbers if present.
if (!AteExtraColon && isTokenStringLiteral()) {
while (1) {
while (true) {
ExprResult Clobber(ParseAsmStringLiteral(/*ForAsmLabel*/ false));
if (Clobber.isInvalid())
@ -888,7 +888,7 @@ bool Parser::ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
return false;
while (1) {
while (true) {
// Read the [id] if present.
if (Tok.is(tok::l_square)) {
BalancedDelimiterTracker T(*this, tok::l_square);

View File

@ -500,7 +500,7 @@ bool Parser::ParseTemplateParameters(
bool
Parser::ParseTemplateParameterList(const unsigned Depth,
SmallVectorImpl<NamedDecl*> &TemplateParams) {
while (1) {
while (true) {
if (NamedDecl *TmpParam
= ParseTemplateParameter(Depth, TemplateParams.size())) {

View File

@ -277,7 +277,7 @@ Parser::TPResult Parser::TryParseSimpleDeclaration(bool AllowForRangeDecl) {
/// '{' '}'
///
Parser::TPResult Parser::TryParseInitDeclaratorList() {
while (1) {
while (true) {
// declarator
TPResult TPR = TryParseDeclarator(false/*mayBeAbstract*/);
if (TPR != TPResult::Ambiguous)
@ -1068,7 +1068,7 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract,
if (mayHaveDirectInit)
return TPResult::Ambiguous;
while (1) {
while (true) {
TPResult TPR(TPResult::Ambiguous);
if (Tok.is(tok::l_paren)) {
@ -1898,7 +1898,7 @@ Parser::TryParseParameterDeclarationClause(bool *InvalidAsDeclaration,
// parameter-declaration
// parameter-declaration-list ',' parameter-declaration
//
while (1) {
while (true) {
// '...'[opt]
if (Tok.is(tok::ellipsis)) {
ConsumeToken();

View File

@ -279,7 +279,7 @@ bool Parser::SkipUntil(ArrayRef<tok::TokenKind> Toks, SkipUntilFlags Flags) {
// We always want this function to skip at least one token if the first token
// isn't T and if not at EOF.
bool isFirstTokenSkipped = true;
while (1) {
while (true) {
// If we found one of the tokens, stop and return true.
for (unsigned i = 0, NumToks = Toks.size(); i != NumToks; ++i) {
if (Tok.is(Toks[i])) {
@ -1448,7 +1448,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
ParseDeclarator(ParmDeclarator);
// Handle the full declarator list.
while (1) {
while (true) {
// If attributes are present, parse them.
MaybeParseGNUAttributes(ParmDeclarator);

View File

@ -542,7 +542,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) {
// Lex all the tokens in raw mode, to avoid entering #includes or expanding
// macros.
while (1) {
while (true) {
Token Tok;
L.LexFromRawLexer(Tok);

View File

@ -91,7 +91,7 @@ void Scope::Init(Scope *parent, unsigned flags) {
UsingDirectives.clear();
Entity = nullptr;
ErrorTrap.reset();
NRVO.setPointerAndInt(nullptr, 0);
NRVO.setPointerAndInt(nullptr, false);
}
bool Scope::containedInPrototypeScope() const {

View File

@ -1438,7 +1438,7 @@ bool ResultBuilder::IsOrdinaryNonTypeName(const NamedDecl *ND) const {
bool ResultBuilder::IsIntegralConstantValue(const NamedDecl *ND) const {
if (!IsOrdinaryNonTypeName(ND))
return 0;
return false;
if (const auto *VD = dyn_cast<ValueDecl>(ND->getUnderlyingDecl()))
if (VD->getType()->isIntegralOrEnumerationType())

View File

@ -1058,7 +1058,7 @@ concepts::ExprRequirement::ExprRequirement(
concepts::ExprRequirement::ReturnTypeRequirement::
ReturnTypeRequirement(TemplateParameterList *TPL) :
TypeConstraintInfo(TPL, 0) {
TypeConstraintInfo(TPL, false) {
assert(TPL->size() == 1);
const TypeConstraint *TC =
cast<TemplateTypeParmDecl>(TPL->getParam(0))->getTypeConstraint();
@ -1070,7 +1070,7 @@ ReturnTypeRequirement(TemplateParameterList *TPL) :
Constraint->getTemplateArgsAsWritten() &&
TemplateSpecializationType::anyInstantiationDependentTemplateArguments(
Constraint->getTemplateArgsAsWritten()->arguments().drop_front(1));
TypeConstraintInfo.setInt(Dependent ? 1 : 0);
TypeConstraintInfo.setInt(Dependent ? true : false);
}
concepts::TypeRequirement::TypeRequirement(TypeSourceInfo *T) :

View File

@ -4761,11 +4761,11 @@ ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl(
break;
unsigned Count = Record[0];
const char *Byte = Blob.data();
F->SearchPathUsage = llvm::BitVector(Count, 0);
F->SearchPathUsage = llvm::BitVector(Count, false);
for (unsigned I = 0; I < Count; ++Byte)
for (unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
if (*Byte & (1 << Bit))
F->SearchPathUsage[I] = 1;
F->SearchPathUsage[I] = true;
break;
}
}

View File

@ -302,7 +302,7 @@ class ExplodedGraphViewer : public Checker< check::EndAnalysis > {
public:
ExplodedGraphViewer() {}
void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,ExprEngine &Eng) const {
Eng.ViewGraph(0);
Eng.ViewGraph(false);
}
};

View File

@ -432,7 +432,7 @@ SVal SimpleSValBuilder::evalBinOpNN(ProgramStateRef state,
return evalCast(lhs, resultTy, QualType{});
}
while (1) {
while (true) {
switch (lhs.getSubKind()) {
default:
return makeSymExprValNN(op, lhs, rhs, resultTy);