diff --git a/clang-tools-extra/clang-tidy/ClangTidy.h b/clang-tools-extra/clang-tidy/ClangTidy.h --- a/clang-tools-extra/clang-tidy/ClangTidy.h +++ b/clang-tools-extra/clang-tidy/ClangTidy.h @@ -38,7 +38,7 @@ /// Returns an ASTConsumer that runs the specified clang-tidy checks. std::unique_ptr - CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File); + createASTConsumer(clang::CompilerInstance &Compiler, StringRef File); /// Get the list of enabled checks. std::vector getCheckNames(); diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -385,7 +385,7 @@ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER std::unique_ptr -ClangTidyASTConsumerFactory::CreateASTConsumer( +ClangTidyASTConsumerFactory::createASTConsumer( clang::CompilerInstance &Compiler, StringRef File) { // FIXME: Move this to a separate method, so that CreateASTConsumer doesn't // modify Compiler. @@ -573,7 +573,7 @@ Action(ClangTidyASTConsumerFactory *Factory) : Factory(Factory) {} std::unique_ptr CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override { - return Factory->CreateASTConsumer(Compiler, File); + return Factory->createASTConsumer(Compiler, File); } private: diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h --- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h +++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h @@ -23,10 +23,10 @@ class SourceManager; namespace ast_matchers { class MatchFinder; -} +} // namespace ast_matchers namespace tooling { class CompilationDatabase; -} +} // namespace tooling namespace tidy { diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp --- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp @@ -66,7 +66,7 @@ ? tooling::DiagnosticMessage(Message, Loc.getManager(), Loc) : tooling::DiagnosticMessage(Message); - // Make sure that if a TokenRange is receieved from the check it is unfurled + // Make sure that if a TokenRange is received from the check it is unfurled // into a real CharRange for the diagnostic printer later. // Whatever we store here gets decoupled from the current SourceManager, so // we **have to** know the exact position and length of the highlight. diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.h b/clang-tools-extra/clang-tidy/ClangTidyOptions.h --- a/clang-tools-extra/clang-tidy/ClangTidyOptions.h +++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.h @@ -108,7 +108,7 @@ std::string Value; /// Priority stores relative precedence of the value loaded from config - /// files to disambigute local vs global value from different levels. + /// files to disambiguate local vs global value from different levels. unsigned Priority; }; typedef std::pair StringPair; @@ -129,8 +129,8 @@ /// and using a FileOptionsProvider, it will take a configuration file in the /// parent directory (if any exists) and apply this config file on top of the /// parent one. IF true and using a ConfigOptionsProvider, it will apply this - /// config on top of any configuation file it finds in the directory using the - /// same logic as FileOptionsProvider. If false or missing, only this + /// config on top of any configuration file it finds in the directory using + /// the same logic as FileOptionsProvider. If false or missing, only this /// configuration file will be used. llvm::Optional InheritParentConfig; diff --git a/clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h b/clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h --- a/clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h +++ b/clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h @@ -26,8 +26,8 @@ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { return LangOpts.CPlusPlus; } - void registerMatchers(ast_matchers::MatchFinder *finder) override; - void check(const ast_matchers::MatchFinder::MatchResult &result) override; + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; } // namespace abseil diff --git a/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp b/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp --- a/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp @@ -145,7 +145,7 @@ return; // We first handle the cases of literal zero (both float and integer). - if (IsLiteralZero(Result, *Arg)) { + if (isLiteralZero(Result, *Arg)) { diag(Call->getBeginLoc(), "use ZeroDuration() for zero-length time intervals") << FixItHint::CreateReplacement(Call->getSourceRange(), diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h --- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h +++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h @@ -33,10 +33,10 @@ /// Given a 'Scale', return the appropriate factory function call for /// constructing a `Time` for that scale. -llvm::StringRef getTimeFactoryForScale(DurationScale scale); +llvm::StringRef getTimeFactoryForScale(DurationScale Scale); // Determine if `Node` represents a literal floating point or integral zero. -bool IsLiteralZero(const ast_matchers::MatchFinder::MatchResult &Result, +bool isLiteralZero(const ast_matchers::MatchFinder::MatchResult &Result, const Expr &Node); /// Possibly strip a floating point cast expression. @@ -77,7 +77,7 @@ getDurationInverseForScale(DurationScale Scale); /// Returns the Time inverse function name for a given `Scale`. -llvm::StringRef getTimeInverseForScale(DurationScale scale); +llvm::StringRef getTimeInverseForScale(DurationScale Scale); /// Assuming `Node` has type `double` or `int` representing a time interval of /// `Scale`, return the expression to make it a suitable `Duration`. diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp --- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp @@ -157,7 +157,7 @@ } /// Returns `true` if `Node` is a value which evaluates to a literal `0`. -bool IsLiteralZero(const MatchFinder::MatchResult &Result, const Expr &Node) { +bool isLiteralZero(const MatchFinder::MatchResult &Result, const Expr &Node) { auto ZeroMatcher = anyOf(integerLiteral(equals(0)), floatLiteral(equals(0.0))); @@ -276,7 +276,7 @@ rewriteInverseDurationCall(Result, Scale, RootNode)) return *MaybeRewrite; - if (IsLiteralZero(Result, RootNode)) + if (isLiteralZero(Result, RootNode)) return std::string("absl::ZeroDuration()"); return (llvm::Twine(getDurationFactoryForScale(Scale)) + "(" + @@ -294,7 +294,7 @@ rewriteInverseTimeCall(Result, Scale, RootNode)) return *MaybeRewrite; - if (IsLiteralZero(Result, RootNode)) + if (isLiteralZero(Result, RootNode)) return std::string("absl::UnixEpoch()"); return (llvm::Twine(getTimeFactoryForScale(Scale)) + "(" + diff --git a/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp b/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp --- a/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp @@ -97,7 +97,7 @@ ", " + NeedleExprCode + ")") .str()); - // Create a preprocessor #include FixIt hint (CreateIncludeInsertion checks + // Create a preprocessor #include FixIt hint (createIncludeInsertion checks // whether this already exists). Diagnostic << IncludeInserter.createIncludeInsertion( Source.getFileID(ComparisonExpr->getBeginLoc()), diff --git a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp --- a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp +++ b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp @@ -240,7 +240,7 @@ else if (RHS->isEvaluatable(*Context)) RHS->EvaluateAsRValue(Result, *Context); else - return false; // Cannot evalue either side. + return false; // Cannot evaluate either side. if (!Result.Val.isInt()) return false; // Cannot check number of iterations, return false to be // safe. diff --git a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp @@ -43,7 +43,7 @@ for (size_t I = 0, Size = LHS.size(); I < Size; I++) { // NOTE: We strip goto labels and annotations in addition to stripping // the `case X:` or `default:` labels, but it is very unlikely that this - // would casue false positives in real-world code. + // would cause false positives in real-world code. if (!areStatementsIdentical(LHS[I]->stripLabelLikeStatements(), RHS[I]->stripLabelLikeStatements(), Context)) { return false; @@ -187,10 +187,10 @@ Branches.back().push_back(S); } - auto End = Branches.end(); - auto BeginCurrent = Branches.begin(); + auto *End = Branches.end(); + auto *BeginCurrent = Branches.begin(); while (BeginCurrent < End) { - auto EndCurrent = BeginCurrent + 1; + auto *EndCurrent = BeginCurrent + 1; while (EndCurrent < End && areSwitchBranchesIdentical(*BeginCurrent, *EndCurrent, Context)) { ++EndCurrent; diff --git a/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.h b/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.h --- a/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.h @@ -31,7 +31,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp @@ -1100,7 +1100,7 @@ /// an implicit conversion. void addConversion(const CXXMethodDecl *ConvFun, QualType FromType, QualType ToType) { - // Try to go from the FromType to the ToType wiht only a single implicit + // Try to go from the FromType to the ToType with only a single implicit // conversion, to see if the conversion function is applicable. MixData Mix = calculateMixability( Check, FromType, ToType, ConvFun->getASTContext(), @@ -1553,7 +1553,7 @@ } /// This namespace contains the implementations for the suppression of -/// diagnostics from similaly used ("related") parameters. +/// diagnostics from similarly-used ("related") parameters. namespace relatedness_heuristic { static constexpr std::size_t SmallDataStructureSize = 4; diff --git a/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp @@ -112,7 +112,8 @@ // Every parameter after the first must have a default value. const auto *Ctor = Result.Nodes.getNodeAs("ctor"); - for (auto Iter = Ctor->param_begin() + 1; Iter != Ctor->param_end(); ++Iter) { + for (auto *Iter = Ctor->param_begin() + 1; Iter != Ctor->param_end(); + ++Iter) { if (!(*Iter)->hasDefaultArg()) return; } diff --git a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp @@ -39,7 +39,7 @@ using ExpansionRanges = std::vector; -/// \bried Get all the macro expansion ranges related to `Loc`. +/// \brief Get all the macro expansion ranges related to `Loc`. /// /// The result is ordered from most inner to most outer. ExpansionRanges getExpansionRanges(SourceLocation Loc, diff --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h --- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h @@ -41,12 +41,12 @@ private: llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, + getDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const override; llvm::Optional - GetMacroFailureInfo(const Token &MacroNameTok, + getMacroFailureInfo(const Token &MacroNameTok, const SourceManager &SM) const override; - DiagInfo GetDiagInfo(const NamingCheckId &ID, + DiagInfo getDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const override; }; diff --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp @@ -152,7 +152,7 @@ } Optional -ReservedIdentifierCheck::GetDeclFailureInfo(const NamedDecl *Decl, +ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl, const SourceManager &) const { assert(Decl && Decl->getIdentifier() && !Decl->getName().empty() && !Decl->isImplicit() && @@ -163,14 +163,14 @@ } Optional -ReservedIdentifierCheck::GetMacroFailureInfo(const Token &MacroNameTok, +ReservedIdentifierCheck::getMacroFailureInfo(const Token &MacroNameTok, const SourceManager &) const { return getFailureInfoImpl(MacroNameTok.getIdentifierInfo()->getName(), true, getLangOpts(), Invert, AllowedIdentifiers); } RenamerClangTidyCheck::DiagInfo -ReservedIdentifierCheck::GetDiagInfo(const NamingCheckId &ID, +ReservedIdentifierCheck::getDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const { return DiagInfo{Message, [&](DiagnosticBuilder &Diag) { Diag << ID.second diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp @@ -176,7 +176,7 @@ .bind("sizeof-pointer-to-aggregate"), this); - // Detect expression like: sizeof(epxr) <= k for a suspicious constant 'k'. + // Detect expression like: sizeof(expr) <= k for a suspicious constant 'k'. if (WarnOnSizeOfCompareToConstant) { Finder->addMatcher( binaryOperator(matchers::isRelationalOperator(), diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp @@ -131,7 +131,7 @@ this); } - // Detect suspicious cast to an inconsistant type (i.e. not integer type). + // Detect suspicious cast to an inconsistent type (i.e. not integer type). Finder->addMatcher( traverse(TK_AsIs, implicitCastExpr(unless(hasType(isInteger())), diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp @@ -84,9 +84,9 @@ auto SR = SourceRange(Node->getLParenLoc(), Node->getRParenLoc()); auto DefaultConstruction = Node->getNumArgs() == 0; if (!DefaultConstruction) { - auto FirstArg = Node->getArg(0); + auto *FirstArg = Node->getArg(0); DefaultConstruction = isa(FirstArg); - if (auto ILE = dyn_cast(FirstArg)) { + if (auto *ILE = dyn_cast(FirstArg)) { DefaultConstruction = ILE->getNumInits() == 0; SR = SourceRange(ILE->getLBraceLoc(), ILE->getRBraceLoc()); } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp @@ -52,7 +52,7 @@ callExpr(callee(functionDecl(LegacyCreatorFunctions))); // C-style functions like `::malloc()` sometimes create owners as void* // which is expected to be cast to the correct type in C++. This case - // must be catched explicitly. + // must be caught explicitly. const auto LegacyOwnerCast = castExpr(hasSourceExpression(CreatesLegacyOwner)); // Functions that do manual resource management but cannot be updated to use diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -122,9 +122,9 @@ // insert into the initializer list of a constructor. We use this to ensure // proper absolute ordering according to the class declaration relative to the // (perhaps improper) ordering in the existing initializer list, if any. -struct IntializerInsertion { - IntializerInsertion(InitializerPlacement Placement, - const CXXCtorInitializer *Where) +struct InitializerInsertion { + InitializerInsertion(InitializerPlacement Placement, + const CXXCtorInitializer *Where) : Placement(Placement), Where(Where) {} SourceLocation getLocation(const ASTContext &Context, @@ -186,11 +186,11 @@ } template -SmallVector +SmallVector computeInsertions(const CXXConstructorDecl::init_const_range &Inits, const R &OrderedDecls, const SmallPtrSetImpl &DeclsToInit) { - SmallVector Insertions; + SmallVector Insertions; Insertions.emplace_back(InitializerPlacement::New, nullptr); typename R::const_iterator Decl = std::begin(OrderedDecls); diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.h --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.h @@ -32,7 +32,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; private: - void DiagnoseSlicedOverriddenMethods(const Expr &call, + void diagnoseSlicedOverriddenMethods(const Expr &Call, const CXXRecordDecl &DerivedDecl, const CXXRecordDecl &BaseDecl); }; diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp @@ -71,7 +71,7 @@ /// Warns on methods overridden in DerivedDecl with respect to BaseDecl. /// FIXME: this warns on all overrides outside of the sliced path in case of /// multiple inheritance. -void SlicingCheck::DiagnoseSlicedOverriddenMethods( +void SlicingCheck::diagnoseSlicedOverriddenMethods( const Expr &Call, const CXXRecordDecl &DerivedDecl, const CXXRecordDecl &BaseDecl) { if (DerivedDecl.getCanonicalDecl() == BaseDecl.getCanonicalDecl()) @@ -92,7 +92,7 @@ if (const auto *BaseRecordType = Base.getType()->getAs()) { if (const auto *BaseRecord = cast_or_null( BaseRecordType->getDecl()->getDefinition())) - DiagnoseSlicedOverriddenMethods(Call, *BaseRecord, BaseDecl); + diagnoseSlicedOverriddenMethods(Call, *BaseRecord, BaseDecl); } } } @@ -115,7 +115,7 @@ // class A { virtual void f(); }; // class B : public A {}; // because in that case calling A::f is the same as calling B::f. - DiagnoseSlicedOverriddenMethods(*Call, *DerivedDecl, *BaseDecl); + diagnoseSlicedOverriddenMethods(*Call, *DerivedDecl, *BaseDecl); // Warn when slicing member variables. const auto &BaseLayout = diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h @@ -77,7 +77,7 @@ } // namespace clang namespace llvm { -/// Specialisation of DenseMapInfo to allow ClassDefId objects in DenseMaps +/// Specialization of DenseMapInfo to allow ClassDefId objects in DenseMaps /// FIXME: Move this to the corresponding cpp file as is done for /// clang-tidy/readability/IdentifierNamingCheck.cpp. template <> diff --git a/clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.h b/clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.h --- a/clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.h +++ b/clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.h @@ -32,8 +32,8 @@ void onEndOfTranslationUnit() override { InterfaceMap.clear(); } private: - void addNodeToInterfaceMap(const CXXRecordDecl *Node, bool isInterface); - bool getInterfaceStatus(const CXXRecordDecl *Node, bool &isInterface) const; + void addNodeToInterfaceMap(const CXXRecordDecl *Node, bool IsInterface); + bool getInterfaceStatus(const CXXRecordDecl *Node, bool &IsInterface) const; bool isCurrentClassInterface(const CXXRecordDecl *Node) const; bool isInterface(const CXXRecordDecl *Node); diff --git a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp --- a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp @@ -35,7 +35,7 @@ Guard = Guard.substr(PosToolsClang + std::strlen("tools/")); // Unlike LLVM svn, LLVM git monorepo is named llvm-project, so we replace - // "/llvm-project/" with the cannonical "/llvm/". + // "/llvm-project/" with the canonical "/llvm/". const static StringRef LLVMProject = "/llvm-project/"; size_t PosLLVMProject = Guard.rfind(std::string(LLVMProject)); if (PosLLVMProject != StringRef::npos) diff --git a/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp b/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp --- a/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp @@ -171,7 +171,7 @@ SmartSmallSetVector CallStackSet; - // Arbitrairly take the first element of SCC as entry point. + // Arbitrarily take the first element of SCC as entry point. CallGraphNode::CallRecord EntryNode(SCC.front(), /*CallExpr=*/nullptr); // Continue recursing into subsequent callees that are part of this SCC, // and are thus known to be part of the call graph loop, until loop forms. diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp --- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -771,7 +771,7 @@ return SM.getExpansionLoc(ExprSR.getEnd()) == T.getLocation(); } -/// Returns true if both LhsEpxr and RhsExpr are +/// Returns true if both LhsExpr and RhsExpr are /// macro expressions and they are expanded /// from different macros. static bool areExprsFromDifferentMacros(const Expr *LhsExpr, @@ -863,7 +863,7 @@ .bind("nested-duplicates"), this); - // Conditional (trenary) operator with equivalent operands, like (Y ? X : X). + // Conditional (ternary) operator with equivalent operands, like (Y ? X : X). Finder->addMatcher( traverse(TK_AsIs, conditionalOperator(expressionsAreEquivalent(), diff --git a/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h b/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h --- a/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h +++ b/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h @@ -37,12 +37,12 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; private: - void diagnoseThrowLocations(const CXXThrowExpr *throwExpr); - void diagnoseCatchLocations(const CXXCatchStmt *catchStmt, - ASTContext &context); - bool isFunctionParameter(const DeclRefExpr *declRefExpr); - bool isCatchVariable(const DeclRefExpr *declRefExpr); - bool isFunctionOrCatchVar(const DeclRefExpr *declRefExpr); + void diagnoseThrowLocations(const CXXThrowExpr *ThrowExpr); + void diagnoseCatchLocations(const CXXCatchStmt *CatchStmt, + ASTContext &Context); + bool isFunctionParameter(const DeclRefExpr *DeclRefExpr); + bool isCatchVariable(const DeclRefExpr *DeclRefExpr); + bool isFunctionOrCatchVar(const DeclRefExpr *DeclRefExpr); const bool CheckAnonymousTemporaries; const bool WarnOnLargeObject; const uint64_t MaxSizeOptions; // The raw value read from the options. diff --git a/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp b/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp --- a/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp @@ -47,43 +47,43 @@ } bool ThrowByValueCatchByReferenceCheck::isFunctionParameter( - const DeclRefExpr *declRefExpr) { - return isa(declRefExpr->getDecl()); + const DeclRefExpr *DeclRefExpr) { + return isa(DeclRefExpr->getDecl()); } bool ThrowByValueCatchByReferenceCheck::isCatchVariable( - const DeclRefExpr *declRefExpr) { - auto *valueDecl = declRefExpr->getDecl(); - if (auto *varDecl = dyn_cast(valueDecl)) - return varDecl->isExceptionVariable(); + const DeclRefExpr *DeclRefExpr) { + auto *ValueDecl = DeclRefExpr->getDecl(); + if (auto *VarDecl = dyn_cast(ValueDecl)) + return VarDecl->isExceptionVariable(); return false; } bool ThrowByValueCatchByReferenceCheck::isFunctionOrCatchVar( - const DeclRefExpr *declRefExpr) { - return isFunctionParameter(declRefExpr) || isCatchVariable(declRefExpr); + const DeclRefExpr *DeclRefExpr) { + return isFunctionParameter(DeclRefExpr) || isCatchVariable(DeclRefExpr); } void ThrowByValueCatchByReferenceCheck::diagnoseThrowLocations( - const CXXThrowExpr *throwExpr) { - if (!throwExpr) + const CXXThrowExpr *ThrowExpr) { + if (!ThrowExpr) return; - auto *subExpr = throwExpr->getSubExpr(); - if (!subExpr) + auto *SubExpr = ThrowExpr->getSubExpr(); + if (!SubExpr) return; - auto qualType = subExpr->getType(); - if (qualType->isPointerType()) { + auto QualType = SubExpr->getType(); + if (QualType->isPointerType()) { // The code is throwing a pointer. - // In case it is strng literal, it is safe and we return. - auto *inner = subExpr->IgnoreParenImpCasts(); - if (isa(inner)) + // In case it is string literal, it is safe and we return. + auto *Inner = SubExpr->IgnoreParenImpCasts(); + if (isa(Inner)) return; // If it's a variable from a catch statement, we return as well. - auto *declRef = dyn_cast(inner); - if (declRef && isCatchVariable(declRef)) { + auto *DeclRef = dyn_cast(Inner); + if (DeclRef && isCatchVariable(DeclRef)) { return; } - diag(subExpr->getBeginLoc(), "throw expression throws a pointer; it should " + diag(SubExpr->getBeginLoc(), "throw expression throws a pointer; it should " "throw a non-pointer value instead"); } // If the throw statement does not throw by pointer then it throws by value @@ -100,61 +100,62 @@ // When encountering a CopyOrMoveConstructor: emit message if after casts, // the expression is a LValue if (CheckAnonymousTemporaries) { - bool emit = false; - auto *currentSubExpr = subExpr->IgnoreImpCasts(); - const auto *variableReference = dyn_cast(currentSubExpr); - const auto *constructorCall = dyn_cast(currentSubExpr); + bool Emit = false; + auto *CurrentSubExpr = SubExpr->IgnoreImpCasts(); + const auto *VariableReference = dyn_cast(CurrentSubExpr); + const auto *ConstructorCall = dyn_cast(CurrentSubExpr); // If we have a DeclRefExpr, we flag for emitting a diagnosis message in // case the referenced variable is neither a function parameter nor a // variable declared in the catch statement. - if (variableReference) - emit = !isFunctionOrCatchVar(variableReference); - else if (constructorCall && - constructorCall->getConstructor()->isCopyOrMoveConstructor()) { + if (VariableReference) + Emit = !isFunctionOrCatchVar(VariableReference); + else if (ConstructorCall && + ConstructorCall->getConstructor()->isCopyOrMoveConstructor()) { // If we have a copy / move construction, we emit a diagnosis message if // the object that we copy construct from is neither a function parameter // nor a variable declared in a catch statement - auto argIter = - constructorCall + auto ArgIter = + ConstructorCall ->arg_begin(); // there's only one for copy constructors - auto *currentSubExpr = (*argIter)->IgnoreImpCasts(); - if (currentSubExpr->isLValue()) { - if (auto *tmp = dyn_cast(currentSubExpr)) - emit = !isFunctionOrCatchVar(tmp); - else if (isa(currentSubExpr)) - emit = true; + auto *CurrentSubExpr = (*ArgIter)->IgnoreImpCasts(); + if (CurrentSubExpr->isLValue()) { + if (auto *Tmp = dyn_cast(CurrentSubExpr)) + Emit = !isFunctionOrCatchVar(Tmp); + else if (isa(CurrentSubExpr)) + Emit = true; } } - if (emit) - diag(subExpr->getBeginLoc(), + if (Emit) + diag(SubExpr->getBeginLoc(), "throw expression should throw anonymous temporary values instead"); } } void ThrowByValueCatchByReferenceCheck::diagnoseCatchLocations( - const CXXCatchStmt *catchStmt, ASTContext &context) { - if (!catchStmt) + const CXXCatchStmt *CatchStmt, ASTContext &Context) { + if (!CatchStmt) return; - auto caughtType = catchStmt->getCaughtType(); - if (caughtType.isNull()) + auto CaughtType = CatchStmt->getCaughtType(); + if (CaughtType.isNull()) return; - auto *varDecl = catchStmt->getExceptionDecl(); - if (const auto *PT = caughtType.getCanonicalType()->getAs()) { - const char *diagMsgCatchReference = "catch handler catches a pointer value; " - "should throw a non-pointer value and " - "catch by reference instead"; + auto *VarDecl = CatchStmt->getExceptionDecl(); + if (const auto *PT = CaughtType.getCanonicalType()->getAs()) { + const char *DiagMsgCatchReference = + "catch handler catches a pointer value; " + "should throw a non-pointer value and " + "catch by reference instead"; // We do not diagnose when catching pointer to strings since we also allow // throwing string literals. if (!PT->getPointeeType()->isAnyCharacterType()) - diag(varDecl->getBeginLoc(), diagMsgCatchReference); - } else if (!caughtType->isReferenceType()) { - const char *diagMsgCatchReference = "catch handler catches by value; " + diag(VarDecl->getBeginLoc(), DiagMsgCatchReference); + } else if (!CaughtType->isReferenceType()) { + const char *DiagMsgCatchReference = "catch handler catches by value; " "should catch by reference instead"; // If it's not a pointer and not a reference then it must be caught "by // value". In this case we should emit a diagnosis message unless the type // is trivial. - if (!caughtType.isTrivialType(context)) { - diag(varDecl->getBeginLoc(), diagMsgCatchReference); + if (!CaughtType.isTrivialType(Context)) { + diag(VarDecl->getBeginLoc(), DiagMsgCatchReference); } else if (WarnOnLargeObject) { // If the type is trivial, then catching it by reference is not dangerous. // However, catching large objects by value decreases the performance. @@ -162,9 +163,9 @@ // We can now access `ASTContext` so if `MaxSize` is an extremal value // then set it to the size of `size_t`. if (MaxSize == std::numeric_limits::max()) - MaxSize = context.getTypeSize(context.getSizeType()); - if (context.getTypeSize(caughtType) > MaxSize) - diag(varDecl->getBeginLoc(), diagMsgCatchReference); + MaxSize = Context.getTypeSize(Context.getSizeType()); + if (Context.getTypeSize(CaughtType) > MaxSize) + diag(VarDecl->getBeginLoc(), DiagMsgCatchReference); } } } diff --git a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp @@ -334,7 +334,7 @@ ArrayRef Args = LP.BindArguments; - auto MaxPlaceholderIt = + const auto *MaxPlaceholderIt = std::max_element(Args.begin(), Args.end(), [](const BindArgument &B1, const BindArgument &B2) { return B1.PlaceHolderIndex < B2.PlaceHolderIndex; diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp @@ -182,7 +182,7 @@ if (!paramReferredExactlyOnce(Ctor, ParamDecl)) return; - // If the parameter is trivial to copy, don't move it. Moving a trivivally + // If the parameter is trivial to copy, don't move it. Moving a trivially // copyable type will cause a problem with performance-move-const-arg if (ParamDecl->getType().getNonReferenceType().isTriviallyCopyableType( *Result.Context)) diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.h b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.h --- a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.h @@ -24,7 +24,7 @@ /// operations do not 'copy' the resource but they 'steal' it. /// `std::unique_ptr` uses move semantics instead, which makes the intent of /// transferring the resource explicit. This difference between the two smart -/// pointers requeres to wrap the copy-ctor and assign-operator with +/// pointers requires wrapping the copy-ctor and assign-operator with /// `std::move()`. /// /// For example, given: diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.cpp @@ -32,7 +32,7 @@ return; if (Info->getName() != Check.getMacroName()) return; - // The first argument to the DISALLOW_COPY_AND_ASSIGN macro is exptected to + // The first argument to the DISALLOW_COPY_AND_ASSIGN macro is expected to // be the class name. const Token *ClassNameTok = Args->getUnexpArgument(0); if (Args->ArgNeedsPreexpansion(ClassNameTok, PP)) diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.h b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.h --- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.h @@ -19,7 +19,7 @@ public: UseNullptrCheck(StringRef Name, ClangTidyContext *Context); bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { - // FIXME this should be CPlusCplus11 but that causes test cases to + // FIXME this should be CPlusPlus11 but that causes test cases to // erroneously fail. return LangOpts.CPlusPlus; } diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp @@ -172,7 +172,7 @@ // same line as the declaration if the beginning brace for the start of // the body falls on the next line. ReplacementText = " " + OverrideSpelling; - auto LastTokenIter = std::prev(Tokens.end()); + auto *LastTokenIter = std::prev(Tokens.end()); // When try statement is used instead of compound statement as // method body - insert override keyword before it. if (LastTokenIter->is(tok::kw_try)) diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h --- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h @@ -18,8 +18,8 @@ struct ClassifiedToken { Token T; - bool isQualifier; - bool isSpecifier; + bool IsQualifier; + bool IsSpecifier; }; /// Rewrites function signatures to use a trailing return type. diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp @@ -78,7 +78,7 @@ return RecursiveASTVisitor::TraverseTypeLoc(TL); } - // Replace the base method in order to call ower own + // Replace the base method in order to call our own // TraverseTypeLoc(). bool TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) { return TraverseTypeLoc(TL.getUnqualifiedLoc()); @@ -172,8 +172,8 @@ classifyToken(const FunctionDecl &F, Preprocessor &PP, Token Tok) { ClassifiedToken CT; CT.T = Tok; - CT.isQualifier = true; - CT.isSpecifier = true; + CT.IsQualifier = true; + CT.IsSpecifier = true; bool ContainsQualifiers = false; bool ContainsSpecifiers = false; bool ContainsSomethingElse = false; @@ -193,8 +193,8 @@ bool Qual = isCvr(T); bool Spec = isSpecifier(T); - CT.isQualifier &= Qual; - CT.isSpecifier &= Spec; + CT.IsQualifier &= Qual; + CT.IsSpecifier &= Spec; ContainsQualifiers |= Qual; ContainsSpecifiers |= Spec; ContainsSomethingElse |= !Qual && !Spec; @@ -329,7 +329,7 @@ !ExtendedLeft) { assert(I <= size_t(std::numeric_limits::max()) && "Integer overflow detected"); - for (int J = static_cast(I) - 1; J >= 0 && Tokens[J].isQualifier; + for (int J = static_cast(I) - 1; J >= 0 && Tokens[J].IsQualifier; J--) ReturnTypeRange.setBegin(Tokens[J].T.getLocation()); ExtendedLeft = true; @@ -337,7 +337,7 @@ // If we found the end of the return type, include right qualifiers. if (SM.isBeforeInTranslationUnit(ReturnTypeRange.getEnd(), Tokens[I].T.getLocation())) { - for (size_t J = I; J < Tokens.size() && Tokens[J].isQualifier; J++) + for (size_t J = I; J < Tokens.size() && Tokens[J].IsQualifier; J++) ReturnTypeRange.setEnd(Tokens[J].T.getLocation()); break; } @@ -380,7 +380,7 @@ SM.isBeforeInTranslationUnit(ReturnTypeCVRange.getEnd(), CT.T.getLocation())) continue; - if (!CT.isSpecifier) + if (!CT.IsSpecifier) continue; // Add the token to 'auto' and remove it from the return type, including diff --git a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h --- a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h +++ b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.h @@ -29,7 +29,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; private: - void ReportAndFix(const ASTContext *Context, const VarDecl *VD, + void reportAndFix(const ASTContext *Context, const VarDecl *VD, const Expr *OperatorCall); }; diff --git a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp --- a/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp @@ -21,7 +21,7 @@ namespace performance { // Checks if the stmt is a ImplicitCastExpr with a CastKind that is not a NoOp. -// The subtelty is that in some cases (user defined conversions), we can +// The subtlety is that in some cases (user defined conversions), we can // get to ImplicitCastExpr inside each other, with the outer one a NoOp. In this // case we skip the first cast expr. static bool isNonTrivialImplicitCast(const Stmt *ST) { @@ -82,12 +82,12 @@ // is a reference. This situation is fine (it probably produces the same // code at the end). if (isNonTrivialImplicitCast(Materialized->getSubExpr())) - ReportAndFix(Result.Context, VD, OperatorCall); + reportAndFix(Result.Context, VD, OperatorCall); } -void ImplicitConversionInLoopCheck::ReportAndFix( - const ASTContext *Context, const VarDecl *VD, - const Expr *OperatorCall) { +void ImplicitConversionInLoopCheck::reportAndFix(const ASTContext *Context, + const VarDecl *VD, + const Expr *OperatorCall) { // We only match on const ref, so we should print a const ref version of the // type. QualType ConstType = OperatorCall->getType().withConst(); diff --git a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h --- a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h +++ b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h @@ -34,7 +34,7 @@ void storeOptions(ClangTidyOptions::OptionMap &Opts) override; private: - void AddMatcher(const ast_matchers::DeclarationMatcher &TargetRecordDecl, + void addMatcher(const ast_matchers::DeclarationMatcher &TargetRecordDecl, StringRef VarDeclName, StringRef VarDeclStmtName, const ast_matchers::DeclarationMatcher &AppendMethodDecl, StringRef AppendCallName, ast_matchers::MatchFinder *Finder); diff --git a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp --- a/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp @@ -84,7 +84,7 @@ Options.store(Opts, "EnableProto", EnableProto); } -void InefficientVectorOperationCheck::AddMatcher( +void InefficientVectorOperationCheck::addMatcher( const DeclarationMatcher &TargetRecordDecl, StringRef VarDeclName, StringRef VarDeclStmtName, const DeclarationMatcher &AppendMethodDecl, StringRef AppendCallName, MatchFinder *Finder) { @@ -156,7 +156,7 @@ VectorLikeClasses.begin(), VectorLikeClasses.end()))); const auto AppendMethodDecl = cxxMethodDecl(hasAnyName("push_back", "emplace_back")); - AddMatcher(VectorDecl, VectorVarDeclName, VectorVarDeclStmtName, + addMatcher(VectorDecl, VectorVarDeclName, VectorVarDeclStmtName, AppendMethodDecl, PushBackOrEmplaceBackCallName, Finder); if (EnableProto) { @@ -168,7 +168,7 @@ // with "add_". So we exclude const methods. const auto AddFieldMethodDecl = cxxMethodDecl(matchesName("::add_"), unless(isConst())); - AddMatcher(ProtoDecl, ProtoVarDeclName, ProtoVarDeclStmtName, + addMatcher(ProtoDecl, ProtoVarDeclName, ProtoVarDeclStmtName, AddFieldMethodDecl, ProtoAddFieldCallName, Finder); } } diff --git a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp --- a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp +++ b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp @@ -48,7 +48,7 @@ // Create the AST consumer. ClangTidyASTConsumerFactory Factory(*Context); std::vector> Vec; - Vec.push_back(Factory.CreateASTConsumer(Compiler, File)); + Vec.push_back(Factory.createASTConsumer(Compiler, File)); return std::make_unique( std::move(Context), std::move(DiagEngine), std::move(Vec)); diff --git a/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.h b/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.h --- a/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.h +++ b/clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.h @@ -23,8 +23,8 @@ class ConstReturnTypeCheck : public ClangTidyCheck { public: using ClangTidyCheck::ClangTidyCheck; - void registerMatchers(ast_matchers::MatchFinder* finder) override; - void check(const ast_matchers::MatchFinder::MatchResult& result) override; + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; } // namespace readability diff --git a/clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.h b/clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.h --- a/clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.h +++ b/clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.h @@ -20,8 +20,8 @@ /// This only replaces the case where the offset being accessed through the /// subscript operation is a known constant 0. This avoids a potential invalid /// memory access when the container is empty. Cases where the constant is not -/// explictly zero can be addressed through the clang static analyzer, and those -/// which cannot be statically identified can be caught using UBSan. +/// explicitly zero can be addressed through the clang static analyzer, and +/// those which cannot be statically identified can be caught using UBSan. class ContainerDataPointerCheck : public ClangTidyCheck { public: ContainerDataPointerCheck(StringRef Name, ClangTidyContext *Context); diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp @@ -90,7 +90,7 @@ namespace tidy { namespace readability { -using utils::IsBinaryOrTernary; +using utils::isBinaryOrTernary; ContainerSizeEmptyCheck::ContainerSizeEmptyCheck(StringRef Name, ClangTidyContext *Context) @@ -191,7 +191,7 @@ std::string ReplacementText = std::string( Lexer::getSourceText(CharSourceRange::getTokenRange(E->getSourceRange()), *Result.SourceManager, getLangOpts())); - if (IsBinaryOrTernary(E) || isa(E)) { + if (isBinaryOrTernary(E) || isa(E)) { ReplacementText = "(" + ReplacementText + ")"; } if (E->getType()->isPointerType()) diff --git a/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp b/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp @@ -86,7 +86,7 @@ }; // The helper struct used to record one increment occurrence, with all the - // details nessesary. + // details necessary. struct Detail { const SourceLocation Loc; // What caused the increment? const unsigned short Nesting; // How deeply nested is Loc located? diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h @@ -186,12 +186,12 @@ private: llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, + getDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const override; llvm::Optional - GetMacroFailureInfo(const Token &MacroNameTok, + getMacroFailureInfo(const Token &MacroNameTok, const SourceManager &SM) const override; - DiagInfo GetDiagInfo(const NamingCheckId &ID, + DiagInfo getDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const override; const FileStyle &getStyleForFile(StringRef FileName) const; diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -1381,7 +1381,7 @@ } llvm::Optional -IdentifierNamingCheck::GetDeclFailureInfo(const NamedDecl *Decl, +IdentifierNamingCheck::getDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const { SourceLocation Loc = Decl->getLocation(); const FileStyle &FileStyle = getStyleForFile(SM.getFilename(Loc)); @@ -1397,7 +1397,7 @@ } llvm::Optional -IdentifierNamingCheck::GetMacroFailureInfo(const Token &MacroNameTok, +IdentifierNamingCheck::getMacroFailureInfo(const Token &MacroNameTok, const SourceManager &SM) const { SourceLocation Loc = MacroNameTok.getLocation(); const FileStyle &Style = getStyleForFile(SM.getFilename(Loc)); @@ -1410,7 +1410,7 @@ } RenamerClangTidyCheck::DiagInfo -IdentifierNamingCheck::GetDiagInfo(const NamingCheckId &ID, +IdentifierNamingCheck::getDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const { return DiagInfo{"invalid case style for %0 '%1'", [&](DiagnosticBuilder &Diag) { diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp @@ -104,8 +104,8 @@ bool Strict) { DifferingParamsContainer DifferingParams; - auto SourceParamIt = ParameterSourceDeclaration->param_begin(); - auto OtherParamIt = OtherDeclaration->param_begin(); + const auto *SourceParamIt = ParameterSourceDeclaration->param_begin(); + const auto *OtherParamIt = OtherDeclaration->param_begin(); while (SourceParamIt != ParameterSourceDeclaration->param_end() && OtherParamIt != OtherDeclaration->param_end()) { diff --git a/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp b/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp @@ -226,7 +226,7 @@ if (!isPointerConst(Var->getType())) return; // Pointer isn't const, no need to add const qualifier. if (!isAutoPointerConst(Var->getType())) - return; // Const isnt wrapped in the auto type, so must be declared + return; // Const isn't wrapped in the auto type, so must be declared // explicitly. if (Var->getType().isLocalConstQualified()) { @@ -267,7 +267,7 @@ if (!isPointerConst(Var->getType())) return; // Pointer isn't const, no need to add const qualifier. if (!isAutoPointerConst(Var->getType())) - // Const isnt wrapped in the auto type, so must be declared explicitly. + // Const isn't wrapped in the auto type, so must be declared explicitly. return; if (llvm::Optional TypeSpec = diff --git a/clang-tools-extra/clang-tidy/utils/ASTUtils.h b/clang-tools-extra/clang-tidy/utils/ASTUtils.h --- a/clang-tools-extra/clang-tidy/utils/ASTUtils.h +++ b/clang-tools-extra/clang-tidy/utils/ASTUtils.h @@ -18,7 +18,7 @@ const FunctionDecl *getSurroundingFunction(ASTContext &Context, const Stmt &Statement); // Determine whether Expr is a Binary or Ternary expression. -bool IsBinaryOrTernary(const Expr *E); +bool isBinaryOrTernary(const Expr *E); /// Checks whether a macro flag is present in the given argument. Only considers /// cases of single match or match in a binary OR expression. For example, diff --git a/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp b/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp --- a/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/ASTUtils.cpp @@ -24,7 +24,7 @@ Statement, Context)); } -bool IsBinaryOrTernary(const Expr *E) { +bool isBinaryOrTernary(const Expr *E) { const Expr *EBase = E->IgnoreImpCasts(); if (isa(EBase) || isa(EBase)) { return true; diff --git a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp --- a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp @@ -48,7 +48,7 @@ declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef"); auto ConstMethodCallee = callee(cxxMethodDecl(isConst())); // Match method call expressions where the variable is referenced as the this - // implicit object argument and opertor call expression for member operators + // implicit object argument and operator call expression for member operators // where the variable is the 0-th argument. auto Matches = match( findAll(expr(anyOf(cxxMemberCallExpr(ConstMethodCallee, on(DeclRefToVar)), diff --git a/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp b/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp --- a/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp +++ b/clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp @@ -19,7 +19,7 @@ public: explicit IncludeInserterCallback(IncludeInserter *Inserter) : Inserter(Inserter) {} - // Implements PPCallbacks::InclusionDerective(). Records the names and source + // Implements PPCallbacks::InclusionDirective(). Records the names and source // locations of the inclusions in the main source file being processed. void InclusionDirective(SourceLocation HashLocation, const Token &IncludeToken, StringRef FileNameRef, @@ -76,7 +76,7 @@ if (!InsertedHeaders[FileID].insert(Header).second) return llvm::None; - return getOrCreate(FileID).CreateIncludeInsertion(Header, IsAngled); + return getOrCreate(FileID).createIncludeInsertion(Header, IsAngled); } llvm::Optional @@ -92,7 +92,7 @@ assert(SourceMgr && "SourceMgr shouldn't be null; did you remember to call " "registerPreprocessor()?"); FileID FileID = SourceMgr->getFileID(HashLocation); - getOrCreate(FileID).AddInclude(FileName, IsAngled, HashLocation, EndLocation); + getOrCreate(FileID).addInclude(FileName, IsAngled, HashLocation, EndLocation); } } // namespace utils diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h @@ -41,12 +41,12 @@ StringRef FileName, IncludeStyle Style); /// Adds the given include directive to the sorter. - void AddInclude(StringRef FileName, bool IsAngled, + void addInclude(StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation); /// Creates a quoted inclusion directive in the right sort order. Returns None /// on error or if header inclusion directive for header already exists. - Optional CreateIncludeInsertion(StringRef FileName, bool IsAngled); + Optional createIncludeInsertion(StringRef FileName, bool IsAngled); private: typedef SmallVector SourceRangeVector; diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp b/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp @@ -129,7 +129,7 @@ : SourceMgr(SourceMgr), Style(Style), CurrentFileID(FileID), CanonicalFile(makeCanonicalName(FileName, Style)) {} -void IncludeSorter::AddInclude(StringRef FileName, bool IsAngled, +void IncludeSorter::addInclude(StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation) { int Offset = findNextLine(SourceMgr->getCharacterData(EndLocation)); @@ -150,7 +150,7 @@ IncludeBucket[Kind].push_back(FileName.str()); } -Optional IncludeSorter::CreateIncludeInsertion(StringRef FileName, +Optional IncludeSorter::createIncludeInsertion(StringRef FileName, bool IsAngled) { std::string IncludeStmt; if (Style == IncludeStyle::IS_Google_ObjC) { diff --git a/clang-tools-extra/clang-tidy/utils/LexerUtils.cpp b/clang-tools-extra/clang-tidy/utils/LexerUtils.cpp --- a/clang-tools-extra/clang-tidy/utils/LexerUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/LexerUtils.cpp @@ -178,7 +178,7 @@ // All macro issues are simply resolved by ensuring it's a semicolon. if (NextTok && NextTok->is(tok::TokenKind::semi)) { // Ideally this would return `F` with spelling location `;` (NextTok) - // following the examle above. For now simply return NextTok location. + // following the example above. For now simply return NextTok location. return NextTok->getLocation(); } diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h @@ -1,4 +1,4 @@ -//===--- RenamderClangTidyCheck.h - clang-tidy ------------------*- C++ -*-===// +//===--- RenamerClangTidyCheck.h - clang-tidy -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -32,7 +32,7 @@ /// Derived classes should not implement any matching logic themselves; this /// class will do the matching and call the derived class' - /// GetDeclFailureInfo() and GetMacroFailureInfo() for determining whether a + /// getDeclFailureInfo() and getMacroFailureInfo() for determining whether a /// given identifier passes or fails the check. void registerMatchers(ast_matchers::MatchFinder *Finder) override final; void @@ -87,11 +87,11 @@ /// /// e.g.: if the identifier was used or declared within a macro we won't /// offer a fixup for safety reasons. - bool ShouldFix() const { + bool shouldFix() const { return FixStatus == ShouldFixStatus::ShouldFix && !Info.Fixup.empty(); } - bool ShouldNotify() const { + bool shouldNotify() const { return FixStatus < ShouldFixStatus::IgnoreFailureThreshold; } @@ -109,7 +109,7 @@ llvm::DenseMap; /// Check Macros for style violations. - void checkMacro(SourceManager &sourceMgr, const Token &MacroNameTok, + void checkMacro(SourceManager &SourceMgr, const Token &MacroNameTok, const MacroInfo *MI); /// Add a usage of a macro if it already has a violation. @@ -126,13 +126,13 @@ /// Overridden by derived classes, returns information about if and how a Decl /// failed the check. A 'None' result means the Decl did not fail the check. virtual llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const = 0; + getDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const = 0; /// Overridden by derived classes, returns information about if and how a /// macro failed the check. A 'None' result means the macro did not fail the /// check. virtual llvm::Optional - GetMacroFailureInfo(const Token &MacroNameTok, + getMacroFailureInfo(const Token &MacroNameTok, const SourceManager &SM) const = 0; /// Represents customized diagnostic text and how arguments should be applied. @@ -151,7 +151,7 @@ /// that should be emitted for the given failure. The base class will then /// further customize the diagnostic by adding info about whether the fix-it /// can be automatically applied or not. - virtual DiagInfo GetDiagInfo(const NamingCheckId &ID, + virtual DiagInfo getDiagInfo(const NamingCheckId &ID, const NamingCheckFailure &Failure) const = 0; private: diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -23,7 +23,7 @@ namespace llvm { -/// Specialisation of DenseMapInfo to allow NamingCheckId objects in DenseMaps +/// Specialization of DenseMapInfo to allow NamingCheckId objects in DenseMaps template <> struct DenseMapInfo { using NamingCheckId = clang::tidy::RenamerClangTidyCheck::NamingCheckId; @@ -176,7 +176,7 @@ if (!Failure.RawUsageLocs.insert(FixLocation).second) return; - if (!Failure.ShouldFix()) + if (!Failure.shouldFix()) return; if (SourceMgr && SourceMgr->isWrittenInScratchSpace(FixLocation)) @@ -265,7 +265,7 @@ } else return NameLookup(llvm::None); // Propagate multiple resolution back up. } - return NameLookup(Found); // If nullptr, decl wasnt found. + return NameLookup(Found); // If nullptr, decl wasn't found. } void RenamerClangTidyCheck::check(const MatchFinder::MatchResult &Result) { @@ -446,7 +446,7 @@ return; Optional MaybeFailure = - GetDeclFailureInfo(Decl, *Result.SourceManager); + getDeclFailureInfo(Decl, *Result.SourceManager); if (!MaybeFailure) return; FailureInfo &Info = *MaybeFailure; @@ -477,7 +477,7 @@ const Token &MacroNameTok, const MacroInfo *MI) { Optional MaybeFailure = - GetMacroFailureInfo(MacroNameTok, SourceMgr); + getMacroFailureInfo(MacroNameTok, SourceMgr); if (!MaybeFailure) return; FailureInfo &Info = *MaybeFailure; @@ -532,14 +532,14 @@ if (Failure.Info.KindName.empty()) continue; - if (Failure.ShouldNotify()) { - auto DiagInfo = GetDiagInfo(Decl, Failure); + if (Failure.shouldNotify()) { + auto DiagInfo = getDiagInfo(Decl, Failure); auto Diag = diag(Decl.first, DiagInfo.Text + getDiagnosticSuffix(Failure.FixStatus, Failure.Info.Fixup)); DiagInfo.ApplyArgs(Diag); - if (Failure.ShouldFix()) { + if (Failure.shouldFix()) { for (const auto &Loc : Failure.RawUsageLocs) { // We assume that the identifier name is made of one token only. This // is always the case as we ignore usages in macros that could build diff --git a/clang-tools-extra/clang-tidy/utils/TypeTraits.h b/clang-tools-extra/clang-tidy/utils/TypeTraits.h --- a/clang-tools-extra/clang-tidy/utils/TypeTraits.h +++ b/clang-tools-extra/clang-tidy/utils/TypeTraits.h @@ -37,7 +37,7 @@ /// Return true if `Type` has a non-trivial move assignment operator. bool hasNonTrivialMoveAssignment(QualType Type); -} // type_traits +} // namespace type_traits } // namespace utils } // namespace tidy } // namespace clang