1.. title:: clang-tidy - zircon-temporary-objects 2 3zircon-temporary-objects 4======================== 5 6Warns on construction of specific temporary objects in the Zircon kernel. 7If the object should be flagged, If the object should be flagged, the fully 8qualified type name must be explicitly passed to the check. 9 10For example, given the list of classes "Foo" and "NS::Bar", all of the 11following 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 okay 30 Foo F(param); // Non-temporary construction okay 31 Foo *F = new Foo(); // New construction okay 32 33 Bar(); // Not NS::Bar, so okay 34 NS::Bar B; // Non-temporary construction okay 35 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 a 40prohibited base class type does not similarly prohibit derived class types. 41 42.. code-block:: c++ 43 44 class Derived : Foo {} // Derived is not explicitly disallowed 45 Derived(); // and so temporary construction is okay 46 47Options 48------- 49 50.. option:: Names 51 52 A semi-colon-separated list of fully-qualified names of C++ classes that 53 should not be constructed as temporaries. Default is empty. 54