[clang-tools-extra] r268356 - [clang-tidy] Cleanup namespace in utils folder.

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 19:54:06 PDT 2016


Author: etienneb
Date: Mon May  2 21:54:05 2016
New Revision: 268356

URL: http://llvm.org/viewvc/llvm-project?rev=268356&view=rev
Log:
[clang-tidy] Cleanup namespace in utils folder.

Summary:
This is a step forward cleaning up the namespaces in clang-tidy/utils.
There is no behavior change.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19819

Modified:
    clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
    clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
    clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
    clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h
    clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
    clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
    clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
    clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
    clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h
    clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
    clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
    clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp
    clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
    clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
    clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
    clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h
    clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.cpp
    clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h
    clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
    clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h
    clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
    clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
    clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp
    clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h
    clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.cpp
    clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h
    clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
    clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
    clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h
    clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp Mon May  2 21:54:05 2016
@@ -22,7 +22,7 @@ namespace cppcoreguidelines {
 ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck(
     StringRef Name, ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context), GslHeader(Options.get("GslHeader", "")),
-      IncludeStyle(IncludeSorter::parseIncludeStyle(
+      IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
           Options.get("IncludeStyle", "llvm"))) {}
 
 void ProBoundsConstantArrayIndexCheck::storeOptions(
@@ -36,8 +36,8 @@ void ProBoundsConstantArrayIndexCheck::r
   if (!getLangOpts().CPlusPlus)
     return;
 
-  Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-                                     Compiler.getLangOpts(), IncludeStyle));
+  Inserter.reset(new utils::IncludeInserter(
+      Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
   Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
 }
 

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h Mon May  2 21:54:05 2016
@@ -24,8 +24,8 @@ namespace cppcoreguidelines {
 /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.html
 class ProBoundsConstantArrayIndexCheck : public ClangTidyCheck {
   const std::string GslHeader;
-  const IncludeSorter::IncludeStyle IncludeStyle;
-  std::unique_ptr<IncludeInserter> Inserter;
+  const utils::IncludeSorter::IncludeStyle IncludeStyle;
+  std::unique_ptr<utils::IncludeInserter> Inserter;
 
 public:
   ProBoundsConstantArrayIndexCheck(StringRef Name, ClangTidyContext *Context);

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp Mon May  2 21:54:05 2016
@@ -35,7 +35,7 @@ void fieldsRequiringInit(const RecordDec
       continue;
     QualType Type = F->getType();
     if (!F->hasInClassInitializer() &&
-        type_traits::isTriviallyDefaultConstructible(Type, Context))
+        utils::type_traits::isTriviallyDefaultConstructible(Type, Context))
       FieldsToInit.insert(F);
   }
 }
@@ -114,12 +114,12 @@ struct IntializerInsertion {
     SourceLocation Location;
     switch (Placement) {
     case InitializerPlacement::New:
-      Location = lexer_utils::getPreviousNonCommentToken(
+      Location = utils::lexer::getPreviousNonCommentToken(
                      Context, Constructor.getBody()->getLocStart())
                      .getLocation();
       break;
     case InitializerPlacement::Before:
-      Location = lexer_utils::getPreviousNonCommentToken(
+      Location = utils::lexer::getPreviousNonCommentToken(
                      Context, Where->getSourceRange().getBegin())
                      .getLocation();
       break;
@@ -389,7 +389,8 @@ void ProTypeMemberInitCheck::checkMissin
     if (const auto *BaseClassDecl = getCanonicalRecordDecl(Base.getType())) {
       AllBases.emplace_back(BaseClassDecl);
       if (!BaseClassDecl->field_empty() &&
-          type_traits::isTriviallyDefaultConstructible(Base.getType(), Context))
+          utils::type_traits::isTriviallyDefaultConstructible(
+              Base.getType(), Context))
         BasesToInit.insert(BaseClassDecl);
     }
   }

Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h Mon May  2 21:54:05 2016
@@ -17,7 +17,7 @@ namespace tidy {
 namespace llvm {
 
 /// Finds and fixes header guards that do not adhere to LLVM style.
-class LLVMHeaderGuardCheck : public HeaderGuardCheck {
+class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck {
 public:
   LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
       : HeaderGuardCheck(Name, Context) {}

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Mon May  2 21:54:05 2016
@@ -42,7 +42,7 @@ parmVarDeclRefExprOccurences(const ParmV
 MoveConstructorInitCheck::MoveConstructorInitCheck(StringRef Name,
                                                    ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
-      IncludeStyle(IncludeSorter::parseIncludeStyle(
+      IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
           Options.get("IncludeStyle", "llvm"))),
       UseCERTSemantics(Context->isCheckEnabled("cert-oop11-cpp")) {}
 
@@ -167,13 +167,14 @@ void MoveConstructorInitCheck::handleMov
 }
 
 void MoveConstructorInitCheck::registerPPCallbacks(CompilerInstance &Compiler) {
-  Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-                                     Compiler.getLangOpts(), IncludeStyle));
+  Inserter.reset(new utils::IncludeInserter(
+      Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
   Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
 }
 
 void MoveConstructorInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
-  Options.store(Opts, "IncludeStyle", IncludeSorter::toString(IncludeStyle));
+  Options.store(Opts, "IncludeStyle",
+                utils::IncludeSorter::toString(IncludeStyle));
 }
 
 } // namespace misc

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h Mon May  2 21:54:05 2016
@@ -38,8 +38,8 @@ private:
   void
   handleParamNotMoved(const ast_matchers::MatchFinder::MatchResult &Result);
 
-  std::unique_ptr<IncludeInserter> Inserter;
-  const IncludeSorter::IncludeStyle IncludeStyle;
+  std::unique_ptr<utils::IncludeInserter> Inserter;
+  const utils::IncludeSorter::IncludeStyle IncludeStyle;
   const bool UseCERTSemantics;
 };
 

Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp Mon May  2 21:54:05 2016
@@ -40,7 +40,7 @@ void SuspiciousSemicolonCheck::check(con
     return;
 
   ASTContext &Ctxt = *Result.Context;
-  auto Token = lexer_utils::getPreviousNonCommentToken(Ctxt, LocStart);
+  auto Token = utils::lexer::getPreviousNonCommentToken(Ctxt, LocStart);
   auto &SM = *Result.SourceManager;
   unsigned SemicolonLine = SM.getSpellingLineNumber(LocStart);
 

Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Mon May  2 21:54:05 2016
@@ -118,11 +118,12 @@ collectParamDecls(const CXXConstructorDe
 
 PassByValueCheck::PassByValueCheck(StringRef Name, ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
-      IncludeStyle(IncludeSorter::parseIncludeStyle(
+      IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
           Options.get("IncludeStyle", "llvm"))) {}
 
 void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
-  Options.store(Opts, "IncludeStyle", IncludeSorter::toString(IncludeStyle));
+  Options.store(Opts, "IncludeStyle",
+                utils::IncludeSorter::toString(IncludeStyle));
 }
 
 void PassByValueCheck::registerMatchers(MatchFinder *Finder) {
@@ -162,8 +163,8 @@ void PassByValueCheck::registerPPCallbac
   // currently does not provide any benefit to other languages, despite being
   // benign.
   if (getLangOpts().CPlusPlus) {
-    Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-                                       Compiler.getLangOpts(), IncludeStyle));
+    Inserter.reset(new utils::IncludeInserter(
+        Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
     Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
   }
 }

Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h Mon May  2 21:54:05 2016
@@ -28,8 +28,8 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  std::unique_ptr<IncludeInserter> Inserter;
-  const IncludeSorter::IncludeStyle IncludeStyle;
+  std::unique_ptr<utils::IncludeInserter> Inserter;
+  const utils::IncludeSorter::IncludeStyle IncludeStyle;
 };
 
 } // namespace modernize

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp Mon May  2 21:54:05 2016
@@ -189,11 +189,12 @@ static bool checkTokenIsAutoPtr(SourceLo
 ReplaceAutoPtrCheck::ReplaceAutoPtrCheck(StringRef Name,
                                          ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
-      IncludeStyle(IncludeSorter::parseIncludeStyle(
+      IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
           Options.get("IncludeStyle", "llvm"))) {}
 
 void ReplaceAutoPtrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
-  Options.store(Opts, "IncludeStyle", IncludeSorter::toString(IncludeStyle));
+  Options.store(Opts, "IncludeStyle",
+                utils::IncludeSorter::toString(IncludeStyle));
 }
 
 void ReplaceAutoPtrCheck::registerMatchers(MatchFinder *Finder) {
@@ -211,8 +212,8 @@ void ReplaceAutoPtrCheck::registerPPCall
   // currently does not provide any benefit to other languages, despite being
   // benign.
   if (getLangOpts().CPlusPlus) {
-    Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-                                       Compiler.getLangOpts(), IncludeStyle));
+    Inserter.reset(new utils::IncludeInserter(
+        Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
     Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
   }
 }

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h Mon May  2 21:54:05 2016
@@ -50,8 +50,8 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  std::unique_ptr<IncludeInserter> Inserter;
-  const IncludeSorter::IncludeStyle IncludeStyle;
+  std::unique_ptr<utils::IncludeInserter> Inserter;
+  const utils::IncludeSorter::IncludeStyle IncludeStyle;
 };
 
 } // namespace modernize

Modified: clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp Mon May  2 21:54:05 2016
@@ -59,16 +59,16 @@ bool ForRangeCopyCheck::handleConstValue
     return false;
   }
   llvm::Optional<bool> Expensive =
-      type_traits::isExpensiveToCopy(LoopVar.getType(), Context);
+      utils::type_traits::isExpensiveToCopy(LoopVar.getType(), Context);
   if (!Expensive || !*Expensive)
     return false;
   auto Diagnostic =
       diag(LoopVar.getLocation(),
            "the loop variable's type is not a reference type; this creates a "
            "copy in each iteration; consider making this a reference")
-      << utils::create_fix_it::changeVarDeclToReference(LoopVar, Context);
+      << utils::fixit::changeVarDeclToReference(LoopVar, Context);
   if (!LoopVar.getType().isConstQualified())
-    Diagnostic << utils::create_fix_it::changeVarDeclToConst(LoopVar);
+    Diagnostic << utils::fixit::changeVarDeclToConst(LoopVar);
   return true;
 }
 
@@ -76,16 +76,17 @@ bool ForRangeCopyCheck::handleCopyIsOnly
     const VarDecl &LoopVar, const CXXForRangeStmt &ForRange,
     ASTContext &Context) {
   llvm::Optional<bool> Expensive =
-      type_traits::isExpensiveToCopy(LoopVar.getType(), Context);
+      utils::type_traits::isExpensiveToCopy(LoopVar.getType(), Context);
   if (LoopVar.getType().isConstQualified() || !Expensive || !*Expensive)
     return false;
-  if (!decl_ref_expr_utils::isOnlyUsedAsConst(LoopVar, *ForRange.getBody(), Context))
+  if (!utils::decl_ref_expr::isOnlyUsedAsConst(LoopVar, *ForRange.getBody(),
+                                               Context))
     return false;
   diag(LoopVar.getLocation(),
        "loop variable is copied but only used as const reference; consider "
        "making it a const reference")
-      << utils::create_fix_it::changeVarDeclToConst(LoopVar)
-      << utils::create_fix_it::changeVarDeclToReference(LoopVar, Context);
+      << utils::fixit::changeVarDeclToConst(LoopVar)
+      << utils::fixit::changeVarDeclToReference(LoopVar, Context);
   return true;
 }
 

Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp Mon May  2 21:54:05 2016
@@ -24,16 +24,16 @@ void recordFixes(const VarDecl &Var, AST
   if (Var.getLocation().isMacroID())
     return;
 
-  Diagnostic << utils::create_fix_it::changeVarDeclToReference(Var, Context);
+  Diagnostic << utils::fixit::changeVarDeclToReference(Var, Context);
   if (!Var.getType().isLocalConstQualified())
-    Diagnostic << utils::create_fix_it::changeVarDeclToConst(Var);
+    Diagnostic << utils::fixit::changeVarDeclToConst(Var);
 }
 
 } // namespace
 
 
 using namespace ::clang::ast_matchers;
-using decl_ref_expr_utils::isOnlyUsedAsConst;
+using utils::decl_ref_expr::isOnlyUsedAsConst;
 
 void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
   auto ConstReference = referenceType(pointee(qualType(isConstQualified())));

Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Mon May  2 21:54:05 2016
@@ -61,7 +61,7 @@ void UnnecessaryValueParamCheck::check(c
   // 2. they are not only used as const.
   if (!IsConstQualified && (llvm::isa<CXXConstructorDecl>(Function) ||
                             !Function->doesThisDeclarationHaveABody() ||
-                            !decl_ref_expr_utils::isOnlyUsedAsConst(
+                            !utils::decl_ref_expr::isOnlyUsedAsConst(
                                 *Param, *Function->getBody(), *Result.Context)))
     return;
   auto Diag =
@@ -79,10 +79,10 @@ void UnnecessaryValueParamCheck::check(c
   for (const auto *FunctionDecl = Function; FunctionDecl != nullptr;
        FunctionDecl = FunctionDecl->getPreviousDecl()) {
     const auto &CurrentParam = *FunctionDecl->getParamDecl(Index);
-    Diag << utils::create_fix_it::changeVarDeclToReference(CurrentParam,
+    Diag << utils::fixit::changeVarDeclToReference(CurrentParam,
                                                            *Result.Context);
     if (!IsConstQualified)
-      Diag << utils::create_fix_it::changeVarDeclToConst(CurrentParam);
+      Diag << utils::fixit::changeVarDeclToConst(CurrentParam);
   }
 }
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp Mon May  2 21:54:05 2016
@@ -15,7 +15,8 @@
 
 namespace clang {
 namespace tidy {
-namespace decl_ref_expr_utils {
+namespace utils {  
+namespace decl_ref_expr {
 
 using namespace ::clang::ast_matchers;
 using llvm::SmallPtrSet;
@@ -93,6 +94,7 @@ bool isOnlyUsedAsConst(const VarDecl &Va
   return isSetDifferenceEmpty(AllDeclRefs, ConstReferenceDeclRefs);
 }
 
-} // namespace decl_ref_expr_utils
+} // namespace decl_ref_expr
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h Mon May  2 21:54:05 2016
@@ -15,7 +15,8 @@
 
 namespace clang {
 namespace tidy {
-namespace decl_ref_expr_utils {
+namespace utils {
+namespace decl_ref_expr {
 
 /// \brief Returns true if all DeclRefExpr to the variable within Stmt do not
 /// modify it.
@@ -25,7 +26,8 @@ namespace decl_ref_expr_utils {
 bool isOnlyUsedAsConst(const VarDecl &Var, const Stmt &Stmt,
                        ASTContext &Context);
 
-} // namespace decl_ref_expr_utils
+} // namespace decl_ref_expr
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.cpp Mon May  2 21:54:05 2016
@@ -14,11 +14,11 @@
 namespace clang {
 namespace tidy {
 namespace utils {
-namespace create_fix_it {
+namespace fixit {
 
 FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context) {
   SourceLocation AmpLocation = Var.getLocation();
-  auto Token = lexer_utils::getPreviousNonCommentToken(Context, AmpLocation);
+  auto Token = utils::lexer::getPreviousNonCommentToken(Context, AmpLocation);
   if (!Token.is(tok::unknown))
     AmpLocation = Lexer::getLocForEndOfToken(Token.getLocation(), 0,
                                              Context.getSourceManager(),
@@ -30,7 +30,7 @@ FixItHint changeVarDeclToConst(const Var
   return FixItHint::CreateInsertion(Var.getTypeSpecStartLoc(), "const ");
 }
 
-} // namespace create_fix_it
+} // namespace fixit
 } // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h Mon May  2 21:54:05 2016
@@ -16,7 +16,7 @@
 namespace clang {
 namespace tidy {
 namespace utils {
-namespace create_fix_it {
+namespace fixit {
 
 /// \brief Creates fix to make VarDecl a reference by adding '&'.
 FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context);
@@ -24,8 +24,8 @@ FixItHint changeVarDeclToReference(const
 /// \brief Creates fix to make VarDecl const qualified.
 FixItHint changeVarDeclToConst(const VarDecl &Var);
 
-} // namespace create_fix_it
-} // utils
+} // namespace fixit
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp Mon May  2 21:54:05 2016
@@ -16,6 +16,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 /// \brief canonicalize a path by removing ./ and ../ components.
 // FIXME: Consider moving this to llvm::sys::path.
@@ -299,5 +300,6 @@ std::string HeaderGuardCheck::formatEndI
   return "endif // " + HeaderGuard.str();
 }
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h Mon May  2 21:54:05 2016
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 /// Finds and fixes header guards.
 class HeaderGuardCheck : public ClangTidyCheck {
@@ -40,6 +41,7 @@ public:
                                      StringRef OldGuard = StringRef()) = 0;
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp Mon May  2 21:54:05 2016
@@ -12,6 +12,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 class IncludeInserterCallback : public PPCallbacks {
 public:
@@ -80,5 +81,6 @@ void IncludeInserter::AddInclude(StringR
                                           end_location);
 }
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h Mon May  2 21:54:05 2016
@@ -20,6 +20,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 
 // IncludeInserter can be used by ClangTidyChecks in the following fashion:
 // class MyCheck : public ClangTidyCheck {
@@ -70,6 +71,7 @@ private:
   friend class IncludeInserterCallback;
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDEINSERTER_H

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.cpp Mon May  2 21:54:05 2016
@@ -12,6 +12,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {  
 
 namespace {
 
@@ -291,5 +292,6 @@ StringRef IncludeSorter::toString(Includ
   return Style == IS_LLVM ? "llvm" : "google";
 }
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h Mon May  2 21:54:05 2016
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {  
 
 // Class used by IncludeSorterCallback and IncludeInserterCallback to record the
 // names of the inclusions in a given source file being processed and generate
@@ -83,6 +84,7 @@ private:
   SmallVector<std::string, 1> IncludeBucket[IK_InvalidInclude];
 };
 
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H

Modified: clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.cpp Mon May  2 21:54:05 2016
@@ -11,7 +11,8 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 Token getPreviousNonCommentToken(const ASTContext &Context,
                                  SourceLocation Location) {
@@ -34,6 +35,7 @@ Token getPreviousNonCommentToken(const A
   return Token;
 }
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h Mon May  2 21:54:05 2016
@@ -15,14 +15,16 @@
 
 namespace clang {
 namespace tidy {
-namespace lexer_utils {
+namespace utils {
+namespace lexer {
 
 // Returns previous non-comment token skipping over any comment text or
 // tok::unknown if not found.
 Token getPreviousNonCommentToken(const ASTContext &Context,
                                  SourceLocation Location);
 
-} // namespace lexer_utils
+} // namespace lexer
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/Matchers.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/Matchers.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/Matchers.h Mon May  2 21:54:05 2016
@@ -31,12 +31,12 @@ AST_MATCHER(BinaryOperator, isComparison
 
 AST_MATCHER(QualType, isExpensiveToCopy) {
   llvm::Optional<bool> IsExpensive =
-      type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
+      utils::type_traits::isExpensiveToCopy(Node, Finder->getASTContext());
   return IsExpensive && *IsExpensive;
 }
 
 AST_MATCHER(RecordDecl, isTriviallyDefaultConstructible) {
-  return type_traits::recordIsTriviallyDefaultConstructible(
+  return utils::type_traits::recordIsTriviallyDefaultConstructible(
       Node, Finder->getASTContext());
 }
 

Modified: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp Mon May  2 21:54:05 2016
@@ -13,6 +13,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 namespace {
@@ -106,6 +107,7 @@ bool isTriviallyDefaultConstructible(Qua
   return false;
 }
 
-} // type_traits
+} // namespace type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h Mon May  2 21:54:05 2016
@@ -15,6 +15,7 @@
 
 namespace clang {
 namespace tidy {
+namespace utils {
 namespace type_traits {
 
 // \brief Returns true If \c Type is expensive to copy.
@@ -28,6 +29,7 @@ bool recordIsTriviallyDefaultConstructib
                                            const ASTContext &Context);
 
 } // type_traits
+} // namespace utils
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp?rev=268356&r1=268355&r2=268356&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp Mon May  2 21:54:05 2016
@@ -33,9 +33,10 @@ public:
       : ClangTidyCheck(CheckName, Context) {}
 
   void registerPPCallbacks(CompilerInstance &Compiler) override {
-    Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
-                                       Compiler.getLangOpts(),
-                                       IncludeSorter::IS_Google));
+    Inserter.reset(new utils::IncludeInserter(
+        Compiler.getSourceManager(),
+        Compiler.getLangOpts(),
+        utils::IncludeSorter::IS_Google));
     Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
   }
 
@@ -58,7 +59,7 @@ public:
   virtual std::vector<StringRef> HeadersToInclude() const = 0;
   virtual bool IsAngledInclude() const = 0;
 
-  std::unique_ptr<IncludeInserter> Inserter;
+  std::unique_ptr<utils::IncludeInserter> Inserter;
 };
 
 class NonSystemHeaderInserterCheck : public IncludeInserterCheckBase {




More information about the cfe-commits mailing list