================ @@ -139,16 +283,17 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, return nullptr; // If there are no registered plugins we don't need to wrap the consumer - if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end()) - return Consumer; + if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end()) { ---------------- ilya-biryukov wrote:
I have also moved the code around in my head, but never actually spelled it out, sorry. My full suggestion would be: - move this if to the end of the function after the plugin consumer registrationg is finished. - right before the final line, do this: ```cpp assert(Consumers.size() >= 1 && "should have added the main consumer"); if (Consumers.size() == 1) return std::move(Consumers.front()); return std::make_unique<MultiplexConsumer>(std::move(Consumers)); ``` If the only way to produce many consumers is compiler plugins, this shortcut makes sense. Now that we also have this custom logic, I feel it adds another condition that one needs to track and just makes things more error-prone. https://github.com/llvm/llvm-project/pull/133910 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits