whisperity created this revision.
whisperity added a reviewer: aaron.ballman.
whisperity added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, martong, gamesh411, Szelethus, arphaman, 
dkrupp, rnkovacs, xazax.hun, mgorny.
Herald added a project: clang.
whisperity added a parent revision: D76541: [clang-tidy][NFC] Add missing check 
group docs and order entries.
whisperity added a child revision: D69560: [clang-tidy] Add 
'experimental-cppcoreguidelines-avoid-adjacent-arguments-of-the-same-type' 
check.

As discussed in D69560 <https://reviews.llvm.org/D69560> with @aaron.ballman, 
sometimes checks might not approximate the rule they target the best due to a 
variety of reasons. This new group should house checks that are //working// 
(i.e. no crashes and stupid outputs) but might not yet exactly match the rule 
we are trying to "sell them" as.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76545

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/experimental/CMakeLists.txt
  clang-tools-extra/clang-tidy/experimental/ExperimentalTidyModule.cpp
  clang-tools-extra/docs/clang-tidy/index.rst

Index: clang-tools-extra/docs/clang-tidy/index.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -65,6 +65,8 @@
 ``clang-analyzer-``    Clang Static Analyzer checks.
 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
 ``darwin-``            Checks related to Darwin coding conventions.
+``experimental-``      Experimental checks that will eventually move to other
+                       groups.
 ``fuchsia-``           Checks related to Fuchsia coding conventions.
 ``google-``            Checks related to Google coding conventions.
 ``hicpp-``             Checks related to High Integrity C++ Coding Standard.
Index: clang-tools-extra/clang-tidy/experimental/ExperimentalTidyModule.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/experimental/ExperimentalTidyModule.cpp
@@ -0,0 +1,45 @@
+//===-- ExperimentalTidyModule.cpp - clang-tidy ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "../ClangTidy.h"
+#include "../ClangTidyModule.h"
+#include "../ClangTidyModuleRegistry.h"
+
+namespace clang {
+namespace tidy {
+namespace experimental {
+
+/// A module containing checks that are experimental versions of future checks
+/// that belong to other modules.
+class ExperimentalModule : public ClangTidyModule {
+public:
+  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+
+  }
+
+  ClangTidyOptions getModuleOptions() override {
+    ClangTidyOptions Options;
+    ClangTidyOptions::OptionMap &Opts = Options.CheckOptions;
+
+    return Options;
+  }
+};
+
+// Register the LLVMTidyModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<ExperimentalModule>
+    X("experimental-module",
+      "Adds checks for that are experimental versions of future checks.");
+
+} // namespace experimental
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the ExperimentalModule.
+volatile int ExperimentalModuleAnchorSource = 0;
+
+} // namespace tidy
+} // namespace clang
Index: clang-tools-extra/clang-tidy/experimental/CMakeLists.txt
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/experimental/CMakeLists.txt
@@ -0,0 +1,14 @@
+set(LLVM_LINK_COMPONENTS support)
+
+add_clang_library(clangTidyExperimentalModule
+  ExperimentalTidyModule.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangLex
+  clangTidy
+  clangTidyUtils
+  clangTooling
+  )
Index: clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
+++ clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
@@ -50,6 +50,11 @@
 static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
     DarwinModuleAnchorSource;
 
+// This anchor is used to force the linker to link the ExperimentalModule.
+extern volatile int ExperimentalModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ExperimentalModuleAnchorDestination =
+    ExperimentalModuleAnchorSource;
+
 // This anchor is used to force the linker to link the FuchsiaModule.
 extern volatile int FuchsiaModuleAnchorSource;
 static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -46,6 +46,7 @@
 add_subdirectory(cert)
 add_subdirectory(cppcoreguidelines)
 add_subdirectory(darwin)
+add_subdirectory(experimental)
 add_subdirectory(fuchsia)
 add_subdirectory(google)
 add_subdirectory(hicpp)
@@ -71,6 +72,7 @@
   clangTidyCERTModule
   clangTidyCppCoreGuidelinesModule
   clangTidyDarwinModule
+  clangTidyExperimentalModule
   clangTidyFuchsiaModule
   clangTidyGoogleModule
   clangTidyHICPPModule
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to