[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-02-24 Thread Shafik Yaghmour via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-02-24 Thread Shafik Yaghmour via cfe-commits
=?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Cloutier , =?utf-8?q?F=C3=A9lix?= Clou

[clang] [clang] more useful error message for decomposition declaration missing initializer (PR #127924)

2025-02-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for improving the summary. @erichkeane mentioned that templates are a special case for the diagnostics with your original approach. Can we add a test that deal w/ templates to verify that the diagnostic works in those case properly? It still looks

[clang] [clang][Sema] Propagate qualifiers during derived-to-base conversion (PR #127824)

2025-02-26 Thread Shafik Yaghmour via cfe-commits
@@ -3107,8 +3107,12 @@ Sema::PerformObjectMemberConversion(Expr *From, /*IgnoreAccess=*/true)) return ExprError(); - return ImpCastExprToType(From, DestType, CK_UncheckedDerivedToBase, - VK, &BasePath); + Quali

[clang] [clang] Alias cc modifier to c (PR #127719)

2025-02-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: It seems like for gcc at least, IIUC, `cc` does a bit more than `c` so while we are supporting `cc` for compatibility we are not fully supporting it? Specifically: `except try harder to print it with no punctuation` Perhaps we should document that in the c

[clang] [clang][Sema] Propagate qualifiers during derived-to-base conversion (PR #127824)

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

[clang] [clang] more useful error message for decomposition declaration missing initializer (PR #127924)

2025-02-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Please provide more details than a link to the github issue. The summary is what goes in the git log and folks downstream often use git log as a first line in analyzing issues. Summaries w/o detailed summary are not useful. https://github.com/llvm/llvm-proj

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-02-25 Thread Shafik Yaghmour via cfe-commits
@@ -504,4 +504,39 @@ namespace AnonymousUnion { static_assert(return_init_all().a.p == 7); // both-error {{}} \ // both-note {{read of member 'p' of union with no active member}} } + +namespace InactiveDestroy { + struct A { +

[clang] [clang][bytecode] Check dtor instance pointers for active-ness (PR #128732)

2025-02-25 Thread Shafik Yaghmour via cfe-commits
@@ -504,4 +504,39 @@ namespace AnonymousUnion { static_assert(return_init_all().a.p == 7); // both-error {{}} \ // both-note {{read of member 'p' of union with no active member}} } + +namespace InactiveDestroy { + struct A { +

[clang] [clang][bytecode][NFC] Add missing LLVM_PREFERRED_TYPE to bitfield (PR #128740)

2025-02-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM but please add a more detailed summary something along the lines of `Added LLVM_PREFERRED_TYPE to InUnion field of InlineDescriptor` would be sufficient. https://github.com/llvm/llvm-project/pull/128740 _

[clang] [clang][ASTImporter] Fix AST import if anonymous namespaces are merged (PR #128735)

2025-02-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I did not fully understand this part of the summary `I did not check for other possibilities for namespaces that are not in a TU or namespace but at least the code should handle all cases` but I take it there are cases you are not testing? Is there a reas

[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] [C++20] Fix crash with invalid concept requirement (PR #138877)

2025-05-07 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Does this also fix: https://github.com/llvm/llvm-project/issues/138823 https://github.com/llvm/llvm-project/pull/138877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] Fix crash with invalid VLA in a type trait (PR #138543)

2025-05-09 Thread Shafik Yaghmour via cfe-commits
@@ -41,3 +41,17 @@ void func(int expr) { int array[sizeof(Ty) ? sizeof(Ty{}) : sizeof(int)]; int old_style_assert[expr ? Ty::one : Ty::Neg_one]; // We don't diagnose as a VLA until instantiation } + +namespace GH138444 { +struct S { // expected-note {{candidate con

[clang] [Clang][Sema] Handle invalid variable template specialization whose type depends on itself (PR #134522)

2025-05-09 Thread Shafik Yaghmour via cfe-commits
shafik wrote: This was flagged in the following issue: https://github.com/llvm/llvm-project/issues/139067#issuecomment-2865530760 https://github.com/llvm/llvm-project/pull/134522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [Clang][NFC] Adding note on details that are not immediately obvious (PR #138349)

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

[clang] [clang][OpenMP] Add error for large expr in collapse clause (PR #138592)

2025-05-09 Thread Shafik Yaghmour via cfe-commits
@@ -15901,6 +15901,13 @@ ExprResult SemaOpenMP::VerifyPositiveIntegerConstantInClause( << E->getSourceRange(); return ExprError(); } + + if (!Result.isRepresentableByInt64()) { shafik wrote: So these are always 64 bit integers? This: https://w

[clang] [clang][OpenMP] Add error for large expr in collapse clause (PR #138592)

2025-05-09 Thread Shafik Yaghmour via cfe-commits
@@ -11523,6 +11523,8 @@ def note_omp_collapse_ordered_expr : Note< "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">; def err_omp_negative_expression_in_clause : Error< "argument to '%0' clause must be a %select{non-negative|str

[clang] [Clang][Sema] Disable checking invalid template id in initializer of primary variable template `std::format_kind` with libstdc++ (PR #139560)

2025-05-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you please describe the issue in the summary instead of just saying it fixes Also add details such as this is fixing an issue introduced by ... Also please as Erich asked, add a test too https://github.com/llvm/llvm-project/pull/139560 ___

[clang] [Clang][NFC] Introduce no local variable to avoid use after move (PR #139784)

2025-05-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/139784 Static analysis flagged the use of Left.size() because we just moved out of Left and that would be undefined behavior. Fix is to take the size and store it in a local variable instead. >From df92525e63ff7c8953c

[clang] [Clang][Lex][NFC] Assert getExternalSource() in updateOutOfDateIdentifier (PR #140137)

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

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Shafik Yaghmour via cfe-commits
@@ -26,14 +26,18 @@ void no_get_1() { auto [a0, a1] = A(); // expected-error {{decomposes into 3 elements}} auto [b0, b1] = B(); // expected-error {{decomposes into 3 elements}} } - auto [a0, a1, a2] = A(); // expected-error {{undeclared identifier 'get'}} expected-

[clang] [Clang][AST] Fix HandleLValueBase to deal with references (PR #140105)

2025-05-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/140105 Since P2280R4 Unknown references and pointers was implemented, HandleLValueBase now has to deal with referneces: D.MostDerivedType->getAsCXXRecordDecl() will return a nullptr if D.MostDerivedType is a Reference

[clang] [Clang][AST] Fix HandleLValueBase to deal with references (PR #140105)

2025-05-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/140105 >From db49f866558acdba7235bed1e535192ce4a1d3dc Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 15 May 2025 10:03:06 -0700 Subject: [PATCH] [Clang][AST] Fix HandleLValueBase to deal with references Sinc

[clang] [clang] Save ShuffleVectorExpr args as ConstantExpr (PR #139709)

2025-05-14 Thread Shafik Yaghmour via cfe-commits
@@ -4566,9 +4566,11 @@ class ShuffleVectorExpr : public Expr { void setExprs(const ASTContext &C, ArrayRef Exprs); - llvm::APSInt getShuffleMaskIdx(const ASTContext &Ctx, unsigned N) const { + llvm::APSInt getShuffleMaskIdx(unsigned N) const { assert((N < NumExprs -

[clang] [Clang][NFC] Introduce no local variable to avoid use after move (PR #139784)

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

[clang] [Clang][Lex][NFC] Assert getExternalSource() in updateOutOfDateIdentifier (PR #140137)

2025-05-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/140137 Static analysis flagged the unconditional access of getExternalSource(). We don't initialize ExternalSource during construction but via setExternalSource(). If this is not set it will violate the invariant cover

[clang] [Clang][AST] Fix HandleLValueBase to deal with references (PR #140105)

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

[clang] [clang] Fixed an assertion failure triggered when instantiating a template with an expr that references an invalid decl (PR #140905)

2025-05-21 Thread Shafik Yaghmour via cfe-commits
@@ -4552,6 +4552,9 @@ LocalInstantiationScope::findInstantiationOf(const Decl *D) { isa(D->getDeclContext())) return nullptr; + if (D->isInvalidDecl()) shafik wrote: Why can't we just check after `D = getCanonicalParmVarDecl(D);`? https://github.

[clang] Revert "[Clang] Fix missed initializer instantiation bug for variable templates" (PR #140930)

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

[clang] [Clang] Use correct evaluation contexts when instantiating a var without initializer (PR #140699)

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

[clang] [Clang] Use correct evaluation contexts when instantiating a var without initializer (PR #140699)

2025-05-20 Thread Shafik Yaghmour via cfe-commits
@@ -18,6 +18,16 @@ int init_arr(); template template template int Outer::Inner::arr[sizeof(T) + sizeof(U) + sizeof(V)] = { init_arr() }; int *p = Outer::Inner::arr; +//CHECK: @_ZN8GH1406221gIiEE = linkonce_odr constant %"struct.GH140622::S" zeroinitializer +namespace GH14062

[clang] [Clang] Use correct evaluation contexts when instantiating a var without initializer (PR #140699)

2025-05-20 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: It would also be nice to get a reduction for: https://github.com/llvm/llvm-project/issues/140632 and see if we can add a test for that if it looks significantly different from the other cases. https://github.com/llvm/llvm-project/pull/140699 ___

[clang] [C] Do not diagnose unions with -Wdefault-const-init (PR #140725)

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

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2025-05-19 Thread Shafik Yaghmour via cfe-commits
shafik wrote: @kripken somewhat reduced: ```cpp struct MyStruct { double m0{-.0}; int m1{-12345}; }; constexpr MyStruct default_val; auto compute_area(double l, const MyStruct &val = default_val) -> double { if (val.m1 == 1) return 2.0; return 0; } #include auto

[clang] [C] Do not diagnose flexible array members with -Wdefault-const-init-field-unsafe (PR #140578)

2025-05-19 Thread Shafik Yaghmour via cfe-commits
@@ -85,3 +85,33 @@ void func() { static const int b; // zero-init-var-warning {{default initialization of an object of type 'const int' is incompatible with C++}} \ cxx-error {{default initialization of an object of const type 'const int'}} } + +//

[clang] [clang] Correct FixIt ranges for unused capture warnings (PR #141148)

2025-05-27 Thread Shafik Yaghmour via cfe-commits
@@ -972,6 +972,12 @@ class Sema final : public SemaBase { /// Calls \c Lexer::getLocForEndOfToken() SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset = 0); + /// Calls \c Lexer::findNextToken() to find the next token, and if the + /// locations of bo

[clang] [C2y] Handle FP-suffixes on prefixed octals (#141230) (PR #141695)

2025-05-27 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you provide the PR that brought in the change you are fixing? https://github.com/llvm/llvm-project/pull/141695 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang] Correct FixIt ranges for unused capture warnings (PR #141148)

2025-05-27 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,250 @@ +// RUN: cp %s %t +// RUN: %clang_cc1 -x c++ -Wunused-lambda-capture -Wno-unused-value -std=c++1z -fixit %t +// RUN: grep -v CHECK %t | FileCheck %s + + +#define MACRO_CAPTURE(...) __VA_ARGS__ +int main() { +int a = 0, b = 0, c = 0; +auto F0 = [a, &b]()

[clang] [Clang] Fix a regression introduced by #138518 (PR #141342)

2025-05-27 Thread Shafik Yaghmour via cfe-commits
@@ -14086,7 +14091,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // The form of initialization (using parentheses or '=') is generally // insignificant, but does matter when the entity being initialized has a // class type. -

[clang] [clang][Lex][NFC] Reorder SrcMgr checks in CheckMacroName (PR #141483)

2025-05-27 Thread Shafik Yaghmour via cfe-commits
@@ -373,8 +373,8 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef, // Macro names with reserved identifiers are accepted if built-in or passed // through the command line (the later may be present if -dD was used to // generate the preproc

[clang] [C2y] Handle FP-suffixes on prefixed octals (#141230) (PR #141695)

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

<    6   7   8   9   10   11