carlosgalvezp updated this revision to Diff 383259.
carlosgalvezp added a comment.
Removed unnecessary dependency in CMakeLists.txt
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112730/new/
https://reviews.llvm.org/D112730
Files:
clang-tools-extra/clang-tidy/CMakeLists.txt
clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/docs/clang-tidy/index.rst
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
int i = 0;
void *j;
void f() { j = reinterpret_cast<void *>(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
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
@@ -60,6 +60,7 @@
``abseil-`` Checks related to Abseil library.
``altera-`` Checks related to OpenCL programming for FPGAs.
``android-`` Checks related to Android.
+``autosar-`` Checks related to AUTOSAR C++14 Coding Guidelines.
``boost-`` Checks related to Boost library.
``bugprone-`` Checks that target bugprone code constructs.
``cert-`` Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@
`android-cloexec-pipe2 <android-cloexec-pipe2.html>`_,
`android-cloexec-socket <android-cloexec-socket.html>`_,
`android-comparison-in-temp-failure-retry <android-comparison-in-temp-failure-retry.html>`_,
+ `autosar-a5-4-2-reinterpret-cast <autosar-a5-4-2-reinterpret-cast.html>`_,
`boost-use-to-string <boost-use-to-string.html>`_, "Yes"
`bugprone-argument-comment <bugprone-argument-comment.html>`_, "Yes"
`bugprone-assert-side-effect <bugprone-assert-side-effect.html>`_,
@@ -328,6 +329,7 @@
.. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
+ `autosar-a5-4-2-reinterpret-cast <autosar-a5-4-2-reinterpret-cast.html>`_, `cppcoreguidelines-pro-type-reinterpret-cast <cppcoreguidelines-pro-type-reinterpret-cast>`_,
`cert-con36-c <cert-con36-c.html>`_, `bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_,
`cert-con54-cpp <cert-con54-cpp.html>`_, `bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_,
`cert-dcl03-c <cert-dcl03-c.html>`_, `misc-static-assert <misc-static-assert.html>`_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===================================================================
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+ :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===============================
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast <cppcoreguidelines-pro-type-reinterpret-cast.html>`_
+for more information.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===================================================================
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -67,6 +67,8 @@
Improvements to clang-tidy
--------------------------
+- New module: `autosar`, covering the AUTOSAR C++14 Coding Guidelines.
+
- Added support for globbing in `NOLINT*` expressions, to simplify suppressing
multiple warnings in the same line.
@@ -103,6 +105,11 @@
New check aliases
^^^^^^^^^^^^^^^^^
+- New alias :doc:`autosar-a5-4-2-reinterpret-cast
+ <clang-tidy/checks/autosar-a5-4-2-reinterpret-cast>` to
+ :doc:`cppcoreguidelines-pro-type-reinterpret-cast
+ <clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast>` was added.
+
- New alias :doc:`cert-exp42-c
<clang-tidy/checks/cert-exp42-c>` to
:doc:`bugprone-suspicious-memory-comparison
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,26 @@
+set(LLVM_LINK_COMPONENTS
+ FrontendOpenMP
+ Support
+ )
+
+add_clang_library(clangTidyAutosarModule
+ AutosarTidyModule.cpp
+
+ LINK_LIBS
+ clangTidy
+ clangTidyUtils
+ clangTidyCppCoreGuidelinesModule
+
+ DEPENDS
+ omp_gen
+ )
+
+clang_target_link_libraries(clangTidyAutosarModule
+ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+ clangTooling
+ )
Index: clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
@@ -0,0 +1,38 @@
+//===--- AutosarTidyModule.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"
+#include "../cppcoreguidelines/ProTypeReinterpretCastCheck.h"
+
+namespace clang {
+namespace tidy {
+namespace autosar {
+
+class AutosarModule : public ClangTidyModule {
+public:
+ void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+ CheckFactories
+ .registerCheck<cppcoreguidelines::ProTypeReinterpretCastCheck>(
+ "autosar-a5-2-4-reinterpret-cast");
+ }
+};
+
+} // namespace autosar
+
+// Register the AutosarTidyModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<autosar::AutosarModule>
+ X("autosar-module", "Adds AUTOSAR C++14 clang-tidy checks.");
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the AutosarModule.
+volatile int AutosarModuleAnchorSource = 0;
+
+} // namespace tidy
+} // namespace clang
Index: clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
+++ clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
@@ -30,6 +30,11 @@
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
AndroidModuleAnchorSource;
+// This anchor is used to force the linker to link the AutosarModule.
+extern volatile int AutosarModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED AutosarModuleAnchorDestination =
+ AutosarModuleAnchorSource;
+
// This anchor is used to force the linker to link the BoostModule.
extern volatile int BoostModuleAnchorSource;
static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -49,9 +49,10 @@
# Checks.
# If you add a check, also add it to ClangTidyForceLinker.h in this directory.
-add_subdirectory(android)
add_subdirectory(abseil)
add_subdirectory(altera)
+add_subdirectory(android)
+add_subdirectory(autosar)
add_subdirectory(boost)
add_subdirectory(bugprone)
add_subdirectory(cert)
@@ -76,9 +77,10 @@
add_subdirectory(readability)
add_subdirectory(zircon)
set(ALL_CLANG_TIDY_CHECKS
- clangTidyAndroidModule
clangTidyAbseilModule
clangTidyAlteraModule
+ clangTidyAndroidModule
+ clangTidyAutosarModule
clangTidyBoostModule
clangTidyBugproneModule
clangTidyCERTModule
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits