[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-04 Thread Haojian Wu via cfe-commits
hokein wrote: > @hokein feel free to merge :) Thanks for the ping. We have several instances of `func(1,);` in our internal codebase, and the number is not small unfortunately. I'm currently working on a cleanup, which will take some time. I plan to merge this patch as soon as the cleanup is

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/125232 Fixes #125225 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH] Diagnose the code with trailing comma in the functio

[clang-tools-extra] [include-cleaner] Dont report explicit refs for global operator new/delete (PR #125199)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/125199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
@@ -2237,6 +2237,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (PP.isCodeCompletionReached() && !CalledSignatureHelp) RunSignatureHelp(); LHS = ExprError(); + } else if (!HasError && HasTrailingComma) { +

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125232 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH 1/2] Diagnose the code with trailing comma in the function call. --

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
hokein wrote: > Can you add a release note and a more detailed description? Thanks Done. I think we don't need a release note, this is a regression fix, and https://github.com/llvm/llvm-project/pull/114684 is not released yet. https://github.com/llvm/llvm-project/pull/125232 __

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125232 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH 1/2] Diagnose the code with trailing comma in the function call. --

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-05 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-05 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-06 Thread Haojian Wu via cfe-commits
hokein wrote: Heads-up: this patch triggers a MSAN failure in an lldb test (`lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py`), the stacktrace: ``` ==5633==WARNING: MemorySanitizer: use-of-uninitialized-value #0 in decltype(auto) clang::ASTNodeImporter::CallOv

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/125478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/126532 Fixes #125821 The assertion was too strict, as Clang can reach this code path when recursively generating deduction guides for alias templates. See the detailed explanation [here](https://github.com/llvm/llvm-

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125478 >From 4af8e1985c4882e1083cd522eb955f69066bd15e Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 3 Feb 2025 11:55:17 +0100 Subject: [PATCH 1/3] [clang] CTAD alias: Respecte explicit deduction guides defined a

[clang] [clang] CTAD alias: Respect explicit deduction guides defined after the first use of the alias template. (PR #125478)

2025-02-10 Thread Haojian Wu via cfe-commits
@@ -237,8 +237,17 @@ static_assert(__is_same(decltype(s.t), int)); // explicit deduction guide. Foo(int) -> Foo; AFoo s2{i}; -// FIXME: the type should be X because of the above explicit deduction guide. -static_assert(__is_same(decltype(s2.t), int)); +static_assert(__is_same(d

[clang] [lldb] [lldb][TypeSystemClang] Initialize ClassTemplateSpecializationDecl's StrictPackMatch field (PR #126215)

2025-02-07 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thank you! https://github.com/llvm/llvm-project/pull/126215 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/126532 >From cc0b4f59c273db9baff85a457ef534d6f7ca9cfb Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Mon, 10 Feb 2025 15:44:00 +0100 Subject: [PATCH] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideF

[clang] [clang] CTAD: Remove an incorrect assertion in BuildDeductionGuideForTypeAlias (PR #126532)

2025-02-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein ready_for_review https://github.com/llvm/llvm-project/pull/126532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] da2b415 - [clang] Add tracking source deduction guide for the explicitly-written

2025-02-02 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-02-02T23:06:25+01:00 New Revision: da2b415b19d178d6b250bb6468ed4a207860adf7 URL: https://github.com/llvm/llvm-project/commit/da2b415b19d178d6b250bb6468ed4a207860adf7 DIFF: https://github.com/llvm/llvm-project/commit/da2b415b19d178d6b250bb6468ed4a207860adf7.diff LO

[clang-tools-extra] [include-cleaner] Dont report explicit refs for global operator new/delete (PR #125199)

2025-01-31 Thread Haojian Wu via cfe-commits
@@ -32,6 +33,11 @@ namespace clang::include_cleaner { namespace { +bool isImplicitOperatorNewDelete(OverloadedOperatorKind OpKind) { hokein wrote: Nit: this function only checks whether `OpKind` is of the new/delete kind. Having `Implici`t in the function na

[clang] [Clang] enhance error recovery with RecoveryExpr for trailing commas in call arguments (PR #114684)

2025-01-31 Thread Haojian Wu via cfe-commits
hokein wrote: I have a fix for it #125232 https://github.com/llvm/llvm-project/pull/114684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 7612dcc - [clang] NFC, add a "continue" bailout in the for-loop of

2025-02-01 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-02-01T10:07:40+01:00 New Revision: 7612dcc6e8d8e7f19b364084effbb01946294720 URL: https://github.com/llvm/llvm-project/commit/7612dcc6e8d8e7f19b364084effbb01946294720 DIFF: https://github.com/llvm/llvm-project/commit/7612dcc6e8d8e7f19b364084effbb01946294720.diff LO

[clang] [clang] Fix the post-filtering heuristic for GSLPointer. (PR #114044)

2024-12-11 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/114044 >From 75a8bd038d6ba68eb70136c0be9ad66fac0c181f Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 1 Nov 2024 16:51:03 +0100 Subject: [PATCH 1/6] [clang] Fix the post-filtering heuristics for GSLPointer case.

[clang] [clang] Fix a dangling reference in clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (PR #119197)

2024-12-10 Thread Haojian Wu via cfe-commits
hokein wrote: I'm landing this change now since it is a straightforward use-after-free fix, happy to address any followups. https://github.com/llvm/llvm-project/pull/119197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [clang] Fix a dangling reference in clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (PR #119197)

2024-12-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/119197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Enable the -Wdangling-capture diagnostic by default. (PR #119685)

2024-12-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/119685 We have tested this diagnostics internally, and we don't find see any issues. >From be7678e1798ad61af05ac3f83d7149125be9ed7a Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 12 Dec 2024 10:57:06 +0100 Subjec

[clang] [clang] Enable the -Wdangling-capture diagnostic by default. (PR #119685)

2024-12-12 Thread Haojian Wu via cfe-commits
hokein wrote: > Did you benchmark the impact on compile times? I don't have concrete numbers, this warning works similarly to other -Wdangling warnings, performing only a lightweight, single-statement analysis on the annotated parameter, I believe the cost on compile times is negligible. htt

[clang] [clang] Enable the -Wdangling-capture diagnostic by default. (PR #119685)

2024-12-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/119685 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks, this looks good. https://github.com/llvm/llvm-project/pull/118174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/118174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits
hokein wrote: > @hokein, can you commit this, please? I don't have the permissions sure, done. https://github.com/llvm/llvm-project/pull/118174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-17 Thread Haojian Wu via cfe-commits
@@ -582,6 +582,15 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, // Temp().ptr; // Here ptr might not dangle. if (isa(Arg->IgnoreImpCasts())) return; +// Avoid false positives when the object is constructed from a conditional

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-17 Thread Haojian Wu via cfe-commits
@@ -582,6 +582,15 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, // Temp().ptr; // Here ptr might not dangle. if (isa(Arg->IgnoreImpCasts())) return; +// Avoid false positives when the object is constructed from a conditional

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-17 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/120233 Fixes https://github.com/llvm/llvm-project/issues/120206 >From 36697bc0bc4047257b2307b26fdb5c4343dee340 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 17 Dec 2024 14:28:00 +0100 Subject: [PATCH] [clang] Fi

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-17 Thread Haojian Wu via cfe-commits
@@ -582,6 +582,15 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, // Temp().ptr; // Here ptr might not dangle. if (isa(Arg->IgnoreImpCasts())) return; +// Avoid false positives when the object is constructed from a conditional

[clang] [clang] Fix the post-filtering heuristic for GSLPointer. (PR #114044)

2024-12-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/114044 >From 15b7806b933b0964d004c9d13565bc834c59fb01 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 1 Nov 2024 16:51:03 +0100 Subject: [PATCH 1/6] [clang] Fix the post-filtering heuristics for GSLPointer case.

[clang] [clang] Fix the post-filtering heuristic for GSLPointer. (PR #114044)

2024-12-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/114044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix the post-filtering heuristic for GSLPointer. (PR #114044)

2024-12-12 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/114044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-19 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/120233 >From 1bd4bf164082d236d17ada8240d7ba096a94609d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 17 Dec 2024 14:28:00 +0100 Subject: [PATCH] [clang] Fix dangling false positives for conditional operators. --

[clang] eace826 - [clang] NFC, simplify the shouldLifetimeExtendThroughPath.

2024-12-19 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2024-12-19T13:05:57+01:00 New Revision: eace8269d9aeb67013d273735ec1be1002a6fac1 URL: https://github.com/llvm/llvm-project/commit/eace8269d9aeb67013d273735ec1be1002a6fac1 DIFF: https://github.com/llvm/llvm-project/commit/eace8269d9aeb67013d273735ec1be1002a6fac1.diff LO

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/120233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/120233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix dangling false positives for conditional operators. (PR #120233)

2024-12-20 Thread Haojian Wu via cfe-commits
hokein wrote: > Please add more details to the summary, especially a note that there > theoretically could be false negatives but it fixes the overall issue and the > tradeoff good. Done. https://github.com/llvm/llvm-project/pull/120233 ___ cfe-comm

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-21 Thread Haojian Wu via cfe-commits
@@ -268,6 +268,40 @@ void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { } } +static bool IsPointerLikeType(QualType QT) { hokein wrote: nit: `isPointerLikeType` https://github.com/llvm/llvm-project/pull/117122 __

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-21 Thread Haojian Wu via cfe-commits
@@ -366,3 +366,82 @@ void use() { capture3(std::string(), x3); // expected-warning {{object whose reference is captured by 'x3' will be destroyed at the end of the full-expression}} } } // namespace temporary_views + +// **

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-21 Thread Haojian Wu via cfe-commits
@@ -1757,6 +1757,9 @@ class Sema final : public SemaBase { /// Add [[clang:::lifetimebound]] attr for std:: functions and methods. void inferLifetimeBoundAttribute(FunctionDecl *FD); + /// Add [[clang:::lifetime_capture(this)]] to STL container methods. h

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-21 Thread Haojian Wu via cfe-commits
@@ -268,6 +268,40 @@ void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { } } +static bool IsPointerLikeType(QualType QT) { + QT = QT.getNonReferenceType(); + if (QT->isPointerType()) +return true; + auto *RD = QT->getAsCXXRecordDecl(); + if (!RD) +return f

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-21 Thread Haojian Wu via cfe-commits
@@ -268,6 +268,40 @@ void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { } } +static bool IsPointerLikeType(QualType QT) { + QT = QT.getNonReferenceType(); + if (QT->isPointerType()) +return true; + auto *RD = QT->getAsCXXRecordDecl(); + if (!RD) +return f

[clang] [Clang] enhance error recovery with RecoveryExpr for trailing commas in call arguments (PR #114684)

2024-11-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/114684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/117122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-22 Thread Haojian Wu via cfe-commits
@@ -7,3 +7,106 @@ struct S { }; // CHECK: CXXMethodDecl {{.*}}clang::lifetime_capture_by(a, b, global) + +// +// Infer annotation for STL container methods. +// ***

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-05 Thread Haojian Wu via cfe-commits
@@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers( // We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they // are type attributes, because we historically haven't allowed these // to be used as type attributes in C++11

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-05 Thread Haojian Wu via cfe-commits
@@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers( // We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they // are type attributes, because we historically haven't allowed these // to be used as type attributes in C++11

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-08 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/122088 We currently have ad-hoc filtering logic for temporary object member access in `VisitGSLPointerArg`. This logic filters out more cases than it should, leading to false negatives. Furthermore, this location lacks

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/122088 >From 8c4f9bcb00c56f564abf6cfa115854681b48f7d9 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 17 Dec 2024 14:28:00 +0100 Subject: [PATCH 1/2] [clang] Refine the temporay object member access filtering for

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-09 Thread Haojian Wu via cfe-commits
@@ -806,3 +806,31 @@ std::string_view test2(int c, std::string_view sv) { } } // namespace GH120206 + +namespace GH120543 { +struct S { + std::string_view sv; + std::string s; +}; +struct Q { + const S* get() const [[clang::lifetimebound]]; +}; +void test1() { + std::strin

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-09 Thread Haojian Wu via cfe-commits
@@ -1103,6 +1094,8 @@ shouldLifetimeExtendThroughPath(const IndirectLocalPath &Path) { for (auto Elem : Path) { if (Elem.Kind == IndirectLocalPathEntry::DefaultInit) return PathLifetimeKind::Extend; +if (Elem.Kind == IndirectLocalPathEntry::MemberExpr) + c

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/123648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
@@ -1571,9 +1571,10 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { } else { Record.push_back(0); } -// For lambdas inside canonical FunctionDecl remember the mapping. +// For lambdas inside template functions, remember the mapping to +/

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: > before this change RelatedDeclsMap was created only for canonical decl but in > reality it has to be done for the definition of the function that does not > always match the canonical decl. I'm new to the module codebase, and it is not obvious to me. Coul

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: We have initiated tests to verify this fix within our codebase. It will take some time to get the results. https://github.com/llvm/llvm-project/pull/123648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/123648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-21 Thread Haojian Wu via cfe-commits
@@ -1571,9 +1571,10 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { } else { Record.push_back(0); } -// For lambdas inside canonical FunctionDecl remember the mapping. +// For lambdas inside template functions, remember the mapping to +/

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-22 Thread Haojian Wu via cfe-commits
@@ -799,14 +817,12 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { } if (D->getFriendObjectKind()) { -// For a function defined inline within a class template, we have to force -// the canonical definition to be the one inside the canonical definition

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/122088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Track source deduction guide for alias template deduction guides (PR #123875)

2025-01-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks, the change looks good. https://github.com/llvm/llvm-project/pull/123875 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-22 Thread Haojian Wu via cfe-commits
@@ -539,11 +539,12 @@ class ASTReader /// Mapping from main decl ID to the related decls IDs. /// - /// These related decls have to be loaded right after the main decl. - /// It is required to have canonical declaration for related decls from the - /// same module as th

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks for the fix! It looks good from my side, just small nits. Feel free to land it. https://github.com/llvm/llvm-project/pull/123648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-22 Thread Haojian Wu via cfe-commits
@@ -799,14 +813,14 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { } if (D->getFriendObjectKind()) { -// For a function defined inline within a class template, we have to force -// the canonical definition to be the one inside the canonical definition

[clang] [C++20][Modules] Fix crash/compiler error due broken AST links (PR #123648)

2025-01-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/123648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-22 Thread Haojian Wu via cfe-commits
hokein wrote: > I like 1, but not really 2, I think we should wait for this to be reasonably > complete before merging it, particularly this close to the release. I'd > probably be ok with 2 if we wait a few weeks until after the release, so that > we can deal with the fallout with less stress

[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

2025-01-21 Thread Haojian Wu via cfe-commits
@@ -537,17 +537,14 @@ class ASTReader /// namespace as if it is not delayed. DelayedNamespaceOffsetMapTy DelayedNamespaceOffsetMap; - /// Mapping from FunctionDecl IDs to the corresponding lambda IDs. - /// - /// These lambdas have to be loaded right after the function

[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

2025-01-21 Thread Haojian Wu via cfe-commits
@@ -798,6 +798,17 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { } } + if (D->getFriendObjectKind()) { hokein wrote: As stated in https://github.com/llvm/llvm-project/issues/122493#issuecomment-2602473058, this is intended. It would be h

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-20 Thread Haojian Wu via cfe-commits
hokein wrote: Discovered a new false positive, similar to https://github.com/llvm/llvm-project/pull/114213, ``` struct Bar {}; struct Foo { std::unique_ptr bar; }; struct Test { Test(Foo foo) : bar(foo.bar.get()), // bogus diagnostic: initializing pointer member 'bar' with the stack add

[clang-tools-extra] [include-cleaner] Respect langopts when analyzing macro names (PR #123634)

2025-01-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/123634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-20 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/122088 >From 82415b4085f3ab956926909d68b16afff26ceb51 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 17 Dec 2024 14:28:00 +0100 Subject: [PATCH 1/4] [clang] Refine the temporay object member access filtering for

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-20 Thread Haojian Wu via cfe-commits
hokein wrote: > Discovered a new false positive, similar to #114213, > > ``` > struct Bar {}; > > struct Foo { >std::unique_ptr bar; > }; > > struct Test { > Test(Foo foo) : bar(foo.bar.get()), // bogus diagnostic: initializing > pointer member 'bar' with the stack address of parameter

[clang] [clang][CodeComplete] Use HeuristicResolver to resolve DependentNameTypes (PR #123818)

2025-01-22 Thread Haojian Wu via cfe-commits
hokein wrote: Do we need a release note in llvm-project/clang/docs/ReleaseNotes.rst? This is an improvement on clang's code completion infra, but maybe it is not noticeable to compiler users. https://github.com/llvm/llvm-project/pull/123818 ___ cfe-c

[clang] [clang][CodeComplete] Use HeuristicResolver to resolve DependentNameTypes (PR #123818)

2025-01-22 Thread Haojian Wu via cfe-commits
@@ -5736,11 +5736,20 @@ class ConceptInfo { // In particular, when E->getType() is DependentTy, try to guess a likely type. // We accept some lossiness (like dropping parameters). // We only try to handle common expressions on the LHS of MemberExpr. -QualType getApproximateType

[clang] [clang][CodeComplete] Use HeuristicResolver to resolve DependentNameTypes (PR #123818)

2025-01-22 Thread Haojian Wu via cfe-commits
@@ -5736,11 +5736,20 @@ class ConceptInfo { // In particular, when E->getType() is DependentTy, try to guess a likely type. // We accept some lossiness (like dropping parameters). // We only try to handle common expressions on the LHS of MemberExpr. -QualType getApproximateType

[clang] [clang][CodeComplete] Use HeuristicResolver to resolve DependentNameTypes (PR #123818)

2025-01-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/123818 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeComplete] Use HeuristicResolver to resolve CXXDependentScopeMemberExpr (PR #124888)

2025-01-30 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. nice cleanup! https://github.com/llvm/llvm-project/pull/124888 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-13 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/122088 >From aee3d1a6f5782bb68547679505571cd4b56f3573 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 17 Dec 2024 14:28:00 +0100 Subject: [PATCH 1/3] [clang] Refine the temporay object member access filtering for

[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

2025-01-13 Thread Haojian Wu via cfe-commits
@@ -1103,6 +1094,8 @@ shouldLifetimeExtendThroughPath(const IndirectLocalPath &Path) { for (auto Elem : Path) { if (Elem.Kind == IndirectLocalPathEntry::DefaultInit) return PathLifetimeKind::Extend; +if (Elem.Kind == IndirectLocalPathEntry::MemberExpr) + c

[clang] d7e7966 - Remove an extra trailing `` in Modules.rst, NFC

2025-01-13 Thread Haojian Wu via cfe-commits
Author: Haojian Wu Date: 2025-01-13T12:04:21+01:00 New Revision: d7e79663e77e05ed4e7580be1dca00d7ef3b12c5 URL: https://github.com/llvm/llvm-project/commit/d7e79663e77e05ed4e7580be1dca00d7ef3b12c5 DIFF: https://github.com/llvm/llvm-project/commit/d7e79663e77e05ed4e7580be1dca00d7ef3b12c5.diff LO

[clang] [llvm] [llvm] Add lifetimebound to llvm::sys::path::filename, etc. (PR #122890)

2025-01-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks, looks good. https://github.com/llvm/llvm-project/pull/122890 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add a unit test suite for HeuristicResolver (PR #121313)

2024-12-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/121313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add a unit test suite for HeuristicResolver (PR #121313)

2024-12-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: this looks good to me in general. https://github.com/llvm/llvm-project/pull/121313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add a unit test suite for HeuristicResolver (PR #121313)

2024-12-31 Thread Haojian Wu via cfe-commits
@@ -0,0 +1,521 @@ +//===-- HeuristicResolverTests.cpp --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang] Infer capture_by for insert_or_assign (PR #122109)

2025-01-08 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/122109 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2025-01-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2025-01-10 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/118567 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][Sema] Upstream HeuristicResolver from clangd (PR #121314)

2025-01-16 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. The change looks good to me. https://github.com/llvm/llvm-project/pull/121314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't infer lifetime_capture-by for reference of raw pointer types. (PR #122240)

2025-01-09 Thread Haojian Wu via cfe-commits
@@ -406,7 +406,7 @@ void use() { strings.insert(strings.begin(), std::string()); std::vector pointers; - pointers.push_back(getLifetimeBoundPointer(std::string())); // expected-warning {{object whose reference is captured by 'pointers' will be destroyed at the end of th

[clang] [clang] Don't infer lifetime_capture-by for reference of raw pointer types. (PR #122240)

2025-01-09 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/122240 When a vector is instantiated with a pointer type (`T` being `const Foo*`), the inferred annotation becomes `push_back(const Foo*& value [[clang::lifetime_capture_by(this)]])`. For reference parameters, the `li

[clang-tools-extra] [clangd] Make EnableFunctionArgSnippets option string-typed (PR #121178)

2024-12-30 Thread Haojian Wu via cfe-commits
@@ -242,13 +242,13 @@ opt FallbackStyle{ init(clang::format::DefaultFallbackStyle), }; -opt EnableFunctionArgSnippets{ +opt EnableFunctionArgSnippets{ hokein wrote: We could also consider the following option, but up to you. ``` enum FunctionArgSnippetsFl

[clang-tools-extra] [clangd] Make EnableFunctionArgSnippets option string-typed (PR #121178)

2024-12-30 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Not a very related comment, I think we need to add the new `ArgumentLists` config in the clangd config doc https://clangd.llvm.org/config#completion. https://github.com/llvm/llvm-project/pull/121178 __

[clang-tools-extra] [clangd] Make EnableFunctionArgSnippets option string-typed (PR #121178)

2024-12-30 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/121178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct the order of substituted arguments in CTAD alias guides (PR #123022)

2025-01-15 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks for the fix, it looks good from myside. https://github.com/llvm/llvm-project/pull/123022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [Clang] Remove the PackExpansion restrictions for rewrite substitution (PR #126206)

2025-02-13 Thread Haojian Wu via cfe-commits
@@ -2041,9 +2041,11 @@ TemplateName TemplateInstantiator::TransformTemplateName( // We're rewriting the template parameter as a reference to another // template parameter. if (Arg.getKind() == TemplateArgument::Pack) { - assert(Arg.pack_size() =

<    25   26   27   28   29   30   31   32   >