[lldb-dev] Unifying ctor+Clear() inits into in-class initializers?

Jan Kratochvil via lldb-dev lldb-dev at lists.llvm.org
Sun Nov 19 06:58:02 PST 2017



At least DWARFCompileUnit and I see even for example MachVMRegion duplicate
intialization of fields in both their constructor and Clear().  Moreover the
initialization is in different place than declaration of the member variable.

Is it OK to just use in-class member variable initializers and:
	void Clear() {
	  new (this) ClassName();

Pavel Labath otherwise suggests to just call Clear() from the constructor.
Still then I find the code could be more readable with in-class members
initializers - moreover during further refactorizations+extensions.

Jan Kratochvil

More information about the lldb-dev mailing list