[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 ready_for_review https://github.com/llvm/llvm-project/pull/68922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68922 >From 0c71b6bdd557ff4b9ad9a4ec4f0919e3460596b0 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 12 Oct 2023 21:35:52 +0200 Subject: [PATCH 1/2] Find opertor!= in the correct namespace --- clang/lib/Sema/Se

[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68922 >From 0c71b6bdd557ff4b9ad9a4ec4f0919e3460596b0 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 12 Oct 2023 21:35:52 +0200 Subject: [PATCH 1/3] Find opertor!= in the correct namespace --- clang/lib/Sema/Se

[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-13 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: > Does this work for function-scope operator declarations? @zygoloid I am not sure I follow. Could you please give an example. If this is about member operator, the search scope is class scope of the first operand. https://github.com/llvm/llvm-project/pull/68922 __

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/68999 We associated conversion seq for args (when reversed) to the wrong index. This lead to clang believing reversed `operator==` a worse overload candidate than the `operator==` without reversed args when both these can

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68999 >From 01ba05ec9349c7b93239b7e6196e3fa6c7fc1f82 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 13 Oct 2023 17:17:32 +0200 Subject: [PATCH 1/2] Correctly compute conversion seq for args to fn with reveresed

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68999 >From 01ba05ec9349c7b93239b7e6196e3fa6c7fc1f82 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 13 Oct 2023 17:17:32 +0200 Subject: [PATCH 1/3] Correctly compute conversion seq for args to fn with reveresed

[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-16 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Thanks @zygoloid. This case was failing with my change. Corrected and added tests. https://github.com/llvm/llvm-project/pull/68922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] Use the correct namespace for looking up matching operator!= (PR #68922)

2023-10-16 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68922 >From 0c71b6bdd557ff4b9ad9a4ec4f0919e3460596b0 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 12 Oct 2023 21:35:52 +0200 Subject: [PATCH 1/4] Find opertor!= in the correct namespace --- clang/lib/Sema/Se

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-16 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,82 @@ +//===--- CoroutineSuspensionHostileCheck.cpp - clang-tidy --===// +// +// 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: Apache-

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-16 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,82 @@ +//===--- CoroutineSuspensionHostileCheck.cpp - clang-tidy --===// +// +// 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: Apache-

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68738 >From f9e29053a7a8fd8222cfbdf579776fafd6564b89 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 10 Oct 2023 21:53:37 +0200 Subject: [PATCH 1/8] [clang-tidy] Add check to flag objects hostile to suspension i

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,82 @@ +//===--- CoroutineSuspensionHostileCheck.cpp - clang-tidy --===// +// +// 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: Apache-

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,82 @@ +//===--- CoroutineSuspensionHostileCheck.cpp - clang-tidy --===// +// +// 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: Apache-

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,82 @@ +//===--- CoroutineSuspensionHostileCheck.cpp - clang-tidy --===// +// +// 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: Apache-

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,131 @@ +// RUN: %check_clang_tidy -std=c++20 %s misc-coroutine-hostile-raii %t \ +// RUN: -config="{CheckOptions: \ +// RUN: {misc-coroutine-hostile-raii.RAIIDenyList: \ +// RUN: 'my::Mutex; ::my::other::Mutex'}}" + +namespace std { + +templa

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Friendly ping. https://github.com/llvm/llvm-project/pull/68999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,49 @@ +.. title:: clang-tidy - misc-coroutine-hostile-raii + +misc-coroutine-hostile-raii + + +This check detects hostile-RAII objects which should not persist across a +suspension point in a coroutine. + +Some objects require that they be destroyed

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68738 >From f9e29053a7a8fd8222cfbdf579776fafd6564b89 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 10 Oct 2023 21:53:37 +0200 Subject: [PATCH 1/9] [clang-tidy] Add check to flag objects hostile to suspension i

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,117 @@ +//===--- CoroutineHostileRAII.cpp - clang-tidy ===// +// +// 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] [RFC] Perform lifetime bound checks for arguments to coroutine (PR #69360)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/69360 None >From be3f5faa6cd17d76f26fb1bc6d6b59a8a78ffe82 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 17 Oct 2023 19:37:28 +0200 Subject: [PATCH] Lifetime bound check for coroutine --- clang/lib/Sema/SemaI

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/68738 >From f9e29053a7a8fd8222cfbdf579776fafd6564b89 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 10 Oct 2023 21:53:37 +0200 Subject: [PATCH 01/10] [clang-tidy] Add check to flag objects hostile to suspension

[clang-tools-extra] [clang-tidy] Add check to diagnose coroutine-hostile RAII objects (PR #68738)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/68738 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: +1 I agree that this is confusing and error prone. https://github.com/llvm/llvm-project/pull/68999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Correctly compute conversion seq for args to fn with reversed param order (PR #68999)

2023-10-17 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/68999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] ac2d265 - [include-cleaner] Handle decls/refs to concepts

2023-08-31 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2023-08-31T13:57:22+02:00 New Revision: ac2d2652db8de9ea2b750dd2bf1232941039dffe URL: https://github.com/llvm/llvm-project/commit/ac2d2652db8de9ea2b750dd2bf1232941039dffe DIFF: https://github.com/llvm/llvm-project/commit/ac2d2652db8de9ea2b750dd2bf1232941039dffe.diff

[clang] cb54c13 - [clang][analyzer] Modify include AllocationState.h in PutenvWithAutoChecker.cpp

2020-02-20 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2020-02-20T17:17:36+01:00 New Revision: cb54c13c217b3e5fcda5c97bab229c1f9c3934b7 URL: https://github.com/llvm/llvm-project/commit/cb54c13c217b3e5fcda5c97bab229c1f9c3934b7 DIFF: https://github.com/llvm/llvm-project/commit/cb54c13c217b3e5fcda5c97bab229c1f9c3934b7.diff

[clang-tools-extra] 2054ed0 - [clangd] Store xref for Macros in ParsedAST.

2019-11-18 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2019-11-18T16:47:18+01:00 New Revision: 2054ed052f15b584e1bce57c8f765991eab2da7d URL: https://github.com/llvm/llvm-project/commit/2054ed052f15b584e1bce57c8f765991eab2da7d DIFF: https://github.com/llvm/llvm-project/commit/2054ed052f15b584e1bce57c8f765991eab2da7d.diff

[clang-tools-extra] 9347655 - [clangd] Add xref for macro to static index.

2019-12-04 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2019-12-05T04:23:18+01:00 New Revision: 9347655a275456c08222833b11ec699fafbc6de6 URL: https://github.com/llvm/llvm-project/commit/9347655a275456c08222833b11ec699fafbc6de6 DIFF: https://github.com/llvm/llvm-project/commit/9347655a275456c08222833b11ec699fafbc6de6.diff

[clang-tools-extra] e397a0a - [clangd] Add instrumentation mode in clangd for metrics collection.

2020-03-05 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2020-03-05T12:39:15+01:00 New Revision: e397a0a5c3c0fa1912fbac23b550fa7d239196ba URL: https://github.com/llvm/llvm-project/commit/e397a0a5c3c0fa1912fbac23b550fa7d239196ba DIFF: https://github.com/llvm/llvm-project/commit/e397a0a5c3c0fa1912fbac23b550fa7d239196ba.diff

[clang-tools-extra] b4d9ac8 - [C++20][ClangTidy] Update the ClangTidy tests to also test in C++20 mode

2023-03-02 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2023-03-02T13:02:51+01:00 New Revision: b4d9ac8b453e20e4223b5935c700698608a6425c URL: https://github.com/llvm/llvm-project/commit/b4d9ac8b453e20e4223b5935c700698608a6425c DIFF: https://github.com/llvm/llvm-project/commit/b4d9ac8b453e20e4223b5935c700698608a6425c.diff

[clang-tools-extra] c396073 - Change ClangTidy unit tests to run in C++20 mode instead of C++11.

2023-03-02 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2023-03-02T14:06:41+01:00 New Revision: c396073a0de6bc156514c34c0ffbdd227178c11b URL: https://github.com/llvm/llvm-project/commit/c396073a0de6bc156514c34c0ffbdd227178c11b DIFF: https://github.com/llvm/llvm-project/commit/c396073a0de6bc156514c34c0ffbdd227178c11b.diff

[clang-tools-extra] ed365f4 - [clangd] Use FileEntryRef for canonicalizing filepaths.

2023-04-13 Thread Utkarsh Saxena via cfe-commits
Author: Utkarsh Saxena Date: 2023-04-13T16:49:30+02:00 New Revision: ed365f464a0a29da08d0a1011603c4cd337c9428 URL: https://github.com/llvm/llvm-project/commit/ed365f464a0a29da08d0a1011603c4cd337c9428 DIFF: https://github.com/llvm/llvm-project/commit/ed365f464a0a29da08d0a1011603c4cd337c9428.diff

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-14 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: > Is there a valid use for having "EHCleanup" that _doesn't_ handle branches > across it? That is, do we _ever_ need a cleanup to be called only for an > exception thrown, and not otherwise leaving the scope? I'm just wondering if > we can simplify things conceptually here and rem

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

2024-02-19 Thread Utkarsh Saxena via cfe-commits
@@ -592,10 +590,14 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, // observed to be unnecessary. if (endOfInit.isValid()) Builder.CreateStore(element, endOfInit); } - -LValue elementLV = CGF.MakeAddrLValue( -Address(e

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

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

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

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

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

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

[clang] [clang-tools-extra] [codegen] Emit missing cleanups when an expression contains a branch (PR #80698)

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

[clang] [clang] Don't emit the warn_dangling_lifetime_pointer diagnostic for the assignment case. (PR #97408)

2024-07-02 Thread Utkarsh Saxena via cfe-commits
@@ -1023,7 +1023,7 @@ static void checkExprLifetimeImpl(Sema &SemaRef, return false; } - if (IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) { + if (InitEntity && IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) { usx95 wrote: I t

[clang] [clang] Don't emit the warn_dangling_lifetime_pointer diagnostic for the assignment case. (PR #97408)

2024-07-02 Thread Utkarsh Saxena via cfe-commits
@@ -0,0 +1,15 @@ + +// RUN: %clang_cc1 -std=c++20 -verify -Wno-dangling-assignment %s usx95 wrote: I would suggest dropping `-Wno-dangling-assignment` and ensuring that we get "only" the dangling assignment and not GSL ones. This would also not need a new file.

[clang] [clang] Don't emit the warn_dangling_lifetime_pointer diagnostic for the assignment case. (PR #97408)

2024-07-02 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Thanks. LGTM. https://github.com/llvm/llvm-project/pull/97408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-04 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: Thanks. This looks quite useful. Since this is not limited to a hardcoded set of types/stl-containers, this is a substantial change in the behaviour of general `Owner types` and warrants extra documentation both in GSL analysis docs and ReleaseNotes. https

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-04 Thread Utkarsh Saxena via cfe-commits
@@ -363,10 +363,14 @@ static bool implicitObjectParamIsLifetimeBound(const FunctionDecl *FD) { if (ATL.getAttrAs()) return true; } - return isNormalAsisgnmentOperator(FD); } +bool isFirstTemplateArgumentGSLPointer(const TemplateArgumentList &TAs) { + return

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-04 Thread Utkarsh Saxena via cfe-commits
@@ -470,10 +474,24 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, VisitGSLPointerArg(Callee, Args[0], !Callee->getReturnType()->isReferenceType()); } else { -if (auto *CCE = dyn_cast(Call); -

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-04 Thread Utkarsh Saxena via cfe-commits
@@ -499,3 +518,28 @@ std::string_view test2(int i, std::optional a) { return std::move(a.value()); } } + +namespace GH100526 { +void test() { + std::vector t1 = {std::string()}; // expected-warning {{object backing the pointer will be destroyed at the end}} ---

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-04 Thread Utkarsh Saxena via cfe-commits
@@ -470,10 +474,24 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, VisitGSLPointerArg(Callee, Args[0], !Callee->getReturnType()->isReferenceType()); } else { -if (auto *CCE = dyn_cast(Call); -

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -499,3 +518,28 @@ std::string_view test2(int i, std::optional a) { return std::move(a.value()); } } + +namespace GH100526 { +void test() { + std::vector t1 = {std::string()}; // expected-warning {{object backing the pointer will be destroyed at the end}} ---

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: Thanks. LG. Some comments on adding more tests. https://github.com/llvm/llvm-project/pull/107213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -525,3 +544,31 @@ void test() { std::string_view svjkk1 = ReturnStringView(StrCat("bar", "x")); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} } } // namespace GH100549 + +namespace GH100526 { +void test() { + std:

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -6690,6 +6690,20 @@ When the Owner's lifetime ends, it will consider the Pointer to be dangling. P.getInt(); // P is dangling } +If a template class is annotated with [[gsl::Owner]], and the first instantiated +template argument is a [[gsl::Pointer]] type, the analy

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -278,6 +278,8 @@ Improvements to Clang's diagnostics - The lifetimebound and GSL analysis in clang are coherent, allowing clang to detect more use-after-free bugs. (#GH100549). +- Clang now diagnoses cases where a dangling `GSLOwner`` object is constructed, e.g. `std::ve

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -525,3 +544,31 @@ void test() { std::string_view svjkk1 = ReturnStringView(StrCat("bar", "x")); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} } } // namespace GH100549 + +namespace GH100526 { +void test() { + std:

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -6690,6 +6690,20 @@ When the Owner's lifetime ends, it will consider the Pointer to be dangling. P.getInt(); // P is dangling } +If a template class is annotated with [[gsl::Owner]], and the first instantiated +template argument is a [[gsl::Pointer]] type, the analy

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -525,3 +544,31 @@ void test() { std::string_view svjkk1 = ReturnStringView(StrCat("bar", "x")); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} } } // namespace GH100549 + +namespace GH100526 { +void test() { + std:

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -525,3 +544,31 @@ void test() { std::string_view svjkk1 = ReturnStringView(StrCat("bar", "x")); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}} } } // namespace GH100549 + +namespace GH100526 { usx95

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-05 Thread Utkarsh Saxena via cfe-commits
@@ -470,10 +474,24 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, VisitGSLPointerArg(Callee, Args[0], !Callee->getReturnType()->isReferenceType()); } else { -if (auto *CCE = dyn_cast(Call); -

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. LGTM. Thanks. https://github.com/llvm/llvm-project/pull/107213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
@@ -990,13 +1009,16 @@ static void checkExprLifetimeImpl(Sema &SemaRef, // int &p = *localUniquePtr; // someContainer.add(std::move(localUniquePtr)); // return p; -IsLocalGslOwner = isRecordWithAttr(L->getType()); +IsLocalGslOwner =

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
@@ -292,7 +292,7 @@ Improvements to Clang's diagnostics - Clang now warns for u8 character literals used in C23 with ``-Wpre-c23-compat`` instead of ``-Wpre-c++17-compat``. -- Clang now diagnoses cases where a dangling `GSLOwner`` object is constructed, e.g. `std::vector v

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

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

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in template arguments (PR #106730)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: We also need documentation explaining the new builtin. Can you also add ReleaseNotes. https://github.com/llvm/llvm-project/pull/106730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in template arguments (PR #106730)

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

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in template arguments (PR #106730)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
@@ -38,9 +40,11 @@ #include "clang/Sema/Template.h" #include "clang/Sema/TemplateDeduction.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallBitVector.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" +#include "

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in template arguments (PR #106730)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
@@ -309,7 +309,10 @@ enum BuiltinTemplateKind : int { BTK__make_integer_seq, /// This names the __type_pack_element BuiltinTemplateDecl. - BTK__type_pack_element + BTK__type_pack_element, + + /// This names the __type_list_dedup BuiltinTemplateDecl. + BTK__type_list_de

[clang] [clang] Diagnose dangling issues for the "Container" case. (PR #107213)

2024-09-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. https://github.com/llvm/llvm-project/pull/107213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/108197 Consider when Input[I] is a VarDecl with parameter pack. We would have already expanded the pack before the code change in the loop`for (unsigned I = 0; I != *NumExpansions; ++I) {`. Now in `if (RetainExpansion)

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/108197 >From 5901d82ea0543074853b963f7dc9106a6fe3bcee Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 11 Sep 2024 11:33:45 + Subject: [PATCH 1/2] [clang] Do not expand pack while retaining expansion --- cl

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

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

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

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

[clang] [clang] Detect dangling assignment for "Container" case. (PR #108205)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
@@ -601,17 +601,23 @@ void test() { std::optional o4 = std::optional(s); // FIXME: should work for assignment cases usx95 wrote: nit: remove fixme. https://github.com/llvm/llvm-project/pull/108205 ___ cfe-comm

[clang] [clang] Detect dangling assignment for "Container" case. (PR #108205)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. https://github.com/llvm/llvm-project/pull/108205 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

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

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/108197 >From 5901d82ea0543074853b963f7dc9106a6fe3bcee Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 11 Sep 2024 11:33:45 + Subject: [PATCH 1/3] [clang] Do not expand pack while retaining expansion --- cl

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/108197 >From 5901d82ea0543074853b963f7dc9106a6fe3bcee Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 11 Sep 2024 11:33:45 + Subject: [PATCH 1/4] [clang] Do not expand pack while retaining expansion --- cl

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Thanks. I have moved this to `ForgetPartiallySubstitutedPackRAII`. https://github.com/llvm/llvm-project/pull/108197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

2024-09-11 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/108197 >From 5901d82ea0543074853b963f7dc9106a6fe3bcee Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 11 Sep 2024 11:33:45 + Subject: [PATCH 1/5] [clang] Do not expand pack while retaining expansion --- cl

[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)

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

[clang] [codegen] Emit missing cleanups for stmt-expr and coro suspensions [take-2] (PR #85398)

2024-04-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/85398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Use pushFullExprCleanup for deferred destroy (PR #88670)

2024-04-14 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/88670 Instead of directly pushing the `Destroy`, we should use `pushFullExprCleanup` which handles conditional branches. This fixes a backend crash due to 89ba7e183e6e2c64370ed1b963e54c06352211db. Tested: ``` CLANG_DIR=/

[clang] Use pushFullExprCleanup for deferred destroy (PR #88670)

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

[clang] Use pushFullExprCleanup for deferred destroy (PR #88670)

2024-04-14 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 ready_for_review https://github.com/llvm/llvm-project/pull/88670 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [codegen] Emit missing cleanups for stmt-expr and coro suspensions [take-2] (PR #85398)

2024-04-14 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: [ayermolo](https://github.com/ayermolo) Thanks for the reproducer. I was able to reproduce it. Sent out fix https://github.com/llvm/llvm-project/pull/88670 https://github.com/llvm/llvm-project/pull/85398 ___ cfe-commits mailing list cfe-

[clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/94528 None >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH] [clangd] Fix crash with null check for Token at Loc --- clan

[clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-05 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/94528 >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH 1/2] [clangd] Fix crash with null check for Token at Loc --- clang-

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-06 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/94528 >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH 1/3] [clangd] Fix crash with null check for Token at Loc --- clang-

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-06 Thread Utkarsh Saxena via cfe-commits
@@ -1354,6 +1354,8 @@ maybeFindIncludeReferences(ParsedAST &AST, Position Pos, ReferencesResult::Reference Result; const auto *Token = AST.getTokens().spelledTokenAt(Loc); +if (!Token) usx95 wrote: Modified `spelledTokenAt`. https://g

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

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

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-06 Thread Utkarsh Saxena via cfe-commits
@@ -1354,6 +1354,8 @@ maybeFindIncludeReferences(ParsedAST &AST, Position Pos, ReferencesResult::Reference Result; const auto *Token = AST.getTokens().spelledTokenAt(Loc); +if (!Token) usx95 wrote: Done. > also, what's the conclusion o

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-06 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/94528 >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH 1/4] [clangd] Fix crash with null check for Token at Loc --- clang-

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-06 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/94528 >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH 1/5] [clangd] Fix crash with null check for Token at Loc --- clang-

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-07 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/94528 >From b13a663ae347649a3bcf9d6e381a5fbbfdc9ea4b Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 5 Jun 2024 19:48:48 + Subject: [PATCH 1/6] [clangd] Fix crash with null check for Token at Loc --- clang-

[clang] [clang-tools-extra] [clangd] Fix crash with null check for Token at Loc (PR #94528)

2024-06-07 Thread Utkarsh Saxena via cfe-commits
@@ -447,7 +447,7 @@ class HighlightingsBuilder { if (!RLoc.isValid()) return; -const auto *RTok = TB.spelledTokenAt(RLoc); +const auto *RTok = TB.spelledTokenContaining(RLoc); usx95 wrote: Done. https://github.com/llvm/llvm-project/pull/945

<    1   2   3   4   5   6   7   8   9   10   >