Support for exporting optional classes; prune empty directives.