@@ -23,16 +23,20 @@ namespace cir {
2323static BackendAction
2424getBackendActionFromOutputType (CIRGenAction::OutputType Action) {
2525 switch (Action) {
26+ case CIRGenAction::OutputType::EmitCIR:
27+ assert (false &&
28+ " Unsupported output type for getBackendActionFromOutputType!" );
29+ break ; // Unreachable, but fall through to report that
2630 case CIRGenAction::OutputType::EmitLLVM:
2731 return BackendAction::Backend_EmitLL;
28- default :
29- llvm_unreachable (" Unsupported action" );
3032 }
33+ // We should only get here if a non-enum value is passed in or we went through
34+ // the assert(false) case above
35+ llvm_unreachable (" Unsupported output type!" );
3136}
3237
33- static std::unique_ptr<llvm::Module> lowerFromCIRToLLVMIR (
34- const clang::FrontendOptions &FEOpts, mlir::ModuleOp MLIRModule,
35- std::shared_ptr<mlir::MLIRContext> MLIRCtx, llvm::LLVMContext &LLVMCtx) {
38+ static std::unique_ptr<llvm::Module>
39+ lowerFromCIRToLLVMIR (mlir::ModuleOp MLIRModule, llvm::LLVMContext &LLVMCtx) {
3640 return direct::lowerDirectlyFromCIRToLLVMIR (MLIRModule, LLVMCtx);
3741}
3842
@@ -72,7 +76,6 @@ class CIRGenConsumer : public clang::ASTConsumer {
7276 void HandleTranslationUnit (ASTContext &C) override {
7377 Gen->HandleTranslationUnit (C);
7478 mlir::ModuleOp MlirModule = Gen->getModule ();
75- std::shared_ptr<mlir::MLIRContext> MLIRCtx = Gen->getContext ();
7679 switch (Action) {
7780 case CIRGenAction::OutputType::EmitCIR:
7881 if (OutputStream && MlirModule) {
@@ -83,8 +86,8 @@ class CIRGenConsumer : public clang::ASTConsumer {
8386 break ;
8487 case CIRGenAction::OutputType::EmitLLVM: {
8588 llvm::LLVMContext LLVMCtx;
86- auto LLVMModule = lowerFromCIRToLLVMIR (CI. getFrontendOpts (), MlirModule,
87- MLIRCtx , LLVMCtx);
89+ std::unique_ptr<llvm::Module> LLVMModule =
90+ lowerFromCIRToLLVMIR (MlirModule , LLVMCtx);
8891
8992 BackendAction BEAction = getBackendActionFromOutputType (Action);
9093 emitBackendOutput (
0 commit comments