[clang] [CIR] Upstream support for cir.get_global (PR #135095)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -200,6 +200,105 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd, } } +mlir::Operation *CIRGenModule::getGlobalValue(StringRef name) { + mlir::Operation *global = mlir::SymbolTable::lookupSymbolIn(theModule, name); + if (!global)

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: A little more testing on comma would be nice, else seems reasonable. https://github.com/llvm/llvm-project/pull/135115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,53 @@ +// RUN: %clang_cc1 -std=c23 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c23 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -807,6 +808,65 @@ class ScalarExprEmitter : public StmtVisitor { VISITCOMP(EQ) VISITCOMP(NE) #undef VISITCOMP + + mlir::Value VisitBinAssign(const BinaryOperator *e) { +const bool ignore = std::exchange(ignoreResultAssign, false); + +mlir::Value rhs; +LValu

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/135115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,116 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===--===// +// StructType +// +// The base type for all RecordDecls. +//===---

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -86,10 +86,80 @@ mlir::Type CIRGenTypes::convertFunctionTypeInternal(QualType qft) { return cir::FuncType::get(SmallVector{}, cgm.VoidTy); } +// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable +// because CIR has different uniquing requiremen

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -86,10 +86,80 @@ mlir::Type CIRGenTypes::convertFunctionTypeInternal(QualType qft) { return cir::FuncType::get(SmallVector{}, cgm.VoidTy); } +// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable +// because CIR has different uniquing requiremen

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,116 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: cir-opt %s | FileCheck %s + +!s32i = !cir.int erichkeane wrote: what is this doing? I dont really see it in the check or definition lines. https://github.com/llvm/llvm-project/pull/135105 ___

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { llvm_unreachable("Unsupported format for long double"); } + /// Get a CIR record kind from a AST declaration tag. + cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) { +

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -37,6 +50,32 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { llvm_unreachable("Unsupported format for long double"); } + /// Get a CIR record kind from a AST declaration tag. + cir::StructType::RecordKind getRecordKind(const clang::TagTypeKind kind) { +

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -86,10 +86,80 @@ mlir::Type CIRGenTypes::convertFunctionTypeInternal(QualType qft) { return cir::FuncType::get(SmallVector{}, cgm.VoidTy); } +// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable +// because CIR has different uniquing requiremen

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --chec

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===--===// +// StructType +// +// The base type for all RecordDecls. +//===---

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -0,0 +1,116 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===--===// +// StructType +// +// The base type for all RecordDecls. +//===---

[clang] [CIR] Upstream support for cir.get_global (PR #135095)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -200,6 +200,105 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd, } } +mlir::Operation *CIRGenModule::getGlobalValue(StringRef name) { + mlir::Operation *global = mlir::SymbolTable::lookupSymbolIn(theModule, name); + if (!global) +return null

[clang] [CIR] Upstream support for cir.get_global (PR #135095)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -1279,6 +1279,37 @@ def GlobalOp : CIR_Op<"global"> { let hasVerifier = 1; } +//===--===// +// GetGlobalOp +//===--===// + +def GetGloba

[clang] [OpenACC][CIR] Implement 'device_type' clause lowering for 'init'/'sh… (PR #135102)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/135102 …utdown' This patch emits the lowering for 'device_type' on an 'init' or 'shutdown'. This one is fairly unique, as these directives have it as an attribute, rather than as a component of the individual oper

[clang] [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (PR #133030)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > @erichkeane, in case you missed the previous notice, this is ready for your > continued review. Thanks, I did miss that. I'll try to get to this later this week. https://github.com/llvm/llvm-project/pull/133030 ___ cfe-commits ma

[clang] [clang] fix NestedNameSpecifier dependency calculation (PR #135067)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/135067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -5585,6 +5585,18 @@ SourceRange EnumConstantDecl::getSourceRange() const { return SourceRange(getLocation(), End); } +bool EnumConstantDecl::isOutOfLine() const { + if (Decl::isOutOfLine()) +return true; + + // In C++, if the enumeration is out of line, the enumerat

[clang] [OpenACC][CIR] Implement 'data' construct lowering (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > > 2- This patch adds the infrastructure/calls to do the > > OpenACCDialect->LLVM-IR lowering. Unfortunately only a handful of > > constructs are actually functional in the OpenACC dialect, of which data is > > one (hence the choice to do it here, and why I chose to do it as

[clang] [OpenACC][CIR] Implement 'data' construct lowering (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/135038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > > > I thought CWG's preferred direction on this was to reject entirely? > > > > > > What do they wish to reject? Defining an enum in a different declaration > > context than its primary context? That seems odd. > > Do you have an idea of the CWG DR? We looked but couldn't f

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > This came up on the core reflector again just yesterday; would be worth > asking there. That was us :D https://github.com/llvm/llvm-project/pull/134998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [OpenACC][CIR] Implement 'data' construct lowering, lower OACC->LLVMIR (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/135038 This patch does two things primarily: 1- It does the lowering of the OpenACC 'data' construct, which requires getting the `default` clause (as `data` requires at least 1 of a list of clauses, and this is th

[clang] [OpenACC][CIR] Implement 'data' construct lowering, lower OACC->LLVMIR (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/135038 >From d175c7cb2de79731f5b5009bb08cc76f971b3e0a Mon Sep 17 00:00:00 2001 From: erichkeane Date: Tue, 8 Apr 2025 17:54:00 -0700 Subject: [PATCH 1/3] [OpenACC][CIR] Implement 'data' construct lowering, lower OA

[clang] [OpenACC][CIR] Implement 'data' construct lowering (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/135038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][NFC] Fix an unused variable warning (PR #135046)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/135046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > I thought CWG's preferred direction on this was to reject entirely? What do they wish to reject? Defining an enum in a different declaration context than its primary context? That seems odd. Do you have an idea of the CWG DR? We looked but couldn't find anything that lo

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -5585,6 +5585,18 @@ SourceRange EnumConstantDecl::getSourceRange() const { return SourceRange(getLocation(), End); } +bool EnumConstantDecl::isOutOfLine() const { + if (Decl::isOutOfLine()) +return true; + + // In C++, if the enumeration is out of line, the enumerat

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -151,3 +151,21 @@ class C { // expected-error {{unexpected ';' before ')'}} }; } + +#if __cplusplus >= 201103L +namespace GH23317 { +struct A { erichkeane wrote: Is this still going to work for: ``` struct A { enum E : int; enum E :

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -5585,6 +5585,18 @@ SourceRange EnumConstantDecl::getSourceRange() const { return SourceRange(getLocation(), End); } +bool EnumConstantDecl::isOutOfLine() const { + if (Decl::isOutOfLine()) +return true; + + // In C++, if the enumeration is out of line, the enumerat

[clang] [OpenACC][CIR] Implement 'data' construct lowering, lower OACC->LLVMIR (PR #135038)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/135038 >From d175c7cb2de79731f5b5009bb08cc76f971b3e0a Mon Sep 17 00:00:00 2001 From: erichkeane Date: Tue, 8 Apr 2025 17:54:00 -0700 Subject: [PATCH 1/2] [OpenACC][CIR] Implement 'data' construct lowering, lower OA

[clang] Fix crash with align_value diagnostic reporting (PR #135013)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/135013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix crash with align_value diagnostic reporting (PR #135013)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -4383,7 +4383,6 @@ static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) { - AlignValueAttr TmpAttr(Context, CI, E); erichkeane wrote: I think that is ac

[clang] Fix crash with align_value diagnostic reporting (PR #135013)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -4383,7 +4383,6 @@ static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) { - AlignValueAttr TmpAttr(Context, CI, E); erichkeane wrote: This attribute cre

[clang] No longer add enumeration constants to the wrong scope (PR #134998)

2025-04-09 Thread Erich Keane via cfe-commits
@@ -1523,7 +1523,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { // Out-of-line definitions shouldn't be pushed into scope in C++, unless they // are function-local declarations. - if (getLangOpts().CPlusPlus && D->isOutOfLine() && !S->get

[clang] [Clang][Sema]:Fix musttail attribute on a function with not_tail_called attribute has no warning/error (PR #134465)

2025-04-09 Thread Erich Keane via cfe-commits
erichkeane wrote: > > @AaronBallman @erichkeane Thank you for your comments. There's a question > > here about whether to report an error or a warning here, and you're in a > > divided opinion. My opinion is that it is better to use the error report > > here. Because these are two mutually exc

[clang] [OpenACC][CIR] Initial patch to do OpenACC->IR lowering (PR #134936)

2025-04-09 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/134936 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Initial patch to do OpenACC->IR lowering (PR #134936)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/134936 >From b843c0c8655fba8ce6d858d37c753bf0dbe304ee Mon Sep 17 00:00:00 2001 From: erichkeane Date: Tue, 8 Apr 2025 11:53:03 -0700 Subject: [PATCH 1/2] [OpenACC][CIR] Initial patch to do OpenACC->IR lowering This

[clang] [OpenACC][CIR] Initial patch to do OpenACC->IR lowering (PR #134936)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/134936 This patch adds some lowering code for Compute Constructs, plus the infrastructure to someday do clauses. Doing this requires adding the dialect to the CIRGenerator. This patch does not however implement/co

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/134889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][NFC] Upstream LValueBaseInfo handling (PR #134928)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I don't have any concerns with this, but would like the rest of the group to review/approve this. https://github.com/llvm/llvm-project/pull/134928 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -57,6 +57,7 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s, switch (s->getStmtClass()) { case Stmt::BreakStmtClass: + case Stmt::NullStmtClass: erichkeane wrote: Ah, i missed that it wasn't just the same unreachable. No real reason to

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -90,3 +90,18 @@ int f3(void) { // OGCG-NEXT: store i32 3, ptr %[[I_PTR]], align 4 // OGCG-NEXT: %[[I:.*]] = load i32, ptr %[[I_PTR]], align 4 // OGCG-NEXT: ret i32 %[[I]] + +// Verify null statement handling. +void f4(void) { + ; erichkeane wrote: Th

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -57,6 +57,7 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s, switch (s->getStmtClass()) { case Stmt::BreakStmtClass: + case Stmt::NullStmtClass: erichkeane wrote: I'm about 99.9% sure that there is no code that can result in it, barring

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/134889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Handle NullStmt (PR #134889)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -57,6 +57,7 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s, switch (s->getStmtClass()) { case Stmt::BreakStmtClass: + case Stmt::NullStmtClass: erichkeane wrote: Classic codegen ALSO puts `NoStmtClass` here, might be worth doing 'while

[clang] [OpenACC][CIR] Basic infrastructure for OpenACC lowering (PR #134717)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/134717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr, friend class ASTStmtWriter; }; +/// Insertion operator for diagnostics. This allows sending +/// Expr into a diagnostic with <<. +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +

[clang] [clang-tools-extra] [libcxx] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr, friend class ASTStmtWriter; }; +/// Insertion operator for diagnostics. This allows sending +/// Expr into a diagnostic with <<. +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +

[clang] [clang-tools-extra] [libcxx] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr, friend class ASTStmtWriter; }; +/// Insertion operator for diagnostics. This allows sending +/// Expr into a diagnostic with <<. +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +

[clang] [Clang] [NFC] Tablegen component diags headers (PR #134777)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/134777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm][Stmt]:Fix musttail attribute on a function with not_tail_called attribute has no warning/error (PR #134465)

2025-04-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane requested changes to this pull request. First: The title of this PR has `llvm` and `stmt` in it, neither of which should be used here, so don't bother with a tag. Second: The PR message (which we use as a commit message) needs a ton more detail. Third: Please add

[clang] [Clang] [NFC] Tablegen component diags headers (PR #134777)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -1562,6 +1563,60 @@ void clang::EmitClangDiagsCompatIDs(const llvm::RecordKeeper &Records, OS << "DIAG_COMPAT_IDS_END()\n"; } +/// ClangDiagsIntefaceEmitter - Emit the diagnostics interface header for +/// a Clang component. +void clang::EmitClangDiagsInterface(llvm::r

[clang] [clang-tools-extra] [libcxx] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-08 Thread Erich Keane via cfe-commits
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr, friend class ASTStmtWriter; }; +/// Insertion operator for diagnostics. This allows sending +/// Expr into a diagnostic with <<. +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +

[clang] [clang][doc]: Merge entries with duplicate content. (PR #134089)

2025-04-07 Thread Erich Keane via cfe-commits
erichkeane wrote: Yeah, LGTM. Thank you! https://github.com/llvm/llvm-project/pull/134089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Basic infrastructure for OpenACC lowering (PR #134717)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/134717 >From 0c0892e5142e2d0f687c091cb55ea14c97c975eb Mon Sep 17 00:00:00 2001 From: erichkeane Date: Mon, 7 Apr 2025 08:07:18 -0700 Subject: [PATCH 1/3] [OpenACC][CIR] Basic infrastructure for OpenACC lowering Thi

[clang] [OpenACC][CIR] Basic infrastructure for OpenACC lowering (PR #134717)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/134717 This is the first of a few patches that will do infrastructure work to enable the OpenACC lowering via the OpenACC dialect. At the moment this just gets the various function calls that will end up generatin

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/134536 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -493,8 +493,8 @@ DeduceNullPtrTemplateArgument(Sema &S, TemplateParameterList *TemplateParams, : CK_NullToPointer) .get(); return DeduceNonTypeTemplateArgument( - S, TemplateParams, NTTP, Ded

[clang] [clang-tools-extra] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/134693 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -493,8 +493,8 @@ DeduceNullPtrTemplateArgument(Sema &S, TemplateParameterList *TemplateParams, : CK_NullToPointer) .get(); return DeduceNonTypeTemplateArgument( - S, TemplateParams, NTTP, Ded

[clang] [clang-tools-extra] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -280,6 +280,9 @@ Improvements to Clang's diagnostics - Clang now better preserves the sugared types of pointers to member. - Clang now better preserves the presence of the template keyword with dependent prefixes. +- Clang now respects the current language mode when print

[clang] [C23] Implement WG14 N3037 (PR #132939)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/132939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C23] Implement WG14 N3037 (PR #132939)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -450,6 +453,41 @@ class StmtComparer { }; } // namespace +static bool +CheckStructurallyEquivalentAttributes(StructuralEquivalenceContext &Context, + const Decl *D1, const Decl *D2, + const Decl *Prim

[clang] [C23] Implement WG14 N3037 (PR #132939)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -11399,6 +11400,22 @@ static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, return {}; } +QualType ASTContext::mergeTagTypes(QualType LHS, QualType RHS) { erichkeane wrote: So this isn't really merging the TYPES, more merging tag

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -47,3 +47,21 @@ namespace InvalidInsertPos { template<> int v; int k = v; } + +namespace GH51347 { + template + auto p = p; // expected-error {{the type of variable template specialization 'p'}} erichkeane wrote: Are there cases where this pattern i

[clang] [clang]: fix reference compatibility in overload resolution (PR #133035)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -5450,6 +5450,12 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, return ICS; } +if (isRValRef && ICS.UserDefined.ConversionFunction->getReturnType() erichkeane wrote: It isn't clear to me why/if this is the right solution here. D

[clang] [RFC] Initial implementation of P2719 (PR #113510)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/113510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add if statement support (PR #134333)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -0,0 +1,254 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll +/

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This also seems to be missing a test that does: C++->CIR C++->CIR->LLVM C++->LLVM all in teh same file? (See files iwth `OGCG` in them). https://github.com/llvm/llvm-project/pull/134536 ___ cfe-commits maili

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) { llvm_unreachable("Unknown unary operator kind!"); } +/// If the specified expr is a simple decay from an array to pointer, +/// return the array subexpression. +/// FIXME: this could be

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-07 Thread Erich Keane via cfe-commits
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) { llvm_unreachable("Unknown unary operator kind!"); } +/// If the specified expr is a simple decay from an array to pointer, +/// return the array subexpression. +/// FIXME: this could be

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-07 Thread Erich Keane via cfe-commits
erichkeane wrote: > We can do a back port once the patch is settled, and it could wait until 20.2. Based on the size/impact here, I'd be pretty against backporting this. The regression stinks, but I'm not comfortable approving this for backport. https://github.com/llvm/llvm-project/pull/13446

[clang] [clang] fix partial ordering of NTTP packs (PR #134461)

2025-04-07 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Not sure I get what is going on, but nothing suspicious/no real comments. https://github.com/llvm/llvm-project/pull/134461 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [Clang] Increase the default expression nesting limit (PR #132021)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This seems reasonable to me. All of the changes look sound. Good job finding room here! https://github.com/llvm/llvm-project/pull/132021 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -11,6 +11,24 @@ include "mlir/Pass/PassBase.td" +def CIRCanonicalize : Pass<"cir-canonicalize"> { + let summary = "Performs CIR canonicalization"; + let description = [{ +Perform canonicalizations on CIR and removes some redundant operations. + +This pass perform

[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -4920,6 +4920,116 @@ If no address spaces names are provided, all address spaces are fenced. __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup", "local") __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup", "local", "global") +__builtin_amdgcn_processor_is and __bui

[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -284,6 +284,18 @@ void CodeGenFunction::AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst, Inst->setMetadata(LLVMContext::MD_mmra, MMRAMetadata::getMD(Ctx, MMRAs)); } +static Value *GetOrInsertAMDGPUPredicate(CodeGenFunction &CGF, Twine Name) { + auto PTy = Integer

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/131891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add warning message for C++17 alias template CTAD (PR #133806)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Perfect, thanks! Whoever notices that CI is happy can merge this. Remind us if you notice/cannot. https://github.com/llvm/llvm-project/pull/133806 ___ cfe-commits mailing list cfe-commits@lis

[clang] [Clang] Add warning message for C++17 alias template CTAD (PR #133806)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -9920,7 +9920,9 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (auto *AliasTemplate = dyn_cast_or_null( TemplateName.getAsTemplateDecl())) { Diag(Kind.getLocation(), - diag::warn_cxx17_compat_ctad_for_alias_templates); +

[clang] [Clang][Diagnostics] Update select uses in DiagnosticXKinds.td to use enum_select (PR #130868)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/130868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream a basic version of class LexicalScope (PR #131945)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/131945 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/134016 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { erichkeane wrote: Sorry, I meant in 'clang' we consider Bool to be 8 bit(when stored)

[clang] [CIR] Upstream support for logical not operations (PR #133966)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -1358,6 +1360,33 @@ mlir::Value CIRGenFunction::emitScalarConversion(mlir::Value src, .emitScalarConversion(src, srcTy, dstTy, loc); } +mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) { + // Perform vector logical not on comparison with zero ve

[clang] [clang] ASTContext: flesh out implementation of getCommonNNS (PR #131964)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/131964 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Suppress pedantic diagnostic for a file not ending in EOL (PR #131794)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -3194,18 +3194,12 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { SourceLocation EndLoc = getSourceLocation(BufferEnd); unsigned DiagID = diag::warn_no_newline_eof; -if (LangOpts.CPlusPlus11) { - // C++11 [lex.phases] 2.2 p2 - // Pref

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -229,6 +229,10 @@ mlir::LogicalResult CIRGenFunction::emitSimpleStmt(const Stmt *s, else emitCompoundStmt(cast(*s)); break; + case Stmt::ContinueStmtClass: erichkeane wrote: Won't let me choose a better line, but line 222 is not accurate any

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -462,6 +462,58 @@ def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp", "ScopeOp", "DoWhileOp", let hasVerifier = 1; } +//===--===// +// IfOp +//===-

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs, mlir::Location rhs) { return mlir::FusedLoc::get(locs, metadata, &getMLIRContext()); } +bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) { + // Null statement, not a label

[clang] [CIR] Upstream support for logical not operations (PR #133966)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -1320,7 +1322,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) { "fixed point casts"); return {}; } -cgf.getCIRGenModule().errorNYI(subExpr->getSourceRange(), "fp options"); +assert(!cir::MissingFeatures:

[clang] [Clang][Diagnostics] Update select uses in DiagnosticXKinds.td to use enum_select (PR #130868)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -2474,9 +2476,9 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) { if (!S.noteUndefinedBehavior()) return false; RHS = -RHS; -return DoShifthttps://github.com/llvm/llvm-project/pull/130868 _

[clang] [clang][ExprConst] Check record base classes for valid structs (PR #132270)

2025-04-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/132270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   8   9   10   >