CXX.POSSIBLE_COPY_PASTE.FSTRING.APPEND_SAME_STRING
Possible copy-paste error: Appending the same FString twice.
This checker reports defects when an Fstring is appended to itself.
Vulnerable code example
Copy
void f1()
{
FString log;
log.Append(log);
}
In the above example, line 4 is noncompliant as the Fstring log is being appended to itself. Klocwork produces a CXX.POSSIBLE_COPY_PASTE.FSTRING.APPEND_SAME_STRING defect at line 4, indicating, "Possible copy-paste error: Appending the same FString twice."
Fixed code example
Copy
void f1()
{
FString log, log1;
log.Append(log1);
}
In the fixed example, Klocwork no longer reports the defect CXX.LOGICAL_OP.INT_OPERAND at line 4.