[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -793,3 +806,202 @@ void test13() { } } // namespace GH100526 + +namespace lifetime_capture_by { +struct S { + const int *x; + void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x = &x; } + void captureSV(std::string_view sv [[clang::lifetime_captu

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115921 >From 2cef37ecdb81452a8f5882dfe765167c1e45b7b6 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 13 Nov 2024 10:24:33 + Subject: [PATCH 1/4] Implement semantics for lifetime analysis --- clang/include

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115921 >From 2cef37ecdb81452a8f5882dfe765167c1e45b7b6 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 13 Nov 2024 10:24:33 + Subject: [PATCH 1/4] Implement semantics for lifetime analysis --- clang/include

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -3229,6 +3231,52 @@ void Sema::CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl, << ParamName << (FDecl != nullptr) << FDecl; } +void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction, + const Expr *ThisArg,

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -1199,6 +1207,21 @@ static void checkExprLifetimeImpl(Sema &SemaRef, break; } +case LK_LifetimeCapture: { + if (!MTE) +return false; + assert(shouldLifetimeExtendThroughPath(Path) == + PathLifetimeKind::NoExtend && +

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -10132,10 +10132,10 @@ def err_lifetimebound_ctor_dtor : Error< "%select{constructor|destructor}0">; def err_lifetimebound_parameter_void_return_type : Error< "'lifetimebound' attribute cannot be applied to a parameter of a function " - "that returns void">; + "that re

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -1438,13 +1471,13 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); checkExprLifetimeImpl(SemaRef, &Entity, ExtendingEntity, LK, -

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115921 >From 2cef37ecdb81452a8f5882dfe765167c1e45b7b6 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 13 Nov 2024 10:24:33 + Subject: [PATCH 1/2] Implement semantics for lifetime analysis --- clang/include

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -793,3 +793,108 @@ void test13() { } } // namespace GH100526 + +namespace lifetime_capture_by { +struct S { + const int *x; + void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x = &x; } + void captureSV(std::string_view sv [[clang::lifetime_captu

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -793,3 +793,108 @@ void test13() { } } // namespace GH100526 + +namespace lifetime_capture_by { +struct S { + const int *x; + void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x = &x; } + void captureSV(std::string_view sv [[clang::lifetime_captu

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -793,3 +793,108 @@ void test13() { } } // namespace GH100526 + +namespace lifetime_capture_by { +struct S { + const int *x; + void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x = &x; } + void captureSV(std::string_view sv [[clang::lifetime_captu

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
@@ -793,3 +793,108 @@ void test13() { } } // namespace GH100526 + +namespace lifetime_capture_by { +struct S { + const int *x; + void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x = &x; } + void captureSV(std::string_view sv [[clang::lifetime_captu

[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

2024-11-13 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115921 >From 2cef37ecdb81452a8f5882dfe765167c1e45b7b6 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Wed, 13 Nov 2024 10:24:33 + Subject: [PATCH 1/3] Implement semantics for lifetime analysis --- clang/include

[clang] [llvm] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From 1aae3527ccba1eeaa8da4dd4309dcbdf590c4adf Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Sun, 3 Nov 2024 20:37:26 +0300 Subject: [PATCH] [MC] Make generated `MCInstPrinter::getMnemonic` const (NFC) (

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-09 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From fa191212f1d0e381503c250c3387e10a5f244576 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/include/clan

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From 1778769830af741684ae6ed0278f5ecc4626edae Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/include/clan

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

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

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From b9379b1a8516fd8c2bb444aed09335eba37c8d53 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/docs/Release

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
@@ -12,6 +12,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/Attrs.inc" usx95 wrote: Removed. https://github.com/llvm/llvm-project/pull/111499 ___ cfe-commits mailing list cf

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: The PR now only includes syntax changes without lifetime analysis. I will address the unaddressed comments here related to analysis in subsequent PR. https://github.com/llvm/llvm-project/pull/111499 ___ cfe-commits mailing list cfe-commit

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
@@ -1199,6 +1213,17 @@ static void checkExprLifetimeImpl(Sema &SemaRef, break; } +case LK_LifetimeCapture: { + if (!MTE) usx95 wrote: I don't think we can easily support this without intraprocedural data flow. For example, consider the fol

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From adaab9e5f549ae1625e8539334dfbc73a0559d8c Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/docs/Release

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

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

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

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

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-09 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: > I did not get to the end of this PR yet, but I was wondering if it would make > sense to split it up. One PR could add the attribute with the semantic > analysis (e.g., warnings for ill-formed arguments). The second PR could > introduce the lifetime analysis part. WDYT? Makes s

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
@@ -1882,6 +1882,46 @@ def LifetimeBound : DeclOrTypeAttr { let SimpleHandler = 1; } +def LifetimeCaptureBy : DeclOrTypeAttr { + let Spellings = [Clang<"lifetime_capture_by", 0>]; + let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>; + let Args = [V

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From 5af16e4afc15956dea0c46ffc3abb20067c047f2 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/include/clan

[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

2024-11-10 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/111499 >From 83f0c8ff48ca1750048688eacc02bfffc52166b7 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Sun, 10 Nov 2024 07:42:49 + Subject: [PATCH] Introduce [[clang::lifetime_capture_by]] --- clang/docs/Release

[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

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

[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

2024-11-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115823 >From 3c233df64906972016c26909263cfd53940d87a0 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 12 Nov 2024 04:28:37 + Subject: [PATCH 1/2] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]]

[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

2024-11-12 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: Fixed the issues. Added more details in the description. https://github.com/llvm/llvm-project/pull/115823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

2024-11-12 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/115823 >From 3c233df64906972016c26909263cfd53940d87a0 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Tue, 12 Nov 2024 04:28:37 + Subject: [PATCH 1/2] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]]

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

2024-09-23 Thread Utkarsh Saxena via cfe-commits
@@ -357,35 +369,101 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) { return false; } +// Returns true if the given constructor is a copy-like constructor, such as +// `Ctor(Owner&&)` or `Ctor(const Owner&)`. +static bool isCopyLikeConstructor(const CXXConst

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

2024-09-23 Thread Utkarsh Saxena via cfe-commits
@@ -327,6 +369,103 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) { return false; } +// Returns true if the given constructor is a copy-like constructor, such as +// `Ctor(Owner&&)` or `Ctor(const Owner&)`. +static bool isCopyLikeConstructor(const CXXConstr

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

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

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

2024-09-23 Thread Utkarsh Saxena via cfe-commits
@@ -285,6 +285,18 @@ static bool isContainerOfPointer(const RecordDecl *Container) { } return false; } +static bool isContainerOfOwner(const RecordDecl *Container) { + if (const auto *CTSD = + dyn_cast_if_present(Container)) { usx95 wrote: nit:

[clang] [clang] Apply the [[gsl::Owner]] or [[gsl::Pointer]] attributes to the STL template specialization declarations. (PR #109653)

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

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

2024-09-27 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Thanks. LGTM. Left a comment to simplify the change. https://github.com/llvm/llvm-project/pull/110247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

2024-09-27 Thread Utkarsh Saxena via cfe-commits
@@ -704,6 +704,15 @@ ItaniumMangleContextImpl::getEffectiveDeclContext(const Decl *D) { return D->getLexicalDeclContext()->getRedeclContext(); } + if (const auto *FTD = dyn_cast(D)) { +// Member-like constrained friends are mangled as if they were members of

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

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

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

2024-09-27 Thread Utkarsh Saxena via cfe-commits
@@ -58,19 +58,19 @@ namespace test2 { // CHECK: call {{.*}}@_ZN5test21AIiEF1fEzQ4TrueIT_E( // CLANG17: call {{.*}}@_ZN5test21fEz( f(ai); -// CHECK: call {{.*}}@_ZN5test2F1gIvEEvzQaa4TrueIT_E4TrueITL0__E( +// CHECK: call {{.*}}@_ZN5test21AIiEF1gIvEEvzQaa4True

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

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

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

2024-09-27 Thread Utkarsh Saxena via cfe-commits
@@ -2270,6 +2270,14 @@ void CXXNameMangler::mangleTemplatePrefix(GlobalDecl GD, mangleTemplateParameter(TTP->getDepth(), TTP->getIndex()); } else { const DeclContext *DC = Context.getEffectiveDeclContext(ND); +if (const auto *FD = dyn_cast(GD.getDecl())) { ---

[clang] [libcxxabi] [clang][ItaniumMangle] Mangle friend function templates with a constr… (PR #110247)

2024-09-27 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: Thanks for catching and fixing this. Please also add release notes in clang/docs/ReleaseNotes.rst https://github.com/llvm/llvm-project/pull/110247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [clang][Itanium Mangle] Enable mangling of enclosing class for member… (PR #110503)

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

[clang] [clang][Itanium Mangle] Enable mangling of enclosing class for member… (PR #110503)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
@@ -704,6 +704,15 @@ ItaniumMangleContextImpl::getEffectiveDeclContext(const Decl *D) { return D->getLexicalDeclContext()->getRedeclContext(); } + if (const auto *FTD = dyn_cast(D)) { +// Member-like constrained friends are mangled as if they were members of +

[clang] [clang][Itanium Mangle] Enable mangling of enclosing class for member… (PR #110503)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: Thanks. Left a comment about adding a FIXME to remove ABI compat checks and figuring out the support for past ABI. https://github.com/llvm/llvm-project/pull/110503 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang][Itanium Mangle] Enable mangling of enclosing class for member… (PR #110503)

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

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
@@ -114,27 +134,42 @@ struct llvm::TimeTraceProfiler { llvm::get_thread_name(ThreadName); } - TimeTraceProfilerEntry *begin(std::string Name, -llvm::function_ref Detail, -bool AsyncEvent = false) { -Sta

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
@@ -145,27 +180,32 @@ struct llvm::TimeTraceProfiler { DurationType Duration = E.End - E.Start; // Only include sections longer or equal to TimeTraceGranularity msec. -if (duration_cast(Duration).count() >= TimeTraceGranularity) +if (duration_cast(Duration).cou

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
@@ -194,13 +234,17 @@ struct llvm::TimeTraceProfiler { J.attribute("pid", Pid); J.attribute("tid", int64_t(Tid)); J.attribute("ts", StartUs); -if (E.AsyncEvent) { +if (TimeTraceEventType::AsyncEvent == E.EventType) { usx9

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Thanks. Looks great now. Should be ready to land. Left some nit comments. https://github.com/llvm/llvm-project/pull/103039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-09-30 Thread Utkarsh Saxena via cfe-commits
@@ -83,6 +83,19 @@ namespace llvm { class raw_pwrite_stream; +// Type of the time trace event. +enum class TimeTraceEventType { + // Complete events have a duration (start and end time points) and are marked + // by the "X" phase type. + CompleteEvent, usx

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

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

[clang] [clang][Itanium Mangle] Enable mangling of enclosing class for member… (PR #110503)

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

[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

2024-10-25 Thread Utkarsh Saxena via cfe-commits
@@ -31,6 +32,11 @@ namespace usage_ok { return *(int*)param; } + template R dependent_void(const T& t [[clang::lifetimebound]]); + void dependent_void_instantiation() { +dependent_void(1); usx95 wrote: nit: add the following for completeness. ``

[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

2024-10-25 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 commented: small nit for one more test. https://github.com/llvm/llvm-project/pull/113460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

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

[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

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

[clang] Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585, #111173)" (PR #111852)

2024-11-06 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: For module related compilation issue: I added the reproducer here: https://github.com/usx95/llvm-project/commit/8886dbecaf04f5c117e70d50e342bf264947cc64 Fails with: ``` sh module-reproducer/args.sh In module 'libB': module-reproducer/flume_test_utils.h:26:10: error: no viable conv

[clang] [clang] Infer lifetime_capture_by for map's subscript operator. (PR #118078)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/118078 ___ 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 map's subscript operator. (PR #118078)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Thanks. LGTM. https://github.com/llvm/llvm-project/pull/118078 ___ 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 map's subscript operator. (PR #118078)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
@@ -270,34 +270,49 @@ void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) { } void Sema::inferLifetimeCaptureByAttribute(FunctionDecl *FD) { - if (!FD) + auto *MD = dyn_cast_if_present(FD); + if (!MD || !MD->getParent()->isInStdNamespace()) return; - auto *MD = d

[clang] [clang] Fix -Wdangling false negative regressions caused by 117315 (PR #118088)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. Thanks for quickly addressing this! https://github.com/llvm/llvm-project/pull/118088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [clang] Fix -Wdangling false negative regressions caused by 117315 (PR #118088)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
@@ -258,9 +258,27 @@ template static bool isRecordWithAttr(QualType Type) { auto *RD = Type->getAsCXXRecordDecl(); if (!RD) return false; + // Generally, if a primary template class declaration is annotated with an + // attribute, all its specializations generated f

[clang] [clang] Fix -Wdangling false negative regressions caused by 117315 (PR #118088)

2024-11-29 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. https://github.com/llvm/llvm-project/pull/118088 ___ 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-21 Thread Utkarsh Saxena 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-22 Thread Utkarsh Saxena 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] Check specialization for annotation (PR #117315)

2024-11-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 created https://github.com/llvm/llvm-project/pull/117315 None >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH] [clang] Check specialization for annotation --- clang/lib

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

2024-11-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117122 >From 9a57223b06a8331a0ef123739a430863dee19d98 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 21 Nov 2024 07:00:56 + Subject: [PATCH 1/3] [clang] Infer lifetime_capture_by for STL containers --- cl

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

2024-11-22 Thread Utkarsh Saxena 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-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited 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 Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited 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 Utkarsh Saxena 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-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited 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 Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited 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 Utkarsh Saxena 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] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117122 >From 9a57223b06a8331a0ef123739a430863dee19d98 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 21 Nov 2024 07:00:56 + Subject: [PATCH 1/4] [clang] Infer lifetime_capture_by for STL containers --- cl

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

2024-11-22 Thread Utkarsh Saxena 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] Infer lifetime_capture_by for STL containers (PR #117122)

2024-11-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117122 >From 9a57223b06a8331a0ef123739a430863dee19d98 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Thu, 21 Nov 2024 07:00:56 + Subject: [PATCH 1/2] [clang] Infer lifetime_capture_by for STL containers --- cl

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

2024-11-22 Thread Utkarsh Saxena 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-22 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 edited 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 Utkarsh Saxena 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] Add a lifetime_capture_by testcase for temporary capturing object. (PR #117733)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: > We could potentially limit the suppression to cases where the destructor is > trivial, but that might not be worth the added complexity. I agree that might not be worth the complexity. Let's revisit if we have practical false positives. Thanks for the tests. LGTM. https://gith

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
@@ -253,9 +253,12 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path, LocalVisitor Visit); template static bool isRecordWithAttr(QualType Type) { - if (auto *RD = Type->getAsCXXRecordDecl()) -re

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/4] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/5] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/8] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
@@ -1763,6 +1763,8 @@ class Sema final : public SemaBase { /// Add [[gsl::Pointer]] attributes for std:: types. void inferGslPointerAttribute(TypedefNameDecl *TD); + static bool isPointerLikeType(QualType QT); usx95 wrote: Added comments. Also moved to C

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/7] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Add a common definition of isPointerLikeType for lifetime analysis (PR #117315)

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

[clang] [clang] Add a common definition of isPointerLikeType for lifetime analysis (PR #117315)

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

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/3] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Add a lifetime_capture_by testcase for temporary capturing object. (PR #117733)

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

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/2] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Improve the lifetime_capture_by diagnostic on the constructor. (PR #117792)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
@@ -623,6 +623,26 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, } if (CheckCoroCall || Callee->getParamDecl(I)->hasAttr()) VisitLifetimeBoundArg(Callee->getParamDecl(I), Arg); +else if (const auto *CaptureAttr = +

[clang] [clang] Improve the lifetime_capture_by diagnostic on the constructor. (PR #117792)

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

[clang] [clang] Improve the lifetime_capture_by diagnostic on the constructor. (PR #117792)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
@@ -535,6 +535,9 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call, bool EnableGSLAnalysis = !Callee->getASTContext().getDiagnostics().isIgnored( diag::warn_dangling_lifetime_pointer, SourceLocation()); + bool EnableDanglingCapture = +

[clang] [clang] Check specialization for annotation (PR #117315)

2024-11-28 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/117315 >From e30ae8a6e0c1df8e33c2add6502342cb269c1cfd Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 22 Nov 2024 11:02:49 + Subject: [PATCH 1/6] [clang] Check specialization for annotation --- clang/lib/S

[clang] [clang] Don't warn if the capturing object is also temporary. (PR #117733)

2024-11-27 Thread Utkarsh Saxena via cfe-commits
usx95 wrote: I considered this during implementation. This is a little controversial. It is possible that the temporary capturing object uses the captured entity in its destructor. In principle, we can always detect the order of destructions of the temporaries and choose to suppress cases when

<    4   5   6   7   8   9   10   11   >