https://github.com/hokein approved this pull request.
looks good, just some nits.
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
https://github.com/hokein 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
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/115482
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Haojian Wu
Date: 2024-11-08T16:25:26+01:00
New Revision: 6737ba40406030cd8a7ea706cd56302f8be7a4b4
URL:
https://github.com/llvm/llvm-project/commit/6737ba40406030cd8a7ea706cd56302f8be7a4b4
DIFF:
https://github.com/llvm/llvm-project/commit/6737ba40406030cd8a7ea706cd56302f8be7a4b4.diff
LO
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -std=c++23 -verify %s
+
+struct S {
+ const int *x;
+ void captureInt(const int&x [[clang::lifetime_capture_by(this)]]) { this->x
= &x; }
+};
+
+///
+// Test for valid usages.
+///
+[[clang::li
@@ -1760,6 +1760,10 @@ class Sema final : public SemaBase {
/// Add [[gsl::Pointer]] attributes for std:: types.
void inferGslPointerAttribute(TypedefNameDecl *TD);
+ LifetimeCaptureByAttr *ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
hokein wrote:
n
@@ -3383,6 +3383,18 @@ def err_callback_callee_is_variadic : Error<
"'callback' attribute callee may not be variadic">;
def err_callback_implicit_this_not_available : Error<
"'callback' argument at position %0 references unavailable implicit 'this'">;
+
+def err_capture_by_
@@ -3967,6 +3967,69 @@ Attribute ``trivial_abi`` has no effect in the following
cases:
}];
}
+
+def LifetimeCaptureByDocs : Documentation {
+ let Category = DocCatFunction;
+ let Content = [{
+The ``lifetime_capture_by(X)`` attribute on a function parameter or
implic
@@ -3967,6 +3967,69 @@ Attribute ``trivial_abi`` has no effect in the following
cases:
}];
}
+
+def LifetimeCaptureByDocs : Documentation {
+ let Category = DocCatFunction;
+ let Content = [{
+The ``lifetime_capture_by(X)`` attribute on a function parameter or
implic
@@ -1760,6 +1760,10 @@ class Sema final : public SemaBase {
/// Add [[gsl::Pointer]] attributes for std:: types.
void inferGslPointerAttribute(TypedefNameDecl *TD);
+ LifetimeCaptureByAttr *ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
+
@@ -1909,6 +1911,12 @@ void TypePrinter::printAttributedAfter(const
AttributedType *T,
OS << " [[clang::lifetimebound]]";
return;
}
+ if (T->getAttrKind() == attr::LifetimeCaptureBy) {
+// FIXME: Print the attribute arguments once we have a way to retrieve
thes
@@ -1760,6 +1760,10 @@ class Sema final : public SemaBase {
/// Add [[gsl::Pointer]] attributes for std:: types.
void inferGslPointerAttribute(TypedefNameDecl *TD);
+ LifetimeCaptureByAttr *ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
hokein wrote:
a
hokein wrote:
Can you clarify the memory leak issue? It’s not immediately obvious to me.
It would be helpful to explain these two issues and describe how the reland
addresses them in the PR description.
https://github.com/llvm/llvm-project/pull/115823
__
@@ -3867,6 +3868,112 @@ static void handleCallbackAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
S.Context, AL, EncodingIndices.data(), EncodingIndices.size()));
}
+LifetimeCaptureByAttr *Sema::ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
+
@@ -3867,6 +3869,117 @@ static void handleCallbackAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
S.Context, AL, EncodingIndices.data(), EncodingIndices.size()));
}
+LifetimeCaptureByAttr *Sema::ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
+
@@ -1889,6 +1889,36 @@ 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
https://github.com/hokein approved this pull request.
Thanks, looks good.
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
@@ -3867,6 +3869,117 @@ static void handleCallbackAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
S.Context, AL, EncodingIndices.data(), EncodingIndices.size()));
}
+LifetimeCaptureByAttr *Sema::ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
+
https://github.com/hokein 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
https://github.com/hokein commented:
Mostly good, two nits.
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
@@ -1889,6 +1889,43 @@ 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
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/109099
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/109653
Fixes #109442
>From ff56c38c032496277dd31a1c3f158e6eacb9fd7d Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Mon, 23 Sep 2024 13:50:39 +0200
Subject: [PATCH] [clang] Apply the [[gsl::Owner]] or [[gsl::Pointer]]
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/109653
>From ea66fe54a0c820cb5671b0ee10a521da8d483714 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Mon, 23 Sep 2024 13:50:39 +0200
Subject: [PATCH] [clang] Apply the [[gsl::Owner]] or [[gsl::Pointer]]
attributes to
https://github.com/hokein closed
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
https://github.com/hokein approved this pull request.
Thanks, still looks good.
https://github.com/llvm/llvm-project/pull/109255
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/108344
>From b00637094596e2cb5dbcb8438c5cb83f6d7a6d82 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Thu, 12 Sep 2024 09:27:03 +0200
Subject: [PATCH 1/5] Reapply "[clang] Diagnose dangling issues for the
"Container" c
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/108344
>From cda8759cb887b8a7d4a66e9b6fb4e543ab40ff5d Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Thu, 12 Sep 2024 09:27:03 +0200
Subject: [PATCH 1/6] Reapply "[clang] Diagnose dangling issues for the
"Container" c
@@ -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)) {
hokein wrote:
Done
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/108344
>From cda8759cb887b8a7d4a66e9b6fb4e543ab40ff5d Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Thu, 12 Sep 2024 09:27:03 +0200
Subject: [PATCH 1/6] Reapply "[clang] Diagnose dangling issues for the
"Container" c
@@ -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
@@ -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
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/109421
The current logic assumes that check names do not have leading spaces.
In cases like "-*, clang-diagnostic*", when processing the second check "
clang-diagnostics-*" (with a leading space), the check fails on
`
@@ -637,6 +637,11 @@ return value must be trivially destructible. The calling
convention of the
caller and callee must match, and they must not be variadic functions or have
old style K&R C function declarations.
+The lifetimes of all local variables and function parameters e
https://github.com/hokein approved this pull request.
Thanks, it looks good, just a few nits.
https://github.com/llvm/llvm-project/pull/109255
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
https://github.com/hokein edited
https://github.com/llvm/llvm-project/pull/109255
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -267,3 +267,30 @@ namespace ns {}
void TestCallNonValue() {
[[clang::musttail]] return ns; // expected-error {{unexpected namespace name
'ns': expected expression}}
}
+
+// Test diagnostics for lifetimes of local variables, which end earlier for a
+// musttail call than f
@@ -181,16 +181,16 @@ llvm::Expected>
getFoldingRanges(ParsedAST &AST) {
// Related issue: https://github.com/clangd/clangd/issues/310
llvm::Expected>
getFoldingRanges(const std::string &Code, bool LineFoldingOnly) {
hokein wrote:
I think we should keep it in
https://github.com/hokein edited
https://github.com/llvm/llvm-project/pull/109154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/109438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein approved this pull request.
https://github.com/llvm/llvm-project/pull/109374
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/109421
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein approved this pull request.
Thanks, looks good.
https://github.com/llvm/llvm-project/pull/110473
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
The feature has already been implemented in another pull request, so I will
close this one now.
https://github.com/llvm/llvm-project/pull/97473
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailma
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/97473
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1216,10 +1328,280 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
->getDeductionCandidateKind() == DeductionCandidate::Aggregate)
continue;
-BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc);
+BuildDeductionGuideForTypeAlias(Sema
@@ -634,7 +634,7 @@ struct ConvertConstructorToDeductionGuideTransform {
// Find all template parameters that appear in the given DeducedArgs.
// Return the indices of the template parameters in the TemplateParams.
-SmallVector TemplateParamsReferencedInTemplateArgumentList(
+
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
->getDeductionCandidateKind() == DeductionCandidate::Aggregate)
continue;
-BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc);
+BuildDeductionGuideForTypeAlias(Sema
@@ -1216,10 +1328,280 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
->getDeductionCandidateKind() == DeductionCandidate::Aggregate)
continue;
-BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc);
+BuildDeductionGuideForTypeAlias(Sema
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
->getDeductionCandidateKind() == DeductionCandidate::Aggregate)
continue;
-BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc);
+BuildDeductionGuideForTypeAlias(Sema
@@ -936,19 +940,21 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef,
Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate));
};
+ TemplateDecl *TD = DeducingTemplate ? DeducingTemplate : AliasTemplate;
+
SmallVector IsDeducibleTypeTraitArgs = {
@@ -944,12 +950,72 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef,
TypeAliasTemplateDecl *AliasTemplate) {
return {Template, AliasRhsTemplateArgs};
}
+struct InheritedConstructorDeductionInfo {
+ // Class template for which we are declaring deduction guides
+ // This is `C` i
@@ -944,12 +950,67 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef,
TypeAliasTemplateDecl *AliasTemplate) {
return {Template, AliasRhsTemplateArgs};
}
+struct InheritedConstructorDeductionInfo {
+ TemplateDecl *DerivedClassTemplate;
hokein wrote:
Thanks, it is
https://github.com/hokein commented:
Sorry for the late response, I missed this earlier (it looks generally good).
https://github.com/llvm/llvm-project/pull/98788
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/ma
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/98788
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
Thanks.
Can you update the comment
[here](https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/LangOptions.h#L242-L245)
to mention this case?
And I think it is better to move the release note `Mangle friend function ...`
from the `Bug Fixes to C++ Support`
@@ -75,18 +76,61 @@ bool isPrivateProtoDecl(const NamedDecl &ND) {
if (ND.getIdentifier() == nullptr)
return false;
auto Name = ND.getIdentifier()->getName();
- if (!Name.contains('_'))
-return false;
- // Nested proto entities (e.g. Message::Nested) have top-leve
https://github.com/hokein approved this pull request.
still good.
https://github.com/llvm/llvm-project/pull/110091
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein approved this pull request.
Thank you, this looks good to me. Let’s wait for a bit to see if other
reviewers have any additional comments.
https://github.com/llvm/llvm-project/pull/110503
___
cfe-commits mailing list
cfe-comm
https://github.com/hokein approved this pull request.
Thanks, the change looks good to me.
Please also add a note in the `clang/docs/ReleaseNotes.rst`
https://github.com/llvm/llvm-project/pull/110638
___
cfe-commits mailing list
cfe-commits@lists.llv
https://github.com/hokein approved this pull request.
This looks good.
https://github.com/llvm/llvm-project/pull/109154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein commented:
I think it warrants a mention in the release notes.
https://github.com/llvm/llvm-project/pull/109255
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit
https://github.com/hokein edited
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
https://github.com/hokein closed
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
@@ -601,17 +601,23 @@ void test() {
std::optional o4 = std::optional(s);
// FIXME: should work for assignment cases
hokein wrote:
Done.
https://github.com/llvm/llvm-project/pull/108205
___
cfe-commits mailing
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/108205
>From ff2f955965fd5f8f17ae76a11e495217aa4f02fd Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Wed, 2 Oct 2024 13:26:44 +0200
Subject: [PATCH] [clang] Detect dangling assignment for "Container"
case.
---
clang
@@ -601,17 +601,23 @@ void test() {
std::optional o4 = std::optional(s);
// FIXME: should work for assignment cases
- v1 = {std::string()};
- o1 = std::string();
+ v1 = {std::string()}; // expected-warning {{object backing the pointer}}
+ o1 = std::string(); // expect
hokein wrote:
Thanks for your work on this. The buildbot is green, so I’ll merge it now.
https://github.com/llvm/llvm-project/pull/110638
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/110638
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
This also introduces a regression for modules, see the reproducer
https://gist.github.com/hokein/3fa75d75b53aba1671cf0c2bfa64c6f3.
```
Building nest_struct pcm
Building tensor_allocataor_interface pcm
Building main.cc
In module 'tensor_allocator_interface':
./tensor_types.h:89:7:
hokein wrote:
The module issue caused by #114569, I reported a reproducer in
https://github.com/llvm/llvm-project/pull/114569#issuecomment-2462556416.
https://github.com/llvm/llvm-project/pull/111852
___
cfe-commits mailing list
cfe-commits@lists.llvm
https://github.com/hokein edited
https://github.com/llvm/llvm-project/pull/113049
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein commented:
Attaching an empty RecoveryExpr as an initializer to indicate that
initialization was attempted but failed seems reasonable to me. I'll leave the
approval to @efriedma-quic.
https://github.com/llvm/llvm-project/pull/113049
__
@@ -115,3 +115,14 @@ namespace nested_union {
// of Test3, or we should exclude f(Test3) as a candidate.
static_assert(f({1}) == 2, ""); // expected-error {{call to 'f' is
ambiguous}}
}
+
+// Fix crash issue https://github.com/llvm/llvm-project/issues/112560.
+// Make sure
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
@@ -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
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
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
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/117690
>From 63f9c7ecee11868d055ef7cd694cf6b06f738360 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 26 Nov 2024 10:31:12 +0100
Subject: [PATCH 1/2] [clang] Diagnose dangling references for parethesized
aggregate
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/117690
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/118078
None
>From 18d56e847901653de9f84e256f30ec0e16ebca96 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Fri, 29 Nov 2024 11:07:56 +0100
Subject: [PATCH] [clang] Infer lifetime_capture_by for map's subscript
operato
https://github.com/hokein created
https://github.com/llvm/llvm-project/pull/118088
A specialization declaration can have an attribute even if the primary template
does not, particularly when the specialization is instantiated from an
annotated using-alias declaration.
Fix #118064
>From b165a
https://github.com/hokein closed
https://github.com/llvm/llvm-project/pull/118001
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
hokein wrote:
committed as part of
https://github.com/llvm/llvm-project/commit/352f8688d0ca250c9e8774321f6c3bcd4298cc09.
https://github.com/llvm/llvm-project/pull/118001
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cg
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/118088
>From b165ad7accfc746210c5ca894b488553124253ed Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Fri, 29 Nov 2024 13:35:56 +0100
Subject: [PATCH 1/2] [clang] Fix a regression.
---
clang/lib/Sema/CheckExprLifetime
hokein wrote:
@usx95 Looks like I uploaded an incomplete version, please take another look.
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-com
@@ -32,6 +32,25 @@ void test_invalid_call(int s) {
int var = some_func(undef1);
}
+int some_func2(int a, int b);
+void test_invalid_call_2() {
+ // CHECK: -RecoveryExpr {{.*}} 'int' contains-errors
+ // CHECK-NEXT: `-UnresolvedLookupExpr {{.*}} ''
lvalue (ADL) = 'some_f
https://github.com/hokein approved this pull request.
Thanks, looks good.
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
@@ -32,6 +32,26 @@ void test_invalid_call(int s) {
int var = some_func(undef1);
}
+int some_func2(int a, int b);
+void test_invalid_call_2() {
+ // CHECK: `-RecoveryExpr {{.*}} 'int' contains-errors
+ // CHECK-NEXT: |-UnresolvedLookupExpr {{.*}} ''
lvalue (ADL) = 'some_
https://github.com/hokein closed
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
@@ -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
@@ -7,3 +7,106 @@ struct S {
};
// CHECK: CXXMethodDecl {{.*}}clang::lifetime_capture_by(a, b, global)
+
+//
+// Infer annotation for STL container methods.
+// ***
@@ -7,3 +7,106 @@ struct S {
};
// CHECK: CXXMethodDecl {{.*}}clang::lifetime_capture_by(a, b, global)
+
+//
+// Infer annotation for STL container methods.
+// ***
@@ -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
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/117792
>From edd8e7354c4ff96446d32830f4cd5e6c3c333a84 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 26 Nov 2024 21:42:45 +0100
Subject: [PATCH 1/2] [clang] Improve the lifetime_capture_by diagnostic on the
const
@@ -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 =
+
https://github.com/hokein updated
https://github.com/llvm/llvm-project/pull/117792
>From edd8e7354c4ff96446d32830f4cd5e6c3c333a84 Mon Sep 17 00:00:00 2001
From: Haojian Wu
Date: Tue, 26 Nov 2024 21:42:45 +0100
Subject: [PATCH 1/2] [clang] Improve the lifetime_capture_by diagnostic on the
const
@@ -411,3 +411,22 @@ void use() {
}
} // namespace with_span
} // namespace inferred_capture_by
+
+namespace on_constructor {
+struct T {
+ T(const int& t [[clang::lifetime_capture_by(this)]]);
+};
+struct T2 {
+ T2(const int& t [[clang::lifetime_capture_by(x)]], int& x);
+};
https://github.com/hokein closed
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
@@ -1763,6 +1763,18 @@ class Sema final : public SemaBase {
/// Add [[gsl::Pointer]] attributes for std:: types.
void inferGslPointerAttribute(TypedefNameDecl *TD);
+ template static bool isRecordWithAttr(QualType Type) {
hokein wrote:
I'd avoid expose
2701 - 2800 of 3165 matches
Mail list logo