[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-24 Thread David Blaikie via cfe-commits
dwblaikie wrote: Hit an msan use-of-uninitialized on an internal use case (a tool that uses Clang via API). the test was compiling this source code: ``` #include namespace proto2 { struct Message {}; } // namespace proto2 struct FakeProto : proto2::Message { const std::string& getter()

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
https://github.com/cor3ntin closed https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
@@ -3048,10 +3050,12 @@ class OverloadExpr : public Expr { Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier()); Result.IsAddressOfOperand = true; + Result.IsAddressOfOperandWithParen = HasParen; cor3ntin wrote: I added a

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
@@ -5813,6 +5813,23 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa(Fn)) +return false; + + Fn = Fn->IgnoreParens(); cor3ntin

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/6] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
@@ -5813,6 +5813,27 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +// [C++26][[expr.unary.op]/p4 +// A pointer to member is only formed when an explicit & +// is used and its operand is a qualified-id not enclosed in

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-05 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/6] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Aaron Ballman via cfe-commits
@@ -899,6 +899,8 @@ class Sema; /// object argument. bool IgnoreObjectArgument : 1; +bool TookAddressOfOverload : 1; AaronBallman wrote: CC @Endilll -- it might be nice to refactor this code to use `LLVM_PREFERRED_TYPE`, but also to fix the

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Aaron Ballman via cfe-commits
@@ -5813,6 +5813,27 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +// [C++26][[expr.unary.op]/p4 +// A pointer to member is only formed when an explicit & +// is used and its operand is a qualified-id not enclosed in

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Aaron Ballman via cfe-commits
@@ -999,6 +1001,8 @@ class Sema; /// Initialization of an object of class type by constructor, /// using either a parenthesized or braced list of arguments. CSK_InitByConstructor, + + CSK_AddressOfOverloadSet, AaronBallman wrote: Please

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/5] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 331eb8a0047504f3ae2cdf2d6c60b93e5d0543f1 f7a13a2821a415ea7342fafa63740dc82e589e26 --

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/5] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -5813,6 +5813,23 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa(Fn)) +return false; + + Fn = Fn->IgnoreParens(); erichkeane

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -7807,6 +7833,7 @@ void Sema::AddTemplateOverloadCandidate( Candidate.IgnoreObjectArgument = isa(Candidate.Function) && !isa(Candidate.Function); +Candidate.TookAddressOfOverload = false; erichkeane wrote: Feel like Candidate should

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
@@ -3048,10 +3050,12 @@ class OverloadExpr : public Expr { Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier()); Result.IsAddressOfOperand = true; + Result.IsAddressOfOperandWithParen = HasParen; erichkeane wrote: Cleanup nit: I

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-04 Thread via cfe-commits
cor3ntin wrote: @AaronBallman @erichkeane ping! https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-29 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/4] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-29 Thread via cfe-commits
@@ -5813,6 +5813,24 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa(Fn)) +return false; + + Fn = Fn->IgnoreParens(); + auto *UO = dyn_cast(Fn);

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-29 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/3] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-28 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/93430 >From 131f515c1341122896ea3c9624751a634db06cb7 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 27 May 2024 01:16:06 +0200 Subject: [PATCH 1/2] [Clang] Static and explicit object member functions with

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
@@ -7636,7 +7651,16 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding // parameter of F. - QualType

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
@@ -16333,7 +16387,7 @@ ExprResult Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, assert(UnOp->getOpcode() == UO_AddrOf && "Can only take the address of an overloaded function"); if (CXXMethodDecl *Method = dyn_cast(Fn)) { - if

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
@@ -209,6 +209,9 @@ C++23 Feature Support - Added a ``__reference_converts_from_temporary`` builtin, completing the necessary compiler support for `P2255R2: Type trait to determine if a reference binds to a temporary `_. +- Implemented `P2797R0:

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
@@ -5834,9 +5852,12 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, // C99 6.5.2.2p7 - the arguments are implicitly converted, as if by // assignment, to the types of the corresponding parameter, ... + + bool AddressOf =

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
@@ -5813,6 +5813,24 @@ static TypoCorrection TryTypoCorrectionForCall(Sema , Expr *Fn, return TypoCorrection(); } +static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { + if (!isa(Fn)) +return false; + + Fn = Fn->IgnoreParens(); + auto *UO = dyn_cast(Fn);

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
https://github.com/Sirraide commented: Just a few minor things I noticed https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread via cfe-commits
https://github.com/Sirraide edited https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++23 %s -ast-dump | FileCheck --check-prefixes=CXX23 %s + +namespace cwg2771 { // cwg2771: 18 + +struct A{ +int a; +void cwg2771(){ + int* r = +} +}; +// CXX23: CXXMethodDecl{{.+}}cwg2771 +// CXX23-NEXT: CompoundStmt

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread Vlad Serebrennikov via cfe-commits
@@ -240,3 +240,29 @@ void test() { } } #endif + + +#if __cplusplus >= 202302L Endilll wrote: Move `#if` inside `namespace`. https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread Vlad Serebrennikov via cfe-commits
@@ -240,3 +240,29 @@ void test() { } } #endif + + +#if __cplusplus >= 202302L +namespace cwg2692 { // cwg2692: 19 + + struct A { +static void f(A); // #cwg2692-1 +void f(this A); // #cwg2692-2 + +void g(); + }; + + void A::g() { +(::f)(A()); // expected-error

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-27 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++23 %s -ast-dump | FileCheck --check-prefixes=CXX23 %s + +namespace cwg2771 { // cwg2771: 18 + +struct A{ +int a; +void cwg2771(){ + int* r = Endilll wrote: You can use `#pragma clang __debug dump ` to

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-26 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) Changes Implement wg21.link/P2797. Because taking the address of an explicit object member function results in a function pointer, a call expression where the id-expression is an explicit object member is made to

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-05-26 Thread via cfe-commits
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/93430 Implement wg21.link/P2797. Because taking the address of an explicit object member function results in a function pointer, a call expression where the id-expression is an explicit object member is made to