brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 29005c4 Raw
54 lines · plain
1.. title:: clang-tidy - fuchsia-temporary-objects2 3fuchsia-temporary-objects4=========================5 6Warns on construction of specific temporary objects in the Zircon kernel.7If the object should be flagged, the fully qualified type name must be8explicitly passed to the check.9 10For example, given the list of classes "Foo" and "NS::Bar", all of the11following will trigger the warning:12 13.. code-block:: c++14 15  Foo();16  Foo F = Foo();17  func(Foo());18 19  namespace NS {20 21  Bar();22 23  }24 25With the same list, the following will not trigger the warning:26 27.. code-block:: c++28 29  Foo F;                 // Non-temporary construction okay30  Foo F(param);          // Non-temporary construction okay31  Foo *F = new Foo();    // New construction okay32 33  Bar();                 // Not NS::Bar, so okay34  NS::Bar B;             // Non-temporary construction okay35 36Note that objects must be explicitly specified in order to be flagged,37and so objects that inherit a specified object will not be flagged.38 39This check matches temporary objects without regard for inheritance and so a40prohibited base class type does not similarly prohibit derived class types.41 42.. code-block:: c++43 44  class Derived : Foo {} // Derived is not explicitly disallowed45  Derived();             // and so temporary construction is okay46 47Options48-------49 50.. option:: Names51 52   A semi-colon-separated list of fully-qualified names of C++ classes that53   should not be constructed as temporaries. Default is empty string.54