================ @@ -495,6 +498,27 @@ void CIRGenModule::setNonAliasAttributes(GlobalDecl gd, mlir::Operation *op) { assert(!cir::MissingFeatures::setTargetAttributes()); } +cir::SourceLanguage CIRGenModule::getCIRSourceLanguage() const { + using ClangStd = clang::LangStandard; + using CIRLang = cir::SourceLanguage; + auto opts = getLangOpts(); + + if (opts.OpenCL && !opts.OpenCLCPlusPlus) + llvm_unreachable("NYI"); + + if (opts.CPlusPlus || opts.CPlusPlus11 || opts.CPlusPlus14 || + opts.CPlusPlus17 || opts.CPlusPlus20 || opts.CPlusPlus23 || + opts.CPlusPlus26) + return CIRLang::CXX; + if (opts.C99 || opts.C11 || opts.C17 || opts.C23 || + opts.LangStd == ClangStd::lang_c89 || + opts.LangStd == ClangStd::lang_gnu89) + return CIRLang::C; + + // TODO(cir): support remaining source languages. + llvm_unreachable("CIR does not yet support the given source language"); ---------------- bcardosolopes wrote:
Use `cgm.errorNYI` here. On a side note, I wonder if instead of asserting here (and in the one above) it'd be better to have a missing feature - might be a better user experience and we move the burden of asserting/erroring to the places where this functionality is actually needed. https://github.com/llvm/llvm-project/pull/152511 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits