[clang-tools-extra] r298229 - Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 19 10:23:24 PDT 2017


Author: aaronballman
Date: Sun Mar 19 12:23:23 2017
New Revision: 298229

URL: http://llvm.org/viewvc/llvm-project?rev=298229&view=rev
Log:
Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA.

This commit renames all of the safety functionality to be hicpp, adds an appropriate LICENSE.TXT, and updates the documentation accordingly.

Added:
    clang-tools-extra/trunk/clang-tidy/hicpp/
      - copied from r298228, clang-tools-extra/trunk/clang-tidy/safety/
    clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp
      - copied, changed from r297580, clang-tools-extra/trunk/clang-tidy/safety/SafetyTidyModule.cpp
    clang-tools-extra/trunk/clang-tidy/hicpp/LICENSE.TXT
    clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-no-assembler.rst
      - copied, changed from r298228, clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst
    clang-tools-extra/trunk/test/clang-tidy/hicpp-no-assembler.cpp
      - copied, changed from r298228, clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp
Removed:
    clang-tools-extra/trunk/clang-tidy/hicpp/SafetyTidyModule.cpp
    clang-tools-extra/trunk/clang-tidy/safety/
    clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst
    clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp
Modified:
    clang-tools-extra/trunk/LICENSE.TXT
    clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
    clang-tools-extra/trunk/clang-tidy/hicpp/CMakeLists.txt
    clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.cpp
    clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.h
    clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt
    clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
    clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/LICENSE.TXT
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/LICENSE.TXT?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/LICENSE.TXT (original)
+++ clang-tools-extra/trunk/LICENSE.TXT Sun Mar 19 12:23:23 2017
@@ -60,3 +60,4 @@ licenses, and/or restrictions:
 Program             Directory
 -------             ---------
 clang-tidy          clang-tidy/cert
+clang-tidy          clang-tidy/hicpp

Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Sun Mar 19 12:23:23 2017
@@ -26,17 +26,17 @@ add_clang_library(clangTidy
   clangToolingCore
   )
 
-add_subdirectory(tool)
-add_subdirectory(plugin)
 add_subdirectory(boost)
 add_subdirectory(cert)
-add_subdirectory(llvm)
 add_subdirectory(cppcoreguidelines)
 add_subdirectory(google)
+add_subdirectory(hicpp)
+add_subdirectory(llvm)
 add_subdirectory(misc)
 add_subdirectory(modernize)
 add_subdirectory(mpi)
 add_subdirectory(performance)
+add_subdirectory(plugin)
 add_subdirectory(readability)
-add_subdirectory(safety)
+add_subdirectory(tool)
 add_subdirectory(utils)

Modified: clang-tools-extra/trunk/clang-tidy/hicpp/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/CMakeLists.txt?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/hicpp/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/CMakeLists.txt Sun Mar 19 12:23:23 2017
@@ -1,8 +1,8 @@
 set(LLVM_LINK_COMPONENTS support)
 
-add_clang_library(clangTidySafetyModule
+add_clang_library(clangTidyHICPPModule
   NoAssemblerCheck.cpp
-  SafetyTidyModule.cpp
+  HICPPTidyModule.cpp
 
   LINK_LIBS
   clangAST

Copied: clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp (from r297580, clang-tools-extra/trunk/clang-tidy/safety/SafetyTidyModule.cpp)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp?p2=clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp&p1=clang-tools-extra/trunk/clang-tidy/safety/SafetyTidyModule.cpp&r1=297580&r2=298229&rev=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/safety/SafetyTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/HICPPTidyModule.cpp Sun Mar 19 12:23:23 2017
@@ -1,4 +1,4 @@
-//===------- SafetyTidyModule.cpp - clang-tidy ----------------------------===//
+//===------- HICPPTidyModule.cpp - clang-tidy -----------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,25 +14,25 @@
 
 namespace clang {
 namespace tidy {
-namespace safety {
+namespace hicpp {
 
-class SafetyModule : public ClangTidyModule {
+class HICPPModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
     CheckFactories.registerCheck<NoAssemblerCheck>(
-        "safety-no-assembler");
+        "hicpp-no-assembler");
   }
 };
 
-// Register the SafetyModule using this statically initialized variable.
-static ClangTidyModuleRegistry::Add<SafetyModule>
-    X("safety-module", "Adds safety-critical checks.");
+// Register the HICPPModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<HICPPModule>
+    X("hicpp-module", "Adds High-Integrity C++ checks.");
 
-} // namespace safety
+} // namespace hicpp
 
 // This anchor is used to force the linker to link in the generated object file
-// and thus register the SafetyModule.
-volatile int SafetyModuleAnchorSource = 0;
+// and thus register the HICPPModule.
+volatile int HICPPModuleAnchorSource = 0;
 
 } // namespace tidy
 } // namespace clang

Added: clang-tools-extra/trunk/clang-tidy/hicpp/LICENSE.TXT
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/LICENSE.TXT?rev=298229&view=auto
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/hicpp/LICENSE.TXT (added)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/LICENSE.TXT Sun Mar 19 12:23:23 2017
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+clang-tidy High-Integrity C++ Files
+------------------------------------------------------------------------------
+All clang-tidy files are licensed under the LLVM license with the following
+additions:
+
+Any file referencing a High-Integrity C++ Coding guideline:
+
+HIC++ Coding Standard as created by PRQA.
+
+Please see http://www.codingstandard.com/section/conditions-of-use/ for more
+information.

Modified: clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.cpp?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.cpp Sun Mar 19 12:23:23 2017
@@ -23,7 +23,7 @@ const internal::VariadicDynCastAllOfMatc
 
 namespace clang {
 namespace tidy {
-namespace safety {
+namespace hicpp {
 
 void NoAssemblerCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(asmStmt().bind("asm-stmt"), this);
@@ -46,6 +46,6 @@ void NoAssemblerCheck::check(const Match
   diag(ASMLocation, "do not use inline assembler in safety-critical code");
 }
 
-} // namespace safety
+} // namespace hicpp
 } // namespace tidy
 } // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.h?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/NoAssemblerCheck.h Sun Mar 19 12:23:23 2017
@@ -7,19 +7,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_SAFETY_NO_ASSEMBLER_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_SAFETY_NO_ASSEMBLER_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_NO_ASSEMBLER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_NO_ASSEMBLER_H
 
 #include "../ClangTidy.h"
 
 namespace clang {
 namespace tidy {
-namespace safety {
+namespace hicpp {
 
 /// Find assembler statements. No fix is offered.
 ///
 /// For the user-facing documentation see:
-/// http://clang.llvm.org/extra/clang-tidy/checks/safety-no-assembler.html
+/// http://clang.llvm.org/extra/clang-tidy/checks/hicpp-no-assembler.html
 class NoAssemblerCheck : public ClangTidyCheck {
 public:
   NoAssemblerCheck(StringRef Name, ClangTidyContext *Context)
@@ -28,8 +28,8 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace safety
+} // namespace hicpp
 } // namespace tidy
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_SAFETY_NO_ASSEMBLER_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_HICPP_NO_ASSEMBLER_H

Removed: clang-tools-extra/trunk/clang-tidy/hicpp/SafetyTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/safety/SafetyTidyModule.cpp?rev=298228&view=auto
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/hicpp/SafetyTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/hicpp/SafetyTidyModule.cpp (removed)
@@ -1,38 +0,0 @@
-//===------- SafetyTidyModule.cpp - clang-tidy ----------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "../ClangTidy.h"
-#include "../ClangTidyModule.h"
-#include "../ClangTidyModuleRegistry.h"
-#include "NoAssemblerCheck.h"
-
-namespace clang {
-namespace tidy {
-namespace safety {
-
-class SafetyModule : public ClangTidyModule {
-public:
-  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
-    CheckFactories.registerCheck<NoAssemblerCheck>(
-        "safety-no-assembler");
-  }
-};
-
-// Register the SafetyModule using this statically initialized variable.
-static ClangTidyModuleRegistry::Add<SafetyModule>
-    X("safety-module", "Adds safety-critical checks.");
-
-} // namespace safety
-
-// This anchor is used to force the linker to link in the generated object file
-// and thus register the SafetyModule.
-volatile int SafetyModuleAnchorSource = 0;
-
-} // namespace tidy
-} // namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt Sun Mar 19 12:23:23 2017
@@ -17,13 +17,13 @@ target_link_libraries(clang-tidy
   clangTidyCERTModule
   clangTidyCppCoreGuidelinesModule
   clangTidyGoogleModule
+  clangTidyHICPPModule
   clangTidyLLVMModule
   clangTidyMiscModule
   clangTidyModernizeModule
   clangTidyMPIModule
   clangTidyPerformanceModule
   clangTidyReadabilityModule
-  clangTidySafetyModule
   clangTooling
   )
 

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Sun Mar 19 12:23:23 2017
@@ -496,10 +496,10 @@ extern volatile int ReadabilityModuleAnc
 static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
     ReadabilityModuleAnchorSource;
 
-// This anchor is used to force the linker to link the SafetyModule.
-extern volatile int SafetyModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED SafetyModuleAnchorDestination =
-    SafetyModuleAnchorSource;
+// This anchor is used to force the linker to link the HICPPModule.
+extern volatile int HICPPModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
+    HICPPModuleAnchorSource;
 
 } // namespace tidy
 } // namespace clang

Copied: clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-no-assembler.rst (from r298228, clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-no-assembler.rst?p2=clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-no-assembler.rst&p1=clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst&r1=298228&r2=298229&rev=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/hicpp-no-assembler.rst Sun Mar 19 12:23:23 2017
@@ -1,10 +1,10 @@
-.. title:: clang-tidy - safety-no-assembler
+.. title:: clang-tidy - hicpp-no-assembler
 
-safety-no-assembler
+hicpp-no-assembler
 ===================
 
 Check for assembler statements. No fix is offered.
 
-Inline assembler is forbidden by safety-critical C++ standards like `High
-Intergrity C++ <http://www.codingstandard.com>`_ as it restricts the
-portability of code.
+Inline assembler is forbidden by the `High Intergrity C++ Coding Standard
+<http://www.codingstandard.com/section/7-5-the-asm-declaration/>`_ 
+as it restricts the portability of code.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=298229&r1=298228&r2=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Sun Mar 19 12:23:23 2017
@@ -53,6 +53,7 @@ Clang-Tidy Checks
    google-runtime-memset
    google-runtime-operator
    google-runtime-references
+   hicpp-no-assembler
    llvm-header-guard
    llvm-include-order
    llvm-namespace-comment
@@ -155,4 +156,3 @@ Clang-Tidy Checks
    readability-simplify-boolean-expr
    readability-static-definition-in-anonymous-namespace
    readability-uniqueptr-delete-release
-   safety-no-assembler

Removed: clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst?rev=298228&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/safety-no-assembler.rst (removed)
@@ -1,10 +0,0 @@
-.. title:: clang-tidy - safety-no-assembler
-
-safety-no-assembler
-===================
-
-Check for assembler statements. No fix is offered.
-
-Inline assembler is forbidden by safety-critical C++ standards like `High
-Intergrity C++ <http://www.codingstandard.com>`_ as it restricts the
-portability of code.

Copied: clang-tools-extra/trunk/test/clang-tidy/hicpp-no-assembler.cpp (from r298228, clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/hicpp-no-assembler.cpp?p2=clang-tools-extra/trunk/test/clang-tidy/hicpp-no-assembler.cpp&p1=clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp&r1=298228&r2=298229&rev=298229&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/hicpp-no-assembler.cpp Sun Mar 19 12:23:23 2017
@@ -1,13 +1,12 @@
-// RUN: %check_clang_tidy %s safety-no-assembler %t
+// RUN: %check_clang_tidy %s hicpp-no-assembler %t
 
 __asm__(".symver foo, bar at v");
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not use inline assembler in safety-critical code [hicpp-no-assembler]
 
 static int s asm("spam");
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: do not use inline assembler in safety-critical code [hicpp-no-assembler]
 
 void f() {
   __asm("mov al, 2");
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use inline assembler in safety-critical code [hicpp-no-assembler]
 }
-

Removed: clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp?rev=298228&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/safety-no-assembler.cpp (removed)
@@ -1,13 +0,0 @@
-// RUN: %check_clang_tidy %s safety-no-assembler %t
-
-__asm__(".symver foo, bar at v");
-// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
-
-static int s asm("spam");
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
-
-void f() {
-  __asm("mov al, 2");
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use inline assembler in safety-critical code [safety-no-assembler]
-}
-




More information about the cfe-commits mailing list