diff options
author | Julie Hockett <juliehockett@google.com> | 2018-03-14 23:47:50 +0000 |
---|---|---|
committer | Julie Hockett <juliehockett@google.com> | 2018-03-14 23:47:50 +0000 |
commit | b6f7c934ac4bf27618f496d1d40df9f53e76eee1 (patch) | |
tree | fb34202c353a7349a1639aa5fe25d172eda95906 /clang-tools-extra/docs | |
parent | 9407bb5f548ebd5900a0fc8226c7f49ee247126f (diff) | |
download | bcm5719-llvm-b6f7c934ac4bf27618f496d1d40df9f53e76eee1.tar.gz bcm5719-llvm-b6f7c934ac4bf27618f496d1d40df9f53e76eee1.zip |
[clang-tidy] Add Zircon module to clang-tidy
Adding a Zircon module to clang-tidy for checks specific to the Zircon
kernel, and adding a checker to fuchsia-zx (for zircon) to flag instances
where specific objects are temporarily created.
Differential Revision: https://reviews.llvm.org/D44346
llvm-svn: 327590
Diffstat (limited to 'clang-tools-extra/docs')
4 files changed, 62 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 217092c5a69..68ea4314e8f 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -59,6 +59,8 @@ Improvements to clang-tidy - New module ``portability``. +- New module ``zircon`` for checks related to Fuchsia's Zircon kernel. + - New `bugprone-throw-keyword-missing <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-throw-keyword-missing.html>`_ check @@ -159,6 +161,11 @@ Improvements to clang-tidy - The 'misc-undelegated-constructor' check was renamed to `bugprone-undelegated-constructor <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-undelegated-constructor.html>`_ +- New `zircon-temporary-objects + <http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html>`_ check + + Warns on construction of specific temporary objects in the Zircon kernel. + Improvements to include-fixer ----------------------------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 1b02ba106dc..c64646bc9c6 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -225,3 +225,4 @@ Clang-Tidy Checks readability-static-definition-in-anonymous-namespace readability-string-compare readability-uniqueptr-delete-release + zircon-temporary-objects diff --git a/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst b/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst new file mode 100644 index 00000000000..7491f77e4b9 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/zircon-temporary-objects.rst @@ -0,0 +1,53 @@ +.. title:: clang-tidy - zircon-temporary-objects + +zircon-temporary-objects +======================== + +Warns on construction of specific temporary objects in the Zircon kernel. +If the object should be flagged, If the object should be flagged, the fully +qualified type name must be explicitly passed to the check. + +For example, given the list of classes "Foo" and "NS::Bar", all of the +following will trigger the warning: + +.. code-block:: c++ + + Foo(); + Foo F = Foo(); + func(Foo()); + + namespace NS { + + Bar(); + + } + +With the same list, the following will not trigger the warning: + +.. code-block:: c++ + + Foo F; // Non-temporary construction okay + Foo F(param); // Non-temporary construction okay + Foo *F = new Foo(); // New construction okay + + Bar(); // Not NS::Bar, so okay + NS::Bar B; // Non-temporary construction okay + +Note that objects must be explicitly specified in order to be flagged, +and so objects that inherit a specified object will not be flagged. + +This check matches temporary objects without regard for inheritance and so a +prohibited base class type does not similarly prohibit derived class types. + +.. code-block:: c++ + + class Derived : Foo {} // Derived is not explicitly disallowed + Derived(); // and so temporary construction is okay + +Options +------- + +.. option:: Names + + A semi-colon-separated list of fully-qualified names of C++ classes that + should not be constructed as temporaries. Default is empty. diff --git a/clang-tools-extra/docs/clang-tidy/index.rst b/clang-tools-extra/docs/clang-tidy/index.rst index 33bceaaab44..dc601ec345e 100644 --- a/clang-tools-extra/docs/clang-tidy/index.rst +++ b/clang-tools-extra/docs/clang-tidy/index.rst @@ -75,6 +75,7 @@ Name prefix Description relate to any particular coding style. ``readability-`` Checks that target readability-related issues that don't relate to any particular coding style. +``zircon-`` Checks related to Zircon kernel coding conventions. ====================== ========================================================= Clang diagnostics are treated in a similar way as check diagnostics. Clang |