[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)

2024-05-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > I have no idea whether that returns a `SourceLocation`, a `PresumedLoc`, a > > `FullSourceLoc`, etc, so I don't think that is a use of `auto` I would want > > to have to reason about as a reviewer. That said, if the only use of `loc` > > is: `Diag(loc,

[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)

2024-05-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > What part of the "camelBack" is visible to the user of the API? (we're not > talking about method names or class names here I believe) Parameter names, which show up in tooltips in IDEs, etc. But again, the important thing is to at least be self-consistent. e.g., ```

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM with a possible improvement in the code (take it or leave it, your call). https://github.com/llvm/llvm-project/pull/89804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit ) { } } } + + // FIXME: We should de-allocate MostRecentTU + for (Decl *D : MostRecentTU->decls()) { +auto *ND = dyn_cast(D); +if (!ND) + continue; +// Check if we

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/89804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce `SemaAccess` (PR #92674)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce `SemaAccess` (PR #92674)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. https://github.com/llvm/llvm-project/pull/92674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce `SemaAccess` (PR #92674)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -1459,11 +1460,11 @@ static AccessResult CheckEffectiveAccess(Sema , llvm_unreachable("invalid access result"); } -static Sema::AccessResult CheckAccess(Sema , SourceLocation Loc, - AccessTarget ) { +static SemaAccess::AccessResult

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Also, please be sure to add a release note about the new functionality. https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -1176,6 +1176,12 @@ def ConvertVector : Builtin { let Prototype = "void(...)"; } +def SelectVector : Builtin { + let Spellings = ["__builtin_selectvector"]; + let Attributes = [NoThrow, Const, CustomTypeChecking]; AaronBallman wrote: Should this also

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -3013,6 +3013,62 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, break; } + case Builtin::BI__builtin_selectvector: { +if (checkArgCount(*this, TheCall, 3)) + return ExprError(); + +ExprResult LHS = TheCall->getArg(0); +

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -3013,6 +3013,62 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, break; } + case Builtin::BI__builtin_selectvector: { +if (checkArgCount(*this, TheCall, 3)) + return ExprError(); + +ExprResult LHS = TheCall->getArg(0); +

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I'm less certain, but CC @jdoerfert @mikerice1969 for more opinions. The original changes actually fixed a bug in OpenMP related to standalone directives. > Note, this seems to have fixed an issue with some OpenMP stand-alone directives not being properly diagnosed as per:

[clang] [Clang] [C23] Fix typeof_unqual for qualified array types (PR #92767)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The changes generally LG, but there's a merge conflict preventing the PR from going through precommit CI. https://github.com/llvm/llvm-project/pull/92767 ___ cfe-commits mailing list

[clang] [Clang] [C23] Fix typeof_unqual for qualified array types (PR #92767)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -2092,8 +2096,8 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { LLVM_PREFERRED_TYPE(TypeBitfields) unsigned : NumTypeBits; -LLVM_PREFERRED_TYPE(bool) -unsigned IsUnqual : 1; // If true: typeof_unqual, else: typeof +

[clang] [Clang] [C23] Fix typeof_unqual for qualified array types (PR #92767)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [C23] Fix typeof_unqual for qualified array types (PR #92767)

2024-05-21 Thread Aaron Ballman via cfe-commits
@@ -92,3 +92,35 @@ extern __attribute__((address_space(0))) int type_attr_test_2; // expec void invalid_param_fn(__attribute__((address_space(1))) int i); // expected-error {{parameter may not be qualified with an address space}} typeof(invalid_param_fn)

[clang] [C] Disallow declarations where a statement is required (PR #92908)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/92908 This fixes a regression introduced in 8bd06d5b65845e5e01dd899a2deb773580460b89 where Clang began to accept a declaration where a statement is required. e.g., ``` if (1) int x; // Previously accepted, now

[clang] [clang] Introduce `SemaPseudoObject` (PR #92646)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/92646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce `SemaPseudoObject` (PR #92646)

2024-05-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coverage] Rework !SystemHeadersCoverage (PR #91446)

2024-05-20 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: FWIW, I landed 3591da9f1ccbd8b19fef4814f96638dbbe9c2b40 to address testing issues on Windows. https://github.com/llvm/llvm-project/pull/91446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] 3591da9 - Fix test for non-Itanium ABIs.

2024-05-20 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2024-05-20T14:23:17-04:00 New Revision: 3591da9f1ccbd8b19fef4814f96638dbbe9c2b40 URL: https://github.com/llvm/llvm-project/commit/3591da9f1ccbd8b19fef4814f96638dbbe9c2b40 DIFF: https://github.com/llvm/llvm-project/commit/3591da9f1ccbd8b19fef4814f96638dbbe9c2b40.diff

[clang] [llvm] Disable compiling and testing Flang on Clang changes (PR #92740)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -68,7 +68,7 @@ function compute-projects-to-test() { done ;; clang) - for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do + for p in clang-tools-extra compiler-rt lldb cross-project-tests; do AaronBallman wrote:

[clang] [llvm] Disable compiling and testing Flang on Clang changes (PR #92740)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -68,7 +68,7 @@ function compute-projects-to-test() { done ;; clang) - for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do + for p in clang-tools-extra compiler-rt lldb cross-project-tests; do AaronBallman wrote:

[clang] [llvm] Disable compiling and testing Flang on Clang changes (PR #92740)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -68,7 +68,7 @@ function compute-projects-to-test() { done ;; clang) - for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do + for p in clang-tools-extra compiler-rt lldb cross-project-tests; do AaronBallman wrote:

[clang] [llvm] Disable compiling Flang and running its tests on Clang changes (PR #92740)

2024-05-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Please add more of a description to the patch summary so it's clear why these changes are being made. https://github.com/llvm/llvm-project/pull/92740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit ) { } } } + + // FIXME: We should de-allocate MostRecentTU + for (Decl *D : MostRecentTU->decls()) { +if (!isa(D)) + continue; +// Check if we need to clean up the

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -2282,7 +2282,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) { // Remove this name from our lexical scope, and warn on it if we haven't // already. -IdResolver.RemoveDecl(D); +if (!PP.isIncrementalProcessingEnabled()) +

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-20 Thread Aaron Ballman via cfe-commits
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit ) { } } } + + // FIXME: We should de-allocate MostRecentTU + for (Decl *D : MostRecentTU->decls()) { +if (!isa(D)) + continue; +// Check if we need to clean up the

[clang] [clang] Introduce `SemaCoroutine` (PR #92645)

2024-05-20 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > What is the goal here? The eventual goal is for Sema to have appropriate layering instead of being a monolithic design. "Appropriate layering" can be handled in many different ways, but the goal when this was discussed extensively in the past was to split by "category"

[clang] [clang] Introduce `SemaCodeCompletion` (PR #92311)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/92311 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ThreadSafety] Skip past implicit cast in `translateAttrExpr` (PR #92277)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/92277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -2282,7 +2282,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) { // Remove this name from our lexical scope, and warn on it if we haven't // already. -IdResolver.RemoveDecl(D); +if (!PP.isIncrementalProcessingEnabled()) +

[clang] [clang-repl] Extend the C support. (PR #89804)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit ) { } } } + + // FIXME: We should de-allocate MostRecentTU + for (Decl *D : MostRecentTU->decls()) { +if (!isa(D)) + continue; +// Check if we need to clean up the

[clang] [Clang][Sema] Fix crash when diagnosing near-match for 'constexpr' redeclaration in C++11 (PR #92452)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/92452 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -1435,6 +1435,38 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NonBlocking : TypeAttr { + let Spellings = [CXX11<"clang", "nonblocking">, AaronBallman wrote: Present Aaron thanks you and Past Aaron apologized

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] [clang-tools-extra] [llvm] [clang-query] Remove support for srcloc output (PR #92442)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/92442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix crash when diagnosing near-match for 'constexpr' redeclaration in C++11 (PR #92452)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -1527,20 +1527,20 @@ struct DeclaratorChunk { /// Retrieve the location of the 'const' qualifier. SourceLocation getConstQualifierLoc() const { - assert(MethodQualifiers); - return MethodQualifiers->getConstSpecLoc(); + return MethodQualifiers ?

[clang] [Clang][Sema] Fix crash when diagnosing near-match for 'constexpr' redeclaration in C++11 (PR #92452)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -9203,15 +9203,15 @@ static NamedDecl *DiagnoseInvalidRedeclaration( << Idx << FDParam->getType() << NewFD->getParamDecl(Idx - 1)->getType(); } else if (FDisConst != NewFDisConst) { - SemaRef.Diag(FD->getLocation(),

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -487,6 +487,9 @@ Improvements to Clang's diagnostics } }; +- Clang emits a ``-Wparentheses`` warning for expressions with consecutive comparisons like ``x < y < z``. + It was made a ``-Wparentheses`` warning to be consistent with gcc.

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a small nit with the release notes. https://github.com/llvm/llvm-project/pull/92200 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92200 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-17 Thread Aaron Ballman via cfe-commits
@@ -215,3 +215,10 @@ namespace PR20735 { // fix-it:"{{.*}}":{[[@LINE-9]]:20-[[@LINE-9]]:20}:")" } } + +void consecutive_builtin_compare(int x, int y, int z) { + (void)(x < y < z); // expected-warning {{comparisons like 'X<=Y<=Z' don't have their mathematical meaning}}

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -7963,6 +7968,154 @@ static Attr *getCCTypeAttr(ASTContext , ParsedAttr ) { llvm_unreachable("unexpected attribute kind!"); } +std::optional +Sema::ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName) { + auto BadExpr = [&]() { +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -1435,6 +1435,38 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NonBlocking : TypeAttr { + let Spellings = [CXX11<"clang", "nonblocking">, AaronBallman wrote: Yeah, Present Aaron regrets Past Aaron's caution

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -1435,6 +1435,38 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NonBlocking : TypeAttr { + let Spellings = [CXX11<"clang", "nonblocking">, AaronBallman wrote: CC @erichkeane `clang_builtin_alias` is the only

[clang] [Clang][Sema] Avoid pack expansion for expanded empty PackIndexingExprs (PR #92385)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4381,11 +4381,13 @@ class PackIndexingExpr final PackIndexingExpr(QualType Type, SourceLocation EllipsisLoc, SourceLocation RSquareLoc, Expr *PackIdExpr, Expr *IndexExpr, - ArrayRef SubstitutedExprs = {}) +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -7963,6 +7968,154 @@ static Attr *getCCTypeAttr(ASTContext , ParsedAttr ) { llvm_unreachable("unexpected attribute kind!"); } +std::optional +Sema::ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName) { + auto BadExpr = [&]() { +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -5028,3 +5060,263 @@ void AutoType::Profile(llvm::FoldingSetNodeID , const ASTContext ) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::Kind

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -7963,6 +7968,154 @@ static Attr *getCCTypeAttr(ASTContext , ParsedAttr ) { llvm_unreachable("unexpected attribute kind!"); } +std::optional +Sema::ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName) { + auto BadExpr = [&]() { +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -5028,3 +5060,263 @@ void AutoType::Profile(llvm::FoldingSetNodeID , const ASTContext ) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::Kind

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -3649,6 +3649,35 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef params, auto = *getTrailingObjects(); EllipsisLoc = epi.EllipsisLoc; } + + if (!epi.FunctionEffects.empty()) { +auto = *getTrailingObjects(); +const size_t EffectsCount

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -2743,3 +2759,153 @@ bool Sema::isDeclaratorFunctionLike(Declarator ) { }); return Result; } + +FunctionEffectDifferences::FunctionEffectDifferences( +const FunctionEffectsRef , const FunctionEffectsRef ) { + + FunctionEffectsRef::iterator POld = Old.begin(); +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,134 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -x c -std=c23 %s + +#if !__has_attribute(clang_nonblocking) +#error "the 'nonblocking' attribute is not available" +#endif + +// ---

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4669,6 +4679,13 @@ class BlockDecl : public Decl, public DeclContext { SourceRange getSourceRange() const override LLVM_READONLY; + FunctionEffectsRef getFunctionEffects() const { +if (TypeSourceInfo *TSI = getSignatureAsWritten()) + if (auto *FPT =

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -2743,3 +2759,153 @@ bool Sema::isDeclaratorFunctionLike(Declarator ) { }); return Result; } + +FunctionEffectDifferences::FunctionEffectDifferences( +const FunctionEffectsRef , const FunctionEffectsRef ) { + + FunctionEffectsRef::iterator POld = Old.begin(); +

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -1870,6 +1870,27 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType, FromFn = QT->getAs(); Changed = true; } + +// For C, when called from checkPointerTypesForAssignment, +// we need not to alter FromFn, or else even an innocuous

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -1870,6 +1870,28 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType, FromFn = QT->getAs(); Changed = true; } + +// For C, when called from checkPointerTypesForAssignment, +// we need not to alter FromFn, or else even an innocuous

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -x c -std=c11 %s AaronBallman wrote: ```suggestion // RUN: %clang_cc1 -fsyntax-only -verify -std=c89 %s ``` https://github.com/llvm/llvm-project/pull/84983

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -5028,3 +5060,263 @@ void AutoType::Profile(llvm::FoldingSetNodeID , const ASTContext ) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::Kind

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -5028,3 +5060,263 @@ void AutoType::Profile(llvm::FoldingSetNodeID , const ASTContext ) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::Kind

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -5028,3 +5060,263 @@ void AutoType::Profile(llvm::FoldingSetNodeID , const ASTContext ) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::Kind

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -4639,6 +4645,303 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { } }; +// -- + +/// Represents an abstract function effect, using just an enumeration

[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -1435,6 +1435,38 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NonBlocking : TypeAttr { + let Spellings = [CXX11<"clang", "nonblocking">, AaronBallman wrote: Generally speaking, these would use the `Clang`

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. The changes should come with a release note so that users know about the behavioral change, but otherwise LGTM. https://github.com/llvm/llvm-project/pull/90877 ___ cfe-commits mailing list

[clang] [llvm] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin, fmax and frexp. (PR #88978)

2024-05-16 Thread Aaron Ballman via cfe-commits
@@ -14574,9 +14574,17 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) { default: return false; + case Builtin::BI__builtin_frexpl: +// AIX library function `frexpl` has 'long double' type and not +// PPCDoubleDouble type. To make sure we generate

[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -10698,7 +10698,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/1815.html;>1815 CD4 Lifetime extension in aggregate initialization -Clang 19 +Yes AaronBallman wrote: It's usually better to apply the

[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -45,6 +45,34 @@ void fallthrough(int n) { #endif } +namespace cwg2428 { // cwg2428: 19 +#if __cplusplus >= 202002L +template +concept C [[deprecated]] = true; // #C AaronBallman wrote: I'd like an additional test for rejecting: ``` template

[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -10698,7 +10698,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/1815.html;>1815 CD4 Lifetime extension in aggregate initialization -Clang 19 +Yes AaronBallman wrote: Unrelated changes snuck in.

[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)

2024-05-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Please be sure to add a release note about implementing the DR. https://github.com/llvm/llvm-project/pull/92295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)

2024-05-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -215,3 +215,10 @@ namespace PR20735 { // fix-it:"{{.*}}":{[[@LINE-9]]:20-[[@LINE-9]]:20}:")" } } + +void consecutive_builtin_compare(int x, int y, int z) { + (void)(x < y < z); // expected-warning {{comparisons like 'X<=Y<=Z' don't have their mathematical meaning}}

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -14878,6 +14878,11 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, case BO_GT: ConvertHalfVec = true; ResultTy = CheckCompareOperands(LHS, RHS, OpLoc, Opc); + +if (const auto *BI = dyn_cast(LHSExpr)) + if (BI->isComparisonOp()) +

[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -5143,6 +5143,10 @@ static bool EvaluateUnaryTypeTrait(Sema , TypeTrait UTT, case UTT_IsFloatingPoint: return T->isFloatingType(); case UTT_IsArray: +// zero-sized arrays aren't considered arrays in partial specializations, AaronBallman wrote:

[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

2024-05-15 Thread Aaron Ballman via cfe-commits
@@ -5143,6 +5143,10 @@ static bool EvaluateUnaryTypeTrait(Sema , TypeTrait UTT, case UTT_IsFloatingPoint: return T->isFloatingType(); case UTT_IsArray: +// zero-sized arrays aren't considered arrays in partial specializations, +// so __is_array shouldn't

[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

2024-05-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/86652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

2024-05-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Realistically, I don't think we can deprecate the extension in general: https://sourcegraph.com/search?q=context:global+%5BA-Za-z0-9_%5D%2B%5Cs%5BA-Za-z0-9_%5D%2B%5C%5B0%5C%5D%3B+-file:.*test.*+-file:.*clang.*+count:10=regexp=0 I

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Set the warning to DefaultIgnore, although -Wparentheses is enabled by > default Do we know why GCC elected to go that route? This seems like something that should be enabled by default because the false positive rate should be quite low.

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Btw, it seems that precommit CI found some valid issues to be addressed https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-05-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > I don't think we should allow it for C++11 and later modes > > To clarify, should we allow enabling them in e.g. `c++03` mode if > `-fraw-string-literals` is passed? I don’t see why not, but I’m not entirely > sure whether you’re saying we should not support that flag

[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)

2024-05-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Thanks for everyone's input so far. Let me try to summarize discussions in > this PR so we can set on an approach and give advice to our CIR community > (and encode on our webpage) on how to move forward in upcoming patches. > Useful resources: > > * [LLVM Coding

[clang] [CIR] Build out AST consumer patterns to reach the entry point into CIRGen (PR #91007)

2024-05-14 Thread Aaron Ballman via cfe-commits
@@ -42,6 +47,14 @@ CreateFrontendBaseAction(CompilerInstance ) { StringRef Action("unknown"); (void)Action; + auto UseCIR = CI.getFrontendOpts().UseClangIRPipeline; AaronBallman wrote: > Nit: technically the coding standard does not say that, I believe

[clang] [Clang][NFC] Mark P2552 as implemented. (PR #92007)

2024-05-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/92007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Mark P2552 as implemented. (PR #92007)

2024-05-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a potential improvement to the test for clarity. https://github.com/llvm/llvm-project/pull/92007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][NFC] Mark P2552 as implemented. (PR #92007)

2024-05-13 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -x c++ -std=c++11 -triple x86_64-pc-linux -fsyntax-only +// RUN: %clang_cc1 -x c++ -std=c++11 -triple x86_64-windows-msvc -fsyntax-only + +// Check we return non-zero values for supported attributes as per +// wg21.link/p2552r3.pdf

[clang] [Clang] Add attribute for consteval builtins; Declare constexpr builtins as constexpr in C++ (PR #91894)

2024-05-13 Thread Aaron Ballman via cfe-commits
@@ -14,13 +14,18 @@ void __builtin_va_copy(double d); // expected-error@+2 {{cannot redeclare builtin function '__builtin_va_end'}} // expected-note@+1 {{'__builtin_va_end' is a builtin with type}} void __builtin_va_end(__builtin_va_list); -// RUN: %clang_cc1 %s -fsyntax-only

[clang] [clang] Report erroneous floating point results in _Complex math (PR #90588)

2024-05-13 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: The changes seem reasonable to me, but I'd like to hear from @jcranmer-intel and/or @hubert-reinterpretcast in terms of whether they agree with this direction. https://github.com/llvm/llvm-project/pull/90588 ___ cfe-commits

[clang] [clang] Introduce `SemaObjC` (PR #89086)

2024-05-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! CC @rjmccall for any last-minute concerns. https://github.com/llvm/llvm-project/pull/89086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)

2024-05-13 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > For publicly-available code, it's not clear to me how much of the burden > should fall on people that identify the problem. I want to do as much of this > work as I can, it's difficult to balance the urgency of providing some > reproducer (it gets hard to push for a fix

[clang] [clang] Disallow VLA type compound literals (PR #91891)

2024-05-13 Thread Aaron Ballman via cfe-commits
Jim M. R. =?utf-8?q?Teichgräber?=,Jim M. R. =?utf-8?q?Teichgräber?Message-ID: In-Reply-To: AaronBallman wrote: > > > Btw, you can probably move this PR out of Draft status, it seems awfully > > > close to finished > > > > > > I'll finish implementing your suggestions, run the tests again

[clang] [clang] Disallow VLA type compound literals (PR #91891)

2024-05-13 Thread Aaron Ballman via cfe-commits
Jim M. R. =?utf-8?q?Teichgräber?=,Jim M. R. =?utf-8?q?Teichgräber?Message-ID: In-Reply-To: AaronBallman wrote: > > Please be sure to add a release note to clang/docs/ReleaseNotes.rst so > > users know about the fix. > > Oh, sorry, I didn't find anything know how release notes were handled -

[clang] [Clang][Comments] Attach comments to decl even if preproc directives are in between (PR #88367)

2024-05-13 Thread Aaron Ballman via cfe-commits
@@ -107,6 +107,24 @@ ///The 2nd source tile. Max size is 1024 Bytes. #define _tile_cmmrlfp16ps(dst, a, b) __builtin_ia32_tcmmrlfp16ps(dst, a, b) +/// Perform matrix multiplication of two tiles containing complex elements and AaronBallman wrote: Is this

[clang] [Clang][Comments] Attach comments to decl even if preproc directives are in between (PR #88367)

2024-05-13 Thread Aaron Ballman via cfe-commits
@@ -533,6 +533,8 @@ __rdtscp(unsigned int *__A) { /// \see __rdpmc #define _rdpmc(A) __rdpmc(A) +; AaronBallman wrote: This is quite surprising; I'm guessing this is so that the previous comment does not associate with the function declared below, but this

<    1   2   3   4   5   6   7   8   9   10   >