Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: alexfh, aaron.ballman.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

Some Include What You Use suggestions were used too.

I checked this patch on my own build on RHEL 6. Regressions were OK.

Repository:
  rL LLVM

http://reviews.llvm.org/D18810

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/misc/DanglingHandleCheck.cpp
  clang-tidy/performance/FasterStringFindCheck.cpp

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 <string>
+#include <vector>
 
 using namespace clang::ast_matchers;
 
@@ -21,7 +25,7 @@
 
 namespace {
 
-static const char StringLikeClassesDelimiter[] = ";";
+const char StringLikeClassesDelimiter[] = ";";
 
 std::vector<std::string> ParseClasses(StringRef Option) {
   SmallVector<StringRef, 4> Classes;
@@ -59,7 +63,7 @@
                                 hasDescendant(substTemplateTypeParmType()))));
 }
 
-} // namespace
+} // anonymous namespace
 
 FasterStringFindCheck::FasterStringFindCheck(StringRef Name,
                                              ClangTidyContext *Context)
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 <string>
+#include <vector>
 
 using namespace clang::ast_matchers;
 
@@ -19,13 +23,13 @@
 
 namespace {
 
-static const char HandleClassesDelimiter[] = ";";
+const char HandleClassesDelimiter[] = ";";
 
 std::vector<std::string> parseClasses(StringRef Option) {
   SmallVector<StringRef, 4> Classes;
   Option.split(Classes, HandleClassesDelimiter);
   std::vector<std::string> Result;
-  for (StringRef &Class : Classes) {
+  for (auto &Class : Classes) {
     Class = Class.trim();
     if (!Class.empty())
       Result.push_back(Class);
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 <cassert>
+#include <cstddef>
+#include <string>
 
 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<const FieldDecl *> &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/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 <algorithm>
@@ -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<std::unique_ptr<ClangTidyCheck>> Checks;
 };
 
-} // namespace
+} // anonymous namespace
 
 ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
     ClangTidyContext &Context)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to