Index: clang-tidy/ClangTidy.cpp =================================================================== --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -36,6 +36,8 @@ #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/ReplacementsYaml.h" #include "clang/Tooling/Tooling.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include @@ -52,9 +54,10 @@ namespace tidy { namespace { -static const char *AnalyzerCheckNamePrefix = "clang-analyzer-"; -static const StringRef StaticAnalyzerChecks[] = { +const char *AnalyzerCheckNamePrefix = "clang-analyzer-"; + +const StringRef StaticAnalyzerChecks[] = { #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \ FULLNAME, @@ -213,7 +216,7 @@ std::vector> Checks; }; -} // namespace +} // anonymous namespace ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory( ClangTidyContext &Context) Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -13,6 +13,10 @@ #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Lex/Lexer.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include +#include +#include using namespace clang::ast_matchers; using llvm::SmallPtrSet; @@ -28,7 +32,7 @@ return Node.isUserProvided(); } -static void +void fieldsRequiringInit(const RecordDecl::field_range &Fields, SmallPtrSetImpl &FieldsToInit) { for (const FieldDecl *F : Fields) { @@ -166,7 +170,7 @@ return OrderedFields; } -} // namespace +} // anonymous namespace void ProTypeMemberInitCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(cxxConstructorDecl(isDefinition(), isUserProvided(), Index: clang-tidy/misc/DanglingHandleCheck.cpp =================================================================== --- clang-tidy/misc/DanglingHandleCheck.cpp +++ clang-tidy/misc/DanglingHandleCheck.cpp @@ -10,6 +10,10 @@ #include "DanglingHandleCheck.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include +#include using namespace clang::ast_matchers; @@ -19,13 +23,13 @@ namespace { -static const char HandleClassesDelimiter[] = ";"; +const char HandleClassesDelimiter[] = ";"; std::vector parseClasses(StringRef Option) { SmallVector Classes; Option.split(Classes, HandleClassesDelimiter); std::vector Result; - for (StringRef &Class : Classes) { + for (auto &Class : Classes) { Class = Class.trim(); if (!Class.empty()) Result.push_back(Class); Index: clang-tidy/performance/FasterStringFindCheck.cpp =================================================================== --- clang-tidy/performance/FasterStringFindCheck.cpp +++ clang-tidy/performance/FasterStringFindCheck.cpp @@ -11,7 +11,11 @@ #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_ostream.h" +#include +#include using namespace clang::ast_matchers; @@ -21,7 +25,7 @@ namespace { -static const char StringLikeClassesDelimiter[] = ";"; +const char StringLikeClassesDelimiter[] = ";"; std::vector ParseClasses(StringRef Option) { SmallVector Classes; @@ -59,7 +63,7 @@ hasDescendant(substTemplateTypeParmType())))); } -} // namespace +} // anonymous namespace FasterStringFindCheck::FasterStringFindCheck(StringRef Name, ClangTidyContext *Context)