[clang] [CIR][Dialect] Add SourceLangAttr (PR #152511)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 19 00:07:41 PDT 2025


================
@@ -495,6 +498,25 @@ 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.CPlusPlus || opts.CPlusPlus11 || opts.CPlusPlus14 ||
+      opts.CPlusPlus17 || opts.CPlusPlus20 || opts.CPlusPlus23 ||
+      opts.CPlusPlus26)
----------------
xlauko wrote:

I would hope `opts.CPlusPlus` implies arbitrary standard. The additional checks are redundant. This could be simplified to just?
```suggestion
  if (opts.CPlusPlus)
```

https://github.com/llvm/llvm-project/pull/152511


More information about the cfe-commits mailing list