[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][CodeGen] Emit “trap reasons” on UBSan traps (PR #145967)

2025-07-23 Thread Shafik Yaghmour via cfe-commits
@@ -14,35 +14,66 @@ #define LLVM_CLANG_LIB_CODEGEN_SANITIZER_HANDLER_H #define LIST_SANITIZER_CHECKS \ - SANITIZER_CHECK(AddOverflow, add_overflow, 0) \ - SANITIZER_CHECK(BuiltinUnreachable, bu

[clang] [clang] Check empty macro name in `#pragma push_macro("")` or `#pragma pop_macro("")` (PR #149982)

2025-07-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix, please add more details in the summary next time. Something along the lines of "added diagnostic which now triggers when which avoids the crash " https://github.com/llvm/llvm-project/pull/149982 ___

[clang] [Sema] Fix false positive warnings for misaligned member access (PR #150025)

2025-07-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix, please add a release note. https://github.com/llvm/llvm-project/pull/150025 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a crash on invalid concept (PR #150186)

2025-07-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: No release note b/c you will backport? https://github.com/llvm/llvm-project/pull/150186 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sanitize] fix crash in -fsanitize-annotate-debug-info (PR #149237)

2025-07-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Next time can you add more details to the summary, these are especially helpful for downstream folks but also for reviewers. Something along the lines of "Perform a null check in SanitizerAnnotateDebugInfo for the result of getCurrentDebugLocation". https:

[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] [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] Be less strict about diagnosing null pointer dereference. (PR #149648)

2025-07-19 Thread Shafik Yaghmour via cfe-commits
@@ -1445,3 +1445,8 @@ static_assert(test_member_null(), ""); } } + +namespace GH149500 { + unsigned int * p = &(*(unsigned int *)0x400); + static const void *q = &(*(const struct sysrq_key_op *)0); shafik wrote: Maybe also `nullptr` test? https://github.co

[clang] [Clang] Be less strict about diagnosing null pointer dereference. (PR #149648)

2025-07-19 Thread Shafik Yaghmour via cfe-commits
@@ -153,3 +150,7 @@ struct PR35214_X { int PR35214_x; int PR35214_y = ((struct PR35214_X *)&PR35214_x)->arr[1]; // expected-error {{not a compile-time constant}} int *PR35214_z = &((struct PR35214_X *)&PR35214_x)->arr[1]; // ok, &PR35214_x + 2 + + +int * GH149500_p = &(*(int

[clang] More fixes for P3144R2 implementation (PR #149406)

2025-07-18 Thread Shafik Yaghmour via cfe-commits
@@ -8392,17 +8392,19 @@ def ext_default_init_const : ExtWarn< "is a Microsoft extension">, InGroup; def err_delete_operand : Error<"cannot delete expression of type %0">; +def err_delete_void_ptr_operand : Error< + "cannot delete pointer to %0">; def ext_delete_void_ptr_o

[clang] More fixes for P3144R2 implementation (PR #149406)

2025-07-18 Thread Shafik Yaghmour via cfe-commits
@@ -8392,17 +8392,19 @@ def ext_default_init_const : ExtWarn< "is a Microsoft extension">, InGroup; def err_delete_operand : Error<"cannot delete expression of type %0">; +def err_delete_void_ptr_operand : Error< + "cannot delete pointer to %0">; def ext_delete_void_ptr_o

[clang] Check if clang::FieldDecl has constant-integer bit width before getting the width (PR #148692)

2025-07-16 Thread Shafik Yaghmour via cfe-commits
@@ -709,7 +709,8 @@ AST_MATCHER(FieldDecl, isBitField) { /// fieldDecl(hasBitWidth(2)) /// matches 'int a;' and 'int c;' but not 'int b;'. AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width) { - return Node.isBitField() && Node.getBitWidthValue() == Width; + return Node.

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

2025-07-15 Thread Shafik Yaghmour via cfe-commits
@@ -10912,9 +10966,18 @@ bool RecordExprEvaluator::VisitCXXParenListOrInitListExpr( isa(Init)); APValue &FieldVal = Result.getStructField(Field->getFieldIndex()); -if (!EvaluateInPlace(FieldVal, Info, Subobject, Init) || -(Fie

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

2025-07-15 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] [libcxx] [Clang] Diagnose forming references to nullptr (PR #143667)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
@@ -5242,7 +5281,10 @@ static bool EvaluateVarDecl(EvalInfo &Info, const VarDecl *VD) { if (InitE->isValueDependent()) return false; - if (!EvaluateInPlace(Val, Info, Result, InitE)) { + if (VD->getType()->isReferenceType() && shafik wrote: Can we a

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

2025-07-15 Thread Shafik Yaghmour via cfe-commits
@@ -9293,7 +9344,10 @@ bool LValueExprEvaluator::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) { } bool LValueExprEvaluator::VisitUnaryDeref(const UnaryOperator *E) { - return evaluatePointer(E->getSubExpr(), Result); + bool Success = evaluatePointer(E->getSubExpr(),

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

2025-07-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Mostly looks good but I think we need more testing and some additional comments. https://github.com/llvm/llvm-project/pull/143667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [Clang] Mark a concept as being invalid if the constraint is invalid (PR #147938)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think this should have had a release note https://github.com/llvm/llvm-project/pull/147938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix scope of typedefs present inside a template class (PR #146729)

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

[clang] Fix scope of typedefs present inside a template class (PR #146729)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Fixes #91451 This should also be included in the summary of the PR. https://github.com/llvm/llvm-project/pull/146729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] try fix missing Visit functions for issue #129393 (PR #138845)

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

[clang] [clang][ASTImporter] try fix missing Visit functions for issue #129393 (PR #138845)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
@@ -1038,6 +1055,188 @@ Expected ASTNodeImporter::import(ConceptReference *From) { return ConceptRef; } +StringRef ASTNodeImporter::ImportASTStringRef(StringRef FromStr) { + char *ToStore = new (Importer.getToContext()) char[FromStr.size()]; + std::copy(FromStr.begin(), F

[clang] [clang][ASTImporter] try fix missing Visit functions for issue #129393 (PR #138845)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Do we have tests that cover these additions already? https://github.com/llvm/llvm-project/pull/138845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [Clang][Sema] fix crash of attribute transform (PR #78088)

2025-07-15 Thread Shafik Yaghmour via cfe-commits
shafik wrote: It looks like this commit is responsible for https://github.com/llvm/llvm-project/issues/148325 https://github.com/llvm/llvm-project/pull/78088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[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

  1   2   3   4   5   6   7   8   9   10   >