[clang] [clang] Fix CTAD not work for C++ explicit type conversion (functional annotation). (PR #75779)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/75779 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix CTAD not work for C++ explicit type conversion (functional annotation). (PR #75779)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > > Why remove the support for ParenListExpr entirely? Could you not fallback > > on looking at the init list expression only when ParenListExpr is null? > > We could keep `ParenListExpr`, but I'm not sure the benefit (IMO, removing it > seems like an API improvement, and make

[clang] fix issue 73559. (PR #74926)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
@@ -641,6 +641,8 @@ Bug Fixes in This Version Fixes (`#67317 `_) - Clang now properly diagnoses use of stand-alone OpenMP directives after a label (including ``case`` or ``default`` labels). +- Fix crash when using C++

[clang] [clang][AST] Invalidate DecompositionDecl if it has invalid initializer. (PR #72428)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: We need a release note and please add a more detailed summary. A description of the problem being solved and the solution to the fix provides. https://github.com/llvm/llvm-project/pull/72428 ___ cfe-commits

[clang] fix issue 73559. (PR #74926)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
shafik wrote: In the future please add a more description title to your PR. Your summary is great though. Also in this case this is a clang and parser fix so you should prefix your title with `[Clang][Parser]` https://github.com/llvm/llvm-project/pull/74926

[clang] [clang][Sema] Add -Wswitch-default warning option (PR #73077)

2023-12-18 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-default %s + +int f1(int a) { + switch (a) {// expected-warning {{'switch' missing 'default' label}} +case 1: a++; break; +case 2: a += 2; break; + } + return a; +}

[clang] [Sema] Fix crash on invalid code with parenthesized aggregate initialization (PR #76232)

2023-12-22 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This is missing a release note. https://github.com/llvm/llvm-project/pull/76232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][sema] make sure arguments of __atomic_exchange complete type (PR #75135)

2023-12-19 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: We should add a release note for this change. https://github.com/llvm/llvm-project/pull/75135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Fix Wswitch-default bad warning in template (PR #76007)

2023-12-19 Thread Shafik Yaghmour via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wswitch-default %s shafik wrote: I think we can add these test to `clang/test/Sema/switch-default.c` https://github.com/llvm/llvm-project/pull/76007

[clang] [Clang][Sema] Fix Wswitch-default bad warning in template (PR #76007)

2023-12-19 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you add more details to you summary "https://github.com/llvm/llvm-project/pull/73077 added -Wswitch-default diagnostic but it produced false positives in templates. This PR will address that issue" https://github.com/llvm/llvm-project/pull/76007

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2023-12-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/75130 >From 8a169838778e333e6bf14a7156a6220d09b5818a Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 11 Dec 2023 18:35:57 -0800 Subject: [PATCH] [Clang][AST] Fix crash in APValue::LValueBase::getType when we

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2023-12-14 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/75130 >From fb0ea87f212c78b5b39345e534a48b8956a19cc4 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Mon, 11 Dec 2023 18:35:57 -0800 Subject: [PATCH] [Clang][AST] Fix crash in APValue::LValueBase::getType when we

[clang] [clang][ASTImporter] import InstantiatedFromMember of ClassTemplateSpecializationDecl (PR #76493)

2023-12-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: LGTM but I will let @balazske approve https://github.com/llvm/llvm-project/pull/76493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] import InstantiatedFromMember of ClassTemplateSpecializationDecl (PR #76493)

2023-12-28 Thread Shafik Yaghmour via cfe-commits
@@ -9342,6 +9342,38 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportConflictTypeAliasTemplate) { EXPECT_FALSE(ImportedCallable); } +AST_MATCHER(ClassTemplateSpecializationDecl, hasInstantiatedFromMember) { + if (auto Instantiate = Node.getInstantiatedFrom()) { +if

[clang] [clang][ASTImporter] import InstantiatedFromMember of ClassTemplateSpecializationDecl (PR #76493)

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

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2023-12-28 Thread Shafik Yaghmour via cfe-commits
@@ -70,11 +70,13 @@ QualType APValue::LValueBase::getType() const { // constexpr int *p = [1]; // valid? // // For now, we take the most complete type we can find. -for (auto *Redecl = cast(D->getMostRecentDecl()); Redecl; +for (auto *Redecl =

[clang] [clang][Sema] deleted overriding function can have lax except spec (PR #76248)

2023-12-28 Thread Shafik Yaghmour via cfe-commits
@@ -979,6 +979,11 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, if (isa(New) && New->getParent()->isDependentType()) return false; + // CWG1351: if either of the old function or the new function is defined as + // deleted, we don't need

[clang] [Sema] Add -Wc++11-narrowing-const-reference (PR #76094)

2023-12-20 Thread Shafik Yaghmour via cfe-commits
@@ -6158,12 +6158,24 @@ def err_illegal_initializer_type : Error<"illegal initializer type %0">; def ext_init_list_type_narrowing : ExtWarn< "type %0 cannot be narrowed to %1 in initializer list">, InGroup, DefaultError, SFINAEFailure; +// *_narrowing_const_reference

[clang] [Clang][Sema] Fix Wswitch-default bad warning in template (PR #76007)

2023-12-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > For now I guess this is Ok, although I think the better fix would be to > diagnose missing or duplicate `default` labels even in the dependent case. > Because `default` labels themselves are never dependent. We should probably add a FIXME for this.

[clang] [Clang][Parser] Fix crash of clang when using C++ constructs like :: in C code (PR #74926)

2023-12-20 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. If you have addressed all review comments and no one has asked you to wait to land the PR then you can land once you get an approval. https://github.com/llvm/llvm-project/pull/74926 ___

[clang] Avoid printing overly large integer. (PR #75902)

2023-12-20 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > I agree with @tbaederr, fixing the underlying issue - either by optimizing > divide (good luck!) or printing in hexadecimal, seems like a better solution. > At the minimum, we should have a fixme comment to explain the restriction > > @tbaederr @erichkeane @shafik opinion? I

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-08 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you please update the description to explain the problem in more details and why these changes fixes the problem. The description is what ends up in the git log and it is important that those logs provide enough information to understand the changes without having to view

[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)

2023-12-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I don't feel like the changes are an improvement to the diagnostic but I would like to hear from others who focus on clang front-end reviews. https://github.com/llvm/llvm-project/pull/74852 ___ cfe-commits mailing

[clang] [Clang][Sema] Check the number of lambda non-concept tempate parameters (PR #74885)

2023-12-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This needs at least one test and a Release note. I expect the code form the issue to be well-formed: https://godbolt.org/z/bhdfG34xc So I am curious why you are adding the diagnostic for? https://github.com/llvm/llvm-project/pull/74885

[clang] [clang][Interp] Reject static lambdas with captures (PR #74718)

2023-12-08 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you please add more details to the description so folks reading the git log know what the change is without having to do more digging. https://github.com/llvm/llvm-project/pull/74718 ___ cfe-commits mailing list

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-08 Thread Shafik Yaghmour via cfe-commits
@@ -7820,6 +7820,18 @@ ExpectedStmt ASTNodeImporter::VisitExplicitCastExpr(ExplicitCastExpr *E) { *ToLParenLocOrErr, OCE->getBridgeKind(), E->getCastKind(), *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr); } + case Stmt::BuiltinBitCastExprClass: {

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2023-12-11 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/75130 In some cases when calling APValue::LValueBase::getType() when we have a ValueDecl in some cases we don't handle invalid decls. We iterating over redeclarations we reset the current decl to the current most

[clang] [Clang] Correctly construct template arguments for file-scope template template parameters (PR #76811)

2024-01-03 Thread Shafik Yaghmour via cfe-commits
@@ -345,15 +345,19 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( using namespace TemplateInstArgsHelpers; const Decl *CurDecl = ND; + + if (!ND) +CurDecl = Decl::castFromDeclContext(DC); + if (Innermost) {

[clang] [Clang] Correctly construct template arguments for file-scope template template parameters (PR #76811)

2024-01-03 Thread Shafik Yaghmour via cfe-commits
@@ -345,15 +345,19 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( using namespace TemplateInstArgsHelpers; const Decl *CurDecl = ND; + + if (!ND) shafik wrote: Can we also get a comment here why this makes sense to call

[clang] [Clang] Correctly construct template arguments for file-scope template template parameters (PR #76811)

2024-01-03 Thread Shafik Yaghmour via cfe-commits
@@ -345,15 +345,19 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( using namespace TemplateInstArgsHelpers; const Decl *CurDecl = ND; + + if (!ND) shafik wrote: Seems less error prone to check `!CurDecl` here. If the surrounding

[clang] [clang] Optimize castToDeclContext for 2% improvement in build times (PR #76825)

2024-01-03 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Please add a detailed summary for this PR. The summary is what usually goes into the git log and it is important that the git log is useful for quick understanding of changes without having to dig into the details.

[clang] [clang] Optimize castToDeclContext for 2% improvement in build times (PR #76825)

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

[clang] [ASTMatchers] fix captureVars assertion failure on capturesVariables (PR #76619)

2024-01-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Thank you for the fix, can you add more details to your summary. The summary is what usually goes into the git log. We would like those to be as descriptive as possible to avoid having to do extra digging to understand the change at a high level.

[libcxx] [libunwind] [libc] [flang] [lld] [lldb] [compiler-rt] [llvm] [clang-tools-extra] [clang] [libclc] [clang] Add tests for DRs about complete-class context (PR #77444)

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

[clang] [clang] Add test for CWG1350 (PR #78040)

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

[flang] [clang] [lld] [mlir] [compiler-rt] [libcxxabi] [libcxx] [clang-tools-extra] [lldb] [libunwind] [libc] [llvm] [openmp] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Shafik Yaghmour via cfe-commits
@@ -5678,10 +5678,15 @@ static ImplicitConversionSequence TryObjectArgumentInitialization( assert(FromType->isRecordType()); QualType ClassType = S.Context.getTypeDeclType(ActingContext); - // [class.dtor]p2: A destructor can be invoked for a const, volatile or - //

[clang] [clang] Fix direct-initialization with new expressions for arrays (PR #78201)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I believe the approach here is not sufficient and we have a current PR in progress: https://github.com/llvm/llvm-project/pull/76976 we also need codegen work to implement this. https://github.com/llvm/llvm-project/pull/78201

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

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

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
@@ -1383,6 +1383,34 @@ void CXXRecordDecl::addedMember(Decl *D) { } } +bool CXXRecordDecl::isLiteral() const { + const LangOptions = getLangOpts(); + if (!(LangOpts.CPlusPlus20 ? hasConstexprDestructor() + : hasTrivialDestructor())) +

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
@@ -208,3 +208,54 @@ namespace dr2565 { // dr2565: 16 open #endif } + + +namespace dr2598 { // dr2598: 18 +#if __cplusplus >= 201103L +struct NonLiteral { +NonLiteral(); +}; + +struct anonymous1 { +union {} a; +}; +static_assert(__is_literal(anonymous1), ""); +

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
@@ -208,3 +208,54 @@ namespace dr2565 { // dr2565: 16 open #endif } + + +namespace dr2598 { // dr2598: 18 +#if __cplusplus >= 201103L +struct NonLiteral { +NonLiteral(); +}; + +struct anonymous1 { +union {} a; +}; +static_assert(__is_literal(anonymous1), ""); +

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
@@ -208,3 +208,54 @@ namespace dr2565 { // dr2565: 16 open #endif } + + +namespace dr2598 { // dr2598: 18 +#if __cplusplus >= 201103L +struct NonLiteral { +NonLiteral(); +}; + +struct anonymous1 { +union {} a; +}; +static_assert(__is_literal(anonymous1), ""); +

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Mostly looks good but I would like a second set of eyes. https://github.com/llvm/llvm-project/pull/78195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Implement CWG2598: Union of non-literal types (PR #78195)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Is this a potentially breaking change since we have expanded what types are considered literals and already existing code may observe this fix? https://github.com/llvm/llvm-project/pull/78195 ___ cfe-commits

[clang] [clang] Fix CTAD not work for function-type and array-type arguments. (PR #78159)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM after more detailed summary provided. https://github.com/llvm/llvm-project/pull/78159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Fix CTAD not work for function-type and array-type arguments. (PR #78159)

2024-01-15 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you please provide a more detailed summary, since these are usually what goes in the git log. It should describe the cause and the approach of the fix. It is also helpful for reviewers as well. https://github.com/llvm/llvm-project/pull/78159

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-17 Thread Shafik Yaghmour via cfe-commits
@@ -2312,12 +2312,31 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec , bool IsForRangeLoop = false; if (TryConsumeToken(tok::colon, FRI->ColonLoc)) { IsForRangeLoop = true; + EnterExpressionEvaluationContext ForRangeInitContext( +

[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-01-17 Thread Shafik Yaghmour via cfe-commits
@@ -238,3 +239,236 @@ void init_capture_init_list() { // CHECK: call {{.*}}dtor // CHECK: } } + +namespace P2718R0 { shafik wrote: Is it possible to also test the case where it does not clean up like in the proposal: ```cpp for (auto e : f2(g())) {} //

[clang] [clang][Parser] Pop scope prior VarDecl invalidating by invalid init (PR #77434)

2024-01-09 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This makes sense to me but I would like @cor3ntin to review as well. This needs a release note. I see that there was two test cases. Do you think it is worth it to add the second test case as well? https://github.com/llvm/llvm-project/pull/77434

[clang] Fix crash with modules and constexpr destructor (PR #69076)

2024-01-09 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > ping @shafik @cor3ntin @ChuanqiXu9, how can we make progress here? Please add a release note and address my previous comment: https://github.com/llvm/llvm-project/pull/69076#issuecomment-1780327252 CC @cor3ntin https://github.com/llvm/llvm-project/pull/69076

[clang] [clang] Fix behavior of `__is_trivially_relocatable(volatile int)` (PR #77092)

2024-01-05 Thread Shafik Yaghmour via cfe-commits
shafik wrote: I think I would like some more eyes on this, I don't know if it is obvious to me what it means to reallocate a volatile object. https://github.com/llvm/llvm-project/pull/77092 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] move -Wcast-function-type under -Wextra (PR #77178)

2024-01-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: This should have a release note and I think this is a potentially breaking change since folks using `Wextra` may get this diagnostic now. https://github.com/llvm/llvm-project/pull/77178 ___ cfe-commits mailing

[clang] [Clang] Wide delimiters ('{{{') for expect strings (PR #77326)

2024-01-08 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Can we add a few tests for this change? https://github.com/llvm/llvm-project/pull/77326 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-11 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); +

[clang] [Clang][Lex] Fix parsing of nested requirement to prevent flowing off the end of token stream (PR #73691)

2023-11-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/73691 Currently when parsing a nested requirement we attempt to balance parens if we have a parameter list. This will fail in some cases of ill-formed code and keep going until we fall off the token stream and crash.

[clang] [clang] Fix a bug with qualified name lookup into current instantiation (PR #73018)

2023-11-28 Thread Shafik Yaghmour via cfe-commits
@@ -482,8 +481,23 @@ ParsedType Sema::getTypeName(const IdentifierInfo , SourceLocation NameLoc, } } } -// If typo correction failed or was not performed, fall through -[[fallthrough]]; +Result.suppressDiagnostics(); +return nullptr; + case

[clang] [clang] Fix a bug with qualified name lookup into current instantiation (PR #73018)

2023-11-28 Thread Shafik Yaghmour via cfe-commits
@@ -482,8 +481,23 @@ ParsedType Sema::getTypeName(const IdentifierInfo , SourceLocation NameLoc, } } } -// If typo correction failed or was not performed, fall through -[[fallthrough]]; +Result.suppressDiagnostics(); +return nullptr; + case

[clang] [Clang][Lex] Fix parsing of nested requirement to prevent flowing off the end of token stream (PR #73691)

2023-11-28 Thread Shafik Yaghmour via cfe-commits
@@ -3639,6 +3639,10 @@ ExprResult Parser::ParseRequiresExpression() { // TryParseParameterDeclarationClause). shafik wrote: I don't think the above fixme above is needed, I don't think there is any other way to handle this, at least based on

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2023-12-05 Thread Shafik Yaghmour via cfe-commits
@@ -8395,10 +8395,11 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, unsigned WarningDiag = diag::warn_decl_shadow; SourceLocation CaptureLoc; - if (isa(D) && isa(ShadowedDecl) && NewDC && - isa(NewDC)) { + if (isa(D) && NewDC && isa(NewDC)) {

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2023-12-05 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM w/ minor comments https://github.com/llvm/llvm-project/pull/74512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2023-12-05 Thread Shafik Yaghmour via cfe-commits
@@ -179,3 +179,21 @@ void f() { #endif } } + +namespace GH71976 { +struct A { + int b = 5; + int foo() { +return [b = b]() { return b; }(); + } +}; + +struct B { + int a; + void foo() { +auto b = [a = this->a] { shafik wrote: ```suggestion

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

2023-12-05 Thread Shafik Yaghmour via cfe-commits
@@ -179,3 +179,21 @@ void f() { #endif } } + +namespace GH71976 { +struct A { + int b = 5; + int foo() { +return [b = b]() { return b; }(); shafik wrote: ```suggestion return [b = b]() { return b; }(); // no diagnostic, init-capture does not shadow

[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

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

[clang] [clang] Reject incomplete type arguments for __builtin_dump_struct (PR #72749)

2023-12-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM you should put the bug report in the problem description so it automatically links the PR and closes it when you merge it. https://github.com/llvm/llvm-project/pull/72749 ___ cfe-commits

[clang] [clang] Fix crash when declaring invalid lambda member (PR #74110)

2023-12-01 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Can you add a little more details in the description on the root cause of the bug? https://github.com/llvm/llvm-project/pull/74110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][ASTImporter] Fix import of variable template redeclarations. (PR #72841)

2023-12-01 Thread Shafik Yaghmour via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -5050,6 +5050,59 @@ TEST_P(ImportFriendClasses, RecordVarTemplateDecl) { EXPECT_EQ(ToTUX, ToX); } +TEST_P(ASTImporterOptionSpecificTestBase, VarTemplateDeclConflict) { + getToTuDecl( + R"( +

[clang] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)

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

[clang] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)

2023-11-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think I mostly like this direction. https://github.com/llvm/llvm-project/pull/73879 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)

2023-11-29 Thread Shafik Yaghmour via cfe-commits
@@ -80,14 +86,21 @@ namespace dr5 { // dr5: 3.1 namespace dr7 { // dr7: 3.4 class A { public: ~A(); }; - class B : virtual private A {}; // expected-note 2 {{declared private here}} - class C : public B {} c; // expected-error 2 {{inherited virtual base class 'A' has

[clang] [Clang][Lex] Fix parsing of nested requirement to prevent flowing off the end of token stream (PR #73691)

2023-11-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/73691 >From 21d6bbdd1f8676e51b053ec3dd9020270e6b929e Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Tue, 28 Nov 2023 11:20:12 -0800 Subject: [PATCH] [Clang][Lex] Fix parsing of nested requirement to prevent

[clang] [Clang] Eagerly instantiate used constexpr function upon definition. (PR #73463)

2023-11-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. Thank you, LGTM https://github.com/llvm/llvm-project/pull/73463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2023-11-29 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Was there an RFC asking the community about exposing lambdas in pre C++11 > modes? This is a sufficiently large language extension that we probably > should verify if we haven't already. I believe this is a conforming extension > (I can't think of a circumstance under which

[clang] [Clang][Lex] Fix parsing of nested requirement to prevent flowing off the end of token stream (PR #73691)

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

[clang] [Clang] Implement P2308R1 - Template Parameter Initialization. (PR #73103)

2023-12-01 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/73103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[flang] [libcxx] [clang] [compiler-rt] [clang-tools-extra] [llvm] [Clang][Sema] Fix qualifier restriction of overriden methods (PR #71696)

2023-12-02 Thread Shafik Yaghmour via cfe-commits
@@ -18469,9 +18469,22 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New, // The new class type must have the same or less qualifiers as the old type. - if (NewClassTy.isMoreQualifiedThan(OldClassTy)) { + if

[flang] [libcxx] [clang] [compiler-rt] [clang-tools-extra] [llvm] [Clang][Sema] Fix qualifier restriction of overriden methods (PR #71696)

2023-12-02 Thread Shafik Yaghmour via cfe-commits
@@ -18469,9 +18469,22 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New, // The new class type must have the same or less qualifiers as the old type. - if (NewClassTy.isMoreQualifiedThan(OldClassTy)) { + if

[clang] [clang] assert fail when number of arguments in pack exceed implement… (PR #74220)

2023-12-03 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > Thanks for this PR! Emitting a diag in `TransformTemplateParmRefExpr` would > probably a better way to go about it. It's not clear to me that the assert` > is an improvement , and adding a diag would not be a lot more work. Would > that be something you would be willing to

[clang] [clang] assert fail when number of arguments in pack exceed implement… (PR #74220)

2023-12-03 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Please make sure before you commit that you update the description with more details. This is what will show up in the git log and we want to make sure that is detailed enough to allow folks to debug build issues etc without having to examine each commit in detail.

[clang] [clang] Improve bit-field in ref NTTP diagnostic (PR #71077)

2023-12-03 Thread Shafik Yaghmour via cfe-commits
shafik wrote: > > Can you add a release note? > > Do you think this small diagnostic wording change is worth noting in relnotes? Yes, we have a `Improvments to clang diagnostics` section. https://github.com/llvm/llvm-project/pull/71077 ___

[clang] [clang] Improve bit-field in ref NTTP diagnostic (PR #71077)

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

[clang] bbb8a0d - [Clang] Fix ResolveConstructorOverload to not select a conversion function if we are going use copy elision

2023-12-08 Thread Shafik Yaghmour via cfe-commits
Author: Shafik Yaghmour Date: 2023-12-08T09:38:59-08:00 New Revision: bbb8a0df7367068e1cf2fc54edd376beb976b430 URL: https://github.com/llvm/llvm-project/commit/bbb8a0df7367068e1cf2fc54edd376beb976b430 DIFF:

[clang] [clang] Crash when referencing capture in static lambda (PR #74661)

2023-12-06 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I think this makes sense but @cor3ntin should look at it. https://github.com/llvm/llvm-project/pull/74661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)

2023-11-30 Thread Shafik Yaghmour via cfe-commits
@@ -80,14 +86,21 @@ namespace dr5 { // dr5: 3.1 namespace dr7 { // dr7: 3.4 class A { public: ~A(); }; - class B : virtual private A {}; // expected-note 2 {{declared private here}} - class C : public B {} c; // expected-error 2 {{inherited virtual base class 'A' has

[clang] Extend life of variables in `DiagComparison` in `ExprConstant` (PR #79522)

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

[clang] Extend life of variables in `DiagComparison` in `ExprConstant` (PR #79522)

2024-01-26 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I believe the problem is that `DiagComparison` is capturing the locals `LHSValue` and `RHSValue` the lambda is being returned, the local are not longer in lifetime but we are calling `toString` on them. Maybe there is some SSO going on here that changes

[clang] [Clang][Sema] fix outline member function template with default align crash (PR #78400)

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

[clang] [Clang][Sema] fix outline member function template with default align crash (PR #78400)

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

[clang] [Clang][Sema] fix outline member function template with default align crash (PR #78400)

2024-01-26 Thread Shafik Yaghmour via cfe-commits
@@ -3061,11 +3062,19 @@ bool Sema::SubstDefaultArgument( /*ForDefinition*/ false); if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs)) return true; + if (FD->isOutOfLine()) { +TemplateArgumentList

[clang] [Clang][Sema] Fix crash when type used in return statement contains errors (PR #79788)

2024-01-28 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/79788 In Sema in `BuildReturnStmt(...)` when we try to determine is the type is move eligable or copy elidable we don't currently check of the init of the `VarDecl` contain errors or not. This can lead to a crash

[clang] [Clang][Sema] Fix crash when type used in return statement contains errors (PR #79788)

2024-01-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/79788 >From dde16b48d563b3e279872081bad148614e9d28a3 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Sun, 28 Jan 2024 22:42:53 -0800 Subject: [PATCH] [Clang][Sema] Fix crash when type used in return statement

[clang] [Clang][Sema] Fix crash when type used in return statement contains errors (PR #79788)

2024-01-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik updated https://github.com/llvm/llvm-project/pull/79788 >From f7f1007954503d013294c2e21ce2160dc7866164 Mon Sep 17 00:00:00 2001 From: Shafik Yaghmour Date: Sun, 28 Jan 2024 22:42:53 -0800 Subject: [PATCH] [Clang][Sema] Fix crash when type used in return statement

[clang] [clang] Implement CTAD for type alias template. (PR #77890)

2024-01-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: In order to aid the discussion on the temporary flag, I think it would be helpful to have a full set of tests that show what elements won't work right with the current set of changes. I think this will help us gauge how impactful partial support would be

[clang] [Clang][Sema] Fix crash when type used in return statement contains errors (PR #79788)

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

[clang] [Clang][Sema] Fix crash when type used in return statement contains errors (PR #79788)

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

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
@@ -1526,10 +1526,9 @@ bool CXXRecordDecl::isGenericLambda() const { #ifndef NDEBUG static bool allLookupResultsAreTheSame(const DeclContext::lookup_result ) { - for (auto *D : R) -if (!declaresSameEntity(D, R.front())) - return false; - return true; + return

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
@@ -1455,39 +1455,44 @@ More information could be found `here Language Extensions Back-ported to Previous Standards = -==

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
@@ -58,16 +58,10 @@ class Class2 : public Class1 { #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer // expected-error {{expected '(' after 'initializer'}} #pragma omp declare reduction(fun2 : long : omp_out += omp_in)

[clang] [clang][ASTImporter] Improve import of variable template specializations. (PR #78284)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -6397,116 +6400,132 @@ ExpectedDecl ASTNodeImporter::VisitVarTemplateSpecializationDecl( // Try to find an existing specialization with these template arguments. void *InsertPos = nullptr; -

[clang] [clang][ASTImporter] Improve import of variable template specializations. (PR #78284)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -6397,116 +6400,132 @@ ExpectedDecl ASTNodeImporter::VisitVarTemplateSpecializationDecl( // Try to find an existing specialization with these template arguments. void *InsertPos = nullptr; -

[clang] [clang] Fix crash when declaring invalid lambda member (PR #74110)

2024-01-31 Thread Shafik Yaghmour via cfe-commits
@@ -1526,10 +1526,9 @@ bool CXXRecordDecl::isGenericLambda() const { #ifndef NDEBUG static bool allLookupResultsAreTheSame(const DeclContext::lookup_result ) { - for (auto *D : R) -if (!declaresSameEntity(D, R.front())) - return false; - return true; + return

<    1   2   3   4   5   6   7   >