[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-22 Thread Shafik Yaghmour via cfe-commits
@@ -263,6 +263,14 @@ namespace { } } +QualType Expr::getEnumCoercedType(const ASTContext &Ctx) const { + bool NotEnumType = dyn_cast(this->getType()) == nullptr; + if (NotEnumType) shafik wrote: This look redundant since `getEnumConstantDecl()` will just

[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81418)

2024-02-22 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wenum-compare -Wno-unused-comparison %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wenum-compare -Wno-unused-comparison %s + +typedef enum EnumA { + A +} EnumA; + +enum EnumB { + B +}; + +enum { + C +}; +

[clang] [clang] Clang should detect illegal copy constructor with template class as its parameter (PR #81251)

2024-02-22 Thread Shafik Yaghmour via cfe-commits
shafik wrote: @cor3ntin the fix looks like the one you recommended but that is quite a lot of tests that fail. https://github.com/llvm/llvm-project/pull/81251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang] Clang should detect illegal copy constructor with template class as its parameter (PR #81251)

2024-02-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This also needs a release note. https://github.com/llvm/llvm-project/pull/81251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clang should detect illegal copy constructor with template class as its parameter (PR #81251)

2024-02-22 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template < class T, class V > struct A +{ +A (); +A (A &); +A (A < V,T >); +// expected-error@-1 {{copy constructor must pass its first argument by reference}} +}; + +void f () +{ +A (A < int, i

[clang] fix: complete comment (PR #97322)

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

[clang] fix: complete comment (PR #97322)

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

[clang] [Clang] Treat default template argument as constant expressions (PR #107073)

2024-09-03 Thread Shafik Yaghmour via cfe-commits
@@ -97,3 +97,29 @@ void foo() { } #endif + +#if __cplusplus >= 202002L +void GH107048() { + constexpr int x{}; + const int y{}; + auto b = []{}; + using A = decltype([]{}); + + int z; // expected-note {{'z' declared here}} + auto c = []{ +// expected-error@-1 {{no ma

[clang] [Clang] Workaround dependent source location issues (PR #106925)

2024-09-03 Thread Shafik Yaghmour via cfe-commits
@@ -5443,11 +5443,24 @@ struct EnsureImmediateInvocationInDefaultArgs // Rewrite to source location to refer to the context in which they are used. ExprResult TransformSourceLocExpr(SourceLocExpr *E) { -if (E->getParentContext() == SemaRef.CurContext) +DeclContext

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

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

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Minor comments, I agree with @cor3ntin that you should split this into two PRs. It will be much better to review in smaller form. https://github.com/llvm/llvm-project/pull/102135 ___ cfe-commits mailing list cfe-co

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -4558,6 +4574,12 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) { Result.setRawIdentifierData(TokPtr); if (!isLexingRawMode()) { const IdentifierInfo *II = PP->LookUpIdentifierInfo(Result); + if (Result.isModuleContextualKeyword()) { +//

[clang] Reapply "[Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros" (PR #102135)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -652,14 +647,14 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result, // Recognize context-sensitive C++20 'export module' and 'export import' // declarations. case tok::identifier: { - IdentifierInfo *II = NextToken().getIdentifierInfo(); - if ((II

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think I need a second run through https://github.com/llvm/llvm-project/pull/97308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)

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

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -5578,19 +5579,35 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { ImmediateCallVisitor V(getASTContext()); if (!NestedDefaultChecking) V.TraverseDecl(Field); - if (V.HasImmediateCalls) { + + // CWG1815 + // Support lifetime ext

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I am not sure I see all the examples from: https://cplusplus.github.io/CWG/issues/1696.html https://github.com/llvm/llvm-project/pull/97308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)

2024-09-05 Thread Shafik Yaghmour via cfe-commits
@@ -6298,6 +6298,15 @@ class Sema final : public SemaBase { using ImmediateInvocationCandidate = llvm::PointerIntPair; + enum class LifetimeExtendingContext { +None, // Not in a lifetime extending context. +FlagOnly, // A flag indicating whether we are in l

[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)

2024-04-04 Thread Shafik Yaghmour via cfe-commits
@@ -18931,7 +18931,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, // constant evaluated bool NeededForConstantEvaluation = isPotentiallyConstantEvaluatedContext(*this) && - isImplicitlyDefinableConstexprFunction(Func); + is

[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)

2024-04-04 Thread Shafik Yaghmour via cfe-commits
@@ -18931,7 +18931,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, // constant evaluated bool NeededForConstantEvaluation = isPotentiallyConstantEvaluatedContext(*this) && - isImplicitlyDefinableConstexprFunction(Func); + is

[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)

2024-04-04 Thread Shafik Yaghmour via cfe-commits
@@ -18931,7 +18931,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, // constant evaluated bool NeededForConstantEvaluation = isPotentiallyConstantEvaluatedContext(*this) && - isImplicitlyDefinableConstexprFunction(Func); + is

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #72607)

2024-04-04 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This mostly makes sense to me, @AaronBallman does this look good to you? https://github.com/llvm/llvm-project/pull/72607 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

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

2024-04-04 Thread Shafik Yaghmour via cfe-commits
shafik wrote: ping @cor3ntin https://github.com/llvm/llvm-project/pull/82310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reject VLAs in `__is_layout_compatible()` (PR #87737)

2024-04-05 Thread Shafik Yaghmour via cfe-commits
@@ -1741,8 +1741,10 @@ void is_layout_compatible(int n) static_assert(!__is_layout_compatible(unsigned char, signed char)); static_assert(__is_layout_compatible(int[], int[])); static_assert(__is_layout_compatible(int[2], int[2])); - static_assert(!__is_layout_compatible

[clang] [Clang] Require base element type of `__has_unique_object_representations` to be complete (PR #95432)

2024-06-13 Thread Shafik Yaghmour via cfe-commits
@@ -2791,6 +2791,12 @@ bool ASTContext::hasUniqueObjectRepresentations( return hasUniqueObjectRepresentations(getBaseElementType(Ty), CheckIfTriviallyCopyable); + if (Ty->isVoidType()) shafik wrote: It is not cle

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

2024-06-13 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/95474 P2280R4 allows the use of references in pointers of unknown origins in a constant expression context but only in specific cases that could be constant expressions. We track whether a variable is a constexpr unkn

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

2024-06-14 Thread Shafik Yaghmour via cfe-commits
@@ -3420,6 +3441,15 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E, } Result = VD->getEvaluatedValue(); + + // P2280R4 If we don't have a value because this is a reference that was not + // initialized or whose lifetime began within E then create a val

[clang] [clang] Cover CWG issues about `export template` (PR #94876)

2024-06-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: LGTM after addressing coloring issues. https://github.com/llvm/llvm-project/pull/94876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-06-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Is this ready to land? https://github.com/llvm/llvm-project/pull/90387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Reuse tail-padding for more types that are not POD for the purpose of layout (PR #90462)

2024-06-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Looks like this is ready to land, if you have reached out to the Fuchsia and XL folks you should be good. https://github.com/llvm/llvm-project/pull/90462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (PR #95399)

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

[clang] [clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (PR #95399)

2024-06-20 Thread Shafik Yaghmour via cfe-commits
@@ -241,6 +238,13 @@ TPLa a; } // namespace Thirteen +namespace Fourteen { +template +int A = T(); + +using enum A; // expected-error {{A is not an enumerated type}} +} // namespace Fourteen shafik wrote: What does `Fourteen` stand for here or is it just a u

[clang] [clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (PR #95399)

2024-06-20 Thread Shafik Yaghmour via cfe-commits
@@ -148,13 +148,10 @@ template struct C { enum class D { d, e, f }; - using enum D; - - static constexpr int W = int(f) + I; + using enum D; // expected-error {{using-enum cannot name a dependent type}} shafik wrote: It

[clang] [clang] Implement CWG2877 "Type-only lookup for using-enum-declarator" (PR #95399)

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

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

2024-06-21 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for this fix. It needs a release note and your summary should have some more details on what the cause of the bug is and how your PR fixes it. efriedma-quic's comment provides a good framework for explaining the cause. https://github.com/llvm/llvm

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

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

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

2024-06-21 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s shafik wrote: I think this may be a more appropriate place for the test: https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/anonymous-union.cpp We usually wrap tests from gi

[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

2024-06-21 Thread Shafik Yaghmour via cfe-commits
@@ -1392,7 +1392,8 @@ class CXXRecordDecl : public RecordDecl { bool allowConstDefaultInit() const { return !data().HasUninitializedFields || !(data().HasDefaultedDefaultConstructor || - needsImplicitDefaultConstructor()); + needsImplici

[clang] [clang] require template arg list after template kw (PR #80801)

2024-05-28 Thread Shafik Yaghmour via cfe-commits
@@ -2995,13 +2996,23 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, ParsedType ObjectType, SS, ObjectType, ObjectHadErrors, TemplateKWLoc ? *TemplateKWLoc : SourceLocation(), Id, IdLoc, EnteringContext, Result, TemplateSpecified); -else

[clang] [clang] Improve ast-dumper text printing of TemplateArgument (PR #93431)

2024-05-28 Thread Shafik Yaghmour via cfe-commits
@@ -947,6 +947,26 @@ void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) { }); } +void TextNodeDumper::dumpTemplateArgument(const TemplateArgument &TA) { + llvm::SmallString<128> Str; + { +llvm::raw_svector_ostream SS(Str); +TA.print(PrintPolicy, SS,

[clang] [Clang] Correctly diagnose a static function overloading a non-static function (PR #93460)

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

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

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

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

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

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

2024-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -373,6 +373,98 @@ namespace cwg1837 { // cwg1837: 3.3 #endif } +namespace cwg1862 { // cwg1862: no +template +struct A { + struct B { +void e(); + }; + + void f(); + + struct D { +void g(); + }; + + T h(); + + template + T i(); +}; + +template<> +struc

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

2024-06-03 Thread Shafik Yaghmour via cfe-commits
@@ -121,6 +145,21 @@ derived d2(42, 9); #endif } +namespace cwg1945 { // cwg1945: no +template struct A { + class B { +class C {}; + }; +}; +class X { + static int x; + // FIXME: this is ill-formed, because A::B::C does not end with a simple-template-id + template +

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

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

[clang] [clang] Add tests for Core issues about friend templates (PR #94288)

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

[clang] [clang] Add tests for some CWG issues from 2024-05-31 telecon (PR #94167)

2024-06-03 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: LGTM, curious why you skipped some and not others from that telecom. Likely folks won't be able to check out the DRs until after St Louis. https://github.com/llvm/llvm-project/pull/94167 ___ cfe-commits mailing li

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

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

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > There's some existing coverage of the affected diagnostics, which shows we > continue to produce those diagnostics... but I added a few more tests for > in-class static member variables. Thank you! https://github.com/llvm/llvm-project/pull/99579 ___

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

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

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can you please add a reference to https://github.com/llvm/llvm-project/issues/100095 in the summary so folks just reading the git log have more context w/o going to the commit itself. I would like to see a more flushed out long-term plan for fixing this pro

[clang] [clang][Sema] Don't mark VarDecls of bindings in tuple-like decompositions as implicit (PR #100355)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > The structure of the AST is not stable but whoever change is would have to > fix the code anyway as it's all the same project so it's a non-issue (as long > as you add sufficient test coverage) I agree relying on the AST is fine w/ sufficient testing. https://github.com/llvm/

[clang] [Clang] Fix confusing diagnositcs related to explicit this parameters (PR #100351)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for this PR, could please put a little more detail in the summary since that is what will be seen by folks using git log. https://github.com/llvm/llvm-project/pull/100351 ___ cfe-commits mailing list cfe-

[clang] [NFC] Move RegisterBuiltinMacro function into the Preprocessor class (PR #100142)

2024-07-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Seems sensible @cor3ntin wdyt? https://github.com/llvm/llvm-project/pull/100142 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Initializer list on RHS of assignment (PR #100548)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
@@ -14578,21 +14578,51 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) { if (getLangOpts().CPlusPlus11 && isa(RHSExpr)) { -// The sy

[clang] Fix #99858 (PR #99859)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for submitting a potential fix. First of all this needs a reproducer, one to verify the existing issue and two because we need to add a test to insure we fix and three we need the rest to make sure we don't regress the fix in later releases. The

[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

2024-07-25 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I would like @AaronBallman to review this before committing. https://github.com/llvm/llvm-project/pull/99833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

2024-07-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: The code mostly makes sense, can we update the summary to clarify the goal of this change? This is what goes in the git log and it is important this is detailed enough to understand the change w/o looking at the details of the change itself. https://github

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

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

[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

2024-07-26 Thread Shafik Yaghmour via cfe-commits
@@ -1579,11 +1579,11 @@ void JSONNodeDumper::VisitMaterializeTemporaryExpr( } void JSONNodeDumper::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node) { - attributeOnlyIfTrue("hasRewrittenInit", Node->hasRewrittenInit()); + JOS.attribute("hasRewrittenInit", Node->hasRewrit

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

2024-07-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/2] [Clang] Implement P2280R4 Using unknown pointers and refere

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

2024-07-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/4] [Clang] Implement P2280R4 Using unknown pointers and refere

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

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH 1/5] [Clang] Implement P2280R4 Using unknown pointers and refere

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

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -1917,6 +1929,16 @@ APValue &CallStackFrame::createTemporary(const KeyT *Key, QualType T, return createLocal(Base, Key, T, Scope); } +APValue & +CallStackFrame::createConstexprUnknownAPValues(const VarDecl *Key, + APValue::LV

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

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -314,53 +316,69 @@ class APValue { DataType Data; public: - APValue() : Kind(None) {} - explicit APValue(APSInt I) : Kind(None) { + bool allowConstexprUnknown() const { return AllowConstexprUnknown; } + + void setConstexprUnknown() { AllowConstexprUnknown = true; } +

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

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -314,53 +316,69 @@ class APValue { DataType Data; public: - APValue() : Kind(None) {} - explicit APValue(APSInt I) : Kind(None) { + bool allowConstexprUnknown() const { return AllowConstexprUnknown; } + + void setConstexprUnknown() { AllowConstexprUnknown = true; } --

[clang] [clang][ASTImporter] Fix typos in trailing return testing on lambda p… (PR #101031)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Another PR would fix the crash when this one is landed. Can you land the fix for the crash first? If the other PR gets reverted it creates a lot of churn, so it would preferable to land that first. Assuming it is not somehow dependent on this fix. https://github.com/llvm/llv

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

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

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

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

[clang] [clang][NFC] Add Type::isPointerOrReferenceType() (PR #101206)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -75,7 +75,7 @@ bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const { const IdentifierInfo* QualType::getBaseTypeIdentifier() const { const Type* ty = getTypePtr(); NamedDecl *ND = nullptr; - if (ty->isPointerType() || ty->isReferenceType()) + if (ty->isPointerO

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

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

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
@@ -442,6 +446,16 @@ namespace { MostDerivedArraySize = 2; MostDerivedPathLength = Entries.size(); } + +void addVectorElementUnchecked(QualType EltTy, uint64_t Size, + uint64_t Idx) { + Entries.push_back(PathEntry::Arra

[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)

2024-07-30 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for working to get this PR finished up. I see at least two comments from the previous PR not addressed here. Please, let's try and get those addressed. @AaronBallman wanted a test to make sure we reject `&V[0]` which I don't see: https://github.c

[clang] [clang] Prevent dangling StringRefs (PR #98699)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This LGTM but when someone blocks you should wait for approval before landing the change. https://github.com/llvm/llvm-project/pull/98699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [clang] Prevent dangling StringRefs (PR #98699)

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

[clang] [clang] replaced the usage of `asctime` with `strftime` (PR #99075)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
@@ -1722,10 +1722,12 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // MSVC, ICC, GCC, VisualAge C++ extension. The generated string should be // of the form "Ddd Mmm dd hh::mm::ss ", which is returned by asctime. const char *Result; +char TimeStrin

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-16 Thread Shafik Yaghmour via cfe-commits
@@ -1284,16 +1294,26 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, auto LTResult = getEntityLifetime(&Entity); LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); - checkExprLifetimeImpl(Sema

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

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/95474 >From 69b09ea5b0f0a1c5419c488ade29b6fedc6de773 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Thu, 13 Jun 2024 14:20:50 -0700 Subject: [PATCH] [Clang] Implement P2280R4 Using unknown pointers and references

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

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

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -11846,19 +11854,21 @@ static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand) { } static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) { - ExplicitSpecifier ES = ExplicitSpecifier::getFromDecl(Cand->Function); + assert(Cand->Function

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. Thank you for this refactor, just a couple of minor comments but otherwise looks good. Please fix first and then merge after it passes tests, if you need someone to merge for you please let me know. https://github.com/llvm/llvm-project/pull

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -9994,8 +9995,9 @@ Sema::AddArgumentDependentLookupCandidates(DeclarationName Name, CandEnd = CandidateSet.end(); Cand != CandEnd; ++Cand) if (Cand->Function) { - Fns.erase(Cand->Function); - if (FunctionTemplateDecl *

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik requested changes to this pull request. https://github.com/llvm/llvm-project/pull/98965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

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

[clang] [Clang] Refactor uses of `Cand->Function` in SemaOverload.cpp (PR #98965)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -11846,19 +11854,21 @@ static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand) { } static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) { - ExplicitSpecifier ES = ExplicitSpecifier::getFromDecl(Cand->Function); + assert(Cand->Function

[clang] [clang] Add deprecation warning for `-Ofast` driver option (PR #98736)

2024-07-17 Thread Shafik Yaghmour via cfe-commits
@@ -931,7 +931,9 @@ def O : Joined<["-"], "O">, Group, def O_flag : Flag<["-"], "O">, Visibility<[ClangOption, CC1Option, FC1Option]>, Alias, AliasArgs<["1"]>; def Ofast : Joined<["-"], "Ofast">, Group, - Visibility<[ClangOption, CC1Option, FlangOption]>; + Visibility<[Clan

[clang] Fix assertion failure during conversion function overload resolution. (PR #98671)

2024-07-18 Thread Shafik Yaghmour via cfe-commits
@@ -1519,7 +1519,8 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1, auto IsExpectedEntity = [](const FunctionDecl *FD) { FunctionDecl::TemplatedKind Kind = FD->getTemplatedKind(); return Kind == FunctionDecl::TK_NonTemplate || - Kind == FunctionDe

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-19 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think I am bit surprised more tests are not affected by this change considering you modified the handling in several places. It seems we should be adding more test coverage with this change. https://github.com/llvm/llvm-project/pull/99579

[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

2024-07-20 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the additional tests, so I am not sure if the coverage is sufficient I see changed under the following diagnostic: note_constexpr_negative_shift note_constexpr_large_shift note_constexpr_lshift_of_negative note_constexpr_lshift_discards but I

[clang] [clang] MangledSymbol: remove pointless copy of vector (PR #90012)

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

[clang] [clang][NFC] Reformat suspicious condition (PR #89923)

2024-04-24 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This makes sense, I added Nico since they added the change that brought in that line. https://github.com/llvm/llvm-project/pull/89923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang] MangledSymbol: remove pointless copy of vector (PR #90012)

2024-04-25 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Looking at the logs, and the error seems to be unrelated to the changes made > https://buildkite.com/llvm-project/clang-ci/builds/16430#018f132d-506e-440c-b18b-fed98237def9/54-5446 You can try using `--allow-empty` to do an empty commit to kick off the build again. https://git

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
@@ -1465,6 +1465,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // Ensure that the function adheres to the forward progress guarantee, which // is required by certain optimizations. + // The attribute will be removed if the body contains a tri

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
@@ -908,6 +908,74 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { incrementProfileCounter(&S); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if (CGM.get

[clang] [NFC] Fix hasQualifier comment (PR #90485)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM, thank you for the documentation fix. https://github.com/llvm/llvm-project/pull/90485 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [clang][NFC] Reformat suspicious condition (PR #89923)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
shafik wrote: The `amdgpu-toolchain.c` test failure looks unrelated. I think we need another empty commit to kick off the build again unfortunately. https://github.com/llvm/llvm-project/pull/89923 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [Clang][Sema] Earlier type checking for builtin unary operators (PR #90500)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: So this seems to apply to member pointer types, pointer types, arrays and function types but I don't see coverage for the full set of paths in the tests. Can we please add more testing. Erich also expressed some concern about breaking existing code due to e

[clang] [Clang] Prevent null pointer dereference in Sema::​CodeCompleteQualifiedId() (PR #90490)

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

[clang] [Clang] Prevent null pointer dereference in Sema::​CodeCompleteQualifiedId() (PR #90490)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
@@ -6714,14 +6714,16 @@ void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, // If the scope is a concept-constrained type parameter, infer nested // members based on the constraints. - if (const auto *TTPT = - dyn_cast_or_null(NNS->getAsType())) { -

<    1   2   3   4   5   6   7   >