[clang-tools-extra] r230952 - [clang-tidy] Refactor: Move llvm clang-tidy checks to namespace clang::tidy::llvm

Alexander Kornienko alexfh at google.com
Mon Mar 2 04:39:18 PST 2015


Author: alexfh
Date: Mon Mar  2 06:39:18 2015
New Revision: 230952

URL: http://llvm.org/viewvc/llvm-project?rev=230952&view=rev
Log:
[clang-tidy] Refactor: Move llvm clang-tidy checks to namespace clang::tidy::llvm

clang-tidy checks are organized into modules. This refactoring moves the llvm
module checks to clang::tidy::llvm

http://reviews.llvm.org/D7995

Patch by Richard Thomson!


Modified:
    clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
    clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h
    clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
    clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h
    clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
    clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
    clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h
    clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp

Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp Mon Mar  2 06:39:18 2015
@@ -11,6 +11,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 bool LLVMHeaderGuardCheck::shouldFixHeaderGuard(StringRef Filename) {
   return Filename.endswith(".h");
@@ -49,5 +50,6 @@ std::string LLVMHeaderGuardCheck::getHea
   return StringRef(Guard).upper();
 }
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang

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=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h Mon Mar  2 06:39:18 2015
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 /// Finds and fixes header guards that do not adhere to LLVM style.
 class LLVMHeaderGuardCheck : public HeaderGuardCheck {
@@ -25,6 +26,7 @@ public:
   std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;
 };
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp Mon Mar  2 06:39:18 2015
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 namespace {
 class IncludeOrderPPCallbacks : public PPCallbacks {
@@ -46,8 +47,8 @@ private:
 
 void IncludeOrderCheck::registerPPCallbacks(CompilerInstance &Compiler) {
   Compiler.getPreprocessor().addPPCallbacks(
-      llvm::make_unique<IncludeOrderPPCallbacks>(*this,
-                                                 Compiler.getSourceManager()));
+      ::llvm::make_unique<IncludeOrderPPCallbacks>(
+          *this, Compiler.getSourceManager()));
 }
 
 static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
@@ -163,5 +164,6 @@ void IncludeOrderPPCallbacks::EndOfMainF
   IncludeDirectives.clear();
 }
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h Mon Mar  2 06:39:18 2015
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 /// \brief Checks the correct order of \c #includes.
 ///
@@ -25,6 +26,7 @@ public:
   void registerPPCallbacks(CompilerInstance &Compiler) override;
 };
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp Mon Mar  2 06:39:18 2015
@@ -17,6 +17,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 class LLVMModule : public ClangTidyModule {
 public:
@@ -33,6 +34,8 @@ public:
 static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
                                                   "Adds LLVM lint checks.");
 
+} // namespace llvm
+
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the LLVMModule.
 volatile int LLVMModuleAnchorSource = 0;

Modified: clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp Mon Mar  2 06:39:18 2015
@@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 void TwineLocalCheck::registerMatchers(MatchFinder *Finder) {
   auto TwineType =
@@ -57,5 +58,6 @@ void TwineLocalCheck::check(const MatchF
   }
 }
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h Mon Mar  2 06:39:18 2015
@@ -14,6 +14,7 @@
 
 namespace clang {
 namespace tidy {
+namespace llvm {
 
 /// \brief Looks for local Twine variables which are prone to use after frees
 /// and should be generally avoided.
@@ -25,6 +26,7 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
+} // namespace llvm
 } // namespace tidy
 } // namespace clang
 

Modified: clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp?rev=230952&r1=230951&r2=230952&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp Mon Mar  2 06:39:18 2015
@@ -3,6 +3,8 @@
 #include "llvm/IncludeOrderCheck.h"
 #include "gtest/gtest.h"
 
+using namespace clang::tidy::llvm;
+
 namespace clang {
 namespace tidy {
 namespace test {





More information about the cfe-commits mailing list