[clang] [clang-tools-extra] [llvm] [Clang] Fix : More Detailed "No expected directives found" (PR #78338)

2024-02-06 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I believe the concerns from @asl and @tbaederr have been addressed and we're fine to land this, but I'll land it tomorrow to give them both a chance to weigh-in and to give precommit CI a chance to finish. https://github.com/llvm/llvm-project/pull/78338

[clang] [Clang] Fix looking for immediate calls in default arguments. (PR #80690)

2024-02-06 Thread Aaron Ballman via cfe-commits
@@ -6198,7 +6198,7 @@ struct ImmediateCallVisitor : public RecursiveASTVisitor { bool VisitCallExpr(CallExpr *E) { if (const FunctionDecl *FD = E->getDirectCallee()) HasImmediateCalls |= FD->isImmediateFunction(); -return RecursiveASTVisitor::VisitStmt(E); +

[clang] [Clang] Fix looking for immediate calls in default arguments. (PR #80690)

2024-02-06 Thread Aaron Ballman via cfe-commits
@@ -6222,9 +6222,9 @@ struct ImmediateCallVisitor : public RecursiveASTVisitor { // Blocks don't support default parameters, and, as for lambdas, // we don't consider their body a subexpression. - bool VisitBlockDecl(BlockDecl *B) { return false; } + bool VisitBlockDecl

[clang] [clang] Use CPlusPlus language option instead of Bool (PR #80975)

2024-02-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The change in OpenCL behavior looks reasonable to me, but let's wait for @AnastasiaStulova to have a chance to weigh in. I think we can skip a release note as this is *almost* an NFC change except for the OpenCL bits. We could put a release note under

[clang] [Clang][TableGen] Add Features to TargetBuiltin (PR #80279)

2024-02-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The changes seem reasonable to me but I'd feel more comfortable if the functionality was also being used (so that we'd get test coverage verifying its correctness). Do you think it would be reasonable to include the RISCV changes as well? https://git

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > One possibility would be to use a type qualifier? It has basically the kind > > of properties you want... the underlying type is > > still there, and places that strip qualifiers will automatically do the > > right thing in a lot of cases. It might require a bit more > >

[clang] [clang-tools-extra] [llvm] [Clang] Fix : More Detailed "No expected directives found" (PR #78338)

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

[clang] [Clang][Sema] Do not attempt to instantiate a deleted move constructor (PR #80959)

2024-02-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > which also begs the question as to what change actually caused this to break > > Since I’m not sure how that is usually done here, is bisecting a reasonable > approach? I’m asking because rebuilding a project the size of Clang > unfortunately ends up taking a rather sub

[clang] [clang][Sema] Subclass `-Wshorten-64-to-32` under `-Wimplicit-int-conversion` (PR #80814)

2024-02-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: LGTM aside from a minor change to the release notes, thank you for this improvement! https://github.com/llvm/llvm-project/pull/80814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [clang][Sema] Subclass `-Wshorten-64-to-32` under `-Wimplicit-int-conversion` (PR #80814)

2024-02-07 Thread Aaron Ballman via cfe-commits
@@ -149,7 +149,12 @@ Improvements to Clang's diagnostics prints. - Clang now diagnoses member template declarations with multiple declarators. -- Clang now diagnoses use of the ``template`` keyword after declarative nested name specifiers. + +- Clang now diagnoses use of th

[clang] [clang][Sema] Subclass `-Wshorten-64-to-32` under `-Wimplicit-int-conversion` (PR #80814)

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

[clang] [clang][Sema] Subclass `-Wshorten-64-to-32` under `-Wimplicit-int-conversion` (PR #80814)

2024-02-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: (Note, precommit CI failures are unrelated.) https://github.com/llvm/llvm-project/pull/80814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][TableGen] Add Features to TargetBuiltin (PR #80279)

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

[clang] [Clang][TableGen] Add Features to TargetBuiltin (PR #80279)

2024-02-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > The changes seem reasonable to me but I'd feel more comfortable if the > > functionality was also being used (so that we'd get test coverage verifying > > its correctness). Do you think it would be reasonable to include the RISCV > > changes as well? > > Yeah, I separa

[clang] [Clang] C++ Templates: Refactor and fix `TransformLambdaExpr`'s mishandling of TypeLocs (PR #78801)

2024-02-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: CC @cor3ntin and @erichkeane for feedback on the approach here https://github.com/llvm/llvm-project/pull/78801 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-07 Thread Aaron Ballman via cfe-commits
@@ -1637,10 +1637,8 @@ def err_inline_namespace_std : Error< def err_unexpected_friend : Error< "friends can only be classes or functions">; def ext_enum_friend : ExtWarn< - "befriending enumeration type %0 is a C++11 extension">, InGroup; -def warn_cxx98_compat_enum_friend

[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

2024-02-07 Thread Aaron Ballman via cfe-commits
@@ -1637,10 +1637,8 @@ def err_inline_namespace_std : Error< def err_unexpected_friend : Error< "friends can only be classes or functions">; def ext_enum_friend : ExtWarn< - "befriending enumeration type %0 is a C++11 extension">, InGroup; -def warn_cxx98_compat_enum_friend

[clang] [clang] Use CPlusPlus language option instead of Bool (PR #80975)

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

[clang] [clang] move -Wcast-function-type under -Wextra (PR #77178)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 %s -fsyntax-only -Wextra -verify + + +int t(int array[static 12]); +int u(int i); +const int v(int i); /* expected-warning {{'const' type qualifier on return type has no effec}} */ +int x(long); + +typedef int (f1)(long); +typedef int (f2)(voi

[clang] [clang] move -Wcast-function-type under -Wextra (PR #77178)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 %s -fsyntax-only -Wextra -verify + + +int t(int array[static 12]); +int u(int i); +const int v(int i); /* expected-warning {{'const' type qualifier on return type has no effec}} */ +int x(long); + +typedef int (f1)(long); +typedef int (f2)(voi

[clang] [clang] move -Wcast-function-type under -Wextra (PR #77178)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 %s -fsyntax-only -Wextra -verify + + +int t(int array[static 12]); +int u(int i); +const int v(int i); /* expected-warning {{'const' type qualifier on return type has no effec}} */ +int x(long); + +typedef int (f1)(long); +typedef int (f2)(voi

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Overall, I think this is a *fantastic* idea for diagnostic readability, thank you for the patch! Please be sure to add a release note so users known to expect the changes. The Windows precommit CI failure is unrelated and can be ignored. Once you think you're ready, be sur

[clang] Consider aggregate bases when checking if an InitListExpr is constant (PR #80519)

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

[clang] Consider aggregate bases when checking if an InitListExpr is constant (PR #80519)

2024-02-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Please be sure to add a release note so users know about the fix, but aside from a bad standards reference, this LGTM (no concerns about C behavior either). https://github.com/llvm/llvm-project/pull/80519 __

[clang] Consider aggregate bases when checking if an InitListExpr is constant (PR #80519)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -3328,6 +3328,12 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef, DIUE->getUpdater()->isConstantInitializer(Ctx, false, Culprit); } case InitListExprClass: { +// C++ [temp.dep.expr]p2: AaronBallman wrote: ```suggestion

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Thank you for working on this! Improved standards support is always greatly appreciated. This feature is a bit more complicated than it appears at first. LLVM will often pessimize code in the presence of assumptions and that's the exact opposite of what users will expect f

[clang] [clang] Document the type_visibility attribute (PR #79157)

2024-02-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you for the improved documentation! https://github.com/llvm/llvm-project/pull/79157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > @Sirraide, would you be comfortable if you, @erichkeane, and I co-authored > > an RFC to the community? > > Sure, I’d be happy to help with that as best I can. An RFC makes sense imo > seeing as this really impacts more parts of LLVM than just Clang. Excellent, thanks!

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -3061,22 +3080,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, continue; [[fallthrough]]; AaronBallman wrote: Oh! Thank you for mentioning they're in different `switch` statements, I had missed that as well.

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Aaron Ballman via cfe-commits
@@ -2842,9 +2862,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, << Args.MakeArgString("-ffp-model=" + FPModel) << Args.MakeArgString("-ffp-model=" + Val); if (Val.equals("fast")) { -optID = options::OPT_f

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-09 Thread Aaron Ballman via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. + DeclR

[clang] [ObjC] Check entire chain of superclasses to see if class layout can be statically known (PR #81335)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @rjmccall Are these tests adequate? While we appreciate the enthusiasm, please only ping reviewers after about a week of not hearing from them on a review (https://llvm.org/docs/CodeReview.html#code-reviews-speed-and-reciprocity), thanks! https://github.com/llvm/llvm-pr

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

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

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-12 Thread Aaron Ballman via cfe-commits
@@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -verify -fsyntax-only +// RUN: %clang_cc1 -Wfree-nonheap-object -fsyntax-only -verify %s void c1(int *a); - +typedef unsigned long size_t; AaronBallman wrote: ```suggestion typedef __typeof__(sizeof(0)) size_t; ``` https

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Precommit CI found a valid failure on Windows: ``` FAIL: Clang :: Sema/attr-cleanup.c (15237 of 19292) TEST 'Clang :: Sema/attr-cleanup.c' FAILED Exit Code: 1 Command Output (stdout): -- # RUN: at line 1 c:\ws\

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman I am a little confused about what is the correct behavior for > one the the cases in the test file for c. > > ```c++ > enum PR4515 {PR4515a=1u,PR4515b=(PR4515a-2)/2}; > int CheckPR4515[PR4515b==0?1:-1]; > ``` > > At present since everything is ints this work

[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > @Sirraide, would you be comfortable if you, @erichkeane, and I > > > co-authored an RFC to the community? > > > > > > Sure, I’d be happy to help with that as best I can. An RFC makes sense imo > > seeing as this really impacts more parts of LLVM than just Clang. > >

[clang] [clang] Refactor `IdentifierInfo::ObjcOrBuiltinID` (PR #71709)

2024-02-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Precommit CI didn't run for Windows, but I tested the changes locally and all tests came back clean for me. https://github.com/llvm/llvm-project/pull/71709 ___ cfe-commits mailing list

[clang] [clang] Add -Wmissing-designated-field-initializers (PR #81364)

2024-02-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for this improvement! Please add a release note to `clang/docs/ReleaseNotes.rst` so users know about the new diagnostic group. https://github.com/llvm/llvm-project/pull/81364 ___ cfe-commits mailing

[clang] [clang] Add -Wmissing-designated-field-initializers (PR #81364)

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

[clang] [clang] Add -Wmissing-designated-field-initializers (PR #81364)

2024-02-12 Thread Aaron Ballman via cfe-commits
@@ -6165,6 +6165,10 @@ def ext_initializer_string_for_char_array_too_long : ExtWarn< def warn_missing_field_initializers : Warning< "missing field %0 initializer">, InGroup, DefaultIgnore; +// The same warning, but another group is needed to disable it separately. +def war

[clang] [clang] Add -Wmissing-designated-field-initializers (PR #81364)

2024-02-12 Thread Aaron Ballman via cfe-commits
@@ -2363,23 +2356,32 @@ void InitListChecker::CheckStructUnionTypes( } // Emit warnings for missing struct field initializers. - if (!VerifyOnly && InitializedSomething && CheckForMissingFields && - !RD->isUnion()) { -// It is possible we have one or more unnamed

[clang] [clang] Do less advertising for unresolved issues in `cxx_dr_status.html` (PR #78836)

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

[clang] [clang] Support `__is_trivially_copyable(int()&)==false` (PR #81298)

2024-02-12 Thread Aaron Ballman via cfe-commits
@@ -57,7 +57,7 @@ UNION(char[2], short) u2 = { .one = { 'a', 'b' } }; // ext-warning 3 {{'_Static_ typedef UNION(char, short) U3; // expected-error {{static assertion failed due to requirement 'sizeof(char) == sizeof(short)': type size mismatch}} \

[clang] [clang] Fix behavior of `__is_trivially_relocatable(volatile int)` (PR #77092)

2024-02-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I think the changes make sense in as much as relocatable is supposed to be a subset of copyable (I continue to think `volatile`-qualified objects should not be trivially copyable... because they aren't... but that's WG21's issue, not ours). I'm addin

[clang] [clang] Fix behavior of `__is_trivially_relocatable(volatile int)` (PR #77092)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > This isn't ABI breaking for us currently (at least in a non-benign way). We > only use it to optimize `vector` growing currently, and just define it to > `is_trivially_copyable` if `__is_trivially_relocatable` isn't available. Excellent, thank you for the confirmation! h

[clang] [clang] Fix behavior of `__is_trivially_relocatable(volatile int)` (PR #77092)

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

[clang] [Clang] Fixes of builtin definitions after PR #68324. (PR #81022)

2024-02-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > There are still some differences that I haven't addressed here as they might > be ok to have: > > * `__builtin_rint{,f,l}` were defined with the `const` attribute, now > they use the `const when FP exceptions are ignored` -- this seems due to the > definition of thes

[clang] [Clang] Fixes of builtin definitions after PR #68324. (PR #81022)

2024-02-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, these fixes all look correct to me. The only thing that seemed somewhat off was with the `sync` functions taking a pointer to a `volatile` (that's not documented in GCC's docs, but I think the signature does make sense). Thank yo

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

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

[clang] [clang] Use "notable" for "interesting" identifiers in `IdentifierInfo` (PR #81542)

2024-02-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, but agreed on adding [NFC] to the patch title https://github.com/llvm/llvm-project/pull/81542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [C23] Fix handling of alignas (PR #81637)

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

[clang] [C23] Fix handling of alignas (PR #81637)

2024-02-13 Thread Aaron Ballman via cfe-commits
@@ -3518,8 +3518,24 @@ void Parser::ParseDeclarationSpecifiers( DS.Finish(Actions, Policy); return; -case tok::l_square: +// alignment-specifier +case tok::kw__Alignas: + if (!getLangOpts().C11) +Diag(Tok, diag::ext_c11_feature) << Tok.getN

[clang] [C23] Fix handling of alignas (PR #81637)

2024-02-13 Thread Aaron Ballman via cfe-commits
@@ -114,6 +114,19 @@ C Language Changes C23 Feature Support ^^^ +- Corrected parsing behavior for the ``alignas`` specifier/qualifier in C23. We + previously handled it as an attribute as in C++, but there are parsing + differences. The behavioral differences

[clang] [compiler-rt] [clang][UBSan] Add implicit conversion check for bitfields (PR #75481)

2024-02-13 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Precommit CI seems to have found some related failures that should be investigated. I'd love to hear opinions from the codegen code owners on this, as well as @zygoloid as UBSan code owner. I'm not opposed to the changes, though I do find it somewhat strange to add them to

[clang] [llvm] [clang] Add fixed point precision macros (PR #81207)

2024-02-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I'm by no means a fixed-point expert, so this is a bit of a drive-by review. One thing to note is that we shouldn't be using N1169 because TR 18037 is freely available: https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037

[clang] [llvm] [clang] Add fixed point precision macros (PR #81207)

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

[clang] [llvm] [clang] Add fixed point precision macros (PR #81207)

2024-02-13 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,67 @@ +/// Assert the fixed point precision macros according to N1169 7.18a.3 are +/// defined when -ffixed-point is provided. + +// RUN: %clang_cc1 -triple=x86_64 -E -dM -ffixed-point -x c < /dev/null | FileCheck -match-full-lines %s +// RUN: %clang_cc1 -triple=x86_64

[clang] [llvm] [clang] Add fixed point precision macros (PR #81207)

2024-02-13 Thread Aaron Ballman via cfe-commits
@@ -1097,6 +1150,47 @@ static void InitializePredefinedMacros(const TargetInfo &TI, TI.getTypeWidth(TI.getIntMaxType()) && "uintmax_t and intmax_t have different widths?"); + if (LangOpts.FixedPoint) { +// Each unsigned type has the same width as th

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > We can enable it as an extension in older language modes later as a separate > patch in case there is user's demand on this. @cor3ntin , @AaronBallman > please let me know what you think. Thank you for investigating this! I'm perfectly fine not enabling this as an extens

[clang] [clang] Add -Wmissing-designated-field-initializers (PR #81364)

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

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I found some possible changes to be made to the diagnostics. https://github.com/llvm/llvm-project/pull/77753 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

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

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -2809,10 +2813,13 @@ def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 " "with virtual base %plural{1:class|:classes}1 is not a literal type">; def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; def err_constexpr_non

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -2809,10 +2813,13 @@ def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 " "with virtual base %plural{1:class|:classes}1 is not a literal type">; def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; def err_constexpr_non

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -2774,9 +2774,13 @@ def err_constexpr_tag : Error< def err_constexpr_dtor : Error< "destructor cannot be declared %sub{select_constexpr_spec_kind}0">; def err_constexpr_dtor_subobject : Error< - "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because " +

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -2809,10 +2813,13 @@ def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 " "with virtual base %plural{1:class|:classes}1 is not a literal type">; def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; def err_constexpr_non

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -2809,10 +2813,13 @@ def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 " "with virtual base %plural{1:class|:classes}1 is not a literal type">; def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; def err_constexpr_non

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

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

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for working on this! One thing I would like to see are some tests added to `clang/test/C/C2x/` (`n3029.c` and `n3030.c`) that tests the examples and changes from the original papers/final standard to demonstrate the features are complete. Th

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -211,6 +217,8 @@ Bug Fixes in This Version - Clang now doesn't produce false-positive warning `-Wconstant-logical-operand` for logical operators in C23. Fixes (`#64356 `_). +- Fixes miscompilation when an enum has a spec

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -135,6 +135,12 @@ C23 Feature Support ``__TYPE_FMTb__`` (e.g., ``__UINT_FAST64_FMTB__``) in C23 mode for use with macros typically exposed from , such as ``PRIb8``. (`#81896: `_). +- Enumerations should allow value

[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

2024-03-05 Thread Aaron Ballman via cfe-commits
@@ -19797,6 +19797,19 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // - If an initializer is specified for an enumerator, the // initializing value has the same type as the expression. EltTy = Val->getType(); +} e

[clang] [clang-repl] Names declared in if conditions and for-init statements are local to the inner context (C++ 3.3.2p4) (PR #84150)

2024-03-06 Thread Aaron Ballman via cfe-commits
Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= Message-ID: In-Reply-To: https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/84150 ___

[clang] [clang-repl] Names declared in if conditions and for-init statements are local to the inner context (C++ 3.3.2p4) (PR #84150)

2024-03-06 Thread Aaron Ballman via cfe-commits
Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. This looks generally reasonable to me; it makes sense that stateme

[clang] [clang-repl] Names declared in if conditions and for-init statements are local to the inner context (C++ 3.3.2p4) (PR #84150)

2024-03-06 Thread Aaron Ballman via cfe-commits
Stefan =?utf-8?q?Gr=C3=A4nitz?= , Stefan =?utf-8?q?Gr=C3=A4nitz?= , Stefan =?utf-8?q?Gr=C3=A4nitz?= , Stefan =?utf-8?q?Gr=C3=A4nitz?= , Stefan =?utf-8?q?Gr=C3=A4nitz?= Message-ID: In-Reply-To: @@ -41,3 +40,16 @@ for (; i > 4; --i) { printf("i = %d\n", i); }; int j = i; print

[clang] [clang-repl] Names declared in if conditions and for-init statements are local to the inner context (C++ 3.3.2p4) (PR #84150)

2024-03-06 Thread Aaron Ballman via cfe-commits
Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= , Stefan =?utf-8?q?Gränitz?= Message-ID: In-Reply-To: @@ -41,3 +40,16 @@ for (; i > 4; --i) { printf("i = %d\n", i); }; int j = i; printf("j = %d\n", j); // CHE

[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -721,10 +722,21 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK, return std::string(Out.str()); } if (const FunctionDecl *FD = dyn_cast(CurrentDecl)) { -if (IK != PredefinedIdentKind::PrettyFunction && +const auto &LO = Context.getLangOpts(

[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -721,10 +722,21 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK, return std::string(Out.str()); } if (const FunctionDecl *FD = dyn_cast(CurrentDecl)) { -if (IK != PredefinedIdentKind::PrettyFunction && +const auto &LO = Context.getLangOpts(

[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -1635,6 +1635,17 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, if (T->getKeyword() != ElaboratedTypeKeyword::None) OS << " "; NestedNameSpecifier *Qualifier = T->getQualifier(); +if (!Policy.SuppressTagKeyword && Policy.SuppressScope

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -26,60 +26,98 @@ Pointer::Pointer(Block *Pointee) Pointer::Pointer(Block *Pointee, unsigned BaseAndOffset) : Pointer(Pointee, BaseAndOffset, BaseAndOffset) {} -Pointer::Pointer(const Pointer &P) : Pointer(P.Pointee, P.Base, P.Offset) {} +Pointer::Pointer(const Pointer &

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -53,6 +57,10 @@ class FunctionPointer final { return toAPValue().getAsString(Ctx, Func->getDecl()->getType()); } + uint32_t getIntegerRepresentation() const { +return static_cast(reinterpret_cast(Func)); + } AaronBallman wrote: This seems dange

[clang] [clang][Interp] Integral pointers (PR #84159)

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

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I think the general direction is pretty reasonable. https://github.com/llvm/llvm-project/pull/84159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -1505,12 +1509,17 @@ bool OffsetHelper(InterpState &S, CodePtr OpPC, const T &Offset, return true; } - if (!CheckNull(S, OpPC, Ptr, CSK_ArrayIndex)) -return false; + if (!CheckNull(S, OpPC, Ptr, CSK_ArrayIndex)) { +// The CheckNul will have emitted a note a

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -1912,6 +1929,10 @@ inline bool NoRet(InterpState &S, CodePtr OpPC) { inline bool NarrowPtr(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); + if (!S.getLangOpts().CPlusPlus) { +S.Stk.push(Ptr); AaronBallman wrote: Might be a good i

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -26,60 +26,98 @@ Pointer::Pointer(Block *Pointee) Pointer::Pointer(Block *Pointee, unsigned BaseAndOffset) : Pointer(Pointee, BaseAndOffset, BaseAndOffset) {} -Pointer::Pointer(const Pointer &P) : Pointer(P.Pointee, P.Base, P.Offset) {} +Pointer::Pointer(const Pointer &

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -187,6 +195,34 @@ bool ByteCodeExprGen::VisitCastExpr(const CastExpr *CE) { return true; } + case CK_IntegralToPointer: { +QualType IntType = SubExpr->getType(); +assert(IntType->isIntegralOrEnumerationType()); +if (!this->visit(SubExpr)) + return f

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -809,9 +809,9 @@ inline bool CmpHelperEQ(InterpState &S, CodePtr OpPC, CompareFn Fn) { // element in the same array are NOT equal. They have the same Base value, // but a different Offset. This is a pretty rare case, so we fix this here // by comparing pointers

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -2180,6 +2201,14 @@ inline bool GetFnPtr(InterpState &S, CodePtr OpPC, const Function *Func) { return true; } +template ::T> +inline bool GetIntPtr(InterpState &S, CodePtr OpPC, const Descriptor *Desc) { + const T &IntVal = S.Stk.pop(); + + S.Stk.push(static_cast(IntVa

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -88,6 +126,12 @@ APValue Pointer::toAPValue() const { if (isZero()) return APValue(static_cast(nullptr), CharUnits::Zero(), Path, /*IsOnePastEnd=*/false, /*IsNullPtr=*/true); + if (isIntegralPointer()) { +return APValue(static_cast(nullptr), +

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -123,8 +167,9 @@ APValue Pointer::toAPValue() const { Path.push_back(APValue::LValuePathEntry({BaseOrMember, IsVirtual})); Ptr = Ptr.getBase(); continue; + +llvm_unreachable("Invalid field type"); AaronBallman wrote: Errr...

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -26,60 +26,98 @@ Pointer::Pointer(Block *Pointee) Pointer::Pointer(Block *Pointee, unsigned BaseAndOffset) : Pointer(Pointee, BaseAndOffset, BaseAndOffset) {} -Pointer::Pointer(const Pointer &P) : Pointer(P.Pointee, P.Base, P.Offset) {} +Pointer::Pointer(const Pointer &

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -172,72 +217,107 @@ class Pointer { Adjust = sizeof(InitMapPtr); else Adjust = sizeof(InlineDescriptor); - return Pointer(Pointee, Base, Base + getSize() + Adjust); + return Pointer(asBlockPointer().Pointee, asBlockPointer().Base, +

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -28,11 +28,26 @@ class Block; class DeadBlock; class Pointer; class Context; +template class Integral; enum PrimType : unsigned; class Pointer; inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P); +struct BlockPointer { Aaro

[clang] [clang][Interp] Integral pointers (PR #84159)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -26,60 +26,98 @@ Pointer::Pointer(Block *Pointee) Pointer::Pointer(Block *Pointee, unsigned BaseAndOffset) : Pointer(Pointee, BaseAndOffset, BaseAndOffset) {} -Pointer::Pointer(const Pointer &P) : Pointer(P.Pointee, P.Base, P.Offset) {} +Pointer::Pointer(const Pointer &

[clang] ae79854 - Update C status page now that Clang 18.x is released

2024-03-06 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2024-03-06T08:58:04-05:00 New Revision: ae79854e4dcfb923130d3cd751363dbee19cb5b5 URL: https://github.com/llvm/llvm-project/commit/ae79854e4dcfb923130d3cd751363dbee19cb5b5 DIFF: https://github.com/llvm/llvm-project/commit/ae79854e4dcfb923130d3cd751363dbee19cb5b5.diff

[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

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

[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

2024-03-06 Thread Aaron Ballman via cfe-commits
@@ -1635,6 +1635,17 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, if (T->getKeyword() != ElaboratedTypeKeyword::None) OS << " "; NestedNameSpecifier *Qualifier = T->getQualifier(); +if (!Policy.SuppressTagKeyword && Policy.SuppressScope

[clang] [clang] Factor out OpenACC part of `Sema` (PR #84184)

2024-03-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Thank you for this factoring! Personally, I think this is a good model to go with for factoring functionality out of Sema and adding a tiny bit of layering to this part of the compiler (full disclosure: Vlad and I worked on this design offline). However, I added several oth

<    9   10   11   12   13   14   15   16   17   18   >