diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 26f751b77f86ae..fe0ce4c5cdc3a0 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -792,7 +792,7 @@ static bool UseNSOptionsMacro(Preprocessor &PP, ASTContext &Ctx, bool PowerOfTwo = true; bool AllHexdecimalEnumerator = true; uint64_t MaxPowerOfTwoVal = 0; - for (auto Enumerator : EnumDcl->enumerators()) { + for (auto *Enumerator : EnumDcl->enumerators()) { const Expr *InitExpr = Enumerator->getInitExpr(); if (!InitExpr) { PowerOfTwo = false; diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp index 99a61e0842a764..b94aee2de573e9 100644 --- a/clang/lib/ARCMigrate/TransGCAttrs.cpp +++ b/clang/lib/ARCMigrate/TransGCAttrs.cpp @@ -158,7 +158,7 @@ class GCAttrsCollector : public RecursiveASTVisitor { if (!D) return false; - for (auto I : D->redecls()) + for (auto *I : D->redecls()) if (!isInMainFile(I->getLocation())) return false; diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 52e7eeca665abe..20fcc8fea4b799 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -7568,7 +7568,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { // FIXME: There might(should) be a better way of doing this computation! CharUnits PtrSize = getTypeSizeInChars(VoidPtrTy); CharUnits ParmOffset = PtrSize; - for (auto PI : Decl->parameters()) { + for (auto *PI : Decl->parameters()) { QualType PType = PI->getType(); CharUnits sz = getObjCEncodingTypeSize(PType); if (sz.isZero()) @@ -7583,7 +7583,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { // Argument types. ParmOffset = PtrSize; - for (auto PVDecl : Decl->parameters()) { + for (auto *PVDecl : Decl->parameters()) { QualType PType = PVDecl->getOriginalType(); if (const auto *AT = dyn_cast(PType->getCanonicalTypeInternal())) { @@ -7612,7 +7612,7 @@ ASTContext::getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const { getObjCEncodingForType(Decl->getReturnType(), S); CharUnits ParmOffset; // Compute size of all parameters. - for (auto PI : Decl->parameters()) { + for (auto *PI : Decl->parameters()) { QualType PType = PI->getType(); CharUnits sz = getObjCEncodingTypeSize(PType); if (sz.isZero()) @@ -7626,7 +7626,7 @@ ASTContext::getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const { ParmOffset = CharUnits::Zero(); // Argument types. - for (auto PVDecl : Decl->parameters()) { + for (auto *PVDecl : Decl->parameters()) { QualType PType = PVDecl->getOriginalType(); if (const auto *AT = dyn_cast(PType->getCanonicalTypeInternal())) { @@ -9724,7 +9724,7 @@ void getIntersectionOfProtocols(ASTContext &Context, llvm::SmallPtrSet LHSProtocolSet; // Start with the protocol qualifiers. - for (auto proto : LHS->quals()) { + for (auto *proto : LHS->quals()) { Context.CollectInheritedProtocols(proto, LHSProtocolSet); } @@ -9735,7 +9735,7 @@ void getIntersectionOfProtocols(ASTContext &Context, llvm::SmallPtrSet RHSProtocolSet; // Start with the protocol qualifiers. - for (auto proto : RHS->quals()) { + for (auto *proto : RHS->quals()) { Context.CollectInheritedProtocols(proto, RHSProtocolSet); } @@ -9743,7 +9743,7 @@ void getIntersectionOfProtocols(ASTContext &Context, Context.CollectInheritedProtocols(RHS->getInterface(), RHSProtocolSet); // Compute the intersection of the collected protocol sets. - for (auto proto : LHSProtocolSet) { + for (auto *proto : LHSProtocolSet) { if (RHSProtocolSet.count(proto)) IntersectionSet.push_back(proto); } diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index c368a61577cba1..bd78ece6efa98e 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -3592,7 +3592,7 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { // Import the function parameters. SmallVector Parameters; - for (auto P : D->parameters()) { + for (auto *P : D->parameters()) { if (Expected ToPOrErr = import(P)) Parameters.push_back(*ToPOrErr); else diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 7dc0fec46d4218..957610ef36b74d 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1527,7 +1527,7 @@ LinkageInfo LinkageComputer::getLVForDecl(const NamedDecl *D, // that all other computed linkages match, check that the one we just // computed also does. NamedDecl *Old = nullptr; - for (auto I : D->redecls()) { + for (auto *I : D->redecls()) { auto *T = cast(I); if (T == D) continue; @@ -1825,7 +1825,7 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const { // Check whether this is actually newer than OldD. We want to keep the // newer declaration. This loop will usually only iterate once, because // OldD is usually the previous declaration. - for (auto D : redecls()) { + for (auto *D : redecls()) { if (D == OldD) break; @@ -2273,7 +2273,7 @@ VarDecl *VarDecl::getActingDefinition() { VarDecl *VarDecl::getDefinition(ASTContext &C) { VarDecl *First = getFirstDecl(); - for (auto I : First->redecls()) { + for (auto *I : First->redecls()) { if (I->isThisDeclarationADefinition(C) == Definition) return I; } @@ -2284,7 +2284,7 @@ VarDecl::DefinitionKind VarDecl::hasDefinition(ASTContext &C) const { DefinitionKind Kind = DeclarationOnly; const VarDecl *First = getFirstDecl(); - for (auto I : First->redecls()) { + for (auto *I : First->redecls()) { Kind = std::max(Kind, I->isThisDeclarationADefinition(C)); if (Kind == Definition) break; @@ -2294,7 +2294,7 @@ VarDecl::DefinitionKind VarDecl::hasDefinition(ASTContext &C) const { } const Expr *VarDecl::getAnyInitializer(const VarDecl *&D) const { - for (auto I : redecls()) { + for (auto *I : redecls()) { if (auto Expr = I->getInit()) { D = I; return Expr; @@ -2330,7 +2330,7 @@ Stmt **VarDecl::getInitAddress() { VarDecl *VarDecl::getInitializingDeclaration() { VarDecl *Def = nullptr; - for (auto I : redecls()) { + for (auto *I : redecls()) { if (I->hasInit()) return I; @@ -3015,7 +3015,7 @@ FunctionDecl::getDefaultedFunctionInfo() const { } bool FunctionDecl::hasBody(const FunctionDecl *&Definition) const { - for (auto I : redecls()) { + for (auto *I : redecls()) { if (I->doesThisDeclarationHaveABody()) { Definition = I; return true; @@ -3686,7 +3686,7 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const { // If any declaration is 'inline' but not 'extern', then this definition // is externally visible. - for (auto Redecl : redecls()) { + for (auto *Redecl : redecls()) { if (Redecl->isInlineSpecified() && Redecl->getStorageClass() != SC_Extern) return true; @@ -3703,7 +3703,7 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const { // [...] If all of the file scope declarations for a function in a // translation unit include the inline function specifier without extern, // then the definition in that translation unit is an inline definition. - for (auto Redecl : redecls()) { + for (auto *Redecl : redecls()) { if (RedeclForcesDefC99(Redecl)) return true; } @@ -4408,7 +4408,7 @@ void TagDecl::startDefinition() { if (auto *D = dyn_cast(this)) { struct CXXRecordDecl::DefinitionData *Data = new (getASTContext()) struct CXXRecordDecl::DefinitionData(D); - for (auto I : redecls()) + for (auto *I : redecls()) cast(I)->DefinitionData = Data; } } @@ -4441,7 +4441,7 @@ TagDecl *TagDecl::getDefinition() const { if (const auto *CXXRD = dyn_cast(this)) return CXXRD->getDefinition(); - for (auto R : redecls()) + for (auto *R : redecls()) if (R->isCompleteDefinition()) return R; diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 15c545b59c8198..5475d0c841f641 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -864,7 +864,7 @@ bool ObjCMethodDecl::isDesignatedInitializerForTheInterface( } bool ObjCMethodDecl::hasParamDestroyedInCallee() const { - for (auto param : parameters()) { + for (auto *param : parameters()) { if (param->isDestroyedInCallee()) return true; } @@ -1496,7 +1496,7 @@ ObjCTypeParamList *ObjCTypeParamList::create( void ObjCTypeParamList::gatherDefaultTypeArgs( SmallVectorImpl &typeArgs) const { typeArgs.reserve(size()); - for (auto typeParam : *this) + for (auto *typeParam : *this) typeArgs.push_back(typeParam->getUnderlyingType()); } diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index 04cbb09356d7b2..51f806429f67ac 100644 --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -564,7 +564,7 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function, AddQualType(Function->getReturnType()); ID.AddInteger(Function->param_size()); - for (auto Param : Function->parameters()) + for (auto *Param : Function->parameters()) AddSubDecl(Param); if (SkipBody) { @@ -934,7 +934,7 @@ class ODRTypeVisitor : public TypeVisitor { auto Protocols = T->getProtocols(); ID.AddInteger(Protocols.size()); - for (auto Protocol : Protocols) { + for (auto *Protocol : Protocols) { AddDecl(Protocol); } @@ -952,7 +952,7 @@ class ODRTypeVisitor : public TypeVisitor { AddDecl(T->getDecl()); auto Protocols = T->getProtocols(); ID.AddInteger(Protocols.size()); - for (auto Protocol : Protocols) { + for (auto *Protocol : Protocols) { AddDecl(Protocol); } diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index 214ae5bd6be484..adfc1d542bb340 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -1702,7 +1702,7 @@ void OMPClausePrinter::VisitOMPSimdlenClause(OMPSimdlenClause *Node) { void OMPClausePrinter::VisitOMPSizesClause(OMPSizesClause *Node) { OS << "sizes("; bool First = true; - for (auto Size : Node->getSizesRefs()) { + for (auto *Size : Node->getSizesRefs()) { if (!First) OS << ", "; Size->printPretty(OS, nullptr, Policy, 0); diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 92a8b18cf68a30..6af2beefc79266 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -472,7 +472,7 @@ void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) { } void OMPClauseProfiler::VisitOMPSizesClause(const OMPSizesClause *C) { - for (auto E : C->getSizesRefs()) + for (auto *E : C->getSizesRefs()) if (E) Profiler->VisitExpr(E); } diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 136af191f3c048..ec6003fe6559de 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3539,7 +3539,7 @@ TagType::TagType(TypeClass TC, const TagDecl *D, QualType can) decl(const_cast(D)) {} static TagDecl *getInterestingTagDecl(TagDecl *decl) { - for (auto I : decl->redecls()) { + for (auto *I : decl->redecls()) { if (I->isCompleteDefinition() || I->isBeingDefined()) return I; } @@ -3780,7 +3780,7 @@ void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID, for (auto typeArg : typeArgs) ID.AddPointer(typeArg.getAsOpaquePtr()); ID.AddInteger(protocols.size()); - for (auto proto : protocols) + for (auto *proto : protocols) ID.AddPointer(proto); ID.AddBoolean(isKindOf); } @@ -3798,7 +3798,7 @@ void ObjCTypeParamType::Profile(llvm::FoldingSetNodeID &ID, ID.AddPointer(OTPDecl); ID.AddPointer(CanonicalType.getAsOpaquePtr()); ID.AddInteger(protocols.size()); - for (auto proto : protocols) + for (auto *proto : protocols) ID.AddPointer(proto); } diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 5aaf2fb74318b6..f042468ebba723 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -2994,7 +2994,7 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt *DS) { // If we bind to a tuple-like type, we iterate over the HoldingVars, and // create a DeclStmt for each of them. if (const auto *DD = dyn_cast(VD)) { - for (auto BD : llvm::reverse(DD->bindings())) { + for (auto *BD : llvm::reverse(DD->bindings())) { if (auto *VD = BD->getHoldingVar()) { DeclGroupRef DG(VD); DeclStmt *DSNew = diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp index 66413f84907a32..06b61b4de92f82 100644 --- a/clang/lib/Analysis/ThreadSafetyCommon.cpp +++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp @@ -637,7 +637,7 @@ SExprBuilder::translateAbstractConditionalOperator( til::SExpr * SExprBuilder::translateDeclStmt(const DeclStmt *S, CallingContext *Ctx) { DeclGroupRef DGrp = S->getDeclGroup(); - for (auto I : DGrp) { + for (auto *I : DGrp) { if (auto *VD = dyn_cast_or_null(I)) { Expr *E = VD->getInit(); til::SExpr* SE = translate(E, Ctx); diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index ff6ca0914e0d13..4061fa805d8003 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -521,7 +521,7 @@ static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, unsigned BlockAlign = GenPtrAlign.getQuantity(); if (auto *Helper = CGM.getTargetCodeGenInfo().getTargetOpenCLBlockHelper()) { - for (auto I : Helper->getCustomFieldTypes()) /* custom fields */ { + for (auto *I : Helper->getCustomFieldTypes()) /* custom fields */ { // TargetOpenCLBlockHelp needs to make sure the struct is packed. // If necessary, add padding fields to the custom fields. unsigned Align = CGM.getDataLayout().getABITypeAlignment(I); @@ -1356,7 +1356,7 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM, fields.add(buildBlockDescriptor(CGM, blockInfo)); } else if (auto *Helper = CGM.getTargetCodeGenInfo().getTargetOpenCLBlockHelper()) { - for (auto I : Helper->getCustomFieldValues(CGM, blockInfo)) { + for (auto *I : Helper->getCustomFieldValues(CGM, blockInfo)) { fields.add(I); } } diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 90b1270dc8abc2..ff39289d68b309 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1723,7 +1723,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) { case ABIArgInfo::CoerceAndExpand: { auto ArgTypesIter = ArgTypes.begin() + FirstIRArg; - for (auto EltTy : ArgInfo.getCoerceAndExpandTypeSequence()) { + for (auto *EltTy : ArgInfo.getCoerceAndExpandTypeSequence()) { *ArgTypesIter++ = EltTy; } assert(ArgTypesIter == ArgTypes.begin() + FirstIRArg + NumIRArgs); diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 4a952b9abd555b..bf20c206e1e1f3 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2995,7 +2995,7 @@ void CodeGenFunction::EmitLambdaBlockInvokeBody() { CallArgs.add(RValue::get(ThisPtr.getPointer()), ThisType); // Add the rest of the parameters. - for (auto param : BD->parameters()) + for (auto *param : BD->parameters()) EmitDelegateCallArg(CallArgs, param, param->getBeginLoc()); assert(!Lambda->isGenericLambda() && @@ -3015,7 +3015,7 @@ void CodeGenFunction::EmitLambdaDelegatingInvokeBody(const CXXMethodDecl *MD) { CallArgs.add(RValue::get(ThisPtr.getPointer()), ThisType); // Add the rest of the parameters. - for (auto Param : MD->parameters()) + for (auto *Param : MD->parameters()) EmitDelegateCallArg(CallArgs, Param, Param->getBeginLoc()); const CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator(); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 4b7e290f6480c8..49dcf7781d03ad 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3894,7 +3894,7 @@ llvm::DISubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) { return SP; } - for (auto NextFD : FD->redecls()) { + for (auto *NextFD : FD->redecls()) { auto MI = SPCache.find(NextFD->getCanonicalDecl()); if (MI != SPCache.end()) { auto *SP = dyn_cast_or_null(MI->second); diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 2075857848656c..df17e0b52815ca 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -707,7 +707,7 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) { } // Now append the ones without specified priority. - for (auto F : CXXGlobalInits) + for (auto *F : CXXGlobalInits) ModuleInits.push_back(F); CXXGlobalInits.clear(); @@ -844,7 +844,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() { // Prepend the module inits to the highest priority set. if (!ModuleInits.empty()) { - for (auto F : ModuleInits) + for (auto *F : ModuleInits) LocalCXXGlobalInits.push_back(F); ModuleInits.clear(); } @@ -862,7 +862,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() { CXXGlobalInits.empty()) return; - for (auto F : CXXGlobalInits) + for (auto *F : CXXGlobalInits) ModuleInits.push_back(F); CXXGlobalInits.clear(); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 324eb56167b56e..6878255c48acbc 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -3760,7 +3760,7 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, const llvm::Twine &name = "arrayidx") { // All the indices except that last must be zero. #ifndef NDEBUG - for (auto idx : indices.drop_back()) + for (auto *idx : indices.drop_back()) assert(isa(idx) && cast(idx)->isZero()); #endif @@ -4297,7 +4297,7 @@ unsigned CodeGenFunction::getDebugInfoFIndex(const RecordDecl *Rec, unsigned FieldIndex) { unsigned I = 0, Skipped = 0; - for (auto F : Rec->getDefinition()->fields()) { + for (auto *F : Rec->getDefinition()->fields()) { if (I == FieldIndex) break; if (F->isUnnamedBitfield()) diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 7bbe9af7ed593c..c734a539cbfbfe 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -3316,7 +3316,7 @@ llvm::Constant *CGObjCGNU::MakeBitField(ArrayRef bits) { auto fields = builder.beginStruct(); fields.addInt(Int32Ty, values.size()); auto array = fields.beginArray(); - for (auto v : values) array.add(v); + for (auto *v : values) array.add(v); array.finishAndAddTo(fields); llvm::Constant *GS = diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 2d704cec05761d..7a972152e1144b 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -1171,7 +1171,7 @@ class ProtocolMethodLists { static ProtocolMethodLists get(const ObjCProtocolDecl *PD) { ProtocolMethodLists result; - for (auto MD : PD->methods()) { + for (auto *MD : PD->methods()) { size_t index = (2 * size_t(MD->isOptional())) + (size_t(MD->isClassMethod())); result.Methods[index].push_back(MD); @@ -3454,7 +3454,7 @@ static bool hasWeakMember(QualType type) { } if (auto recType = type->getAs()) { - for (auto field : recType->getDecl()->fields()) { + for (auto *field : recType->getDecl()->fields()) { if (hasWeakMember(field->getType())) return true; } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 81c687e4530f42..caf14868078ec5 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -725,7 +725,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, const bool SanitizeBounds = SanOpts.hasOneOf(SanitizerKind::Bounds); bool NoSanitizeCoverage = false; - for (auto Attr : D->specific_attrs()) { + for (auto *Attr : D->specific_attrs()) { // Apply the no_sanitize* attributes to SanOpts. SanitizerMask mask = Attr->getMask(); SanOpts.Mask &= ~mask; diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index f6eaa35b48738f..677b66d3e1dcb6 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -107,7 +107,7 @@ class PCHContainerGenerator : public ASTConsumer { return true; SmallVector ArgTypes; - for (auto i : D->parameters()) + for (auto *i : D->parameters()) ArgTypes.push_back(i->getType()); QualType RetTy = D->getReturnType(); QualType FnTy = Ctx.getFunctionType(RetTy, ArgTypes, @@ -126,7 +126,7 @@ class PCHContainerGenerator : public ASTConsumer { ArgTypes.push_back(D->getSelfType(Ctx, D->getClassInterface(), selfIsPseudoStrong, selfIsConsumed)); ArgTypes.push_back(Ctx.getObjCSelType()); - for (auto i : D->parameters()) + for (auto *i : D->parameters()) ArgTypes.push_back(i->getType()); QualType RetTy = D->getReturnType(); QualType FnTy = Ctx.getFunctionType(RetTy, ArgTypes, diff --git a/clang/lib/CodeGen/SwiftCallingConv.cpp b/clang/lib/CodeGen/SwiftCallingConv.cpp index e42859af05a2bf..a7d7c9357272df 100644 --- a/clang/lib/CodeGen/SwiftCallingConv.cpp +++ b/clang/lib/CodeGen/SwiftCallingConv.cpp @@ -124,7 +124,7 @@ void SwiftAggLowering::addTypedData(const RecordDecl *record, CharUnits begin, const ASTRecordLayout &layout) { // Unions are a special case. if (record->isUnion()) { - for (auto field : record->fields()) { + for (auto *field : record->fields()) { if (field->isBitField()) { addBitFieldData(field, begin, 0); } else { @@ -161,7 +161,7 @@ void SwiftAggLowering::addTypedData(const RecordDecl *record, CharUnits begin, } // Add fields. - for (auto field : record->fields()) { + for (auto *field : record->fields()) { auto fieldOffsetInBits = layout.getFieldOffset(field->getFieldIndex()); if (field->isBitField()) { addBitFieldData(field, begin, fieldOffsetInBits); diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index ecf3da284b2a76..90d2e0659a39a5 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -102,7 +102,7 @@ Compilation::getArgsForToolChain(const ToolChain *TC, StringRef BoundArch, } // Add allocated arguments to the final DAL. - for (auto ArgPtr : AllocatedArgs) + for (auto *ArgPtr : AllocatedArgs) Entry->AddSynthesizedArg(ArgPtr); } diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index ba359a1d31a53a..0a61b5e2d62d4f 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3715,7 +3715,7 @@ class OffloadingActionBuilder final { /*BoundArch=*/nullptr); // Propagate active offloading kinds for each input to the link action. // Each input may have different active offloading kind. - for (auto A : HostAction->inputs()) { + for (auto *A : HostAction->inputs()) { auto ArgLoc = HostActionToInputArgMap.find(A); if (ArgLoc == HostActionToInputArgMap.end()) continue; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 2dd9ac01b3ef96..99a8642cfd85bd 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4974,13 +4974,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Since we can't access frontend flags through hasArg, let's manually iterate // through them. bool FoundAnalyzerConfig = false; - for (auto Arg : Args.filtered(options::OPT_Xclang)) + for (auto *Arg : Args.filtered(options::OPT_Xclang)) if (StringRef(Arg->getValue()) == "-analyzer-config") { FoundAnalyzerConfig = true; break; } if (!FoundAnalyzerConfig) - for (auto Arg : Args.filtered(options::OPT_Xanalyzer)) + for (auto *Arg : Args.filtered(options::OPT_Xanalyzer)) if (StringRef(Arg->getValue()) == "-analyzer-config") { FoundAnalyzerConfig = true; break; @@ -6924,7 +6924,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // do not pass it to other cc1 commands when save-temps is enabled if (C.getDriver().isSaveTempsEnabled() && !isa(JA)) { - for (auto Arg : Args.filtered(options::OPT_Xclang)) { + for (auto *Arg : Args.filtered(options::OPT_Xclang)) { Arg->claim(); if (StringRef(Arg->getValue()) != "-finclude-default-header") CmdArgs.push_back(Arg->getValue()); diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 3b084dfdbfa2ca..4760a6f5286277 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -2161,7 +2161,7 @@ void tools::addHIPRuntimeLibArgs(const ToolChain &TC, TC.AddHIPRuntimeLibArgs(Args, CmdArgs); } else { // Claim "no HIP libraries" arguments if any - for (auto Arg : Args.filtered(options::OPT_no_hip_rt)) { + for (auto *Arg : Args.filtered(options::OPT_no_hip_rt)) { Arg->claim(); } } diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 9730109dd993f2..047ec67f95e121 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -1369,7 +1369,7 @@ static bool findMipsMtiMultilibs(const Multilib::flags_list &Flags, {"/../../../../mips-mti-linux-gnu/lib" + M.gccSuffix()}); }); } - for (auto Candidate : {&MtiMipsMultilibsV1, &MtiMipsMultilibsV2}) { + for (auto *Candidate : {&MtiMipsMultilibsV1, &MtiMipsMultilibsV2}) { if (Candidate->select(Flags, Result.SelectedMultilib)) { Result.Multilibs = *Candidate; return true; @@ -1462,7 +1462,7 @@ static bool findMipsImgMultilibs(const Multilib::flags_list &Flags, {"/../../../../mips-img-linux-gnu/lib" + M.gccSuffix()}); }); } - for (auto Candidate : {&ImgMultilibsV1, &ImgMultilibsV2}) { + for (auto *Candidate : {&ImgMultilibsV1, &ImgMultilibsV2}) { if (Candidate->select(Flags, Result.SelectedMultilib)) { Result.Multilibs = *Candidate; return true; diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp index 35728ffb0b55aa..7791074d7c92a1 100644 --- a/clang/lib/Driver/ToolChains/HIPAMD.cpp +++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp @@ -202,7 +202,7 @@ HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple, if (!Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize, true)) return; - for (auto A : Args.filtered(options::OPT_fsanitize_EQ)) { + for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) { SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false); if (K != SanitizerKind::Address) D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target) diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 1108a02407e4fb..8197fccd2f3e34 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -2539,7 +2539,7 @@ class ObjCHeaderStyleGuesser : public TokenAnalyzer { "UIView", }; - for (auto Line : AnnotatedLines) { + for (auto *Line : AnnotatedLines) { if (Line->First && (Line->First->TokenText.startswith("#") || Line->First->TokenText == "__pragma" || Line->First->TokenText == "_Pragma")) { diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index f833541caa25c5..cff61d7929a1bf 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -920,12 +920,12 @@ void DumpModuleInfoAction::ExecuteAction() { if (Primary) { if (!Primary->submodules().empty()) Out << " Sub Modules:\n"; - for (auto MI : Primary->submodules()) { + for (auto *MI : Primary->submodules()) { PrintSubMapEntry(MI->Name, MI->Kind); } if (!Primary->Imports.empty()) Out << " Imports:\n"; - for (auto IMP : Primary->Imports) { + for (auto *IMP : Primary->Imports) { PrintSubMapEntry(IMP->Name, IMP->Kind); } if (!Primary->Exports.empty()) diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index a206642e4b5874..c1120058235c6d 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -258,7 +258,7 @@ void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) { } // Mangle in type information for the arguments. - for (auto PD : D->parameters()) { + for (auto *PD : D->parameters()) { Out << '#'; VisitType(PD->getType()); } diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp index 9081714c893f53..4ee10f9fddfbeb 100644 --- a/clang/lib/Sema/IdentifierResolver.cpp +++ b/clang/lib/Sema/IdentifierResolver.cpp @@ -287,7 +287,7 @@ static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) { // If the existing declaration is somewhere in the previous declaration // chain of the new declaration, then prefer the new declaration. - for (auto RD : New->redecls()) { + for (auto *RD : New->redecls()) { if (RD == Existing) return DMK_Replace; diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 1158685681af19..5215b60defe8a9 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1315,7 +1315,7 @@ void Sema::ActOnEndOfTranslationUnit() { Consumer.CompleteTentativeDefinition(VD); } - for (auto D : ExternalDeclarations) { + for (auto *D : ExternalDeclarations) { if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed()) continue; @@ -1784,7 +1784,7 @@ void Sema::emitDeferredDiags() { return; DeferredDiagnosticsEmitter DDE(*this); - for (auto D : DeclsToCheckForDeferredDiags) + for (auto *D : DeclsToCheckForDeferredDiags) DDE.checkRecordedDecl(D); } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 6d5769a3962779..c80605ba7f5a78 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -4201,7 +4201,7 @@ static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, // We need to have names for all of the parameters, if we're going to // generate a forwarding call. - for (auto P : Method->parameters()) + for (auto *P : Method->parameters()) if (!P->getDeclName()) return; @@ -4229,7 +4229,7 @@ static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, Results.getAllocator().CopyString(Overridden->getNameAsString())); Builder.AddChunk(CodeCompletionString::CK_LeftParen); bool FirstParam = true; - for (auto P : Method->parameters()) { + for (auto *P : Method->parameters()) { if (FirstParam) FirstParam = false; else diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 1a29e6bb86f391..3a84761616163d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8088,7 +8088,7 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, if (shadowedVar->isExternC()) { // For shadowing external vars, make sure that we point to the global // declaration, not a locally scoped extern declaration. - for (auto I : shadowedVar->redecls()) + for (auto *I : shadowedVar->redecls()) if (I->isFileVarDecl()) { ShadowedDecl = I; break; @@ -10463,7 +10463,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } llvm::SmallPtrSet ValidTypes; - for (auto Param : NewFD->parameters()) + for (auto *Param : NewFD->parameters()) checkIsValidOpenCLKernelParameter(*this, D, Param, ValidTypes); if (getLangOpts().OpenCLCPlusPlus) { @@ -11972,7 +11972,7 @@ namespace { // Track and increment the index here. isInitList = true; InitFieldIndex.push_back(0); - for (auto Child : InitList->children()) { + for (auto *Child : InitList->children()) { CheckExpr(cast(Child)); ++InitFieldIndex.back(); } @@ -12453,7 +12453,7 @@ void Sema::checkNonTrivialCUnionInInitializer(const Expr *Init, InitType.hasNonTrivialToPrimitiveCopyCUnion()) && "shouldn't be called if type doesn't have a non-trivial C struct"); if (auto *ILE = dyn_cast(Init)) { - for (auto I : ILE->inits()) { + for (auto *I : ILE->inits()) { if (!I->getType().hasNonTrivialToPrimitiveDefaultInitializeCUnion() && !I->getType().hasNonTrivialToPrimitiveCopyCUnion()) continue; @@ -14915,7 +14915,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D, } // Introduce our parameters into the function scope - for (auto Param : FD->parameters()) { + for (auto *Param : FD->parameters()) { Param->setOwningFunction(FD); // If this has an identifier, add it to the scope stack. diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 0e9b27fff180a4..580ecf8995db1c 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -7256,7 +7256,7 @@ static void handleAVRSignalAttr(Sema &S, Decl *D, const ParsedAttr &AL) { static void handleBPFPreserveAIRecord(Sema &S, RecordDecl *RD) { // Add preserve_access_index attribute to all fields and inner records. - for (auto D : RD->decls()) { + for (auto *D : RD->decls()) { if (D->hasAttr()) continue; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 7c70255fd3e5d3..f7e20759e3d6e9 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -3777,7 +3777,7 @@ namespace { void CheckInitListExpr(InitListExpr *ILE) { InitFieldIndex.push_back(0); - for (auto Child : ILE->children()) { + for (auto *Child : ILE->children()) { if (InitListExpr *SubList = dyn_cast(Child)) { CheckInitListExpr(SubList); } else { @@ -3848,7 +3848,7 @@ namespace { Expr *Callee = E->getCallee(); if (isa(Callee)) { HandleValue(Callee, false /*AddressOf*/); - for (auto Arg : E->arguments()) + for (auto *Arg : E->arguments()) Visit(Arg); return; } @@ -3873,7 +3873,7 @@ namespace { return Inherited::VisitCXXOperatorCallExpr(E); Visit(Callee); - for (auto Arg : E->arguments()) + for (auto *Arg : E->arguments()) HandleValue(Arg->IgnoreParenImpCasts(), false /*AddressOf*/); } @@ -15582,7 +15582,7 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { ClassPattern->lookup(Field->getDeclName()); FieldDecl *Pattern = nullptr; - for (auto L : Lookup) { + for (auto *L : Lookup) { if (isa(L)) { Pattern = cast(L); break; @@ -15931,7 +15931,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { diag::err_operator_overload_static) << FnDecl->getDeclName(); } else { bool ClassOrEnumParam = false; - for (auto Param : FnDecl->parameters()) { + for (auto *Param : FnDecl->parameters()) { QualType ParamType = Param->getType().getNonReferenceType(); if (ParamType->isDependentType() || ParamType->isRecordType() || ParamType->isEnumeralType()) { @@ -15954,7 +15954,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { // operator (CWG2507) allow default arguments. if (Op != OO_Call) { ParmVarDecl *FirstDefaultedParam = nullptr; - for (auto Param : FnDecl->parameters()) { + for (auto *Param : FnDecl->parameters()) { if (Param->hasDefaultArg()) { FirstDefaultedParam = Param; break; @@ -16260,7 +16260,7 @@ bool Sema::CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl) { // A parameter-declaration-clause containing a default argument is not // equivalent to any of the permitted forms. - for (auto Param : FnDecl->parameters()) { + for (auto *Param : FnDecl->parameters()) { if (Param->hasDefaultArg()) { Diag(Param->getDefaultArgRange().getBegin(), diag::err_literal_operator_default_argument) @@ -17968,7 +17968,7 @@ bool Sema::DefineUsedVTables() { // definition. bool IsExplicitInstantiationDeclaration = ClassTSK == TSK_ExplicitInstantiationDeclaration; - for (auto R : Class->redecls()) { + for (auto *R : Class->redecls()) { TemplateSpecializationKind TSK = cast(R)->getTemplateSpecializationKind(); if (TSK == TSK_ExplicitInstantiationDeclaration) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index ed33d9ffe83123..c55cb7842072b2 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -782,7 +782,7 @@ ObjCTypeParamList *Sema::actOnObjCTypeParamList(Scope *S, // scope until later (after the instance variable block), but we want the // diagnostics to occur right after we parse the type parameter list. llvm::SmallDenseMap knownParams; - for (auto typeParam : typeParams) { + for (auto *typeParam : typeParams) { auto known = knownParams.find(typeParam->getIdentifier()); if (known != knownParams.end()) { Diag(typeParam->getLocation(), diag::err_objc_type_param_redecl) @@ -803,7 +803,7 @@ ObjCTypeParamList *Sema::actOnObjCTypeParamList(Scope *S, } void Sema::popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList) { - for (auto typeParam : *typeParamList) { + for (auto *typeParam : *typeParamList) { if (!typeParam->isInvalidDecl()) { S->RemoveDecl(typeParam); IdResolver.RemoveDecl(typeParam); @@ -1029,7 +1029,7 @@ ObjCInterfaceDecl *Sema::ActOnStartClassInterface( // Clone the type parameter list. SmallVector clonedTypeParams; - for (auto typeParam : *prevTypeParamList) { + for (auto *typeParam : *prevTypeParamList) { clonedTypeParams.push_back( ObjCTypeParamDecl::Create( Context, @@ -1502,7 +1502,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQualifiers( llvm::SmallPtrSet knownProtocols; Context.CollectInheritedProtocols(baseClass, knownProtocols); bool allProtocolsDeclared = true; - for (auto proto : protocols) { + for (auto *proto : protocols) { if (knownProtocols.count(static_cast(proto)) == 0) { allProtocolsDeclared = false; break; @@ -3855,7 +3855,7 @@ static void DiagnoseVariableSizedIvars(Sema &S, ObjCContainerDecl *OCD) { // Check if variable sized ivar is in interface and visible to subclasses. if (!isa(OCD)) { - for (auto ivar : Ivars) { + for (auto *ivar : Ivars) { if (!ivar->isInvalidDecl() && IsVariableSizedType(ivar->getType())) { S.Diag(ivar->getLocation(), diag::warn_variable_sized_ivar_visibility) << ivar->getDeclName() << ivar->getType(); @@ -3990,7 +3990,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef allMethods, // they are overridden by an explicit method that is encountered // later. if (auto *OID = dyn_cast(CurContext)) { - for (auto PropImpl : OID->property_impls()) { + for (auto *PropImpl : OID->property_impls()) { if (auto *Getter = PropImpl->getGetterMethodDecl()) if (Getter->isSynthesizedAccessorStub()) OID->addDecl(Getter); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index f124ad3bc08d07..43c27c0ddd5e9e 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -136,7 +136,7 @@ void Sema::NoteDeletedFunction(FunctionDecl *Decl) { /// Determine whether a FunctionDecl was ever declared with an /// explicit storage class. static bool hasAnyExplicitStorageClass(const FunctionDecl *D) { - for (auto I : D->redecls()) { + for (auto *I : D->redecls()) { if (I->getStorageClass() != SC_None) return true; } @@ -16289,7 +16289,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo); // Put the parameter variables in scope. - for (auto AI : CurBlock->TheDecl->parameters()) { + for (auto *AI : CurBlock->TheDecl->parameters()) { AI->setOwningFunction(CurBlock->TheDecl); // If this has an identifier, add it to the scope stack. @@ -17670,7 +17670,7 @@ HandleImmediateInvocations(Sema &SemaRef, for (auto CE : Rec.ImmediateInvocationCandidates) if (!CE.getInt()) EvaluateAndDiagnoseImmediateInvocation(SemaRef, CE); - for (auto DR : Rec.ReferenceToConsteval) { + for (auto *DR : Rec.ReferenceToConsteval) { auto *FD = cast(DR->getDecl()); SemaRef.Diag(DR->getBeginLoc(), diag::err_invalid_consteval_take_address) << FD; @@ -18111,7 +18111,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, } } else { // Walk redefinitions, as some of them may be instantiable. - for (auto i : Func->redecls()) { + for (auto *i : Func->redecls()) { if (!i->isUsed(false) && i->isImplicitlyInstantiable()) MarkFunctionReferenced(Loc, i, MightBeOdrUse); } diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index c43c9dc21bd5e9..bc950ab7c4a7a4 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -8467,7 +8467,7 @@ class TransformTypos : public TreeTransform { /// /// Returns true if there are any untried correction combinations. bool CheckAndAdvanceTypoExprCorrectionStreams() { - for (auto TE : TypoExprs) { + for (auto *TE : TypoExprs) { auto &State = SemaRef.getTypoExprState(TE); TransformCache.erase(TE); if (!State.Consumer->hasMadeAnyCorrectionProgress()) @@ -8534,7 +8534,7 @@ class TransformTypos : public TreeTransform { // TypoExprs were created recursively and thus won't be in our // Sema's TypoExprs - they were created in our `RecursiveTransformLoop`. auto &SemaTypoExprs = SemaRef.TypoExprs; - for (auto TE : TypoExprs) { + for (auto *TE : TypoExprs) { TransformCache.erase(TE); SemaRef.clearDelayedTypo(TE); diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index b5cf96af07afab..8f21cf5cc7d7a3 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5977,7 +5977,7 @@ void InitializationSequence::InitializeFrom(Sema &S, !Context.hasSameUnqualifiedType(SourceType, DestType))) { llvm::SmallVector InitArgs; - for (auto Arg : Args) { + for (auto *Arg : Args) { if (Arg->getType()->isExtVectorType()) { const auto *VTy = Arg->getType()->castAs(); unsigned Elm = VTy->getNumElements(); diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index aca0b7a1477304..1cf44bd694c54d 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -418,7 +418,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class, CheckParmsForFunctionDef(Params, /*CheckParameterNames=*/false); - for (auto P : Method->parameters()) + for (auto *P : Method->parameters()) P->setOwningFunction(Method); } diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 22d72c3251a0c6..70a32bd737160c 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -156,7 +156,7 @@ namespace { void addUsingDirectives(DeclContext *DC, DeclContext *EffectiveDC) { SmallVector queue; while (true) { - for (auto UD : DC->using_directives()) { + for (auto *UD : DC->using_directives()) { DeclContext *NS = UD->getNominatedNamespace(); if (SemaRef.isVisible(UD) && visited.insert(NS).second) { addUsingDirective(UD, EffectiveDC); @@ -2018,7 +2018,7 @@ static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D, unsigned IDNS) { assert(!LookupResult::isAvailableForLookup(SemaRef, D) && "not in slow case"); - for (auto RD : D->redecls()) { + for (auto *RD : D->redecls()) { // Don't bother with extra checks if we already know this one isn't visible. if (RD == D) continue; @@ -2362,7 +2362,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, continue; } - for (auto I : ND->using_directives()) { + for (auto *I : ND->using_directives()) { NamespaceDecl *Nom = I->getNominatedNamespace(); if (S.isVisible(I) && Visited.insert(Nom).second) Queue.push_back(Nom); @@ -4161,7 +4161,7 @@ class LookupVisibleHelper { // Traverse using directives for qualified name lookup. if (QualifiedNameLookup) { ShadowContextRAII Shadow(Visited); - for (auto I : Ctx->using_directives()) { + for (auto *I : Ctx->using_directives()) { if (!Result.getSema().isVisible(I)) continue; lookupInDeclContext(I->getNominatedNamespace(), Result, diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 118afb81dd7229..e915c7ed88a847 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1028,7 +1028,7 @@ static bool hasWrittenStorageAttribute(ObjCPropertyDecl *Prop, // Find the corresponding property in the primary class definition. auto OrigClass = Category->getClassInterface(); - for (auto Found : OrigClass->lookup(Prop->getDeclName())) { + for (auto *Found : OrigClass->lookup(Prop->getDeclName())) { if (ObjCPropertyDecl *OrigProp = dyn_cast(Found)) return OrigProp->getPropertyAttributesAsWritten() & OwnershipMask; } diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index a8de8c2f2c829d..d05380b30e47f4 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18422,7 +18422,7 @@ static T filterLookupForUDReductionAndMapper( static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) { assert(!LookupResult::isVisible(SemaRef, D) && "not in slow case"); - for (auto RD : D->redecls()) { + for (auto *RD : D->redecls()) { // Don't bother with extra checks if we already know this one isn't visible. if (RD == D) continue; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 91e308d0d0fee2..352738c850f238 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -14204,7 +14204,7 @@ ExprResult Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, MultiExprArg ArgExpr) { SmallVector Args; Args.push_back(Base); - for (auto e : ArgExpr) { + for (auto *e : ArgExpr) { Args.push_back(e); } DeclarationName OpName = diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index e8837d88f97ddb..3419eb1eec6b47 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3147,7 +3147,7 @@ Sema::SubstituteExplicitTemplateArguments( if (ExplicitTemplateArgs.size() == 0) { // No arguments to substitute; just copy over the parameter types and // fill in the function type. - for (auto P : Function->parameters()) + for (auto *P : Function->parameters()) ParamTypes.push_back(P->getType()); if (FunctionType) diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 24ea3254cb2727..b0256a16babe75 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -6398,7 +6398,7 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { void Sema::PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs) { - for (auto DD : Pattern->ddiags()) { + for (auto *DD : Pattern->ddiags()) { switch (DD->getKind()) { case DependentDiagnostic::Access: HandleDependentAccessCheck(*DD, TemplateArgs); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index eef8f9fdb07f18..5d1ee45c10de5a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8032,7 +8032,7 @@ IdentifierInfo *ASTReader::get(StringRef Name) { // lookups). Perform the lookup in PCH files, though, since we don't build // a complete initial identifier table if we're carrying on from a PCH. if (PP.getLangOpts().CPlusPlus) { - for (auto F : ModuleMgr.pch_modules()) + for (auto *F : ModuleMgr.pch_modules()) if (Visitor(*F)) break; } else { @@ -9645,7 +9645,7 @@ void ASTReader::diagnoseOdrViolations() { bool Found = false; const Decl *DCanon = D->getCanonicalDecl(); - for (auto RI : D->redecls()) { + for (auto *RI : D->redecls()) { if (RI->getLexicalDeclContext() == CanonDef) { Found = true; break; diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 35b8db27bd0ebf..14985cc32d0e4f 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -167,7 +167,7 @@ namespace clang { } Record.push_back(typeParams->size()); - for (auto typeParam : *typeParams) { + for (auto *typeParam : *typeParams) { Record.AddDeclRef(typeParam); } Record.AddSourceLocation(typeParams->getLAngleLoc()); @@ -661,7 +661,7 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { } Record.push_back(D->param_size()); - for (auto P : D->parameters()) + for (auto *P : D->parameters()) Record.AddDeclRef(P); Code = serialization::DECL_FUNCTION; } diff --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp index fea35d03cb8137..c9b17a56b224d3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp @@ -118,7 +118,7 @@ void CFErrorFunctionChecker::checkASTDecl(const FunctionDecl *D, II = &D->getASTContext().Idents.get("CFErrorRef"); bool hasCFError = false; - for (auto I : D->parameters()) { + for (auto *I : D->parameters()) { if (IsCFError(I->getType(), II)) { hasCFError = true; break; diff --git a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp index 1d8835f6b4741f..8b4004d059e814 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -907,7 +907,7 @@ void NullabilityChecker::checkPostObjCMessage(const ObjCMethodCall &M, // this class of methods reduced the emitted diagnostics by about 30% on // some projects (and all of that was false positives). if (Name.contains("String")) { - for (auto Param : M.parameters()) { + for (auto *Param : M.parameters()) { if (Param->getName() == "encoding") { State = State->set(ReturnRegion, Nullability::Contradicted); diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp index 1aa665f0ef45d1..fb90fc9c91ea33 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp @@ -368,7 +368,7 @@ class StreamChecker : public CheckergetType(); if (!T->isIntegralOrEnumerationType() && !T->isPointerType()) return nullptr; diff --git a/clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp index 05f8f6084c0b68..0fa3d6043971f4 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp @@ -92,7 +92,7 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val, if (const auto *CD = dyn_cast(C.getStackFrame()->getDecl())) { if (CD->isImplicit()) { - for (auto I : CD->inits()) { + for (auto *I : CD->inits()) { if (I->getInit()->IgnoreImpCasts() == StoreE) { OS << "Value assigned to field '" << I->getMember()->getName() << "' in implicit constructor is garbage or undefined"; diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp index 97f75135bf922e..6b4615e189bcd8 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp @@ -69,7 +69,7 @@ class NoUncountedMemberChecker if (shouldSkipDecl(RD)) return; - for (auto Member : RD->fields()) { + for (auto *Member : RD->fields()) { const Type *MemberType = Member->getType().getTypePtrOrNull(); if (!MemberType) continue; diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 3a8d69df7a6413..57591960a14017 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -1124,7 +1124,7 @@ static const ObjCMethodDecl *findDefiningRedecl(const ObjCMethodDecl *MD) { // Find the redeclaration that defines the method. if (!MD->hasBody()) { - for (auto I : MD->redecls()) + for (auto *I : MD->redecls()) if (I->hasBody()) MD = cast(I); } diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp index de90f4a71be005..994de60a732a23 100644 --- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -616,7 +616,7 @@ void CoreEngine::enqueue(ExplodedNodeSet &Set, } void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS) { - for (auto I : Set) { + for (auto *I : Set) { // If we are in an inlined call, generate CallExitBegin node. if (I->getLocationContext()->getParent()) { I = generateCallExitBeginNode(I, RS); diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp index 5a55e81497b032..25c36e9aea24d6 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp @@ -206,7 +206,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME, ExplodedNodeSet dstPostCheckers; getCheckerManager().runCheckersForObjCMessageNil(dstPostCheckers, Pred, *Msg, *this); - for (auto I : dstPostCheckers) + for (auto *I : dstPostCheckers) finishArgumentConstruction(Dst, I, *Msg); return; } @@ -270,7 +270,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME, // If there were constructors called for object-type arguments, clean them up. ExplodedNodeSet dstArgCleanup; - for (auto I : dstEval) + for (auto *I : dstEval) finishArgumentConstruction(dstArgCleanup, I, *Msg); ExplodedNodeSet dstPostvisit; diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp index 65d8508424320e..a76046ae79193f 100644 --- a/clang/lib/Tooling/Tooling.cpp +++ b/clang/lib/Tooling/Tooling.cpp @@ -98,7 +98,7 @@ static bool ignoreExtraCC1Commands(const driver::Compilation *Compilation) { OffloadCompilation = true; if (Jobs.size() > 1) { - for (auto A : Actions){ + for (auto *A : Actions){ // On MacOSX real actions may end up being wrapped in BindArchAction if (isa(A)) A = *A->input_begin();