[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

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

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-29 Thread Haojian Wu via cfe-commits
hokein wrote: > Can you also add a lit test for: > > ```c++ > std::vector getVector(); > std::set s; > s.insert(getVector().begin(), getVector().end()); // FIXME: taking iterator > of a temporary container without immediate dereference is almost always wrong. > ``` I think this is a different

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-29 Thread Haojian Wu via cfe-commits
@@ -37,67 +37,56 @@ struct vector { struct [[gsl::Pointer()]] View {}; std::vector views; // CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition implicit_instantiation -// CHECK: TemplateArgument type 'View' -// CHECK-NOT: LifetimeCaptureByAttr

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-29 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/118013 >From feb9445efffa69c158407bda6f5981a033197567 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 28 Nov 2024 14:27:23 +0100 Subject: [PATCH 1/3] [clang] NFC, simplify the attr-lifetime-capture-by.test --- cl

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
@@ -37,67 +37,56 @@ struct vector { struct [[gsl::Pointer()]] View {}; std::vector views; // CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition implicit_instantiation -// CHECK: TemplateArgument type 'View' -// CHECK-NOT: LifetimeCaptureByAttr

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Can you also add a lit test for: ```cpp std::vector getVector(); std::set s; s.insert(getVector().begin(), getVector().end()); // FIXME: taking iterator of a temporary container without immediate dereference is almost always wrong. ``` https:

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/118013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Haojian Wu (hokein) Changes We incorrectly annotate the iterator parameter for `insert` method (`void insert(const_iterator, const value_type& value)`), because iterator is also a gsl-pointer type. This patch fixes it. --- Full diff: ht

[clang] [clang] Fix incorrect inferred lifetime_capture_by attr on STL (PR #118013)

2024-11-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/118013 We incorrectly annotate the iterator parameter for `insert` method (`void insert(const_iterator, const value_type& value)`), because iterator is also a gsl-pointer type. This patch fixes it. >From feb9445efffa