[clang] [Clang][Sema] Expression in assumption attribute should be full expression (PR #150814)

2025-07-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Is there no issue associated with the crash? https://github.com/llvm/llvm-project/pull/150814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [Sema] [Modules] Use DynamicRecursiveASTVisitor to reduce generted code size (PR #151074)

2025-07-29 Thread Shafik Yaghmour via cfe-commits
shafik wrote: FYI there is also this: https://llvm-compile-time-tracker.com/ https://github.com/llvm/llvm-project/pull/151074 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce elementwise ctlz/cttz builtins (PR #131995)

2025-08-01 Thread Shafik Yaghmour via cfe-commits
@@ -860,3 +860,41 @@ static_assert(__builtin_elementwise_sub_sat(0U, 1U) == 0U); static_assert(__builtin_bit_cast(unsigned, __builtin_elementwise_sub_sat((vector4char){5, 4, 3, 2}, (vector4char){1, 1, 1, 1})) == (LITTLE_END ? 0x01020304 : 0x04030201)); static_assert(__builtin_

[clang] [clang][bytecode] Fix a crash in codegen (PR #151515)

2025-08-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Do we get a frontend diagnostic in this case? https://github.com/llvm/llvm-project/pull/151515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen][counted_by] See past parentheses and no-op casts (PR #151266)

2025-08-01 Thread Shafik Yaghmour via cfe-commits
@@ -471,3 +471,80 @@ size_t test9(struct annotated_sized_ptr *p, int index) { size_t test10(struct annotated_sized_ptr *p, int index) { return __bdos(&((unsigned int *) p->buf)[index]); } + +struct pr151236_struct { +int *a __counted_by(a_count); +short a_coun

[clang] [clang][NFC] Remove leftover comment (PR #151822)

2025-08-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you https://github.com/llvm/llvm-project/pull/151822 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Use SmallVector for Function::Code (PR #151821)

2025-08-02 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -44,12 +44,12 @@ bool Context::isPotentialConstantExpr(State &Parent, const FunctionDecl *FD) { Compiler(*this, *P).compileFunc( FD, const_cast(Func)); - ++EvalID; - // And run it. - if (!Run(Parent, Func)) + i

[clang] [clang][bytecode] Use SmallVector for Function::Code (PR #151821)

2025-08-02 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/151821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] fix for heterogeneous chip's host side's MaybeODRUseExprs clear (PR #121085)

2025-08-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I don't think I understand this change. There at least needs to be a more detailed summary and tests. I imagine test would help clarify the intent better. https://github.com/llvm/llvm-project/pull/121085 ___ cfe-co

[clang] [clang][bytecode][NFC] Only collect non-null args if we have to (PR #152074)

2025-08-05 Thread Shafik Yaghmour via cfe-commits
@@ -2064,7 +2069,7 @@ bool Compiler::visitCallArgs(ArrayRef Args, return false; } -if (FuncDecl && NonNullArgs[ArgIndex]) { +if (HasNonNullAttr && NonNullArgs[ArgIndex]) { shafik wrote: Couldn't we just use `!NonNullArgs.empty()` rather th

[clang] [Analysis] Avoid some warnings about exit from noreturn function (PR #144408)

2025-07-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: It looks like this PR causes a regression: https://github.com/llvm/llvm-project/issues/150336 https://github.com/llvm/llvm-project/pull/144408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [clang] Fix const eval of constexpr-unknown relational comparisons. (PR #150088)

2025-07-22 Thread Shafik Yaghmour via cfe-commits
@@ -14631,8 +14631,9 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E, // - Otherwise pointer comparisons are unspecified. if (!LHSDesignator.Invalid && !RHSDesignator.Invalid && IsRelational) { bool WasArrayIndex; - unsigned Misma

[clang] [clang] Fix const eval of constexpr-unknown relational comparisons. (PR #150088)

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

[clang] [clang] Fix const eval of constexpr-unknown relational comparisons. (PR #150088)

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

[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)

2025-08-06 Thread Shafik Yaghmour via cfe-commits
@@ -6361,6 +6362,143 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { findHandleTypeOnResource(const Type *RT); }; +/// Instances of this class represent operands to a SPIR-V type instruction. +class SpirvOperand { +public: + enum SpirvOpera

[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)

2025-08-06 Thread Shafik Yaghmour via cfe-commits
@@ -6361,6 +6362,143 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { findHandleTypeOnResource(const Type *RT); }; +/// Instances of this class represent operands to a SPIR-V type instruction. +class SpirvOperand { +public: + enum SpirvOpera

[clang] [clang][bytecode][NFC] Code size is always aligned (PR #151824)

2025-08-02 Thread Shafik Yaghmour via cfe-commits
@@ -137,21 +137,21 @@ int32_t ByteCodeEmitter::getOffset(LabelTy Label) { template static void emit(Program &P, std::vector &Code, const T &Val, bool &Success) { + size_t ValPos = Code.size(); size_t Size; if constexpr (std::is_pointer_v) -Size =

[clang] [clang][bytecode][NFC] Code size is always aligned (PR #151824)

2025-08-04 Thread Shafik Yaghmour via cfe-commits
@@ -137,21 +137,21 @@ int32_t ByteCodeEmitter::getOffset(LabelTy Label) { template static void emit(Program &P, std::vector &Code, const T &Val, bool &Success) { + size_t ValPos = Code.size(); size_t Size; if constexpr (std::is_pointer_v) -Size =

[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] 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

[clang] [Clang] Fix crash on template-specialization (PR #142338)

2025-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -160,7 +160,7 @@ template struct X; // Make sure that the instantiated constructor initializes start and // end properly. -// CHECK-LABEL: define linkonce_odr void @_ZN1XIiEC2ERKS0_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %othe

[clang] [llvm] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)

2025-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -44,20 +45,24 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { StringRef Category = StringRef()) const; // Query ignorelisted entries if any bit in Mask matches the entry's section. - // Return 0 if not found. If found, return the line

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

2025-06-03 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] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2025-06-03 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Based on #141114 and #141858 should this PR be reverted? A fix was landed: https://github.com/llvm/llvm-project/pull/142498 https://github.com/llvm/llvm-project/pull/95474 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

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

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

[clang] [Clang] Implement LWG3819 for `__reference_meows_from_temporary` (PR #142554)

2025-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -1343,12 +1343,21 @@ static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind, if (RD && RD->isAbstract()) return false; +// LWG3819: For reference_meows_from_temporary traits, && is not added to shafik wrote: I apologize, maybe I am jus

[clang] [Clang] Fix crash on template-specialization (PR #142338)

2025-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -160,7 +160,7 @@ template struct X; // Make sure that the instantiated constructor initializes start and // end properly. -// CHECK-LABEL: define linkonce_odr void @_ZN1XIiEC2ERKS0_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %othe

[clang] [Clang] Implement LWG3819 for `__reference_meows_from_temporary` (PR #142554)

2025-06-04 Thread Shafik Yaghmour via cfe-commits
@@ -1343,12 +1343,21 @@ static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind, if (RD && RD->isAbstract()) return false; +// LWG3819: For reference_meows_from_temporary traits, && is not added to shafik wrote: After some offline discussi

[clang] [Clang][NFC] Use move in std::vector local in HandleTranslationUnit (PR #142851)

2025-06-04 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/142851 Static analysis flagged this since we could move MergedRanges since it is a std::vector, a local and unused after that line. So there is a potential saving. >From b427ae1ef18c48126a0faf5f40678cc6e4e30634 Mon Sep

[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

2025-06-02 Thread Shafik Yaghmour via cfe-commits
@@ -2083,6 +2086,88 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef, + SourceLocat

[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

2025-06-02 Thread Shafik Yaghmour via cfe-commits
@@ -2083,6 +2086,88 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef, + SourceLocat

[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

2025-06-02 Thread Shafik Yaghmour via cfe-commits
@@ -2083,6 +2086,88 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef, + SourceLocat

[clang] [Clang] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

2025-06-02 Thread Shafik Yaghmour via cfe-commits
@@ -144,3 +144,54 @@ static_assert(__builtin_is_cpp_trivially_relocatable(U2)); // expected-note@#tr-U2 {{'U2' defined here}} } + +namespace trivially_copyable { +struct B { + virtual ~B(); +}; +struct S : virtual B { // #tc-S +S(); +int & a; +const int ci; +B

[clang] [clang][NFC] Move Diags.isIgnored check later in checkForRedundantLoop (PR #141470)

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

[clang] [Sema] Fix type mismatch error when arguments to elementwise math builtin have different qualifiers, which should be well-formed (PR #141485)

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

[clang] [llvm] [UBSan] Support src:*=sanitize for multiple ignorelists. (PR #141640)

2025-05-29 Thread Shafik Yaghmour via cfe-commits
@@ -44,20 +45,24 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList { StringRef Category = StringRef()) const; // Query ignorelisted entries if any bit in Mask matches the entry's section. - // Return 0 if not found. If found, return the line

[clang] [Clang] Reset ArgPackSubstIndex before rewriting CTAD template parameters (PR #141741)

2025-05-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the quick fix! https://github.com/llvm/llvm-project/pull/141741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Variable is unused when opt mode is on and assert is turned off (PR #142049)

2025-05-30 Thread Shafik Yaghmour via cfe-commits
@@ -764,7 +764,8 @@ static bool interp__builtin_addressof(InterpState &S, CodePtr OpPC, const InterpFrame *Frame, const CallExpr *Call) { assert(Call->getArg(0)->isLValue()); - PrimType PtrT = S.get

[clang] [Clang] Fix an out of bound access in -verify comment parsing (PR #141940)

2025-05-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Did you not do a release note b/c this was introduced w/ a recent change? https://github.com/llvm/llvm-project/pull/141940 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [clang][NFC] Move Diags.isIgnored check later in checkForRedundantLoop (PR #141470)

2025-05-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you elaborate in your summary. I am guessing because the other checks are a lot cheaper and this overall improves performance? https://github.com/llvm/llvm-project/pull/141470 ___ cfe-commits mailing list cfe-

[clang] [clang] Remove separate evaluation step for static class member init. (PR #142713)

2025-06-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: So just to confirm my reading, this is benefiting from `CheckCompleteVariableDeclaration` doing: ```cpp // Evaluate the initializer to see if it's a constant initializer. HasConstInit = var->checkForConstantInitialization(Notes); ``` or is there more?

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

2025-06-05 Thread Shafik Yaghmour via cfe-commits
@@ -16597,7 +16597,8 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, BD->setCaptures(Context, Captures, BSI->CXXThisCaptureIndex != 0); // Pop the block scope now but keep it alive to the end of this function. - AnalysisBasedWarnings::Policy WP = Analysis

[clang] [clang] Remove separate evaluation step for static class member init. (PR #142713)

2025-06-06 Thread Shafik Yaghmour via cfe-commits
@@ -143,3 +143,8 @@ namespace fold_initializer { const float A::f = __builtin_is_constant_evaluated(); static_assert(fold(A::f == 1.0f)); } + +struct GH99680 { + static const int x = 1/(1-__builtin_is_constant_evaluated()); // expected-error {{in-class initializer for sta

[clang] [Clang][ByteCode][NFC] Move APInt into pushInteger since it is being passed by value (PR #143578)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/143578 >From 09060e9a91842346f106d55b32141b16efe7378d Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 10 Jun 2025 10:41:04 -0700 Subject: [PATCH 1/2] [Clang][ByteCode][NFC] Move APInt into pushInteger since i

[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
@@ -4920,6 +4914,11 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind, ModifierFound = true; } else { StepFound = parseStepSize(*this, Data, Kind, Tok.getLocation()); +if (!StepFound) { shafik wrote: hu

[clang] [Clang][NFC] Move HeadingAndSpellings to avoid copying (PR #143611)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143611 Static analysis flagged that we could move HeadingAndSpellings and avoid a copy of a large object. >From 55d520891a09e3cd3ef85eeba501ad80d8240619 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 10 Jun

[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/143603 >From 6bcbd5e1691edd4cbc36bd0c318cdd3b526db1c3 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 10 Jun 2025 13:51:19 -0700 Subject: [PATCH 1/2] [Clang][Tooling][NFC] Use move to avoid copies of large ob

[clang] [Clang][ByteCode][NFC] Move APInt into pushInteger since it is being passed by value (PR #143578)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/143578 >From 09060e9a91842346f106d55b32141b16efe7378d Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 10 Jun 2025 10:41:04 -0700 Subject: [PATCH 1/3] [Clang][ByteCode][NFC] Move APInt into pushInteger since i

[clang] [Clang][NFC] Move UntypedParameters instead of copy (PR #143646)

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

[clang] [Clang] _default-movable_ should be based on the first declaration (PR #143661)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: It feels like having `isDefaultedOnDeclaration()` would be tremendously more readable and express the intent rather than doing "the dance" when necessary. https://github.com/llvm/llvm-project/pull/143661 ___ cfe-c

[clang] [Clang] Fix name lookup of conversion operators (PR #142945)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
@@ -3673,6 +3678,8 @@ void Parser::ParseDeclarationSpecifiers( *Next.getIdentifierInfo(), Next.getLocation(), getCurScope(), &SS, false, false, nullptr, shafik wrote: Please add bugprone-argument-comments for these as well, since you are mo

[clang] [Clang] Fix name lookup of conversion operators (PR #142945)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
@@ -3673,6 +3678,8 @@ void Parser::ParseDeclarationSpecifiers( *Next.getIdentifierInfo(), Next.getLocation(), getCurScope(), &SS, false, false, nullptr, shafik wrote: Also applies in some other places as well. https://github.com/llvm/llvm-p

[clang] [Clang][NFC] Move HeadingAndSpellings to avoid copying (PR #143611)

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

[clang] [Clang] Diagnose forming references to nullptr (PR #143667)

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

[clang] [Clang] Diagnose forming references to nullptr (PR #143667)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
@@ -35,6 +35,7 @@ enum AccessKinds { AK_Construct, AK_Destroy, AK_IsWithinLifetime, + AK_CheckReferenceInitialization shafik wrote: ```suggestion AK_ReferenceInitialization ``` I could also go for `AK_ReadForReferenceInitialization`. The "Check" is w

[clang] [Clang] Diagnose forming references to nullptr (PR #143667)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
@@ -1321,3 +1321,24 @@ constexpr bool check = different_in_loop(); // expected-error@-1 {{}} expected-note@-1 {{in call}} } + +namespace GH48665 { +constexpr bool foo(int *i) { shafik wrote: Other tests: https://godbolt.org/z/o66Gr3fc8 ```cpp struct A {

[clang] [Clang] Diagnose forming references to nullptr (PR #143667)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I have the same questions as @efriedma-quic https://github.com/llvm/llvm-project/pull/143667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Move FatbinFileName instead of copy (PR #143827)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143827 Static analysis flagged FatbinFileName since we can move it instead of copying it. >From 5fd6d2ff512a971b8e6ad8f900c31a1b74b49ed5 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 11 Jun 2025 20:58:07 -

[clang] [clang][Sema] Fixed Compound Literal is not Constant Expression (PR #143852)

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -7219,6 +7219,17 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr); } +static bool IsInsideFunction(Scope *S) { shafik wrote: @AaronBallman it feels like it make

[clang] [Clang][NFC] Move Input into SmallVector instead of copy (PR #143830)

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

[clang] [Clang][NFC] Move FatbinFileName instead of copy (PR #143827)

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

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -13632,82 +13632,36 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, RequireCompleteDeclContext(const_cast(SS), NamedContext)) return true; - if (getLangOpts().CPlusPlus11) { -// C++11 [namespace.udecl]p3: -// In a using

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

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

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-12 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: @Endilll has been handling a lot of conformance testing, so please wait for more feedback from him before landing. https://github.com/llvm/llvm-project/pull/143492 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [Clang][ByteCode][NFC] Move APInt into pushInteger since it is being passed by value (PR #143578)

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

[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143603 Static analysis flagged these cases in which can use std::move and avoid copies of large objects. >From 6bcbd5e1691edd4cbc36bd0c318cdd3b526db1c3 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 10 Jun

[clang] [Clang][NFC][ByteCode] Initialize Function HasBody in constructor (PR #143443)

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

[clang] [Clang][ByteCode][NFC] Move APInt into pushInteger since it is being passed by value (PR #143578)

2025-06-10 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143578 Static analysis flagged that we could move APInt instead of copy, indeed it has a move constructor and so we should move into values for APInt. >From 09060e9a91842346f106d55b32141b16efe7378d Mon Sep 17 00:00:00

[clang] [Clang][NFC] Move Input into SmallVector instead of copy (PR #143830)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143830 Static analysis flagged Input as a large object that would benefit from being moved over being copied. >From ea85dd226ad4c8a6f9ef0a7f16c22fdc386c1334 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Wed, 11

[clang] [clang] increase default constexpr step limit (PR #143785)

2025-06-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I would also like to see some more background info on how we came up with the original limit (if it exists). https://github.com/llvm/llvm-project/pull/143785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][bytecode][NFC] Fix ternary operators with known IsArray values (PR #152894)

2025-08-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the quick fix! https://github.com/llvm/llvm-project/pull/152894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AST][NFC] Add assertion on Init to CompoundLiteralExpr (PR #152593)

2025-08-07 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/152593 Static analysis complained that: child_range(&Init, &Init+1); in the children member function was potentially out of bounds. This is false b/c it is forming an iterator range but it would be invalid if Init w

[clang] [clang-tools-extra] [Clang] Add a builtin that deduplicate types into a pack (PR #106730)

2025-08-07 Thread Shafik Yaghmour via cfe-commits
@@ -20,4 +22,10 @@ void expr() { static_assert(__is_same(TypePackElement<0, X<0>, X<1>>, X<0>), ""); static_assert(__is_same(TypePackElement<1, X<0>, X<1>>, X<1>), ""); #endif + +#ifdef DEDUP + static_assert(__is_same(TypePackDedup, TypeList<>), ""); + static_assert(__is_

[clang] [Clang][AST][NFC] Add assertion on Init to CompoundLiteralExpr (PR #152593)

2025-08-07 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/152593 >From d7c1848b87a9f33d29acd3c526ea19b7ddaa7be7 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 7 Aug 2025 13:31:03 -0700 Subject: [PATCH 1/2] [Clang][AST][NFC] Add assertion on Init to CompoundLiteralE

[clang] [Clang][NFC] Clarify some SourceManager related code (PR #153527)

2025-08-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/153527 Static analysis flagged the columns - 1 code, it was correct but the assumption was not obvious. I document the assumption w/ assertions. While digging through related code I found getColumnNumber that looks wro

[clang] [clang][clang-scan-deps] Add named modules to format 'experimental-full' (PR #145221)

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

[clang] [clang][clang-scan-deps] Add named modules to format 'experimental-full' (PR #145221)

2025-08-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Apologies for t https://github.com/llvm/llvm-project/pull/145221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][clang-scan-deps] Add named modules to format 'experimental-full' (PR #145221)

2025-08-13 Thread Shafik Yaghmour via cfe-commits
@@ -188,13 +192,23 @@ class FullDependencyConsumer : public DependencyConsumer { ContextHash = std::move(Hash); } + void handleProvidedAndRequiredStdCXXModules( + std::optional Provided, + std::vector Requires) override { +ModuleName = Provided ? Provided-

[clang] [clang][clang-scan-deps] Add named modules to format 'experimental-full' (PR #145221)

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

[clang] [Clang][NFC] Clarify some SourceManager related code (PR #153527)

2025-08-14 Thread Shafik Yaghmour via cfe-commits
@@ -1095,6 +1095,8 @@ prepareAndFilterRanges(const SmallVectorImpl &Ranges, unsigned StartColumn = SM.getExpansionColumnNumber(Begin); unsigned EndColumn = SM.getExpansionColumnNumber(End); +assert(StartColumn && "StartColumn has a value of 0"); s

[clang] [Clang][Bytecode][NFC] Move Result into APSInt constructor (PR #153664)

2025-08-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/153664 Static analysis flagged this line because we are copying Result instead of moving it. >From 8361389ca73e9c70731ef9dd8c7b0fac1f06 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 14 Aug 2025 13:05:4

[clang] [Clang][Bytecode][NFS] Init Semantics non-static member of class Floating (PR #153671)

2025-08-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/153671 Static analysis flagged that the non-static member Semantics was not initialized by the default default constructor. Fix is to initialize it using in class member initialization. >From bd93d02c1d7d0ba27ad563a5e

<    7   8   9   10   11   12   13   14   >