[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/136323 >From 3beecb29772e13c6a1a41877e5e8cbbfb17a88f2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 18 Apr 2025 12:26:36 -0400 Subject: [PATCH 1/5] Control analysis-based diagnostics with #pra

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -2493,9 +2493,10 @@ class sema::AnalysisBasedWarnings::InterProceduralData { CalledOnceInterProceduralData CalledOnceData; }; -static unsigned isEnabled(DiagnosticsEngine &D, unsigned diag) { - return (unsigned)!D.isIgnored(diag, SourceLocation()); -} +template +static

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -2504,23 +2505,37 @@ sema::AnalysisBasedWarnings::AnalysisBasedWarnings(Sema &s) NumUninitAnalysisVariables(0), MaxUninitAnalysisVariablesPerFunction(0), NumUninitAnalysisBlockVisits(0), MaxUninitAnalysisBlockVisitsPerFunction(0) { +} + +// We need this he

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/136323 >From 3beecb29772e13c6a1a41877e5e8cbbfb17a88f2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 18 Apr 2025 12:26:36 -0400 Subject: [PATCH 1/4] Control analysis-based diagnostics with #pra

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -2493,35 +2493,44 @@ class sema::AnalysisBasedWarnings::InterProceduralData { CalledOnceInterProceduralData CalledOnceData; }; -static unsigned isEnabled(DiagnosticsEngine &D, unsigned diag) { - return (unsigned)!D.isIgnored(diag, SourceLocation()); +static bool isEnable

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -2493,35 +2493,44 @@ class sema::AnalysisBasedWarnings::InterProceduralData { CalledOnceInterProceduralData CalledOnceData; }; -static unsigned isEnabled(DiagnosticsEngine &D, unsigned diag) { - return (unsigned)!D.isIgnored(diag, SourceLocation()); +static bool isEnable

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -1202,6 +1202,30 @@ Clang also allows you to push and pop the current warning state. This is particularly useful when writing a header file that will be compiled by other people, because you don't know what warning flags they build with. +Note that the following diagnostic

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/136323 >From 3beecb29772e13c6a1a41877e5e8cbbfb17a88f2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 18 Apr 2025 12:26:36 -0400 Subject: [PATCH 1/2] Control analysis-based diagnostics with #pra

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Werror=unreachable-code-aggressive %s + +// Test that analysis-based warnings honor #pragma diagnostic controls. These +// diagnostics are triggered at the end of a function body, so the pragma needs +// to be enabled thr

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
@@ -1202,6 +1202,30 @@ Clang also allows you to push and pop the current warning state. This is particularly useful when writing a header file that will be compiled by other people, because you don't know what warning flags they build with. +Note that the following diagnostic

[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)

2025-04-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > Do we need a deprecation period for this change? This will break anyone > > using the old names in scripts and whatnot. > > Also, the changes will need something in the release notes so users know > > about the new names. > > Is there a specific way to mark flags as dep

[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > @cor3ntin I question if `-Wloop-analysis` should be completely rewritten > > using dataflow analysis, rather than AST based matching. > > That's an interesting idea, but I don't think that should stop us from > landing this improvement. Maybe we want to open an issue fo

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-18 Thread Aaron Ballman via cfe-commits
8f2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 18 Apr 2025 12:26:36 -0400 Subject: [PATCH] Control analysis-based diagnostics with #pragma Previously, analysis-based diagnostics (like -Wconsumed) had to be enabled at file scope in order to be run at the end of each function body. T

[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)

2025-04-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: So I think the things that are missing are: 1) If `Insert` or `Remove` is true, we should diagnose those as being deprecated and recommend using `disable-insert` or `disable-remove` instead. 2) A release note should be added to clang-tools-extra/docs/R

[clang] Give this diagnostic a diagnostic group (PR #136182)

2025-04-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/136182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Give this diagnostic a diagnostic group (PR #136182)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/136182 I put this under -Wunitialized because that's the same group it's under in GCC. Fixes #41104 >From a195528d6db796b8925be3d43802ced6d931a9a2 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread Aaron Ballman via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread Aaron Ballman via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [clang] Add source range to 'use of undeclared identifier' diagnostics (PR #117671)

2025-04-17 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/117671 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/6] Disable -fdollars-in-identifiers by default Cl

[clang] a84a6f7 - Fix this _Countof test for 32 vs 64-bits

2025-04-17 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2025-04-17T07:36:48-04:00 New Revision: a84a6f7dd68b218757e192fe21a806c80ef0b63d URL: https://github.com/llvm/llvm-project/commit/a84a6f7dd68b218757e192fe21a806c80ef0b63d DIFF: https://github.com/llvm/llvm-project/commit/a84a6f7dd68b218757e192fe21a806c80ef0b63d.diff

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-04-17 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > hi @AaronBallman, no unfortunately we didn't make any progress here, and I > just verified that reproducer from [#118480 > (comment)](https://github.com/llvm/llvm-project/pull/118480#issuecomment-2538988006) > is still triggering the issue (with -std=c++20). Internal val

[clang] [clang] Implement dump() for MemberPointer APValues (PR #136130)

2025-04-17 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > Can you do the JSONNodeDumper as well so the two stay somewhat in-sync? > > Looks like that goes through `APValue::printPretty()`, so nothing to do for > that. Ah, good to know, thanks! https://github.com/llvm/llvm-project/pull/136130 __

[clang] [clang] Implement dump() for MemberPointer APValues (PR #136130)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM assuming precommit CI is happy too. https://github.com/llvm/llvm-project/pull/136130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-04-17 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > ping, is this still a problem? > > > > > > yes, this is still happening. but I am currently lacking cycles to dig > > deeper into expression evaluation to see if this is the right fix given the > > reproducer. @VitaNuo was to take a look with some limited capacity, b

[clang] [clang] Implement dump() for MemberPointer APValues (PR #136130)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Can you do the JSONNodeDumper as well so the two stay somewhat in-sync? https://github.com/llvm/llvm-project/pull/136130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [clang][ExprConst] Diagnose ptr subs with non-zero offset (PR #135938)

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

[clang] 4bd9b9e - Fix failing bot with changes to _Countof testing

2025-04-17 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2025-04-17T07:32:12-04:00 New Revision: 4bd9b9e9adf9db1a326e2f2fa616c714beb83c4f URL: https://github.com/llvm/llvm-project/commit/4bd9b9e9adf9db1a326e2f2fa616c714beb83c4f DIFF: https://github.com/llvm/llvm-project/commit/4bd9b9e9adf9db1a326e2f2fa616c714beb83c4f.diff

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread Aaron Ballman via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { ---

[clang] [clang] Implement StmtPrinter for EmbedExpr (PR #135957)

2025-04-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Precommit CI failures appear to be unrelated. https://github.com/llvm/llvm-project/pull/135957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread Aaron Ballman via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread Aaron Ballman via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] c536967 - Split _Countof tests into two files; NFC

2025-04-17 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2025-04-17T07:13:31-04:00 New Revision: c536967af123c30b43f186133e8719e0090f24a6 URL: https://github.com/llvm/llvm-project/commit/c536967af123c30b43f186133e8719e0090f24a6 DIFF: https://github.com/llvm/llvm-project/commit/c536967af123c30b43f186133e8719e0090f24a6.diff

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > We should disable the warning if we're preprocessing asm, which should mostly > solve the issue with warnings. Effectively checking for `LangOpts.DollarIdents || LangOpts.AsmPreprocessor`? Or do you think `DollarIdents` should be true if `AsmPreprocessor` is true? https:

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

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > IMO, we are better served by a warning diagnostic if we detect these are > > misused. `ParseCXXCondition` (or the C equivalent, but since you are > > returning bool it seems you're not concerned about C?) might be a good > > place to set a variable to enable the warning

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Doesn't the Linux kernel use it for syscall names? Might be wrong on this. CC @nathanchance @nickdesaulniers for more information, but even if the kernel does, is it a significant imposition to pass `-fdollars-in-identifiers` to enable the extension explicitly? https://g

[clang] [clang] Implement StmtPrinter for EmbedExpr (PR #135957)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -1284,7 +1284,11 @@ void StmtPrinter::VisitSourceLocExpr(SourceLocExpr *Node) { } void StmtPrinter::VisitEmbedExpr(EmbedExpr *Node) { - llvm::report_fatal_error("Not implemented"); + // Embed parameters are not reflected in the AST, so there is no way to print --

[clang] [clang] Implement StmtPrinter for EmbedExpr (PR #135957)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -4049,5 +4050,13 @@ void Preprocessor::HandleEmbedDirective(SourceLocation HashLoc, Token &EmbedTok, if (Callbacks) Callbacks->EmbedDirective(HashLoc, Filename, isAngled, MaybeFileRef, *Params); - HandleEmbedDirectiveImpl(HashLoc, *Param

[clang] [clang] Implement StmtPrinter for EmbedExpr (PR #135957)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/135957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement StmtPrinter for EmbedExpr (PR #135957)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Can fix up the formatting issues found by precommit CI, and the change should also come with a release note. https://github.com/llvm/llvm-project/pull/135957 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > It appears that gcc only disallows '$' in identifiers in C++26 mode. Not sure > how relevant that is to clang. > [bugzilla](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343) Or am I > misreading that thread? I get the same reading, but I am not certain we want to foll

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > If you don't want to do anything fancy, can you just add a warning in > Lexer::LexTokenInternal if we see a '$' (where we set the token type to > tok::unknown)? That should be easy to implement, and have zero impact on > lexer performance. Okay, that's pretty reasonable.

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/5] Disable -fdollars-in-identifiers by default Cl

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman requested changes to this pull request. > This patch adds support for GCC bound member functions extension: > https://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html > > Related issue: #22495 Closes #82727 I think this requires an RFC justifying carrying

[clang] [NFC][Clang] Introduce type aliases to replace use of auto in clang/lib/CodeGen/CGCall.cpp. (PR #135861)

2025-04-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! We could do further coding style adjustments if we wanted (particularly around naming conventions), but I don't insist; this is still forward progress. Thank you! https://github.com/llvm/llvm-project/pull/135861

[clang] [llvm] [ARM] Adding diagnostics for mcmodel=tiny when used in invalid targets (PR #125643)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -44,3 +44,5 @@ // ERR-AARCH64_32: error: unsupported argument 'small' to option '-mcmodel=' for target 'aarch64_32-unknown-linux' // ERR-LOONGARCH64-PLT-EXTREME: error: invalid argument '-mcmodel=extreme' not allowed with '-fplt' + +// CHECK: error: unsupported argument '

[clang] [llvm] [ARM] Adding diagnostics for mcmodel=tiny when used in invalid targets (PR #125643)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -1,5 +1,5 @@ // RUN: not %clang -### -c --target=i686 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s -// RUN: %clang --target=x86_64 -### -c -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=TINY %s +// RUN: not %clang --target=x86_64 -### -c -mcmodel=tiny %

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Aaron Ballman via cfe-commits
@@ -7,7 +7,7 @@ #define foo`bar /* expected-error {{whitespace required after macro name}} */ #define foo2!bar /* expected-warning {{whitespace recommended after macro name}} */ -#define foo3$bar /* expected-error {{'$' in identifier}} */ +#define foo3$bar /* expected-er

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman Were you able to manually cherry-pick this one? Yup! That was handled in https://github.com/llvm/llvm-project/pull/135798 thank you! https://github.com/llvm/llvm-project/pull/135660 ___ cfe-commits mailing list cfe

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

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > So the changes needed to move this patch forward are to only perform the > attribute check when we're checking for a valid redefinition, not type > compatibility in general. A follow-up to improve upon this can do the layout > check when looking for compatibility. Alterna

[clang] clang_EvalResult_getAsCXString impl (PR #134551)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > What if we add unsigned clang_getCStringLength(CXString); which gets the > > length but not the contents? Do we need to package pointer and size > > together? > > Where do we store the length, if we can't add a new field to `CXString`, and > we can't use `private_flags

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Yes please. :-) And thanks very much. You're welcome, thanks for bringing the issue up and sticking with me until I understood it. :-D I've posted https://github.com/llvm/llvm-project/pull/135798 to backport to 20.x https://github.com/llvm/llvm-project/pull/86131 ___

[clang] clang_EvalResult_getAsCXString impl (PR #134551)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > `CXString::private_flags` only has 2 bits used. Could we use the rest for the > size? Would it be enough? I'd be a bit uncomfortable with that. It would work, but it means we're never able to add any new private flags in the future. > There's also the possibility to not

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > ping, is this still a problem? > > yes, this is still happening. but I am currently lacking cycles to dig deeper > into expression evaluation to see if this is the right fix given the > reproducer. @VitaNuo was to take a look with some limited capacity, but I > think s

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

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -717,6 +717,12 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { return false; } + if (const FunctionDecl *CalleeDecl = CE->getDirectCallee(); + CalleeDecl && CalleeDecl->hasAttr()) { +Diag(St->getBeginLoc(), diag::err_musttail_mismatch) <<

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

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

[clang] [libcxxabi] [llvm] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! The precommit CI failure appears to be unrelated. https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/135660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Allow some attributes on declarations after definitions (PR #135791)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/135791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -24,7 +24,7 @@ int templateFunction(T value) __attribute__((annotate("works"))); // CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2] // CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8] -// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60]

[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -2,3 +2,26 @@ _Alignas(int) struct c1; // expected-warning {{'_Alignas' attribute ignored}} alignas(int) struct c1; // expected-warning {{'alignas' attribute ignored}} + + +__attribute__(()) [[]] alignas(int) int a; // expected-none TODO: actually this line should be an er

[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -3062,13 +3062,16 @@ class Parser : public CodeCompletionHandler { bool CouldBeBitField = false); Decl *ParseHLSLBuffer(SourceLocation &DeclEnd); - void MaybeParseMicrosoftAttributes(ParsedAttributes &Attrs) { + bool MaybeParseMicrosoftAttrib

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fdollars-in-identifiers -fasm-blocks -emit-llvm -o - | FileCheck %s

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

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. This LGTM, are you happy with it @erichkeane? https://github.com/llvm/llvm-project/pull/134465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > I'm confused -- how is there existing code depending on a builtin which > > doesn't yet exist in Clang? Are we copying these builtins from somewhere > > else? > > This is part of the pointer authentication support we are upstreaming, all of > which has been in use for

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: /cherry-pick d0e4af8a88dc7a0377677000d0c92104ff215347 https://github.com/llvm/llvm-project/pull/135660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I put up #135660 for review, thank you for bringing this up! @pdimov should now be resolved via d0e4af8a88dc7a0377677000d0c92104ff215347; do you need this backported to Clang 20 I suppose? https://github.com/llvm/llvm-project/pull/86131 ___

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman milestoned https://github.com/llvm/llvm-project/pull/135660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Allow some attributes on declarations after definitions (PR #135791)

2025-04-15 Thread Aaron Ballman via cfe-commits
rom fa878e011da7a04ff53ce706b8a9a4f16f82fc18 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 15 Apr 2025 10:36:48 -0400 Subject: [PATCH] Allow some attributes on declarations after definitions The deprecated, maybe_unused, and nodiscard standard attributes may all be applied to a redeclaration afte

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > LGTM. Or should I say, "Thanks, I hate it". > > Do you know how likely it is WG14 come up with a good solution for "arbitrary > function pointer" ? The last we heard on this topic was https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2230.htm which was discussed in Brno

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -4036,6 +4036,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { LangOpts.MicrosoftExt = 1;// To get kw___try, kw___finally. LangOpts.DeclSpecKeyword = 1; // To get __declspec. LangOpts.C99 = 1; // To get kw_restrict for non-underscore-prefixed res

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > If we're going to do this, I think we need better diagnostics. Just > > straight disabling this is going to give very confusing diagnostics to > > anyone actually using dollar-signs in identifiers. > > Some ideas: > > ``` > > * We can give a warning if we see a "$" adjac

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/4] Disable -fdollars-in-identifiers by default Cl

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 %s -triple x86_64-windows -fsyntax-only -Wcast-function-type -Wno-cast-function-type-strict -verify=windows +// RUN: %clang_cc1 %s -triple x86_64-windows -fsyntax-only -Wcast-function-type -Wno-cast-function-type-strict -x c++ -verify=windows

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

2025-04-15 Thread Aaron Ballman via cfe-commits
@@ -732,6 +732,16 @@ CodeGenTypes::arrangeBuiltinFunctionDeclaration(CanQualType resultType, RequiredArgs::All); } +const CGFunctionInfo & +CodeGenTypes::arrangeSYCLKernelCallerDeclaration(QualType resultType, +

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135660 >From 1e9fce88cc5e1d4f75e7126a394ec8f9440b8d63 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 14 Apr 2025 15:21:04 -0400 Subject: [PATCH 1/2] Silence -Wcast-function-type warnings on idioma

[clang] Merge similar Clang Thread Safety attributes (PR #135561)

2025-04-14 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you for the cleanup! The behavioral changes all seem defensible to me. Should those have a release note? https://github.com/llvm/llvm-project/pull/135561 ___ cfe-commits mailing l

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I put up https://github.com/llvm/llvm-project/pull/135660 for review, thank you for bringing this up! https://github.com/llvm/llvm-project/pull/86131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] Silence -Wcast-function-type warnings on idiomatic Windows code (PR #135660)

2025-04-14 Thread Aaron Ballman via cfe-commits
-project/pull/86131 >From 1e9fce88cc5e1d4f75e7126a394ec8f9440b8d63 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 14 Apr 2025 15:21:04 -0400 Subject: [PATCH] Silence -Wcast-function-type warnings on idiomatic Windows code On Windows, GetProcAddress() is the API used to dynamically l

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

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @erichkeane @AaronBallman This is my first time participating in an open > source project. Welcome! > I would like to ask if you have the same opinion so far. I have revised many > versions over and over again. I just hope that the requirements can be > clarified. FWI

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

2025-04-14 Thread Aaron Ballman via cfe-commits
@@ -717,6 +717,13 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { return false; } + if (const FunctionDecl *CalleeDecl = CE->getDirectCallee(); + CalleeDecl && CalleeDecl->hasAttr()) { +Diag(St->getBeginLoc(), diag::err_musttail_mismatch) <<

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Ah, derp, the issue was me not passing `-Wextra` (sorry!). Hmm, yeah, this does seem like a case we probably want to suppress, for similar reasons as we do for `dlsym`. https://github.com/llvm/llvm-project/pull/86131 ___ cfe-commi

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

2025-04-14 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s + +int __attribute__((not_tail_called)) foo1(int a) { +return a + 1; +} + + +int foo2(int a) { +[[clang::musttail]] +return foo1(a); // expected-error {{cannot perform a tail call to function 'foo1' bec

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

2025-04-14 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s + +int __attribute__((not_tail_called)) foo1(int a) { +return a + 1; +} + + +int foo2(int a) { +[[clang::musttail]] +return foo1(a); // expected-error {{cannot perform a tail call to function 'foo1' bec

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Since you aren't diagnosing reinterpret-casting a function pointer from > `void*`, because this would warn on idiomatic POSIX code (`dlsym` returns > `void*`), it seemed to me that you'd be interested in not warning on > idiomatic Windows code (`GetProcAddress` returns `F

[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)

2025-04-14 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Do we need a deprecation period for this change? This will break anyone using the old names in scripts and whatnot. Also, the changes will need something in the release notes so users know about the new names. https://github.com/llvm/llvm-project/pul

[clang] [clang][test] Improve unit tests for Fixed point AST matchers. (PR #134398)

2025-04-14 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/134398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reject character devices in #embed for now (PR #135370)

2025-04-14 Thread Aaron Ballman via cfe-commits
@@ -458,6 +458,8 @@ def warn_compat_pp_embed_directive : Warning< InGroup, DefaultIgnore; def err_pp_embed_dup_params : Error< "cannot specify parameter '%0' twice in the same '#embed' directive">; +def err_pp_embed_device_file : Error< + "device files are not yet supporte

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > I just noticed there's no documentation for > > > `__builtin_virtual_member_address()` so I'm addressing that. > > > Due to code drift and time I realized that they disagree as to whether > > > they should take `C*` or `C&` so I'm going to make them both accept > > >

[clang] Split -Wcast-function-type into a separate group (PR #86131)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > This warning creates issues under Windows, where reinterpret-casting from > FARPROC to the actual function type is common. > > #92738 > [boostorg/interprocess#259](https://github.com/boostorg/interprocess/issues/259) > > Reinterpret-casting a function pointer to another

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > If we're going to do this, I think we need better diagnostics. Just straight > disabling this is going to give very confusing diagnostics to anyone actually > using dollar-signs in identifiers. > > Some ideas: > > * We can give a warning if we see a "$" adjacent to a

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-14 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/3] Disable -fdollars-in-identifiers by default Cl

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-04-14 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman do you have any further requests or changes for this PR? The only outstanding issue I know of is: https://github.com/llvm/llvm-project/pull/100830/files#r2039375386 https://github.com/llvm/llvm-project/pull/100830

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

2025-04-11 Thread Aaron Ballman via cfe-commits
@@ -717,6 +717,12 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { return false; } + if (const FunctionDecl *CalleeDecl = CE->getDirectCallee(); + CalleeDecl && CalleeDecl->hasAttr()) { +Diag(St->getBeginLoc(), diag::err_musttail_mismatch) <<

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/135407 >From c7e0132617ab01c12b393876b39381171996b793 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH 1/2] Disable -fdollars-in-identifiers by default Cl

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

2025-04-11 Thread Aaron Ballman via cfe-commits
@@ -717,6 +717,12 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { return false; } + if (const FunctionDecl *CalleeDecl = CE->getDirectCallee(); + CalleeDecl && CalleeDecl->hasAttr()) { +Diag(St->getBeginLoc(), diag::err_musttail_mismatch) <<

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Aaron Ballman via cfe-commits
n Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 13:03:07 -0400 Subject: [PATCH] Disable -fdollars-in-identifiers by default Clang used to enable -fdollars-in-identifiers by default for compatibility with GCC. However, this is no longer a conforming extension after WG21 P2558R2

[clang] [C23] Fix failed assertions with invalid #embed parameters (PR #135368)

2025-04-11 Thread Aaron Ballman via cfe-commits
Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 11 Apr 2025 09:55:04 -0400 Subject: [PATCH] Fix failed assertions with invalid #embed parameters If the invalid parameter was not the last parameter given, we would fail to skip to the end of the directive and trip a failed assertion. Fi

[clang] [clang] Reject character devices in #embed for now (PR #135370)

2025-04-11 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM assuming precommit CI comes back green. Thank you! https://github.com/llvm/llvm-project/pull/135370 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [clang] Reject character devices in #embed for now (PR #135370)

2025-04-11 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > on Windows we could use something like COM1 on Windows. > > How would that look like? `#embed "COM1" limit(1)` But when I try that on my Windows machine, I get a file not found error. Perhaps try `#embed "NUL" limit(1)`? https://github.com/llvm/llvm-project/pull/13537

  1   2   3   4   5   6   7   8   9   10   >