[cfe-commits] [PATCH] use templates instead of creating a new class for each OS/Target combination
Chris Lattner
clattner at apple.com
Mon Jun 29 22:45:32 PDT 2009
On Jun 29, 2009, at 12:19 PM, Török Edwin wrote:
> Hi,
>
> The attached patch changes the Linux and FreeBSD targetinfo classes to
> be templates,
> allowing them to be instantiated with any target.
>
> Besides avoiding code duplication (the LinuxX86_32TargetInfo wasn't
> much
> different from LinuxX64_TargetInfo except it inherited from a
> different
> class),
> it also makes it easier to add support for a new target for an already
> supported OS.
> It also avoids the need to create a new class for each OS / Target
> combination.
>
> Please review.
This looks good to me. If you care, you could go for a fully policy-
based design by making the architecture be a template argument and use
one template class for all the instantiations.
-Chris
More information about the cfe-commits
mailing list