[clang] [clang] Fix a segfault when M is a nullptr (PR #130712)

2025-03-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This needs a release note and it would be helpful to know how you found this and a test w/ a minimal reproducer. Are there any bugs reports for this? https://github.com/llvm/llvm-project/pull/130712 ___ cfe-commits

[clang] [Sema] Diagnose by-value copy constructors in template instantiations (PR #130866)

2025-03-12 Thread Shafik Yaghmour via cfe-commits
@@ -10921,8 +10921,8 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) { // parameters have default arguments. if (!Constructor->isInvalidDecl() && Constructor->hasOneParamOrDefaultArgs() && - Constructor->getTemplateSpecializationKind() != -

[clang] [Clang] Do not emit nodiscard warnings for the base expr of static member access (PR #131450)

2025-03-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/131450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix an incorrect assumption on getTemplatedDecl() (PR #131559)

2025-03-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the quick fix, I would have also added the test that did not crash but issued a diagnostic from the issue as well: https://github.com/llvm/llvm-project/issues/131530 unless we have a similar test already. https://github.com/llvm/llvm-project/

[clang] [Clang] Increase the default expression nesting limit (PR #132021)

2025-03-19 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think you need to update this too, unless I missed something: https://clang.llvm.org/docs/UsersManual.html#controlling-implementation-limits https://github.com/llvm/llvm-project/pull/132021 ___ cfe-commits mailin

[clang] [libc] [clang] diagnose invalid member pointer class on instantiation (PR #132516)

2025-03-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Why was this landed w/o any approvals? https://github.com/llvm/llvm-project/pull/132516 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Check PP presence when printing stats (PR #131608)

2025-03-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix! Second, that we need a summary explaining the problem and solution. Is this linked to a bug report, if it is, then we should mention that bug report as well. I would also like to see a test showing a case where we successfully print

[clang] [Clang] Do not create dependent CallExpr having UnresolvedLookupExpr inside non-dependent context (PR #124609)

2025-03-21 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Clang does crash with one of the included test cases, if you try to actually > use the function: https://godbolt.org/z/e6e6Ehjoj That is not a regression test, at minimum when fixing a bug we should include a test that directly reproduces the bug to ensure that we don't reintro

[clang] [clang][bytecode][NFC] Add assert to ptrauth_string_discriminator (PR #132527)

2025-03-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: LGTM, thank you for adding this comment! https://github.com/llvm/llvm-project/pull/132527 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/131515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,182 @@ +// RUN: %clang_cc1 %s -std=c++2c -fsyntax-only -verify +// RUN: %clang_cc1 %s -std=c++2c -fsyntax-only -verify -fexperimental-new-constant-interpreter + + +struct S0 {}; +struct S1 {int a;}; +struct S2 {int a; int b;}; +struct S3 {double a; int b; int c;};

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
@@ -257,7 +260,7 @@ Improvements to Clang's diagnostics as function arguments or return value respectively. Note that :doc:`ThreadSafetyAnalysis` still does not perform alias analysis. The feature will be default-enabled with ``-Wthread-safety`` in a future release. -- Th

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/131515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
@@ -368,7 +368,11 @@ std::optional SValBuilder::getConstantVal(const Expr *E) { case Stmt::TypeTraitExprClass: { const auto *TE = cast(E); -return makeTruthVal(TE->getValue(), TE->getType()); +if (TE->isStoredAsBoolean()) + return makeTruthVal(TE->getBoolVa

[clang] [Clang][RFC] Introduce a trait to determine the structure binding size (PR #131515)

2025-03-18 Thread Shafik Yaghmour via cfe-commits
@@ -1911,6 +1911,38 @@ A simplistic usage example as might be seen in standard C++ headers follows: // Emulate type trait for compatibility with other compilers. #endif + +.. _builtin_structured_binding_size-doc: + +__builtin_structured_binding_size (C++) +---

[clang] [C++20][Modules] Prevent premature calls to PassInterestingDeclsToConsumer() within FinishedDeserializing(). (PR #129982)

2025-03-16 Thread Shafik Yaghmour via cfe-commits
@@ -10792,47 +10822,54 @@ void ASTReader::FinishedDeserializing() { --NumCurrentElementsDeserializing; if (NumCurrentElementsDeserializing == 0) { -// Propagate exception specification and deduced type updates along -// redeclaration chains. -// -// We do t

[clang] [C++20][Modules] Prevent premature calls to PassInterestingDeclsToConsumer() within FinishedDeserializing(). (PR #129982)

2025-03-16 Thread Shafik Yaghmour via cfe-commits
@@ -4309,12 +4309,12 @@ Decl *ASTReader::ReadDeclRecord(GlobalDeclID ID) { void ASTReader::PassInterestingDeclsToConsumer() { assert(Consumer); - if (PassingDeclsToConsumer) + if (!CanPassDeclsToConsumer) return; // Guard variable to avoid recursively redoing the

[clang] [Lex][Clang] Add checking to HeaderMapImpl::getString to make it more robust (PR #131677)

2025-04-05 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > LGTM with nit addressed. Test coverage would be nice to add, but not strictly > required if this is purely a defensive measure (which it seems to be). Exactly. https://github.com/llvm/llvm-project/pull/131677 ___ cfe-commits mailing l

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

2025-04-05 Thread Shafik Yaghmour via cfe-commits
@@ -1913,8 +1919,9 @@ TEST_F(StructuralEquivalenceCacheTest, Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false); + get<0>(TU)-

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

2025-04-05 Thread Shafik Yaghmour via cfe-commits
@@ -1849,8 +1852,9 @@ TEST_F(StructuralEquivalenceCacheTest, ReturnStmtNonEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false);

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -156,11 +158,11 @@ struct StructuralEquivalenceTest : ::testing::Test { StructuralEquivalenceContext::NonEquivalentDeclSet NonEquivalentDecls01; StructuralEquivalenceContext::NonEquivalentDeclSet NonEquivalentDecls10; StructuralEquivalenceContext Ctx01( -

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -2080,9 +2090,9 @@ TEST_F(StructuralEquivalenceCacheTest, TemplateParmDepth) { EXPECT_FALSE(isInNonEqCache(std::make_pair(NonEqDecl0, NonEqDecl1), true)); StructuralEquivalenceContext Ctx_IgnoreTemplateParmDepth( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTCo

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -11432,6 +11433,22 @@ static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, return {}; } +QualType ASTContext::mergeTagTypes(QualType LHS, QualType RHS) { + // C17 and earlier and C++ disallow two tag definitions within the same TU + // from bei

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -2003,8 +2012,9 @@ TEST_F(StructuralEquivalenceCacheTest, Cycle) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false); + ge

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -9089,8 +9089,8 @@ bool Sema::hasStructuralCompatLayout(Decl *D, Decl *Suggested) { // FIXME: Add a specific mode for C11 6.2.7/1 in StructuralEquivalenceContext // and isolate from other C++ specific checks. StructuralEquivalenceContext Ctx( - D->getASTContext()

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -1932,8 +1939,9 @@ TEST_F(StructuralEquivalenceCacheTest, VarDeclWithInitNoEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, fa

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -1868,8 +1872,9 @@ TEST_F(StructuralEquivalenceCacheTest, VarDeclNoEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false); +

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -1826,8 +1828,9 @@ TEST_F(StructuralEquivalenceCacheTest, SimpleNonEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false); +

[clang] [clang] Fix static_cast bypassing access control (PR #132285)

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -1572,13 +1571,12 @@ TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, if (RefConv & Sema::ReferenceConversions::DerivedToBase) { Kind = CK_DerivedToBase; -CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, - /*D

[clang] [clang] Fix static_cast bypassing access control (PR #132285)

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -23,3 +22,66 @@ void test(A &a, B &b) { const A &&ar10 = static_cast(xvalue()); const A &&ar11 = static_cast(xvalue()); } + +struct C : private A { // expected-note 4 {{declared private here}} shafik wrote: Normally when we add tests to an existing file

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -1964,8 +1972,9 @@ TEST_F(StructuralEquivalenceCacheTest, SpecialNonEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false); +

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/132939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -4567,8 +4567,9 @@ namespace { Reader.getOwningModuleFile(Cat)) { StructuralEquivalenceContext::NonEquivalentDeclSet NonEquivalentDecls; StructuralEquivalenceContext Ctx( - Cat->getASTContext(), Existing->getASTCo

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: A lot of nits https://github.com/llvm/llvm-project/pull/132939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Do not create dependent CallExpr having UnresolvedLookupExpr inside non-dependent context (PR #124609)

2025-03-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I have a few concerns w/ this PR. Number one we do not cover the original test case which crashes, as far as I can tell none of the tests crash before this fix. This is large oversight. It looks like currently gcc is the only one that rejects this code as w

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/132939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Second round of comments, I may make a third go around but I wouldn't wait for me. https://github.com/llvm/llvm-project/pull/132939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,472 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c23 -pedantic -Wall -Wno-comment -verify=both,c23 %s +// RUN: %clang_cc1 -fsyntax-only -std=c17 -pedantic -Wall -Wno-comment -Wno-c23-extensions -verify=both,c17 %s + +/* WG14 N3037: + * Improved tag compatibility + * + *

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,472 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c23 -pedantic -Wall -Wno-comment -verify=both,c23 %s +// RUN: %clang_cc1 -fsyntax-only -std=c17 -pedantic -Wall -Wno-comment -Wno-c23-extensions -verify=both,c17 %s + +/* WG14 N3037: + * Improved tag compatibility + * + *

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

2025-03-25 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,472 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c23 -pedantic -Wall -Wno-comment -verify=both,c23 %s +// RUN: %clang_cc1 -fsyntax-only -std=c17 -pedantic -Wall -Wno-comment -Wno-c23-extensions -verify=both,c17 %s + +/* WG14 N3037: + * Improved tag compatibility + * + *

[clang] [C2y] Implement WG14 N3369 and N3469 (_Countof) (PR #133125)

2025-03-27 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c2y -pedantic -Wall -Wno-comment -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c2y -pedantic -Wall -Wno-comment -fexperimental-new-constant-interpreter -verify %s + +/* WG14 N3369: Clang 21 + * _Lengthof operator + * +

[clang] [C2y] Implement WG14 N3369 and N3469 (_Countof) (PR #133125)

2025-03-27 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c2y -pedantic -Wall -Wno-comment -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c2y -pedantic -Wall -Wno-comment -fexperimental-new-constant-interpreter -verify %s + +/* WG14 N3369: Clang 21 + * _Lengthof operator + * +

[clang] [Clang] Correct the DeclRefExpr's Type after the initializer gets instantiated (PR #133212)

2025-03-27 Thread Shafik Yaghmour via cfe-commits
@@ -467,3 +467,29 @@ namespace VexingParse { template int var; // expected-note {{declared here}} int x(var); // expected-error {{use of variable template 'var' requires template arguments}} } + +#ifndef PRECXX11 + +namespace GH79750 { shafik wrote: I am

[clang] [Clang][CodeGen] Respect -fwrapv-pointer when emitting struct GEPs (PR #134269)

2025-04-07 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This makes sense to me but this is not my area. https://github.com/llvm/llvm-project/pull/134269 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Make enums trivially equality comparable (PR #133587)

2025-04-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: The summary should not merely link to an issue but describe the problem as well. Two reasons: 1) for folks reading this in git log 2) The issue may not totally explain what is going on. I actually did not get it at first b/c the issue talks about *char* and

[clang] [Clang] Make enums trivially equality comparable (PR #133587)

2025-04-09 Thread Shafik Yaghmour via cfe-commits
@@ -5240,9 +5249,13 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S, static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLocation KeyLoc) { QualType CanonicalType = Type.getCanonicalType(); if (CanonicalType->isIncompleteType() || C

[clang] [Clang] Add non static data member initializer for BindingDecl member Decomp (PR #134969)

2025-04-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/134969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] fix constexpr-unknown handling of self-references. (PR #132990)

2025-03-28 Thread Shafik Yaghmour via cfe-commits
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown { int y; constinit int& g = (x,y); // expected-warning {{left operand of comma operator has no effect}} } + +namespace uninit_reference_used { + int y; + constexpr int &r = r; // expected-error {{must be ini

[clang] [C2y] Add octal prefixes, deprecate unprefixed octals (PR #131626)

2025-03-17 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -verify=expected,c2y -pedantic -std=c2y %s +// RUN: %clang_cc1 -verify=expected,c2y,compat -Wpre-c2y-compat -std=c2y %s +// RUN: %clang_cc1 -verify=expected,ext -pedantic -std=c23 %s +// RUN: %clang_cc1 -verify=expected,cpp -pedantic -x c++ -W

[clang] [clang-tools-extra] [Clang] Implement CWG2813: Class member access with prvalues (PR #120223)

2025-03-14 Thread Shafik Yaghmour via cfe-commits
shafik wrote: It looks like this is linked to: https://github.com/llvm/llvm-project/issues/131410 and it is not clear to me the diagnostic in these cases makes a lot of sense or at least the motivation does not feel strong to me. This new approach feels evolutionary to me and if this was the

[clang] [C2y] Add octal prefixes, deprecate unprefixed octals (PR #131626)

2025-03-17 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -verify=expected,c2y -pedantic -std=c2y %s +// RUN: %clang_cc1 -verify=expected,c2y,compat -Wpre-c2y-compat -std=c2y %s +// RUN: %clang_cc1 -verify=expected,ext -pedantic -std=c23 %s +// RUN: %clang_cc1 -verify=expected,cpp -pedantic -x c++ -W

[clang] [C2y] Add octal prefixes, deprecate unprefixed octals (PR #131626)

2025-03-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/131626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [clang] fix diagnostic printing of expressions ignoring LangOpts (PR #134693)

2025-04-08 Thread Shafik Yaghmour via cfe-commits
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr, friend class ASTStmtWriter; }; +/// Insertion operator for diagnostics. This allows sending +/// Expr into a diagnostic with <<. +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +

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

2025-03-29 Thread Shafik Yaghmour via cfe-commits
@@ -1886,8 +1891,9 @@ TEST_F(StructuralEquivalenceCacheTest, VarDeclWithDifferentStorageClassNoEq) { Lang_CXX03); StructuralEquivalenceContext Ctx( - get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(), - NonEquivalentDecls, StructuralEquivalenceKind::D

[clang] [Sema] Handle AttributedType in template deduction with derived-to-base conversions (PR #134361)

2025-04-04 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This should have had a release note. https://github.com/llvm/llvm-project/pull/134361 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libc] [clang] diagnose invalid member pointer class on instantiation (PR #132516)

2025-04-04 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Why was this landed w/o any approvals? I am reading the PR and I see now this was a fix for something you just landed but that was not clear from the summary in the PR. https://github.com/llvm/llvm-project/pull/132516 ___ cfe-commits

[clang] [Lex][Clang] Add checking to HeaderMapImpl::getString to make it more robust (PR #131677)

2025-04-04 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/131677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression (PR #132919)

2025-03-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: CC @mizvekov since it was suggested this is related to https://github.com/llvm/llvm-project/issues/126550 and it looked like based on the conversation there, there was some existing work going on. https://github.com/llvm/llvm-project/pull/132919 ___

[clang] [clang] fix constexpr-unknown handling of self-references. (PR #132990)

2025-03-28 Thread Shafik Yaghmour via cfe-commits
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E, Result = VD->getEvaluatedValue(); - // C++23 [expr.const]p8 - // ... For such an object that is not usable in constant expressions, the - // dynamic type of the object is constexpr-un

[clang] [clang] Fix nullptr dereference when checking friend default comparison (PR #132320)

2025-04-04 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: @BruceAko why did you close the PR? https://github.com/llvm/llvm-project/pull/132320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Accept recursive non-dependent calls to functions with deduced return type (PR #75456)

2025-04-04 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Looks like this is linked to the following regression: https://github.com/llvm/llvm-project/issues/133688 https://github.com/llvm/llvm-project/pull/75456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [Clang] [Sema] Document invariant in Sema::AddOverloadCandidate (PR #135256)

2025-04-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/135256 Static analysis flagged 1 - ArgIdx in Sema::AddOverloadCandidate for its potential to overflow. Turns out this is intentional since when PO == OverloadCandidateParamOrder::Reversed Args.size() is always two, so

[clang] [Clang][P1061] Fix invalid pack binding crash (PR #135129)

2025-04-10 Thread Shafik Yaghmour via cfe-commits
@@ -3,9 +3,15 @@ // RUN: %clang_cc1 -std=c++23 -verify=cxx23,nontemplate -fsyntax-only -Wc++26-extensions %s void decompose_array() { - int arr[4] = {1, 2, 3, 6}; shafik wrote: We should have both cases tested, we want as wide test coverage as possible. S

[clang] [Clang][P1061] Fix invalid pack binding crash (PR #135129)

2025-04-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/135129 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][P1061] Fix invalid pack binding crash (PR #135129)

2025-04-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the quick fix, I left a comment on the test which should be addressed in a follow up, unless I am missing something and the coverage is elsewhere already. https://github.com/llvm/llvm-project/pull/135129 ___

[clang] [Clang] Make enums trivially equality comparable (PR #133587)

2025-04-15 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > > The summary should not merely link to an issue but describe the problem as > > well. Two reasons: > > ``` > > 1. for folks reading this in git log > > > > 2. The issue may not totally explain what is going on. > > ``` > > > > > > > > > > > > > > > >

[clang] [Clang] Make enums trivially equality comparable (PR #133587)

2025-04-15 Thread Shafik Yaghmour via cfe-commits
@@ -5240,9 +5249,13 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S, static bool isTriviallyEqualityComparableType(Sema &S, QualType Type, SourceLocation KeyLoc) { QualType CanonicalType = Type.getCanonicalType(); if (CanonicalType->isIncompleteType() || C

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

2025-04-15 Thread Shafik Yaghmour via cfe-commits
@@ -5349,6 +5350,40 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_virtual_member_address: { +Address This = EmitLValue(E->getArg(0)).getAddress(); +APValue ConstMemF

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

2025-04-15 Thread Shafik Yaghmour via cfe-commits
@@ -5349,6 +5350,40 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_virtual_member_address: { +Address This = EmitLValue(E->getArg(0)).getAddress(); +APValue ConstMemF

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

2025-04-15 Thread Shafik Yaghmour 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] [clang] Constant-evaluate format strings as last resort (PR #135864)

2025-04-15 Thread Shafik Yaghmour via cfe-commits
@@ -3,6 +3,11 @@ // RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -triple=x86_64-unknown-fuchsia %s // RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -triple=x86_64-linux-android %s +// expected-n

[clang] [clang] fix unresolved dependent template specialization mangling (PR #135111)

2025-04-17 Thread Shafik Yaghmour via cfe-commits
shafik wrote: This crash is also linked to this PR: https://github.com/llvm/llvm-project/issues/136119 https://github.com/llvm/llvm-project/pull/135111 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [clang] fix unresolved dependent template specialization mangling (PR #135111)

2025-04-17 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > https://godbolt.org/z/sY44dG6Ya is the reproducer. It is not super small but > still should give an idea as the stack is quite similar to stuff touched by > this PR. Did you open a bug report? Maybe w/ reduction is ends up the same as the one I just linked to. https://github.

[clang] [clang] fix unresolved dependent template specialization mangling (PR #135111)

2025-04-17 Thread Shafik Yaghmour via cfe-commits
shafik wrote: CC @var-const https://github.com/llvm/llvm-project/pull/135111 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-17 Thread Shafik Yaghmour via cfe-commits
@@ -299,3 +299,18 @@ void test10() { for (auto[i, j, k] = arr; i < a; ++i) { } for (auto[i, j, k] = arr; i < a; ++arr[0]) { } }; + +extern void foo(int); shafik wrote: Can we also get tests that show diagnostics for lambda cases as well. https://github.co

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

2025-04-17 Thread Shafik Yaghmour via cfe-commits
@@ -299,3 +299,18 @@ void test10() { for (auto[i, j, k] = arr; i < a; ++i) { } for (auto[i, j, k] = arr; i < a; ++arr[0]) { } }; + +extern void foo(int); shafik wrote: We normally wrap tests from bug reports in `namespace GH` where is the bug rep

[clang] [Clang] [Sema] Fix a crash when a `friend` function is redefined as deleted (PR #135679)

2025-04-17 Thread Shafik Yaghmour via cfe-commits
@@ -271,3 +271,33 @@ void operators() { if (to_int_int) {} // expected-error {{attempt to use a deleted function: deleted (TO, operator bool)}} static_cast(to_int_int); // expected-error {{static_cast from 'TO' to 'bool' uses deleted function: deleted (TO, operator bool)}}

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

2025-04-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I am going to chime in, in support of both Aaron's and Erich's position here. This does not seem like an extension we want to support. So given the objections, we need at minimum an RFC and see how that goes. Maybe during that discussion a more compelling c

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

2025-04-18 Thread Shafik Yaghmour via cfe-commits
@@ -712,8 +713,7 @@ CodeGenTypes::arrangeBlockFunctionDeclaration(const FunctionProtoType *proto, const CGFunctionInfo & CodeGenTypes::arrangeBuiltinFunctionCall(QualType resultType, const CallArgList &args) { - // FIXME: Kill copy. --

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

2025-04-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/135861 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] diagnose deleted/default redeclaration of defined friend functions (PR #136717)

2025-04-22 Thread Shafik Yaghmour via cfe-commits
@@ -274,26 +274,22 @@ void operators() { namespace gh135506 { struct a { - // FIXME: We currently don't diagnose these invalid redeclarations if the - // second declaration is defaulted or deleted. This probably needs to be - // handled in ParseCXXInlineMethodDef() after pa

[clang] [Clang] Remove use after move of lambda (PR #136728)

2025-04-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/136728 Static analysis flagged this use after move. It is undefined behavior and I don't see any possible performance gains here to attempt to do anything else but simply remove it. >From 693a1f38d9a28ef515ccb738bee62

[clang] [Clang][Sema] Fix the lambda call expression inside of a type alias declaration (PR #82310)

2025-04-21 Thread Shafik Yaghmour via cfe-commits
shafik wrote: This crash looks linked to this PR: https://github.com/llvm/llvm-project/issues/136432 https://github.com/llvm/llvm-project/pull/82310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [llvm] [Clang][C++23] Core language changes from P1467R9 extended floating-point types and standard names. (PR #78503)

2025-04-21 Thread Shafik Yaghmour via cfe-commits
@@ -9278,6 +9278,8 @@ def err_cast_pointer_to_non_pointer_int : Error< def err_nullptr_cast : Error< "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0" >; +def err_invalid_implicit_floating_point_cast : Error< shafik wrote: I don't

[clang] Silence spurious -Wnontrivial-memcall warnings in C mode (PR #137429)

2025-04-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This should have a release note. https://github.com/llvm/llvm-project/pull/137429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Use temporary instead of one use local variable when creating APValue (PR #137029)

2025-04-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/137029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Use temporary instead of one use local variable when creating APValue (PR #137029)

2025-04-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/137029 Static analysis flagged this code b/c we should have been using std::move when passing by value since the value is not used anymore. In this case the simpler fix is just to use a temporary value as many of the o

[clang] [Clang][NFC] Move temp variable back into the source (PR #137095)

2025-04-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/137095 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Const correctness fix for range based for loop (PR #137431)

2025-04-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/137431 Static analysis flagged that we did not make const a item declaration b/c we did not modify it all during the loop. >From 6b1e4f4c170c3f15697209f385397f295d15d2db Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour

[clang] [clang] Warn about deprecated volatile-qualified return types (PR #137899)

2025-04-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you add more details in the summary. Specifically your approach to fixing the issue. Something along the lines of "In GetFullTypeForDeclarator ... moved check ... b/c ..." https://github.com/llvm/llvm-project/pull/137899 ___

[clang] [Clang][NFC] Use std::move to avoid copy (PR #138073)

2025-04-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/138073 Static analysis flagged this code for using copy when we could use std::move. Worth noting that CD.Message is a StringRef but Conflict.Message is std::string. Otherwise I would have used a temporary in place and

[clang] [Clang][NFC] Explicitly delete copy ctor and assignment for CGAtomicOptionsRAII (PR #137275)

2025-04-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/137275 Static analysis flagged CGAtomicOptionsRAII as having an explicit destructor but not having explicit copy ctor and assignment. Rule of three says we should. We are just using this as an RAII object, no need for

[clang] [C] Warn on uninitialized const objects (PR #137166)

2025-04-24 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=c,unsafe -Wdefault-const-init %s +// RUN: %clang_cc1 -fsyntax-only -verify=c,unsafe -Wc++-compat %s +// RUN: %clang_cc1 -fsyntax-only -verify=unsafe %s +// RUN: %clang_cc1 -fsyntax-only -verify=c -Wdefault-const-init -Wno

[clang] [C] Warn on uninitialized const objects (PR #137166)

2025-04-24 Thread Shafik Yaghmour via cfe-commits
@@ -6496,6 +6496,17 @@ static bool canPerformArrayCopy(const InitializedEntity &Entity) { return false; } +static const FieldDecl *getConstField(const RecordDecl *RD) { + for (const FieldDecl *FD : RD->fields()) { +QualType QT = FD->getType(); +if (QT.isConstQualif

[clang] [Clang][NFC] Const correctness fix for range based for loop (PR #137431)

2025-04-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/137431 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Avoid a duplicate variable in SemaExprCXX.cpp (PR #137464)

2025-04-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn about deprecated volatile-qualified return types (PR #137899)

2025-05-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. https://github.com/llvm/llvm-project/pull/137899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn about deprecated volatile-qualified return types (PR #137899)

2025-05-05 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > @shafik I have changed the commit message, can you please look again? I see the commit [238d737](https://github.com/llvm/llvm-project/pull/137899/commits/238d73776c85ed22386ac494f275261638cd40d3) which adds the improved summary but I don't see at the top of this page in the su

[clang] [Clang][NFC] assert IFaceT in SemaObjC::HandleExprPropertyRefExpr (PR #138026)

2025-04-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/138026 Static analysis flagged that we use IFaceT in HandleExprPropertyRefExpr without checking even though getInterfaceType() can return nullptr. The comments make it clear the assumption is that we will always have a

[clang] [Clang][NFC] assert IFaceT in SemaObjC::HandleExprPropertyRefExpr (PR #138026)

2025-05-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/138026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    5   6   7   8   9   10   11   >