[clang] [Clang] Ignore invalid base classes (PR #147213)

2025-07-10 Thread Shafik Yaghmour via cfe-commits
@@ -2252,7 +2252,7 @@ void Parser::ParseBaseClause(Decl *ClassDecl) { while (true) { // Parse a base-specifier. BaseResult Result = ParseBaseSpecifier(ClassDecl); -if (Result.isInvalid()) { +if (!Result.isUsable()) { shafik wrote: I am a bit

[clang] [clang][deps] Stop lexing if hit a failure while loading a PCH/module in a submodule. (PR #146976)

2025-07-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Seems like this should have a release note? https://github.com/llvm/llvm-project/pull/146976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix manual memory management with SmallVector in ConceptRef (PR #147231)

2025-07-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thanks, this is a nice refactor. https://github.com/llvm/llvm-project/pull/147231 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash on `void{}` (PR #147514)

2025-07-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I guess we missed a release note? https://github.com/llvm/llvm-project/pull/147514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Avoid duplicate diagnostics for incomplete types in nested name specifier (C++20+) (PR #147036)

2025-07-07 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Why doesn't C++20 below suffer from the issue? > > I think it's a waste to add a Sema scope object just for diagnostic issues. > It's more like that there's an underlying issue that would be otherwise > hidden by the patch. Can you explore? Thank you for this PR but I agree th

[clang] [Clang][NFC] Avoid copies by using std::move (PR #146960)

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

[clang] [Clang][NFC] Avoid copies by using std::move (PR #146960)

2025-07-03 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/146960 Static analysis flagged this code as using copies when we could use move instead. I used a temporary in some cases instead of an explicit move. >From 672514ff2ab201ea9d3098f4a94251155533ce55 Mon Sep 17 00:00:00

[clang] [clang] Speedup getFileIDLocal with a separate offset table. (PR #146604)

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

[clang] [clang] Handle consteval constructors with default initialization. (PR #144970)

2025-06-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I am a little suspicious of this change because right now we are only calling `ActOnCXXExitDeclInitializer` in `~InitializerScopeRAII()` and now it seems like we need to sprinkle it in other places. https://github.com/llvm/llvm-project/pull/144970 _

[clang] [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (PR #146127)

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

[clang] [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (PR #146127)

2025-06-27 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/146127 Static analysis flagged some cases we could avoid copies by using std::move in Disasm.cpp. >From 6dbfe12457e7fd7dbb62d4cb5d53b3206b78e492 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Fri, 27 Jun 2025 10

[clang] [Clang][ByteCode][NFC] Misc minor performance fixes (PR #145988)

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

[clang] [Clang][ByteCode][NFC] Misc minor performance fixes (PR #145988)

2025-06-27 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Looks like the window CI fail is related to this issue: https://github.com/llvm/llvm-project/issues/145703 https://github.com/llvm/llvm-project/pull/145988 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [clang][bytecode][NFC] Remove PT_FnPtr (PR #135947)

2025-06-26 Thread Shafik Yaghmour via cfe-commits
@@ -16,27 +16,22 @@ APValue FunctionPointer::toAPValue(const ASTContext &) const { return APValue(static_cast(nullptr), CharUnits::Zero(), {}, /*OnePastTheEnd=*/false, /*IsNull=*/true); - if (!Valid) -return APValue(static_cast(nullptr), -

[clang] Clarify some code based on static analysis complaints; NFC (PR #145679)

2025-06-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for looking into this one. https://github.com/llvm/llvm-project/pull/145679 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

2025-06-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: As a previous comment noted, this needs a release note but I think the summary should also mention that this fixes the warning diagnostic from `-Wdangling-gsl`. Maybe worth a comment in the test explaining these are verifying we don't trigger a diagnostic f

[clang] [clang][Preprocessor] Handle the first pp-token in EnterMainSourceFile (PR #145244)

2025-06-24 Thread Shafik Yaghmour via cfe-commits
@@ -139,10 +139,9 @@ class TokenLexer { void Init(const Token *TokArray, unsigned NumToks, bool DisableMacroExpansion, bool OwnsTokens, bool IsReinject); - /// If the next token lexed will pop this macro off the - /// expansion stack, return 2. If the next un

[clang] [llvm] [HLSL] Implicit resource binding for cbuffers (PR #139022)

2025-06-24 Thread Shafik Yaghmour via cfe-commits
@@ -539,19 +537,29 @@ static void initializeBuffer(CodeGenModule &CGM, llvm::GlobalVariable *GV, } static void initializeBufferFromBinding(CodeGenModule &CGM, -llvm::GlobalVariable *GV, unsigned Slot, -

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

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

[clang] [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (PR #144274)

2025-06-17 Thread Shafik Yaghmour via cfe-commits
@@ -43,6 +43,11 @@ void call_snprintf(double d, int n, int *ptr) { __builtin_snprintf(node_name, sizeof(node_name), "%pOFn", ptr); // nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}} __builtin_snprintf

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

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -5223,6 +5230,24 @@ enum EvalStmtResult { }; } +static bool EvaluateInitForDeclOfReferenceType(EvalInfo &Info, + const ValueDecl *D, + const Expr *Init, LValue &Result, +

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

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -4426,7 +4431,7 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, // Unless we're looking at a local variable or argument in a constexpr call, // the variable we're reading must be const. -if (!Frame) { +if (AK != clang::AK_Referen

[clang] [libcxx] [Clang] Add __builtin_invoke and use it in libc++ (PR #116709)

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -1547,6 +1547,58 @@ ExprResult Sema::ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, return BuildTypeTrait(Kind, KWLoc, ConvertedArgs, RParenLoc); } +bool Sema::BuiltinIsBaseOf(SourceLocation RhsTLoc, QualType LhsT, + QualType RhsT) { + //

[clang] [libcxx] [Clang] Add __builtin_invoke and use it in libc++ (PR #116709)

2025-06-12 Thread Shafik Yaghmour via cfe-commits
@@ -1547,6 +1547,58 @@ ExprResult Sema::ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, return BuildTypeTrait(Kind, KWLoc, ConvertedArgs, RParenLoc); } +bool Sema::BuiltinIsBaseOf(SourceLocation RhsTLoc, QualType LhsT, + QualType RhsT) { + //

[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][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 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][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][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] 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][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][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] 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] 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
@@ -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
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][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] 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] 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] _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][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][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][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][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-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 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][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][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][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][NFC] Remove dead PassTypeToPlacementDelete field (PR #143448)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. Thank you for the fix! https://github.com/llvm/llvm-project/pull/143448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use llvm::count (NFC) (PR #143228)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: You should always have a summary, for this one it could have simply been "replace std::count with llvm::count in Sema::CheckBaseSpecifier" https://github.com/llvm/llvm-project/pull/143228 ___ cfe-commits mailing li

[clang] [Clang] Explain why a type is not replaceable. (PR #143265)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -1763,27 +1763,39 @@ def err_user_defined_msg_constexpr : Error< "constant expression">; // Type traits explanations -def note_unsatisfied_trait : Note<"%0 is not %enum_select{" - "%TriviallyRelocatable{trivially relocatable}|" -

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

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -14055,8 +14055,10 @@ FunctionDecl *Sema::ResolveSingleFunctionTemplateSpecialization( // specified and it, along with any default template arguments, // identifies a single function template specialization, then the // template-id is an lvalue for the fun

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

2025-06-09 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: I

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -2513,6 +2513,9 @@ void testValueInRangeOfEnumerationValues() { // expected-error@-1 {{constexpr variable 'x2' must be initialized by a constant expression}} // expected-note@-2 {{integer value 8 is outside the valid range of values [-8, 7] for the enumeration type 'E1'

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

2025-06-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143443 Static analysis flagged HasBody as not being initialized during construction. It looks like an oversight in: https://github.com/llvm/llvm-project/pull/139671 This would be a lot simpler with C++20 which allows i

[clang] [Clang][NFC] Add nullptr check in InitializationSequence::InitializeFrom (PR #143067)

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

[clang] [llvm] [HLSL] Implicit resource binding for cbuffers (PR #139022)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -539,19 +537,29 @@ static void initializeBuffer(CodeGenModule &CGM, llvm::GlobalVariable *GV, } static void initializeBufferFromBinding(CodeGenModule &CGM, -llvm::GlobalVariable *GV, unsigned Slot, -

[clang] [Clang] Clarify the `[[trivial_abi]]` documentation. (PR #143243)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -4431,7 +4431,11 @@ destroy the object before returning. The lifetime of the copy of the parameter in the caller ends without a destructor call when the call begins. If a type is trivial for the purpose of calls, it is assumed to be trivially -relocatable for the purpose o

[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] [flang] [llvm] [Driver] Move CommonArgs to a location visible by the Frontend Drivers (PR #142800)

2025-06-06 Thread Shafik Yaghmour via cfe-commits
@@ -3167,3 +3167,29 @@ void tools::handleInterchangeLoopsArgs(const ArgList &Args, options::OPT_fno_loop_interchange, EnableInterchange)) CmdArgs.push_back("-floop-interchange"); } + +std::optional tools::ParseMPreferVectorWidthOption( +clang::Diagno

[clang] [Clang][NFC] Add nullptr check in InitializationSequence::InitializeFrom (PR #143067)

2025-06-06 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > If this were a bug, I suspect it would have been reported. Most likely, > `dyn_cast_or_null(Entity.getDecl());` is never null, and could be > replaced by `cast`? Did you try that? It could but that feel like a weak argument, I would like something stronger. We do `dyn_cast_or_

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

2025-06-06 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] 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] [flang] [Driver] Move CommonArgs to a location visible by the Frontend Drivers (PR #142800)

2025-06-05 Thread Shafik Yaghmour via cfe-commits
@@ -3167,3 +3167,29 @@ void tools::handleInterchangeLoopsArgs(const ArgList &Args, options::OPT_fno_loop_interchange, EnableInterchange)) CmdArgs.push_back("-floop-interchange"); } + +std::optional tools::ParseMPreferVectorWidthOption( +clang::Diagno

[clang] [flang] [Driver] Move CommonArgs to a location visible by the Frontend Drivers (PR #142800)

2025-06-05 Thread Shafik Yaghmour via cfe-commits
@@ -3167,3 +3167,29 @@ void tools::handleInterchangeLoopsArgs(const ArgList &Args, options::OPT_fno_loop_interchange, EnableInterchange)) CmdArgs.push_back("-floop-interchange"); } + +std::optional tools::ParseMPreferVectorWidthOption( +clang::Diagno

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

2025-06-05 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] 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: I think some of these examples are covered in the test suite but I am not sure if all are. Can you confirm this is consistent with: https://eel.is/c++draft/expr.const#28.5 https://github.com/llvm/llvm-project/pull/142713

[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] [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] 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] 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-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] 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 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
@@ -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] [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] 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] Don't evaluate the initializer of constexpr-unknown parameters. (PR #142498)

2025-06-02 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. I was literally just writing this PR and saw you just submitted this one, thank you! LGTM https://github.com/llvm/llvm-project/pull/142498 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[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] Added explanation why a is trivial copyable evaluated to false. (PR #142341)

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

[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] 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
https://github.com/shafik commented: Thank you for the fix. Please add more details to your summary, explaining why the motivation for the fix and some details on how it is being implemented. https://github.com/llvm/llvm-project/pull/142341 ___ cfe

[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] [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] [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] [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][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] 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][Sema] Cleanup and optimize DiagnoseAssignmentEnum (PR #141471)

2025-05-28 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/shafik commented: Very nice change. How are you coming up w/ the target for your improvements? Is this something other folks could try and try and find some inspiration? https://github.com/llvm/llvm-project/pull/141471 _

[clang] [clang][Sema] Cleanup and optimize DiagnoseAssignmentEnum (PR #141471)

2025-05-28 Thread Shafik Yaghmour via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -1741,57 +1741,65 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, void Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr) { + + const auto *E

[clang] [clang][Sema] Cleanup and optimize DiagnoseAssignmentEnum (PR #141471)

2025-05-28 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/141471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

  1   2   3   4   5   6   7   8   9   10   >