[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

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

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -4110,6 +4116,10 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, } bool IsConstant = BaseType.isConstant(Info.Ctx); +bool ConstexprVar = false; +if (const auto *VD = dyn_cast_if_present( +Info.EvaluatingDecl.dyn_cast()

[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
@@ -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
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/73099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[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
@@ -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
@@ -14397,17 +14559,21 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { QualType baseType = Context.getBaseElementType(type); bool HasConstInit = true; + if (getLangOpts().C23 && var->isConstexpr() && !Init) +Diag(var->getLocation(), diag::err_constexpr

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

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -8857,7 +8894,9 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { if (NewVD->isConstexpr() && !T->isDependentType() && RequireLiteralType(NewVD->getLocation(), T, - diag::err_constexpr_var_non_literal)) { +

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

2023-11-28 Thread Aaron Ballman via cfe-commits
@@ -9237,6 +9282,22 @@ static FunctionDecl *CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, FunctionDecl *NewFD = nullptr; bool isInline = D.getDeclSpec().isInlineSpecified(); + ConstexprSpecKind ConstexprKind = D.getDeclSpec().getConstexprSpecifier(); + if (Constex

[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
@@ -0,0 +1,86 @@ +// RUN: %clang_cc1 -std=c2x -verify -triple x86_64 -pedantic -Wno-conversion -Wno-constant-conversion %s + +/* WG14 N3018: Full + * The constexpr specifier for object definitions + */ + +#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL) +#define UINT_MAX (__INT_

[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
@@ -8605,6 +8620,28 @@ static bool checkForConflictWithNonVisibleExternC(Sema &S, const T *ND, return false; } +static bool CheckC23ConstexprVarTypeQualifiers(Sema &SemaRef, + SourceLocation VarLoc, +

[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] Move documentation about -verify from a header to public docs (PR #73694)

2023-11-28 Thread Aaron Ballman via cfe-commits
rom 12a2c85005c32e55541bc7f9ebb54920111ca8f3 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 28 Nov 2023 14:23:08 -0500 Subject: [PATCH] Move documentation about -verify from a header to public docs The internals manual seems like a more obvious home for the details instead of hiding them away in a header file and rely

[clang] Move documentation about -verify from a header to public docs (PR #73694)

2023-11-29 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Would it make sense to document this more publicly? While it's designed to be > an internal tool, it's really useful for people who want to make sure their > library produces high quality diagnostics (e.g. `nodiscard`, `static_assert`s > etc.). I'm sure you are aware that

[clang] Move documentation about -verify from a header to public docs (PR #73694)

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

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for the documentation! In general, it's looking great. I did have some specific questions or ideas on the more user-facing documentation. I've not yet thoroughly reviewed the implementation plans docs. One thing that's not clear from this is

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

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

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [Clang] Implement P2864R2 Remove Deprecated Arithmetic Conversion on… (PR #73105)

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

[clang] [Clang] Implement P2864R2 Remove Deprecated Arithmetic Conversion on… (PR #73105)

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

[clang] [Clang] Implement P2864R2 Remove Deprecated Arithmetic Conversion on… (PR #73105)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -182,6 +182,9 @@ C++2c Feature Support This is applied to both C++ standard attributes, and other attributes supported by Clang. This completes the implementation of `P2361R6 Unevaluated Strings `_ +- Implemented `P2864R2 Remove Deprecated A

[clang] [Clang] Implement P2864R2 Remove Deprecated Arithmetic Conversion on… (PR #73105)

2023-11-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM -- I'm a bit worried about breaking working code, but the user has to explicitly opt into C++26 mode and so it's only slightly unreasonable for them to have to change their previously correct, working code because of this. I say

[clang] [HLSL] Support vector swizzles on scalars (PR #67700)

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

[clang] [Clang] Implement P2308R1 - Template Parameter Initialization. (PR #73103)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -62,7 +62,7 @@ namespace ClassNTTP { template constexpr int f() { return a.y; } static_assert(f() == 2); - template int id; + template int id; // expected-note {{passing argument to parameter 'a' here}} AaronBallman wrote: What diagnostic is this no

[clang] [Clang] Implement P2308R1 - Template Parameter Initialization. (PR #73103)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors \ AaronBallman wrote: I don't think we need `-fexceptions -fcxx-exceptions -Wno-variadic-macros -Wno-c11-extensions` either.

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -4739,6 +4753,76 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, llvm_unreachable("Improper second standard conversion"); } + if (SCS.Element != ICK_Identity) { +// if SCS.Element is not ICK_Identity the To and From types must be HLSL ---

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -4966,6 +4967,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); } + AaronBallman wrote: Spurious whitesp

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -123,82 +123,59 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc, /// GetConversionRank - Retrieve the implicit conversion rank /// corresponding to the given implicit conversion kind. ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -361,6 +361,9 @@ CAST_OPERATION(AddressSpaceConversion) // Convert an integer initializer to an OpenCL sampler. CAST_OPERATION(IntToOCLSampler) +// Truncate a vector type (HLSL only). +CAST_OPERATION(VectorTruncation) AaronBallman wrote: Should we name thi

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Adding some additional reviewers to look over codegen changes and also for another set of eyes on the conversion changes in Sema (the changes look correct to me, but conversion logic is dense enough that getting more eyes on it is a good idea). https://github.com/llvm/llvm

[clang] [Clang] Implement P2308R1 - Template Parameter Initialization. (PR #73103)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -62,7 +62,7 @@ namespace ClassNTTP { template constexpr int f() { return a.y; } static_assert(f() == 2); - template int id; + template int id; // expected-note {{passing argument to parameter 'a' here}} AaronBallman wrote: Ahhh, it was just out of s

[clang] aeb051a - Correct the documentation category for the 'cleanup' attribute

2023-11-29 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2023-11-29T12:08:39-05:00 New Revision: aeb051affe690d42e4a7bf96b4704244acc6cefb URL: https://github.com/llvm/llvm-project/commit/aeb051affe690d42e4a7bf96b4704244acc6cefb DIFF: https://github.com/llvm/llvm-project/commit/aeb051affe690d42e4a7bf96b4704244acc6cefb.diff

[clang] 2273ee0 - Remove an outdated comment; NFC

2023-11-29 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2023-11-29T12:13:12-05:00 New Revision: 2273ee086a5ecd676b0d9782f7b55c8fa2409b35 URL: https://github.com/llvm/llvm-project/commit/2273ee086a5ecd676b0d9782f7b55c8fa2409b35 DIFF: https://github.com/llvm/llvm-project/commit/2273ee086a5ecd676b0d9782f7b55c8fa2409b35.diff

[clang] [Clang][Sema] Don't say "is declared here" for invalid template locations (PR #71264)

2023-11-29 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > ping. @AaronBallman Does this look like a reasonable thing to do to you? Sorry for the delay on the review! I agree that "is declared here" is useless when "here" is... nowhere. But the point to the note is to help the user to see what the actual declaration is to help t

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -123,82 +123,59 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc, /// GetConversionRank - Retrieve the implicit conversion rank /// corresponding to the given implicit conversion kind. ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

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

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * +namespace { + +struct MemberExprBaseVisitor +: public StmtVisitor { + MemberExprBaseVisitor() = default; + + //===--

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I added the codegen code owners for opinions, but personally, I prefer the direction this patch is heading over the one in https://github.com/llvm/llvm-project/pull/73465 https://github.com/llvm/llvm-project/pull/73730

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -956,42 +956,70 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * +namespace { + +struct MemberExprBaseVisitor +: public StmtVisitor { + MemberExprBaseVisitor() = default; + + //===--

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * +namespace { + +struct MemberExprBaseVisitor +: public StmtVisitor { + MemberExprBaseVisitor() = default; + + //===--

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman It's not letting me comment on your comment. While a compound > literal doesn't have a DRE, it's also not a flexible array, so it's not > supposed to get this far. Note that this method should only be executed if > the flexible array member exists and has th

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * +namespace { + +struct MemberExprBaseVisitor +: public StmtVisitor { + MemberExprBaseVisitor() = default; + + //===--

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -956,42 +956,72 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * +namespace { + +struct MemberExprBaseVisitor +: public StmtVisitor { + MemberExprBaseVisitor() = default; + + //===--

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

2023-11-29 Thread Aaron Ballman via cfe-commits
@@ -1464,6 +1467,21 @@ class AnnotatingParser { } } + void parseEmbedDirective() { +if (CurrentToken && CurrentToken->is(tok::less)) { + next(); + while (CurrentToken) { +// Mark tokens up to the trailing line comments as implicit string +/

[llvm] [clang] [clang-tools-extra] [STLExtras] Add out-of-line definition of friend operator== for C++20 (PR #72348)

2023-11-30 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I am awaiting C++20 build bots to be updated to 17.0.6. (cc: @ilya-biryukov) > > FYI: @cor3ntin @AaronBallman with this change, clang 17.0.6 would be the > minimum version to build LLVM in C++20 after this change. Would you like me > to announce it somewhere or update som

[compiler-rt] [libc] [lld] [lldb] [clang-tools-extra] [llvm] [flang] [libcxx] [clang] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-30 Thread Aaron Ballman via cfe-commits
@@ -286,7 +286,33 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS, lmKind = LengthModifier::AsInt3264; break; case 'w': - lmKind = LengthModifier::AsWide; ++I; break; + ++I; + if (I == E) return false; + if (*I == 'f

[compiler-rt] [lld] [libcxx] [llvm] [clang] [lldb] [libc] [clang-tools-extra] [flang] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-30 Thread Aaron Ballman via cfe-commits
@@ -286,7 +286,33 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS, lmKind = LengthModifier::AsInt3264; break; case 'w': - lmKind = LengthModifier::AsWide; ++I; break; + ++I; + if (I == E) return false; + if (*I == 'f

[clang] 1d05b21 - Add test coverage for -Wunknown-directives; NFC

2023-11-30 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2023-11-30T11:00:46-05:00 New Revision: 1d05b21e035f579af2f96b4a61847d2c9f358ac2 URL: https://github.com/llvm/llvm-project/commit/1d05b21e035f579af2f96b4a61847d2c9f358ac2 DIFF: https://github.com/llvm/llvm-project/commit/1d05b21e035f579af2f96b4a61847d2c9f358ac2.diff

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-11-30 Thread Aaron Ballman via cfe-commits
@@ -123,82 +123,59 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc, /// GetConversionRank - Retrieve the implicit conversion rank /// corresponding to the given implicit conversion kind. ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind

[clang] [clang] Use the materialized temporary's type while creating the APValue (PR #73355)

2023-11-30 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM -- thank you for the detailed analysis in the issue and fix! https://github.com/llvm/llvm-project/pull/73355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[flang] [compiler-rt] [libunwind] [libcxx] [clang] [lld] [clang-tools-extra] [lldb] [libc] [llvm] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-12-01 Thread Aaron Ballman via cfe-commits
@@ -286,7 +286,33 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS, lmKind = LengthModifier::AsInt3264; break; case 'w': - lmKind = LengthModifier::AsWide; ++I; break; + ++I; + if (I == E) return false; + if (*I == 'f

[lldb] [flang] [libunwind] [clang-tools-extra] [libcxx] [clang] [libc] [compiler-rt] [llvm] [lld] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-12-01 Thread Aaron Ballman via cfe-commits
@@ -537,8 +557,12 @@ ArgType PrintfSpecifier::getScalarArgType(ASTContext &Ctx, ArgType(Ctx.getPointerDiffType(), "ptrdiff_t")); case LengthModifier::AsAllocate: case LengthModifier::AsMAllocate: - case LengthModifier::AsWide: return ArgTyp

[compiler-rt] [lld] [lldb] [libunwind] [flang] [llvm] [libcxx] [libc] [clang-tools-extra] [clang] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-12-01 Thread Aaron Ballman via cfe-commits
@@ -286,7 +286,33 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS, lmKind = LengthModifier::AsInt3264; break; case 'w': - lmKind = LengthModifier::AsWide; ++I; break; + ++I; + if (I == E) return false; + if (*I == 'f

[clang] [lldb] [libc] [clang-tools-extra] [lld] [libcxx] [llvm] [libunwind] [flang] [compiler-rt] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-12-01 Thread Aaron Ballman via cfe-commits
@@ -460,6 +463,14 @@ class FormatSpecifier { FieldWidth = Amt; } + void setExplicitlyFixedSize(unsigned s) { +ExplicitlyFixedSize = s; AaronBallman wrote: ```suggestion void setExplicitlyFixedSize(unsigned S) { ExplicitlyFixedSize = S; ``` h

[clang] [clang][NFC] Adjust TBAA Base Info API (PR #73263)

2024-01-08 Thread Aaron Ballman via cfe-commits
@@ -95,8 +95,6 @@ static bool TypeHasMayAlias(QualType QTy) { /// Check if the given type is a valid base type to be used in access tags. static bool isValidBaseType(QualType QTy) { - if (QTy->isReferenceType()) -return false; AaronBallman wrote: This lo

[clang] [libcxx] [lld] [lldb] [compiler-rt] [clang-tools-extra] [openmp] [mlir] [llvm] [flang] [clang] Add `intrin0.h` header to mimic `intrin0.h` used by MSVC STL for clang-cl (PR #75711)

2024-01-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > If we land this as-is, it'll tank build time on Windows. I would like some measurements so we can compare build times on Windows. https://github.com/llvm/llvm-project/pull/75711 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'm not fan about this check. For me there is no use case for it. Yeah, I don't see much motivation for the check. I know that once upon a time (my grey beard is showing, lol) there were compiler bugs in some implementations where a missing return statement in `main` woul

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-10 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The changes also need a release note. https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

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

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-10 Thread Aaron Ballman via cfe-commits
@@ -6771,6 +6771,9 @@ def warn_pointer_sub_null_ptr : Warning< def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, InGroup>, DefaultIgnore; +def warn_fast_floatingpoint_eq : Warning< + "explicit comparison with %0 when the program is a

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-10 Thread Aaron Ballman via cfe-commits
@@ -9090,10 +9092,16 @@ bool Sema::SemaBuiltinVAStartARMMicrosoft(CallExpr *Call) { /// SemaBuiltinUnorderedCompare - Handle functions like __builtin_isgreater and /// friends. This is declared to take (...), so we have to check everything. -bool Sema::SemaBuiltinUnorderedCo

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -6771,6 +6771,9 @@ def warn_pointer_sub_null_ptr : Warning< def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, InGroup>, DefaultIgnore; +def warn_fast_floatingpoint_eq : Warning< + "explicit comparison with %0 when the program is a

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2288,10 +2288,11 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) { ForRangeStmt = Actions.ActOnCXXForRangeStmt( getCurScope(), ForLoc, CoawaitLoc, FirstPart.get(), ForRangeInfo.LoopVar.get(), ForRangeInfo.ColonLoc, CorrectedRan

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2783,6 +2789,7 @@ StmtResult Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, LoopVar->setType(SubstAutoTypeDependent(LoopVar->getType())); } } else if (!BeginDeclStmt.get()) { + AaronBallman wrote: Spurious whitespace change can be removed.

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -6289,9 +6289,19 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, ImmediateCallVisitor V(getASTContext()); if (!NestedDefaultChecking) V.TraverseDecl(Param); -if (V.HasImmediateCalls) { - ExprEvalContexts.back().DelayedDefaultInitial

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

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

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2539,6 +2539,12 @@ StmtResult Sema::ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, return StmtError(); } + if (getLangOpts().CPlusPlus23) { +auto Entity = InitializedEntity::InitializeVariable(RangeVar); AaronBallman wrote: Please spell

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -6305,6 +6315,10 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, if (Res.isInvalid()) return ExprError(); Init = Res.get(); + + // Collect MaterializeTemporaryExprs in the rewrited CXXDefaultArgExpr. AaronBallman

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for this! I think it looks pretty close, but I'd love to get more eyes on this given the importance of the feature. CC @zygoloid @rjmccall @erichkeane https://github.com/llvm/llvm-project/pull/76361 _

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -8244,11 +8229,33 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) { // If the expression is a prvalue after this optional conversion, the // temporary materialization conversion is applied. // -// We skip this step: IR generation is able to synthesiz

[clang] [llvm] New calling convention preserve_none (PR #76868)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2868,6 +2868,11 @@ def M68kRTD: DeclOrTypeAttr { let Documentation = [M68kRTDDocs]; } +def PreserveNone : DeclOrTypeAttr { + let Spellings = [Clang<"preserve_none">]; AaronBallman wrote: Calling conventions are somewhat odd in the attribute system, so

[clang] [clang] Emit bad shift warnings (PR #70307)

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

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wshift-count-negative %s +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wall %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wshift-count-negative %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wall %s + +

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The patch summary doesn't really explain why the changes are needed. Can you explain what problem you're solving (perhaps link to an issue if this is fixing one that was reported by someone)? https://github.com/llvm/llvm-project/pull/70307 ___

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2803,9 +2803,10 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS, // C++11 [expr.shift]p1: Shift width must be less than the bit width of // the shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wshift-negative-value %s +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wall %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wshift-negative-value %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wall %s + +

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -2836,9 +2837,11 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS, // C++11 [expr.shift]p1: Shift width must be less than the bit width of the // shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); -

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-01-11 Thread Aaron Ballman via cfe-commits
@@ -426,7 +426,7 @@ void dr081(void) { /* Demonstrate that we don't crash when left shifting a signed value; that's * implementation defined behavior. */ - _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */ + _Static_assert(-1 << 1 ==

[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)

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

[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)

2024-01-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Aside from a minor NFC nit with where we decide to do the check, this LGTM https://github.com/llvm/llvm-project/pull/74510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

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