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
1 void f1() 2 { 3 FString log; 4 log.Append(log); 5 }
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
1 void f1() 2 { 3 FString log, log1; 4 log.Append(log1); 5 }
In the fixed example, Klocwork no longer reports the defect CXX.LOGICAL_OP.INT_OPERAND at line 4.