[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)
+    return CIRLang::CXX;
+  if (opts.C99 || opts.C11 || opts.C17 || opts.C23 ||
----------------
xlauko wrote:

```suggestion
  if (opts.C99 || opts.C11 || opts.C17 || opts.C23 || opts.C2y
```

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


More information about the cfe-commits mailing list