QuTech-Delft / OpenQL

OpenQL: A Portable Quantum Programming Framework for Quantum Accelerators. https://dl.acm.org/doi/10.1145/3474222
https://openql.readthedocs.io
Other
100 stars 45 forks source link

Static self-registration of passes and architectures #461

Closed pablolh closed 2 years ago

pablolh commented 2 years ago

Copy of commit message:

Use static fields in the pass and arch derived classes
to register them to the factory, instead of having the factories
register every class.

For this, a CMake OBJECT library has to be used, otherwise the linker
will get rid of those seemingly unused symbols.

Having the static bool field in the base classes would require the use
of the Curiously Recurring Template Pattern and a bigger change. I
decided to leave it for now.
pablolh commented 2 years ago

Indeed I forgot to update the documentation. This is done now. I haven't added tests; but the existing tests cover the fact that passes are registered (I've experienced that when debugging).