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
@@ -332,23 +332,20 @@ static void SetupSerializedDiagnostics(DiagnosticOptions
*DiagOpts,
}
}
-void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
+void CompilerInstance::createDiagnostics(llvm::vfs::FileSystem &VFS,
+
https://github.com/bricknerb approved this pull request.
Thanks for fixing!
It might be worth understanding whether this should have been caught by some
test.
We might want to add a test or a check that would catch this.
https://github.com/llvm/llvm-project/pull/115852
_
https://github.com/bricknerb edited
https://github.com/llvm/llvm-project/pull/115852
___
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/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/2] [Clang] [NFC] Add "human" diagnostic argument format This
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/115835
This allows formatting large integers in a human friendly way. Example:
"5321584" -> "5.32M".
Use it where such human numbers are generated manually today.
>From ccf18e49f884b4430dff70d59fb3236259661f9d Mon S
@@ -477,6 +486,136 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+// FIXME: We should isolate the parser from SpecialCaseList and just use it
+// here.
+class WarningsSpecialCaseList : public llvm::SpecialC
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/115464
None
>From 01200ae10a21ad408b08eda542e759f9d3d76cbb Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Fri, 8 Nov 2024 12:18:21 +0100
Subject: [PATCH] [clang] [NFC] Split checkAttributesAfterMerging() to mult
@@ -167,4 +179,155 @@ TEST(DiagnosticTest, storedDiagEmptyWarning) {
// Make sure an empty warning can round-trip with \c StoredDiagnostic.
Diags.Report(CaptureConsumer.StoredDiags.front());
}
+
+class SuppressionMappingTest : public testing::Test {
+public:
+ SuppressionM
@@ -167,4 +176,159 @@ TEST(DiagnosticTest, storedDiagEmptyWarning) {
// Make sure an empty warning can round-trip with \c StoredDiagnostic.
Diags.Report(CaptureConsumer.StoredDiags.front());
}
+
+class SuppressionMappingTest : public testing::Test {
+public:
+ SuppressionM
@@ -167,4 +176,159 @@ TEST(DiagnosticTest, storedDiagEmptyWarning) {
// Make sure an empty warning can round-trip with \c StoredDiagnostic.
Diags.Report(CaptureConsumer.StoredDiags.front());
}
+
+class SuppressionMappingTest : public testing::Test {
+public:
+ SuppressionM
@@ -477,6 +486,109 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+class WarningsSpecialCaseList : public llvm::SpecialCaseList {
+public:
+ static std::unique_ptr
+ create(const llvm::MemoryBuffer &MB, st
https://github.com/bricknerb approved this pull request.
https://github.com/llvm/llvm-project/pull/112517
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,90 @@
+
+Warning suppression mappings
+
+
+.. contents::
+ :local:
+
+Introduction
+
+
+Warning suppression mappings enable users to suppress Clang's diagnostics in a
+per-file granular manner. Enabli
@@ -477,6 +486,136 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+// FIXME: We should isolate the parser from SpecialCaseList and just use it
+// here.
+class WarningsSpecialCaseList : public llvm::SpecialC
bricknerb wrote:
Unit tests cover the code and Clang integration tests are useful to test a
feature end-to-end.
The compiler logic that handles the code until it reaches this point might
break the assumptions we have in the specific code (especially if we thin
1 - 100 of 290 matches
Mail list logo