On 21/04/2021 22:13, Shafik Yaghmour wrote:
Having side effects in the argument to a function call just feels like a bad 
idea in general even if it seems obviously correct here e.g.

   ++last_symbol_id,

Can’t we just do:

   uint64_t last_symbol_id =
       num_symbols ? symbol_table->SymbolAtIndex(num_symbols - 1)->GetID() + 1: 
1;

This would just change the pre-increment to a post-increment. The increment still needs to happen somewhere, as the function can add more than one symbol.

However, I don't have a problem with moving the increment out of the function call. That is what I've done in e5984a3.

Thanks for reviewing this,
Pavel
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to