@@ -6967,6 +6967,11 @@ static void checkAttributesAfterMerging(Sema &S,
NamedDecl &ND) {
} else if (isa(MD) || isa(MD)) {
S.Diag(A->getLocation(), diag::err_lifetimebound_ctor_dtor)
<< isa(MD) << A->getRange();
+} else if (FD->getReturnT
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/114203
>From 82d89b8b5d1e5faebefed57f3289eb43ad9f8d65 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 30 Oct 2024 11:24:07 +0100
Subject: [PATCH 1/3] [clang] Output an error when [[lifetimebound]] attribute
@@ -2227,6 +2227,28 @@ LLVM_DUMP_METHOD void SourceManager::dump() const {
}
}
+static std::string NumberToHumanString(uint64_t number) {
+ static constexpr std::array, 4> Units = {
+ {{1'000'000'000'000UL, 'T'},
+ {1'000'000'000UL, 'G'},
+ {1'000'000UL, 'M
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/114999
>From 6f3c9f95f7ad558659bc7d868ab4d5e5f6af05c0 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Tue, 5 Nov 2024 15:29:10 +0100
Subject: [PATCH 1/2] [clang] Make source locations space usage diagnostics
numb
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/114198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -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
@@ -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
@@ -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
@@ -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
@@ -4493,6 +4493,13 @@ static void RenderDiagnosticsOptions(const Driver &D,
const ArgList &Args,
Args.addOptOutFlag(CmdArgs, options::OPT_fspell_checking,
options::OPT_fno_spell_checking);
+
+ if (const Arg *A =
+ Args.getLastArg(options::OPT
@@ -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
@@ -70,6 +76,16 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
else
Diags.setExtensionHandlingBehavior(diag::Severity::Ignored);
+ if (!Opts.DiagnosticSuppressionMappingsFile.empty()) {
+if (auto Buf =
bricknerb wrote:
This is typic
@@ -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 edited
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
https://github.com/bricknerb edited
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
@@ -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
@@ -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
@@ -575,25 +575,42 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID,
SourceLocation Loc,
DiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
Result = diag::Severity::Error;
+ // Rest of the mappings are only applicable for diagnostics associated wit
@@ -575,25 +575,42 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID,
SourceLocation Loc,
DiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
Result = diag::Severity::Error;
+ // Rest of the mappings are only applicable for diagnostics associated wit
@@ -946,6 +953,27 @@ class DiagnosticsEngine : public
RefCountedBase {
return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this);
}
+ /// Diagnostic suppression mappings can be used to suppress specific
+ /// diagnostics in specific files.
+ /// Mapping file is exp
@@ -8979,3 +8979,8 @@ def wasm_opt : Flag<["--"], "wasm-opt">,
Group,
HelpText<"Enable the wasm-opt optimizer (default)">,
MarshallingInfoNegativeFlag>;
+
+def warning_suppression_mappings_EQ : Joined<["--"],
+ "warning-suppression-mappings=">, Group,
+ HelpText<"File c
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/113460
>From 4405d652029081cd63094e9a81dfa31e8611aad4 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 23 Oct 2024 15:50:43 +0200
Subject: [PATCH 1/7] [clang] Output a warning when [[lifetimebound]] attribute
@@ -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);
bricknerb wrote:
Done.
https://github.com/llvm/llvm-pro
https://github.com/bricknerb closed
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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -108,6 +108,9 @@ class DiagnosticOptions : public
RefCountedBase{
/// The file to serialize diagnostics to (non-appending).
std::string DiagnosticSerializationFile;
+ /// File that defines diagnostic suppression mappings.
bricknerb wrote:
Clarify thi
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S,
NamedDecl &ND) {
}
}
}
+
+for (unsigned int I = 0; I < FD->getNumParams(); ++I) {
+ const ParmVarDecl *P = FD->getParamDecl(I);
+
+ // The [[lifetimebound]] attribute can be
https://github.com/bricknerb created
https://github.com/llvm/llvm-project/pull/113460
Fixes: https://github.com/llvm/llvm-project/issues/107556
>From 4405d652029081cd63094e9a81dfa31e8611aad4 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 23 Oct 2024 15:50:43 +0200
Subject: [PATCH] [cl
https://github.com/bricknerb 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
@@ -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
@@ -477,6 +485,100 @@ 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
@@ -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 edited
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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+class WarningsSpecialCaseList : public llvm::SpecialCaseList {
bricknerb wrote:
Do we need to keep all implementation deta
@@ -477,6 +485,100 @@ 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
@@ -575,25 +575,42 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID,
SourceLocation Loc,
DiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
Result = diag::Severity::Error;
+ // Rest of the mappings are only applicable for diagnostics associated wit
@@ -41,8 +46,10 @@ static void EmitUnknownDiagWarning(DiagnosticsEngine &Diags,
<< (Prefix.str() += std::string(Suggestion));
}
+
bricknerb wrote:
Remove extra blank line?
https://github.com/llvm/llvm-project/pull/112517
___
@@ -575,25 +575,42 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID,
SourceLocation Loc,
DiagID != diag::fatal_too_many_errors && Diag.FatalsAsError)
Result = diag::Severity::Error;
+ // Rest of the mappings are only applicable for diagnostics associated wit
@@ -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
@@ -946,6 +953,24 @@ class DiagnosticsEngine : public
RefCountedBase {
return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this);
}
+ /// Diagnostic suppression mappings can be used to ignore diagnostics based
on
+ /// the file they occur in. Mapping file is expect
@@ -8998,3 +8998,8 @@ def wasm_opt : Flag<["--"], "wasm-opt">,
Group,
HelpText<"Enable the wasm-opt optimizer (default)">,
MarshallingInfoNegativeFlag>;
+
+def warning_suppression_mappings_EQ : Joined<["--"],
+ "warning-suppression-mappings=">, Group,
+ HelpText<"File c
@@ -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 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
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
@@ -477,6 +485,100 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+class WarningsSpecialCaseList : public llvm::SpecialCaseList {
bricknerb wrote:
Do we need to use inheritance here?
Could
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ 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
@@ -477,6 +485,100 @@ void DiagnosticsEngine::setSeverityForAll(diag::Flavor
Flavor,
setSeverity(Diag, Map, Loc);
}
+namespace {
+class WarningsSpecialCaseList : public llvm::SpecialCaseList {
bricknerb wrote:
Consider moving this class to a separate f
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
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
@@ -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
@@ -1110,12 +1117,13 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema
&SemaRef,
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
-static void checkExprLifetimeImpl(Sema &SemaRef,
- const InitializedEntity *I
@@ -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/
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
@@ -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
@@ -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,
@@ -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,
-
@@ -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)
+return false;
+ assert(shouldLifetimeExtendThroughPath(Path) ==
+ PathLifetimeKind::NoExtend &&
+
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
@@ -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
@@ -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
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
@@ -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 closed
https://github.com/llvm/llvm-project/pull/113437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -368,11 +365,10 @@ IntrusiveRefCntPtr
CompilerInstance::createDiagnostics(
SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
if (!Opts->DiagnosticSerializationFile.empty())
-SetupSerializedDiagnostics(Opts, *Diags,
- Opts->DiagnosticSer
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
_
@@ -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 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/3] [Clang] [NFC] Add "human" diagnostic argument format This
@@ -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/114999
>From 6f3c9f95f7ad558659bc7d868ab4d5e5f6af05c0 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Tue, 5 Nov 2024 15:29:10 +0100
Subject: [PATCH 1/3] [clang] Make source locations space usage diagnostics
numb
@@ -2227,6 +2227,28 @@ LLVM_DUMP_METHOD void SourceManager::dump() const {
}
}
+static std::string NumberToHumanString(uint64_t Number) {
bricknerb wrote:
Renamed to `humanizeNumber()`.
https://github.com/llvm/llvm-project/pull/114999
_
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S,
NamedDecl &ND) {
}
}
}
+
+for (unsigned int I = 0; I < FD->getNumParams(); ++I) {
+ const ParmVarDecl *P = FD->getParamDecl(I);
+
+ // The [[lifetimebound]] attribute can be
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S,
NamedDecl &ND) {
}
}
}
+
+for (unsigned int I = 0; I < FD->getNumParams(); ++I) {
bricknerb wrote:
Makes sense!
Added a test for that with FIXME to fix in another pu
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/113460
>From 4405d652029081cd63094e9a81dfa31e8611aad4 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 23 Oct 2024 15:50:43 +0200
Subject: [PATCH 1/3] [clang] Output a warning when [[lifetimebound]] attribute
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/113460
>From 4405d652029081cd63094e9a81dfa31e8611aad4 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 23 Oct 2024 15:50:43 +0200
Subject: [PATCH 1/2] [clang] Output a warning when [[lifetimebound]] attribute
https://github.com/bricknerb updated
https://github.com/llvm/llvm-project/pull/113460
>From 4405d652029081cd63094e9a81dfa31e8611aad4 Mon Sep 17 00:00:00 2001
From: Boaz Brickner
Date: Wed, 23 Oct 2024 15:50:43 +0200
Subject: [PATCH 1/6] [clang] Output a warning when [[lifetimebound]] attribute
@@ -133,6 +133,15 @@ C++ Specific Potentially Breaking Changes
// Fixed version:
unsigned operator""_udl_name(unsigned long long);
+- Clang will now produce an error diagnostic when [[clang::lifetimebound]] is
+ applied on a parameter of a function that returns void.
@@ -946,6 +953,24 @@ class DiagnosticsEngine : public
RefCountedBase {
return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this);
}
+ /// Diagnostic suppression mappings can be used to ignore diagnostics based
on
+ /// the file they occur in. Mapping file is expect
@@ -946,6 +953,24 @@ class DiagnosticsEngine : public
RefCountedBase {
return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this);
}
+ /// Diagnostic suppression mappings can be used to ignore diagnostics based
on
+ /// the file they occur in. Mapping file is expect
bricknerb wrote:
Add that change to clang/docs/ReleaseNotes.rst?
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
bricknerb wrote:
> Would you be willing to write additional tests for
> https://cplusplus.github.io/CWG/issues/960.html in a separate PR?
Sure, I'll take a look.
https://github.com/llvm/llvm-project/pull/112713
___
cfe-commits mailing list
cfe-commit
https://github.com/bricknerb closed
https://github.com/llvm/llvm-project/pull/112713
___
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/112517
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -701,11 +702,10 @@ class CompilerInstance : public ModuleLoader {
/// used by some diagnostics printers (for logging purposes only).
///
/// \return The new object on success, or null on failure.
- static IntrusiveRefCntPtr
- createDiagnostics(DiagnosticOptions *Opts
@@ -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
@@ -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
@@ -599,6 +600,19 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID,
SourceLocation Loc,
SM.isInSystemMacro(Loc))
return diag::Severity::Ignored;
+ // Apply suppression mappings if severity wasn't explicitly mapped with a
+ // clang-diagnostics pragma to ens
bricknerb wrote:
Yes, I meant as an integration test.
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-commit
101 - 200 of 305 matches
Mail list logo