Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08af080

Browse files
author
Dave Bartolomeo
committed
Add examples to QLDoc comment
1 parent c739f98 commit 08af080

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/exprs

cpp/ql/src/semmle/code/cpp/exprs/Cast.qll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -843,16 +843,17 @@ class ArrayToPointerConversion extends Conversion, @array_to_pointer {
843843
/**
844844
* A node representing a temporary object created as part of an expression.
845845
*
846-
* This is most commonly seen in the following cases (from [class.temporary]/2):
847-
* - when binding a reference to a prvalue
848-
* - when performing member access on a class prvalue
849-
* - when performing an array-to-pointer conversion or subscripting on an array prvalue
850-
* - when initializing an object of type std::initializer_list from a braced-init-list
851-
* - for certain unevaluated operands
852-
* - when a prvalue that has type other than cv void appears as a discarded-value expression
853-
*
854-
* This node will only exist if the object is of class type, and even then only if either the
855-
* object's initialization or destruction is non-trivial.
846+
* This is most commonly seen in the following cases:
847+
* ```c++
848+
* // when binding a reference to a prvalue
849+
* const std::string& r = std::string("text");
850+
*
851+
* // when performing member access on a class prvalue
852+
* strlen(std::string("text").c_str());
853+
*
854+
* // when a prvalue of a type with a destructor is discarded
855+
* s.substr(0, 5); // Return value is discarded but requires destruction
856+
* ```
856857
*/
857858
class TemporaryObjectExpr extends Conversion, @temp_init {
858859
/** Gets a textual representation of this conversion. */

0 commit comments

Comments
 (0)