[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-10-30 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Your release note looks great, just a few formatting related nits with it. https://github.com/llvm/llvm-project/pull/65268 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-10-30 Thread Aaron Ballman via cfe-commits
@@ -301,6 +301,10 @@ Improvements to Clang's diagnostics - Clang now always diagnoses when using non-standard layout types in ``offsetof`` . (`#64619: `_) +Improvements to Clang's time-trace +---

[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-10-30 Thread Aaron Ballman via cfe-commits
@@ -301,6 +301,10 @@ Improvements to Clang's diagnostics - Clang now always diagnoses when using non-standard layout types in ``offsetof`` . (`#64619: `_) +Improvements to Clang's time-trace +---

[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-10-31 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Hi @nikic, thanks for spotting the issue and reverted the commit. > > Hi @AaronBallman, > > As @nikic mentioned that the issue is that the used strings may be expensive > to compute. If we remove the change to record the function name and function > location, I think the

[clang] [clang] Change representation of CurLexerKind (PR #70381)

2023-10-31 Thread Aaron Ballman via cfe-commits
@@ -817,7 +817,7 @@ For later versions of Visual Studio, no setup is required--> {IncludeMacroStack._Mypair._Myval2._Mylast - 1,na} {CurLexer._Mypair._Myval2,na} Expanding Macro: {CurTokenLexer._Mypair._Myval2,na} - AaronBallman wrote: Yeah,

[clang] [clang] Change representation of CurLexerKind (PR #70381)

2023-10-31 Thread Aaron Ballman via cfe-commits
@@ -767,7 +762,7 @@ class Preprocessor { /// \#included, and macros currently being expanded from, not counting /// CurLexer/CurTokenLexer. struct IncludeStackInfo { -enum CurLexerKind CurLexerKind; +LexerCallback CurLexerCallback; Aaron

[llvm] [clang] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)

2023-10-31 Thread Aaron Ballman via cfe-commits
@@ -49,7 +49,7 @@ struct ExprDependenceScope { using ExprDependence = ExprDependenceScope::ExprDependence; struct TypeDependenceScope { - enum TypeDependence : uint8_t { + enum TypeDependence : unsigned { AaronBallman wrote: Now that we're reviewing https:/

[clang] [clang] Remove diagnostic that came with `[[clang::preferred_type]]` (PR #70632)

2023-10-31 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Because we're on the fence about whether this has value and we're getting early feedback about diagnostic chattiness and we lack adequate test coverage for the changes, I think it's reasonable to back this out for now. It might make m

[clang] [clang] Ignore GCC 11 `[[malloc(x)]]` attribute (PR #68059)

2023-10-31 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I see that the fix is almost ready, good. But generally it would also have > helped if the `__has_c_attribute` feature test for this type of borrowed > attributes would provide means to distinguish different versions. Here gcc as > well as clang only have the value 1. So

[clang] [clang-tools-extra] [Attributes][HLSL] Teach EnumArgument to refer to an external enum (PR #70835)

2023-10-31 Thread Aaron Ballman via cfe-commits
@@ -279,12 +279,13 @@ class DefaultIntArgument : IntArgument { // This argument is more complex, it includes the enumerator type name, // a list of strings to accept, and a list of enumerators to map them to. -class EnumArgument values, +class EnumArgument values, ---

[clang] [Clang] Add __datasizeof (PR #67805)

2023-10-31 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -o - | FileCheck %s + +// CHECK: define dso_local noundef i32 @_Z4testi(i32 noundef %i) #0 { +// CHECK-NEXT: entry: +// CHECK-NEXT: %i.addr = alloca i32, align 4 +// CHECK-NEXT: store i32 %i, ptr %i.addr, a

[clang] [clang][Interp] Implement __builtin_bit_cast (PR #68288)

2023-10-31 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -0,0 +1,816 @@ +// RUN: %clang_cc1 -verify -std=c++2a -fsyntax-only -fexperimental-new-constant-inter

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-11-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > And contrariwise, if there's some sneaky way to put push/pop pragmas in > non-file contexts, that also seems like a serious problem, because the way we > process them is not designed to understand local scopes, which means we're > just doing random stuff instead of implem

[clang] [clang] Change representation of CurLexerKind (PR #70381)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -767,7 +762,7 @@ class Preprocessor { /// \#included, and macros currently being expanded from, not counting /// CurLexer/CurTokenLexer. struct IncludeStackInfo { -enum CurLexerKind CurLexerKind; +LexerCallback CurLexerCallback; Aaron

[clang] [Clang] Add __datasizeof (PR #67805)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM with the new codegen test, thank you! https://github.com/llvm/llvm-project/pull/67805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang-tools-extra] [clang] [Attributes][HLSL] Teach EnumArgument to refer to an external enum (PR #70835)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -279,12 +279,13 @@ class DefaultIntArgument : IntArgument { // This argument is more complex, it includes the enumerator type name, // a list of strings to accept, and a list of enumerators to map them to. -class EnumArgument values, +class EnumArgument values, ---

[clang] [Driver][DragonFly] Fixes for linker path and command-line option handling (PR #69095)

2023-11-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: This appears to have broken some bots: https://lab.llvm.org/buildbot/#/builders/119/builds/15633 https://lab.llvm.org/buildbot/#/builders/60/builds/14449 Can you investigate and get those bots back to green? https://github.com/llvm/llvm-project/pull/69095 ___

[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you! https://github.com/llvm/llvm-project/pull/65268 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement inc/dec for IntegralAP (PR #69597)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/69597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement inc/dec for IntegralAP (PR #69597)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: FWIW, when the description for the PR says it can't be merged for some reason, it usually goes on the bottom of my review queue until those issues are addressed. It's difficult to accept known-broken code. :-( https://github.com/llvm/llvm-project/pull

[clang] [clang][Interp] Implement inc/dec for IntegralAP (PR #69597)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -167,17 +169,13 @@ template class IntegralAP final { } static bool increment(IntegralAP A, IntegralAP *R) { -// FIXME: Implement. -assert(false); -*R = IntegralAP(A.V - 1); -return false; +IntegralAP One(1, A.bitWidth()); +return add(A, One, A.b

[clang] [clang][Interp] Implement inc/dec for IntegralAP (PR #69597)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -167,17 +169,13 @@ template class IntegralAP final { } static bool increment(IntegralAP A, IntegralAP *R) { -// FIXME: Implement. -assert(false); -*R = IntegralAP(A.V - 1); -return false; +IntegralAP One(1, A.bitWidth()); AaronBallm

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/65638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -5339,16 +5339,22 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, TypeSpecType == DeclSpec::TST_interface || TypeSpecType == DeclSpec::TST_union || TypeSpecType == DeclSpec::TST_enum) { - for (const ParsedAttr &AL : DS.ge

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Aside from some nits, I think this looks reasonable to me. I'll leave the final sign-off to @erichkeane but if he doesn't approve in the next few days (WG21 meetings are upcoming so he may be busy), I'll come back to approve. Thank you for all the hel

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -264,6 +264,11 @@ Attribute Changes in Clang supports but that are never the result of default argument promotion, such as ``float``. (`#59824: `_) +- Clang now warns you that the ``_Alignas`` attribute on declaration s

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -451,3 +451,5 @@ namespace P2361 { // expected-warning {{use of the 'deprecated' attribute is a C++14 extension}} [[nodiscard("\123")]] int b(); // expected-error{{invalid escape sequence '\123' in an unevaluated string literal}} } + +align

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -192,6 +192,13 @@ class AttributeCommonInfo { bool isC23Attribute() const { return SyntaxUsed == AS_C23; } + bool isAlignas() const { +// In the current state of code, IsAlignas is only configured to return AaronBallman wrote: How about: ``` // FIX

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Please be sure to add a reasonable description to the patch summary so that reviewers know more about what's going on, but thank you for already having written docs (that helps give context). The changes should come with a release note as well. https

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CodeAlignAttrDocs : Documentation { + let Category = DocCatVariable; + let Heading = "clang::code_align"; + let Content = [{ +The ``clang::code_align(N)``

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,56 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -4280,3 +4280,12 @@ def PreferredType: InheritableAttr { let Args = [TypeArgument<"Type", 1>]; let Documentation = [PreferredTypeDocumentation]; } + +def CodeAlign: StmtAttr { + let Spellings = [CXX11<"clang", "code_align">, + C23<"clang", "code_align"

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -788,6 +797,20 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx, } } + // Translate 'loop attributes' arguments to equivalent Attr enums. + // It's being handled separately from LoopHintAttrs not to support + // legacy GNU attributes and prag

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,56 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CodeAlignAttrDocs : Documentation { + let Category = DocCatVariable; + let Heading = "clang::code_align"; + let Content = [{ +The ``clang::code_align(N)``

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Aaron Ballman via cfe-commits
@@ -10026,6 +10026,10 @@ def err_duplicate_case_differing_expr : Error< def warn_case_empty_range : Warning<"empty case range specified">; def warn_missing_case_for_condition : Warning<"no case matching constant switch condition '%0'">; +def err_loop_attr_duplication : Error<

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-11-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > And contrariwise, if there's some sneaky way to put push/pop pragmas in > > > non-file contexts, that also seems like a serious problem, because the > > > way we process them is not designed to understand local scopes, which > > > means we're just doing random stuff i

[clang] [clang-tools-extra] [clang][NFC] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -84,22 +88,33 @@ inline bool isUniqueGVALinkage(GVALinkage L) { } inline bool isExternallyVisible(Linkage L) { - return L >= VisibleNoLinkage; + switch (L) { + case Linkage::Invalid: +llvm_unreachable("Linkage hasn't been computed!"); AaronBallman wr

[clang] [clang-tools-extra] [clang][NFC] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -1921,7 +1920,20 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const { } bool NamedDecl::hasLinkage() const { - return getFormalLinkage() != NoLinkage; + switch (getFormalLinkage()) { + case Linkage::Invalid: +llvm_unreachable("Linkage h

[clang] [clang-tools-extra] [clang][NFC] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -2214,7 +2214,7 @@ void ASTWriter::WriteDeclAbbrevs() { Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec Abv->Add(BitCodeAbbrevOp(0)); // InitStyle Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong - Abv->Ad

[clang-tools-extra] [clang] [clang][NFC] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -560,7 +562,7 @@ bool CXIndexDataConsumer::handleDecl(const NamedDecl *D, if (shouldSuppressRefs()) markEntityOccurrenceInFile(D, Loc); - + AaronBallman wrote: Every other change in this file is unrelated to the linkage enum and should be backed o

[clang] [clang-tools-extra] [clang] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -1921,7 +1920,20 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const { } bool NamedDecl::hasLinkage() const { - return getFormalLinkage() != NoLinkage; + switch (getFormalLinkage()) { + case Linkage::Invalid: +llvm_unreachable("Linkage h

[clang] [clang-tools-extra] [clang] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -2214,7 +2214,7 @@ void ASTWriter::WriteDeclAbbrevs() { Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec Abv->Add(BitCodeAbbrevOp(0)); // InitStyle Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong - Abv->Ad

[llvm] [clang-tools-extra] [lld] [libc] [clang] [libcxx] [lldb] [compiler-rt] [flang] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a nit with the new macro (feel free to fix when landing). https://github.com/llvm/llvm-project/pull/70349 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[lld] [compiler-rt] [flang] [libcxx] [llvm] [libc] [clang] [clang-tools-extra] [lldb] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -569,4 +569,12 @@ void AnnotateIgnoreWritesEnd(const char *file, int line); #define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION #endif +/// \macro LLVM_PREFERRED_TYPE +/// Adjust type of bit-field in debug info. +#if __has_attribute(preferred_type) AaronBallman wro

[libcxx] [flang] [compiler-rt] [clang] [lld] [lldb] [llvm] [libc] [clang-tools-extra] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70349 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -2214,7 +2214,7 @@ void ASTWriter::WriteDeclAbbrevs() { Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec Abv->Add(BitCodeAbbrevOp(0)); // InitStyle Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong - Abv->Ad

[clang] [clang-tools-extra] [clang] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from the comment nit from @ChuanqiXu9 https://github.com/llvm/llvm-project/pull/71049 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/69061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,103 @@ +// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s + +void t1(void) { + int array[1] = { 0 }; + char subscript = 0; + int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}} +} + +void t2(void) { + int array[1] = { 0

[clang-tools-extra] [clang] [clang] Refactor `clang::Linkage` (PR #71049)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM but please add NFC back into the patch title so it's more clear why there's no changes to test coverage. Thank you for the cleanup! https://github.com/llvm/llvm-project/pull/71049 ___ cf

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -62,3 +62,28 @@ void t10(void) { UnsignedCharTy subscript = 0; int val = array[subscript]; // no warning for unsigned char } + +void t11(void) { + int array[256] = { 0 }; + int val = array['a']; // no warning for char with known positive value +} + +void t12(void) { +

[clang] [clang] Change representation of CurLexerKind (PR #70381)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! It's always great to improve compile-time performance! https://github.com/llvm/llvm-project/pull/70381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -6018,9 +6018,15 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, << IndexExpr->getSourceRange()); if ((IndexExpr->getType()->isSpecificBuiltinType(BuiltinType::Char_S) || - IndexExpr->getType()->isSpecificBuiltinType(B

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,127 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=expected,c-local -x c %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp-local -pedantic -x c++ -std=c++11 %s + +void foo() { + int i; + int a[10], b[10]; + + [[clang::code_align(8)]] + for (i = 0; i < 10; ++i

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,50 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-02 Thread Aaron Ballman via cfe-commits
@@ -10026,6 +10026,10 @@ def err_duplicate_case_differing_expr : Error< def warn_case_empty_range : Warning<"empty case range specified">; def warn_missing_case_for_condition : Warning<"no case matching constant switch condition '%0'">; +def err_loop_attr_duplication : Error<

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for the link to the LLVM side of things, that helps! https://github.com/llvm/llvm-project/pull/70762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [Driver][DragonFly] Fixes for linker path and command-line option handling (PR #69095)

2023-11-02 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > This appears to have broken some bots: > > > [lab.llvm.org/buildbot/#/builders/119/builds/15633](https://lab.llvm.org/buildbot/#/builders/119/builds/15633) > > > > > > [lab.llvm.org/buildbot/#/builders/60/builds/14449](https://lab.llvm.org/buildbot/#/builders/60/build

[clang] [Driver][DragonFly] Fixes for linker path and command-line option handling (PR #69095)

2023-11-02 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > This appears to have broken some bots: > https://lab.llvm.org/buildbot/#/builders/119/builds/15633 > https://lab.llvm.org/buildbot/#/builders/60/builds/14449 > > Can you investigate and get those bots back to green? Ping? https://github.com/llvm/llvm-project/pull/69095

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-02 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for this! The changes should come with a release note in `clang/docs/ReleaseNotes.rst` so users know about the change in behavior. https://github.com/llvm/llvm-project/pull/69061 ___ cfe-commits mai

[llvm] [clang] [clang-tools-extra] [Clang][Sema] Skip RecordDecl when checking scope of declarations (PR #69432)

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

[clang] Fix to attribute plugins reaching an unreachable (PR #70877)

2023-11-03 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Can you please add a more detailed description of the problem and what the > fix actually is. The description is what ends up in the git log and it is > important that we have enough details there to understand the PR and what > changes it makes. > > I do not see a test,

[clang] Fix to attribute plugins reaching an unreachable (PR #70877)

2023-11-03 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: As far as the changes go, they look correct to me. Thank you for the fix! Can you try adding test coverage for the change? https://github.com/llvm/llvm-project/pull/70877 ___ cfe-commits mailing list cfe-comm

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2023-11-03 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -1894,6 +1894,8 @@ void TypePrinter::printAttributedAfter(const AttributedType *T, case attr::ArmMveStrictPolymorphism:

[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

2023-11-03 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -8938,6 +8957,11 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, attr.setUsedAsTypeAttr();

[clang] [clang] Improve `_Alignas` on a `struct` declaration diagnostic (PR #65638)

2023-11-03 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Thank you for the fix! https://github.com/llvm/llvm-project/pull/65638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Remove warnings from -Wchar-subscripts for known positive constants (PR #69061)

2023-11-03 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you for the fix! https://github.com/llvm/llvm-project/pull/69061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [libc] [libcxx] [compiler-rt] [flang] [clang] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -940,7 +940,7 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, if (const ValueDecl *VD = CGF.FindCountedByField(Base)) { IndexedType = Base->getType(); - const Expr *E = CGF.BuildCountedByFieldExpr(Base, VD); + Expr *E = CGF.BuildCount

[compiler-rt] [llvm] [libc] [flang] [clang] [libcxx] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -956,37 +956,55 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +Expr *CodeGenFunction

[libc] [llvm] [compiler-rt] [libcxx] [flang] [clang] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, // Build a load of the counted_by field. bool IsSigned = CountedByFD->getType()->isSignedIntegerType(); - const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -3,8 +3,8 @@ extern groupshared float f; extern float groupshared f; // Ok, redeclaration? -// NOTE:lambda is not enabled except for hlsl202x. -// expected-error@+2 {{expected expression}} +// expected-warning@+3 {{lambdas are a C++11 extension}} +// expected-error@+2 {{

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2023-11-27 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Was there an RFC asking the community about exposing lambdas in pre C++11 modes? This is a sufficiently large language extension that we probably should verify if we haven't already. I believe this is a conforming extension (I can't think of a circums

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2023-11-27 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/73376 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++03 %s + +void func() { AaronBallman wrote: We should also test that `__has_feature(cxx_lambdas)` produces the correct results -- I think you're missing changes in `include/clang/

[clang] [Clang] Improve support for expression messages in `static_assert` (PR #73234)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -std=c++2c -verify %s + +namespace dr2798 { // dr2798: 17 drafting +#if __cpp_static_assert >= 202306 +struct string { +constexpr string() { +data_ = new char[6](); +__builtin_memcpy(data_, "Hello", 5); +data_[5] = 0

[clang] [Clang] Improve support for expression messages in `static_assert` (PR #73234)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -179,18 +179,20 @@ static_assert(false, Message{}); // expected-error {{static assertion failed: He } struct MessageInvalidSize { -constexpr auto size(int) const; // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}} -constex

[clang] [Clang] Improve support for expression messages in `static_assert` (PR #73234)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -179,18 +179,20 @@ static_assert(false, Message{}); // expected-error {{static assertion failed: He } struct MessageInvalidSize { -constexpr auto size(int) const; // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}} -constex

[clang] [Clang] Improve support for expression messages in `static_assert` (PR #73234)

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

[clang] [Clang] Improve support for expression messages in `static_assert` (PR #73234)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -std=c++2c -verify %s + +namespace dr2798 { // dr2798: 17 drafting +#if __cpp_static_assert >= 202306 +struct string { +constexpr string() { +data_ = new char[6](); +__builtin_memcpy(data_, "Hello", 5); +data_[5] = 0

[lldb] [libc] [compiler-rt] [libcxx] [llvm] [flang] [clang-tools-extra] [clang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman Can you describe your current plan how driver options are going > to behave in the light of `#embed`? I'm flexible with how we proceed, so if others have different ideas, feel free to suggest them! But my initial inclination is: * `--embed-dir=` as a way to

[clang] [Clang] CWG2789 Overload resolution with implicit and explicit object… (PR #73493)

2023-11-27 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/73493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] CWG2789 Overload resolution with implicit and explicit object… (PR #73493)

2023-11-27 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Changes LGTM modulo some comments on the review. https://github.com/llvm/llvm-project/pull/73493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [Clang] CWG2789 Overload resolution with implicit and explicit object… (PR #73493)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -10121,22 +10143,41 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1, /// We're allowed to use constraints partial ordering only if the candidates /// have the same parameter types: -/// [over.match.best]p2.6 -/// F1 and F2 are non-template

[clang] [libc] [clang-tools-extra] [flang] [llvm] [libcxx] [compiler-rt] [lldb] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'd also like to highlight the use case of diagnostic for compiler crashes. > IIRC preprocessed source to attach to an issue is produced with > `-frewrite-includes`, so we might want to change its behavior for `#embed`. > This might be a good use case for `#embed_base64`.

[flang] [libcxx] [compiler-rt] [clang] [libc] [llvm] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, // Build a load of the counted_by field. bool IsSigned = CountedByFD->getType()->isSignedIntegerType(); - const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)

[libc] [compiler-rt] [libcxx] [clang] [llvm] [flang] [Clang] Use correct base expression for counted_by field (#73168) (PR #73465)

2023-11-27 Thread Aaron Ballman via cfe-commits
@@ -916,7 +916,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, // Build a load of the counted_by field. bool IsSigned = CountedByFD->getType()->isSignedIntegerType(); - const Expr *CountedByExpr = BuildCountedByFieldExpr(Base, CountedByFD)

[llvm] [compiler-rt] [clang] [libcxx] [clang-tools-extra] [lldb] [libc] [flang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Your reasoning works until we have a crash that relies on `#embed` and/or its > contents. Agreed, that's the "downsides" I mentioned. > From what I saw triaging old crashes, crash submitters are conscious if they > work with proprietary code they can't share even a fragm

[flang] [llvm] [lldb] [clang-tools-extra] [libc] [clang] [compiler-rt] [libcxx] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'm somewhat concerned about the default for `-E` being to explode `#embed` > into the comma-separated raw integers. Even with moderately-sized embeds, I > think it'll generate unusably-bloated output. The human-readability of a big > list of integers is not better than e

[clang-tools-extra] [libcxx] [libc] [llvm] [lldb] [compiler-rt] [clang] [flang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-28 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I guess I'd consider the "mental model" here to be that (notionally) `#embed` > is preprocessed by expanding to `#embed_base64`, which is handled by the > compiler proper, not the preprocessor. Yes, that's not entirely true in the > implementation, but it seems like a rea

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -5152,13 +5152,17 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, // and definitions of functions and variables. // C++2a [dcl.constexpr]p1: The consteval specifier shall be applied only to // the declaration of a function or function te

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -14240,6 +14294,114 @@ StmtResult Sema::ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, : IdentLoc); } +static ImplicitConversionKind getConversionKind(QualType FromType, +

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -2231,6 +2231,12 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc, return false; } + if (Info.getLangOpts().C23) { AaronBallman wrote: ```suggestion // C23 6.7.1p6: If an object or subobject declared with storage-cl

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -14240,6 +14294,114 @@ StmtResult Sema::ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, : IdentLoc); } +static ImplicitConversionKind getConversionKind(QualType FromType, AaronBallman wrot

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -7894,6 +7898,17 @@ NamedDecl *Sema::ActOnVariableDeclarator( (getLangOpts().CPlusPlus17 || Context.getTargetInfo().getCXXABI().isMicrosoft())) NewVD->setImplicitlyInline(); + +if (getLangOpts().C23) { + DeclSpec::TSCS TSC = D.getDeclSpec().ge

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -208,6 +208,7 @@ C23 Feature Support - Clang now supports which defines several macros for performing checked integer arithmetic. It is also exposed in pre-C23 modes. +- Clang now supports ``N3018 The constexpr specifier for object definitions``. Aa

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -2932,6 +2932,22 @@ def warn_private_extern : Warning< def note_private_extern : Note< "use __attribute__((visibility(\"hidden\"))) attribute instead">; +// C23 constexpr +def err_c23_thread_local_constexpr : Error< + "thread-local storage is not allowed with constexpr">

[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

2023-11-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for working on this! First round of comments done (I've not thoroughly reviewed the test cases yet though). https://github.com/llvm/llvm-project/pull/73099 ___ cfe-commits mailing list cfe-commits@l

<    3   4   5   6   7   8   9   10   11   12   >