[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-18 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: 30 of 31, this time is much closer) https://github.com/user-attachments/assets/de806772-30df-42bd-9928-19bad35dca02";> it seems like [those](https://lab.llvm.org/buildbot/#/builders/73) builds were broken a couple hours ago: https://github.com/user-attachments/assets/c375276a-d3a

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-18 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: Well, the more it waits the bigger a probability it will have logical conflicts after merging into `main`. https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-17 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox ready_for_review https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: > Testing Time: 301.48s Total Discovered Tests: 105926 Skipped : 23 (0.02%) Unsupported : 2682 (2.53%) Passed : 103036 (97.27%) Expectedly Failed:185 (0.17%) 1 warning(s) in tests https://github.com/llvm/llvm-project/pull/108866 __

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: Errors were fixed. If there's some other `make` target that could catch even more errors - please lemme know. cc: @AaronBallman I'm gonna remove Draft from this PR after `check-all` target finish with OK-state. https://github.com/llvm/llvm-project/pull/108866 __

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox updated https://github.com/llvm/llvm-project/pull/108866 >From aee4cf70dedaa3c8b7b6508238e01f92d60c631c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 10 Sep 2024 16:19:05 + Subject: [PATCH 1/5] fix quick OOM in FormatDiagnostic --- .../ClangTidyDiagnosticCons

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] Fix OOM in FormatDiagnostic (2nd attempt) (PR #108866)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox created https://github.com/llvm/llvm-project/pull/108866 The last attempt failed - https://github.com/llvm/llvm-project/pull/108187#issuecomment-2353122096 so was reverted - #108838 Not quite sure how to build targets available, so I run the same `cmake` and the `ni

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-16 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: > LGTM! Do you need someone to land these changes on your behalf? I suppose so.. or what are my options? The Merge button isn't active of course. I believe someone from maintainers would merge this PR and I will be so proud) https://github.com/llvm/llvm-project/pull/108187 __

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-14 Thread Vakhurin Sergei via cfe-commits
@@ -945,50 +959,11 @@ class DiagnosticsEngine : public RefCountedBase { void Report(const StoredDiagnostic &storedDiag); - /// Determine whethere there is already a diagnostic in flight. - bool isDiagnosticInFlight() const { -return CurDiagID != std::numeric_limits::

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-14 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox updated https://github.com/llvm/llvm-project/pull/108187 >From aee4cf70dedaa3c8b7b6508238e01f92d60c631c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 10 Sep 2024 16:19:05 + Subject: [PATCH 1/4] fix quick OOM in FormatDiagnostic --- .../ClangTidyDiagnosticCons

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: Whew, managed to add both tests. https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -fallow-pch-with-compiler-errors -std=c++20 -x c++-header -emit-pch %s -o %t -verify +// RUN: %clang_cc1 -fallow-pch-with-compiler-errors -std=c++20 -include-pch %t %s -verify igelbox wrote: In the `main` branch it didn't fa

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox updated https://github.com/llvm/llvm-project/pull/108187 >From aee4cf70dedaa3c8b7b6508238e01f92d60c631c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 10 Sep 2024 16:19:05 + Subject: [PATCH 1/3] fix quick OOM in FormatDiagnostic --- .../ClangTidyDiagnosticCons

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
@@ -538,24 +511,51 @@ bool DiagnosticsEngine::EmitCurrentDiagnostic(bool Force) { Emitted = (DiagLevel != DiagnosticIDs::Ignored); if (Emitted) { // Emit the diagnostic regardless of suppression level. - Diags->EmitDiag(*this, DiagLevel); + Diags->EmitD

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
@@ -571,8 +571,7 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc, } // If explicitly requested, map fatal errors to errors. - if (Result == diag::Severity::Fatal && - Diag.CurDiagID != diag::fatal_too_many_errors && Diag.FatalsAsError) --

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox updated https://github.com/llvm/llvm-project/pull/108187 >From aee4cf70dedaa3c8b7b6508238e01f92d60c631c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 10 Sep 2024 16:19:05 + Subject: [PATCH 1/2] fix quick OOM in FormatDiagnostic --- .../ClangTidyDiagnosticCons

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: > I'm not certain that there is a reasonable way to add test coverage for the > changes, but if you can devise a test, that would be appreciated. I wonder there should be some tests like: - input = some source files - output = expected it compiles well and has no assertions fired

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
igelbox wrote: > Have you run your changes with address and ub sanitizers to see if there are > some uncaught edge cases? Not quire sure I get the point about UB-sanitizers. I tested this changes against my proprietary code which caused the issue with OOM/infinite-loop and it works just fine.

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-12 Thread Vakhurin Sergei via cfe-commits
@@ -538,24 +511,51 @@ bool DiagnosticsEngine::EmitCurrentDiagnostic(bool Force) { Emitted = (DiagLevel != DiagnosticIDs::Ignored); if (Emitted) { // Emit the diagnostic regardless of suppression level. - Diags->EmitDiag(*this, DiagLevel); + Diags->EmitD

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox ready_for_review https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox updated https://github.com/llvm/llvm-project/pull/108187 >From aee4cf70dedaa3c8b7b6508238e01f92d60c631c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 10 Sep 2024 16:19:05 + Subject: [PATCH] fix quick OOM in FormatDiagnostic --- .../ClangTidyDiagnosticConsumer

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox edited https://github.com/llvm/llvm-project/pull/108187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
@@ -538,24 +511,51 @@ bool DiagnosticsEngine::EmitCurrentDiagnostic(bool Force) { Emitted = (DiagLevel != DiagnosticIDs::Ignored); if (Emitted) { // Emit the diagnostic regardless of suppression level. - Diags->EmitDiag(*this, DiagLevel); + Diags->EmitD

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
@@ -1333,13 +1263,7 @@ class DiagnosticBuilder : public StreamingDiagnostic { public: /// Copy constructor. When copied, this "takes" the diagnostic info from the /// input and neuters it. - DiagnosticBuilder(const DiagnosticBuilder &D) : StreamingDiagnostic() { -Diag

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
@@ -571,8 +571,7 @@ DiagnosticIDs::getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc, } // If explicitly requested, map fatal errors to errors. - if (Result == diag::Severity::Fatal && - Diag.CurDiagID != diag::fatal_too_many_errors && Diag.FatalsAsError) --

[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

2024-09-11 Thread Vakhurin Sergei via cfe-commits
https://github.com/igelbox created https://github.com/llvm/llvm-project/pull/108187 Resolves: #70930 (and probably latest comments from #251) by fixing racing for the shared `DiagStorage` value which caused messing with args inside the storage and then formatting the following message with `ge