https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/124128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/131165
None
>From c7b3a1c83ca0bd2631e9dcfcce0fe672d1140cce Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Thu, 13 Mar 2025 17:01:26 +0100
Subject: [PATCH] [Clang] Improve `getReplacedTemplateParameterList()` con
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/131165
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/130613
Unfortunately, making `MangleContext::mangleName()` would require a lot of
const escapes due to lazy initialization and id creations:
`Mangle.h`:
*
https://github.com/llvm/llvm-project/blob/dffbc030e75b758e7
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/124128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/124128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/124128
>From 06bf61b6e3900edb99bcbe1c48e1581463f1ec11 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Thu, 23 Jan 2025 16:03:22 +0100
Subject: [PATCH 1/2] [clang] Fix segmentation fault caused by
VarBypassDetecto
bricknerb wrote:
Thanks for the feedback!
Is there a way to call `ASTContext::createMangleContext()` when I have a `const
ASTUnit`?
I've tried to make `ASTContext::createMangleContext()` const but this failed as
it seems to actually call methods that potentially modify the context.
However, w
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/130096
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bricknerb wrote:
Thanks everyone!
Closing this.
https://github.com/llvm/llvm-project/pull/130096
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/130096
Also, remove the non-const `ASTUnit::getASTContext()` since it's no longer
necessary.
This would make it similar to `Decl::getAstContext() const` for a more
consistent and flexible API.
>From be1b384568aab7a
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -Wstack-exhausted
bricknerb wrote:
I believe one of @cor3ntin concerns in #111701 was flakiness, not just speed.
I'm happy to try and add that option if there are no objections.
https://github.com/llvm/llvm
bricknerb wrote:
Please let me know if you have any comments.
I plan to merge this next week (after making the agreed changes) if there are
no more comments.
https://github.com/llvm/llvm-project/pull/124128
___
cfe-commits mailing list
cfe-commits@lis
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/124128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/124128
This happens when using -O2.
Added a test that reproduces it based on a test that was reverted in #111701:
https://github.com/bricknerb/llvm-project/blob/93e4a7386ec897e53d7330c6206d38759a858be2/clang/test/Co
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/123042
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -223,7 +223,11 @@ buildASTFromCode(StringRef Code, StringRef FileName =
"input.cc",
/// \param PCHContainerOps The PCHContainerOperations for loading and creating
/// clang modules.
///
-/// \param Adjuster A function to filter the command line arguments as
specified.
+///
@@ -692,11 +692,12 @@ std::unique_ptr buildASTFromCodeWithArgs(
StringRef Code, const std::vector &Args, StringRef FileName,
StringRef ToolName, std::shared_ptr
PCHContainerOps,
ArgumentsAdjuster Adjuster, const FileContentMappings &VirtualMappedFiles,
-Diagnos
https://github.com/bricknerb unassigned
https://github.com/llvm/llvm-project/pull/123042
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/123042
>From 197fa433e56c875b4098806576f14b33a37a4300 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 15 Jan 2025 11:48:20 +0100
Subject: [PATCH 1/2] [clang] Add support for passing FileSystem to
buildASTFro
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/123042
This would allow tools that don't use the real file system to use this function.
>From 197fa433e56c875b4098806576f14b33a37a4300 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 15 Jan 2025 11:48:20 +01
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/122029
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public
Mergeable {
/// Returns the index of this field within its record,
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
- unsigned getFieldIndex() const;
+ unsigned getFieldIndex() cons
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public
Mergeable {
/// Returns the index of this field within its record,
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
- unsigned getFieldIndex() const;
+ unsigned getFieldIndex() cons
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public
Mergeable {
/// Returns the index of this field within its record,
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
- unsigned getFieldIndex() const;
+ unsigned getFieldIndex() cons
https://github.com/bricknerb approved this pull request.
https://github.com/llvm/llvm-project/pull/122029
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public
Mergeable {
/// Returns the index of this field within its record,
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
- unsigned getFieldIndex() const;
+ unsigned getFieldIndex() cons
bricknerb wrote:
Thanks for doing this!
FWIW, I think splitting this to smaller PRs would be easier. For example:
1. `getFieldIndex()` inlining.
2. Passing fields instead of their indexes and iterate over fields.
3. Use `std::next()` instead of defining a `Next` variable.
4. Rename `isNoUniqueAdd
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/116937
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -184,14 +184,30 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module
*RootModule) {
const SourceManager &SM = PP.getSourceManager();
const ModuleMap &MM = HS.getModuleMap();
- llvm::DenseSet ModuleMaps;
-
- llvm::DenseSet ProcessedModules;
- auto CollectModuleMa
@@ -184,14 +184,30 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module
*RootModule) {
const SourceManager &SM = PP.getSourceManager();
const ModuleMap &MM = HS.getModuleMap();
- llvm::DenseSet ModuleMaps;
-
- llvm::DenseSet ProcessedModules;
- auto CollectModuleMa
https://github.com/bricknerb approved this pull request.
Thanks!
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -184,14 +184,30 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module
*RootModule) {
const SourceManager &SM = PP.getSourceManager();
const ModuleMap &MM = HS.getModuleMap();
- llvm::DenseSet ModuleMaps;
-
- llvm::DenseSet ProcessedModules;
- auto CollectModuleMa
https://github.com/bricknerb approved this pull request.
https://github.com/llvm/llvm-project/pull/116374
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bricknerb wrote:
> Added @bricknerb to help with reviewing this (esp. the code style aspects)
Focused on code style, please let me know if you want me to dive in more to
correctness.
https://github.com/llvm/llvm-project/pull/116374
___
cfe-commits ma
@@ -184,14 +184,30 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module
*RootModule) {
const SourceManager &SM = PP.getSourceManager();
const ModuleMap &MM = HS.getModuleMap();
- llvm::DenseSet ModuleMaps;
-
- llvm::DenseSet ProcessedModules;
- auto CollectModuleMa
@@ -0,0 +1,348 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+};
+X x;
+
+// **
@@ -0,0 +1,348 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+};
+X x;
+
+// **
@@ -3922,16 +3922,41 @@ def LifetimeCaptureByDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a
function
-parameter or implicit object parameter indicates that that objects t
bricknerb wrote:
Do we have tests for bad usage of [[lifetime_capture_by]] ?
For example, wrong number of parameters, "X" not defined, "X" is not an object
that can actually capture something (for example: an integer passed by value)
etc. ?
Perhaps some of the
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/116937
None
>From 376c3582016fb100743a0bbedd329ea480a14a31 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 20 Nov 2024 09:19:22 +0100
Subject: [PATCH] [clang] [NFC] Remove SourceLocation() parameter from
Di
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/116080
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bricknerb wrote:
I'm not familiar either with such a feature, but it seems it's possible to
achieve, though not in a super straight forward way: For example:
https://stackoverflow.com/questions/16937359/git-copy-file-preserving-history
https://github.com/llvm
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/116612
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3951,7 +3958,7 @@ The capturing entity ``X`` can be one of the following:
std::set s;
};
-- 'global', 'unknown' (without quotes).
+- `global`, `unknown`.
bricknerb wrote:
Parameter names have enough constraints given local style guides and
read
@@ -3951,7 +3958,7 @@ The capturing entity ``X`` can be one of the following:
std::set s;
};
-- 'global', 'unknown' (without quotes).
+- `global`, `unknown`.
bricknerb wrote:
Thanks for clarifying!
I think we should try to find an alternative for li
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
bricknerb wrote:
I might tend to agree if this test file was short and easy to follow.
Given th
@@ -3922,16 +3922,41 @@ def LifetimeCaptureByDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a
function
-parameter or implicit object parameter indicates that that objects t
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
=
@@ -1110,13 +1117,14 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema
&SemaRef,
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
-static void checkExprLifetimeImpl(Sema &SemaRef,
- const InitializedEntity *I
https://github.com/bricknerb requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3922,16 +3922,41 @@ def LifetimeCaptureByDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a
function
-parameter or implicit object parameter indicates that that objects t
@@ -3951,7 +3958,7 @@ The capturing entity ``X`` can be one of the following:
std::set s;
};
-- 'global', 'unknown' (without quotes).
+- `global`, `unknown`.
bricknerb wrote:
To clarify, I suggested the following:
```c++
void captureInt(const int &
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/116612
None
>From 26e955a339c9b676d48711ee54713092c0401d48 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Mon, 18 Nov 2024 14:29:07 +0100
Subject: [PATCH] [clang] [NFC] Merge conditions
---
clang/lib/Sema/Chec
@@ -1411,18 +1437,34 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
// warnings or errors on inner temporaries within this one's initializer.
return false;
};
-
bricknerb wrote:
Bring back the blank line after the visitor definition.
https://gi
@@ -3229,6 +3230,52 @@ void Sema::CheckArgAlignment(SourceLocation Loc,
NamedDecl *FDecl,
<< ParamName << (FDecl != nullptr) << FDecl;
}
+void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
+ const Expr *ThisArg,
@@ -1110,13 +1117,14 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema
&SemaRef,
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
-static void checkExprLifetimeImpl(Sema &SemaRef,
- const InitializedEntity *I
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
=
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/116226
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3229,6 +3230,52 @@ void Sema::CheckArgAlignment(SourceLocation Loc,
NamedDecl *FDecl,
<< ParamName << (FDecl != nullptr) << FDecl;
}
+void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
+ const Expr *ThisArg,
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
=
@@ -3925,13 +3925,20 @@ def LifetimeCaptureByDocs : Documentation {
parameter or implicit object parameter indicates that that objects that are
referred to
by that parameter may also be referred to by the capturing entity ``X``.
-By default, a reference is considered to refer
@@ -3951,7 +3958,7 @@ The capturing entity ``X`` can be one of the following:
std::set s;
};
-- 'global', 'unknown' (without quotes).
+- `global`, `unknown`.
bricknerb wrote:
What happens when the parameters are named "global" or "unknown"?
https:/
@@ -3229,6 +3230,52 @@ void Sema::CheckArgAlignment(SourceLocation Loc,
NamedDecl *FDecl,
<< ParamName << (FDecl != nullptr) << FDecl;
}
+void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
+ const Expr *ThisArg,
https://github.com/bricknerb requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
=
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
bricknerb wrote:
Perhaps let's split the test file that checks the capture-by on the standard
@@ -3229,6 +3230,52 @@ void Sema::CheckArgAlignment(SourceLocation Loc,
NamedDecl *FDecl,
<< ParamName << (FDecl != nullptr) << FDecl;
}
+void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
+ const Expr *ThisArg,
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+
+#include "Inputs/lifetime-analysis.h"
+
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
=
@@ -1460,7 +1502,15 @@ void checkExprLifetime(Sema &SemaRef, const
AssignedEntity &Entity,
checkExprLifetimeImpl(SemaRef, /*InitEntity=*/nullptr,
/*ExtendingEntity=*/nullptr, LK_Assignment, &Entity,
-Init);
+
@@ -3925,13 +3925,20 @@ def LifetimeCaptureByDocs : Documentation {
parameter or implicit object parameter indicates that that objects that are
referred to
bricknerb wrote:
While you're here, remove one of the "that" ?
https://github.com/llvm/llvm-project/pull
@@ -3983,6 +3990,21 @@ The attribute supports specifying more than one
capturing entities:
s2.insert(a);
}
+Currently clang would diagnose when a temporary is used as an argument to a
bricknerb wrote:
Nit: Use "Clang" and not "clang" when referring to
@@ -3925,13 +3925,20 @@ def LifetimeCaptureByDocs : Documentation {
parameter or implicit object parameter indicates that that objects that are
referred to
by that parameter may also be referred to by the capturing entity ``X``.
-By default, a reference is considered to refer
@@ -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
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -249,7 +254,7 @@ static void
visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path,
LocalVisitor Visit);
template static bool isRecordWithAttr(QualType Type) {
- if (auto *RD = Type->getAsCXXRecordDecl())
+ if (a
@@ -793,3 +806,202 @@ void test13() {
}
} // namespace GH100526
+
+namespace lifetime_capture_by {
+struct X {
+ const int *x;
+ void captureInt(const int& x [[clang::lifetime_capture_by(this)]]) { this->x
= &x; }
+ void captureSV(std::string_view sv [[clang::lifetime_capt
@@ -1420,9 +1446,18 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
? IndirectLocalPathEntry::LifetimeBoundCall
: IndirectLocalPathEntry::GslPointerAssignment,
Init});
+ } else if (LK == LK_LifetimeCapture) {
bricknerb wr
https://github.com/bricknerb commented:
Please request another review after comments are addressed.
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo
@@ -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,
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/116226
None
>From 35c1a01df73a52acda55bb4a162fdbddd03c764d Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Thu, 14 Nov 2024 14:27:33 +0100
Subject: [PATCH] [clang] [NFC] Merge two ifs to a single one
---
clang/
@@ -1199,6 +1207,21 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
break;
}
+case LK_LifetimeCapture: {
+ if (!MTE)
+return false;
+ assert(shouldLifetimeExtendThroughPath(Path) ==
+ PathLifetimeKind::NoExtend &&
+
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10230,6 +10230,9 @@ def warn_dangling_pointer_assignment : Warning<
"object backing %select{|the pointer }0%1 "
"will be destroyed at the end of the full-expression">,
InGroup;
+def warn_dangling_reference_captured : Warning<
+ "object whose reference is captured
@@ -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; }
bricknerb wrote:
Be consistent regarding sp
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/116080
None
>From 3d3d273f849ed5cdf357d6c1ea7c34f76f51afeb Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 13 Nov 2024 17:54:40 +0100
Subject: [PATCH] [clang] [NFC] In GetDiagForGotoScopeDecl(), limit Init t
@@ -1199,6 +1207,21 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
break;
}
+case LK_LifetimeCapture: {
+ if (!MTE)
+return false;
+ assert(shouldLifetimeExtendThroughPath(Path) ==
+ PathLifetimeKind::NoExtend &&
+
@@ -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
@@ -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,
-
@@ -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,
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
+// RUN: %clang_cc1 --std=c++20 -fsyntax-only -Wdangling -Wdangling-field
-Wreturn-stack-address -verify %s
bricknerb wrote:
Should we limit all the
@@ -1199,6 +1207,21 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
break;
}
+case LK_LifetimeCapture: {
+ if (!MTE)
bricknerb wrote:
Add a comment explaining when do we expect this to happen?
https://github.com/llvm/llvm-project/pull/
@@ -1110,12 +1117,13 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema
&SemaRef,
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
-static void checkExprLifetimeImpl(Sema &SemaRef,
- const InitializedEntity *I
@@ -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
https://github.com/bricknerb commented:
First pass, still didn't dive fully into the logic.
https://github.com/llvm/llvm-project/pull/115921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/115835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/115464
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -315,6 +315,18 @@ Description:
than ``1`` are not supported. This formatter is currently hard-coded to use
English ordinals.
+**"human" format**
+
+Example:
+ ``"total size is %human0 bytes"``
+Class:
+ Integers
+Description:
+ This is a formatter which represents t
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/115835
>From ccf18e49f884b4430dff70d59fb3236259661f9d Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Tue, 12 Nov 2024 10:19:58 +0100
Subject: [PATCH 1/3] [Clang] [NFC] Add "human" diagnostic argument format This
@@ -368,11 +365,10 @@ IntrusiveRefCntPtr
CompilerInstance::createDiagnostics(
SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
if (!Opts->DiagnosticSerializationFile.empty())
-SetupSerializedDiagnostics(Opts, *Diags,
- Opts->DiagnosticSer
1 - 100 of 305 matches
Mail list logo