[PATCH] D82825: [clang-tidy] Added alias llvm-else-after-return.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 17:27:44 PDT 2020
njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, gribozavr2.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.
njames93 added a comment.
This is supposed to have a parent revision D82824 <https://reviews.llvm.org/D82824> but for some reason phab won't let me add it
Added an alias llvm-else-after-return from readability-else-after-return to help enforce one of the llvm coding guidelines.
Repository:
rG LLVM Github Monorepo
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
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,17 @@
+.. 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.
+
+This check helps to enforce this `LLVM Coding Standards recommendation
+<https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return>`_.
+
+Note: In this alias the options ``WarnOnUnfixable`` and
+``RefactorConditionVariables`` are both set to ``false`` by default.
+
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.274293.patch
Type: text/x-patch
Size: 3702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200630/a16752b4/attachment-0001.bin>
More information about the cfe-commits
mailing list