[PATCH] D82825: [clang-tidy] Added alias llvm-else-after-return.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 12:53:59 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfc3c693b617f: [clang-tidy] Added alias llvm-else-after-return. (authored by njames93).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82825/new/

https://reviews.llvm.org/D82825

Files:
  clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/llvm-else-after-return.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst


Index: clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst
+++ clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst
@@ -77,3 +77,13 @@
    the ``if`` statement is the last statement in its parents scope.
    Default value is `true`.
 
+
+LLVM alias
+----------
+
+There is an alias of this check called llvm-else-after-return.
+In that version the options :option:`WarnOnUnfixable` and 
+:option:`WarnOnConditionVariables` are both set to `false` by default.
+
+This check helps to enforce this `LLVM Coding Standards recommendation
+<https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return>`_.
Index: clang-tools-extra/docs/clang-tidy/checks/llvm-else-after-return.rst
===================================================================
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/llvm-else-after-return.rst
@@ -0,0 +1,11 @@
+.. title:: clang-tidy - llvm-else-after-return
+.. meta::
+   :http-equiv=refresh: 5;URL=readability-else-after-return.html
+
+llvm-else-after-return
+======================
+
+The llvm-else-after-return check is an alias, please see
+`readability-else-after-return <readability-else-after-return.html>`_
+for more information.
+
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
@@ -423,4 +423,5 @@
    `hicpp-use-nullptr <hicpp-use-nullptr.html>`_, `modernize-use-nullptr <modernize-use-nullptr.html>`_, "Yes"
    `hicpp-use-override <hicpp-use-override.html>`_, `modernize-use-override <modernize-use-override.html>`_, "Yes"
    `hicpp-vararg <hicpp-vararg.html>`_, `cppcoreguidelines-pro-type-vararg <cppcoreguidelines-pro-type-vararg.html>`_,
+   `llvm-else-after-return <llvm-else-after-return.html>`_, `readability-else-after-return <readability-else-after-return.html>`_, "Yes"
    `llvm-qualified-auto <llvm-qualified-auto.html>`_, `readability-qualified-auto <readability-qualified-auto.html>`_, "Yes"
Index: clang-tools-extra/docs/ReleaseNotes.rst
===================================================================
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -192,6 +192,11 @@
   :doc:`bugprone-signed-char-misuse
   <clang-tidy/checks/bugprone-signed-char-misuse>` was added.
 
+- New alias :doc:`llvm-else-after-return
+  <clang-tidy/checks/llvm-else-after-return>` to
+  :doc:`readability-else-after-return
+  <clang-tidy/checks/readability-else-after-return>` was added.
+
 Changes in existing checks
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
Index: clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
===================================================================
--- clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
+++ clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
@@ -9,6 +9,7 @@
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
+#include "../readability/ElseAfterReturnCheck.h"
 #include "../readability/NamespaceCommentCheck.h"
 #include "../readability/QualifiedAutoCheck.h"
 #include "HeaderGuardCheck.h"
@@ -24,6 +25,8 @@
 class LLVMModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+    CheckFactories.registerCheck<readability::ElseAfterReturnCheck>(
+        "llvm-else-after-return");
     CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard");
     CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order");
     CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
@@ -40,6 +43,9 @@
   ClangTidyOptions getModuleOptions() override {
     ClangTidyOptions Options;
     Options.CheckOptions["llvm-qualified-auto.AddConstToQualified"] = "0";
+    Options.CheckOptions["llvm-else-after-return.WarnOnUnfixable"] = "0";
+    Options.CheckOptions["llvm-else-after-return.RefactorConditionVariables"] =
+        "0";
     return Options;
   }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82825.275698.patch
Type: text/x-patch
Size: 4223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200706/43d6af45/attachment-0001.bin>


More information about the cfe-commits mailing list