[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/91317 >From c1e0ad6ee57a95fa4321bbe91aa754167da9fb3b Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH 1/3] [clang-format] Add DiagHandler for getStyle function It al

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/91317 >From c1e0ad6ee57a95fa4321bbe91aa754167da9fb3b Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH 1/2] [clang-format] Add DiagHandler for getStyle function It al

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style = getS

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style = getS

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - auto applyChildFormatTexts = [&](FormatStyl

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - pointhex wrote: No problem.

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread via cfe-commits
https://github.com/pointhex updated https://github.com/llvm/llvm-project/pull/91317 >From c1e0ad6ee57a95fa4321bbe91aa754167da9fb3b Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH] [clang-format] Add DiagHandler for getStyle function It allo

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style = getS

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style = getS

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style = getS

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - owenca wrote: Sorry! We do n

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - auto applyChildFormatTexts = [&](FormatStyl

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-13 Thread via cfe-commits
pointhex wrote: I used to redirect output. I guess that is enough. Maybe, you know a better solution for that. ```::testing::internal::CaptureStderr(); auto Style = getStyle("{invalid_key=invalid_value}", "a.h", "LLVM", "", &FS, false); ... const std::string output = ::testing::

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-13 Thread via cfe-commits
https://github.com/pointhex updated https://github.com/llvm/llvm-project/pull/91317 >From 6c8cc11d2d4591b06514f5f16e88ffd30d149488 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH] [clang-format] Add DiagHandler for getStyle function It allo

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread Owen Pan via cfe-commits
owenca wrote: @mydeveloperday requested it. See https://github.com/llvm/llvm-project/pull/91317#pullrequestreview-2095010527. There are calls to `getStyle()` in `ConfigParseTest.cpp`. Maybe add a test there? https://github.com/llvm/llvm-project/pull/91317 _

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread via cfe-commits
pointhex wrote: > Can you add a unit test? Yes, no problem, I just didn't get if it is needed or not. Could you please tell me if you already have a unit test for that function and where? I didn't manage to find it. https://github.com/llvm/llvm-project/pull/91317

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread Owen Pan via cfe-commits
owenca wrote: > Am I right that no one has a major issue with the patch? So fixing the > "const" issue and adding a unit test will let that in? Can you add a unit test? https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread via cfe-commits
pointhex wrote: @mydeveloperday @owenca Kind reminder. https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -3945,20 +3945,23 @@ const char *DefaultFallbackStyle = "LLVM"; llvm::ErrorOr> loadAndParseConfigFile(StringRef ConfigFile, llvm::vfs::FileSystem *FS, - FormatStyle *Style, bool AllowUnknownOptions) { + FormatStyle *Style, bool Al

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = + DiagH

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = + DiagH

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread via cfe-commits
pointhex wrote: > Can you call `parseConfiguration()` instead of `getStyle()` in QtCreator > while the user is entering code? It seems inefficient to call `getStyle()` > all the time. I do it in the places where I can use parseConfiguration instead. But in some cases I need getStyle and it's

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = + DiagH

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Can you call `parseConfiguration()` instead of `getStyle()` in QtCreator while the user is entering code? It seems inefficient to call `getStyle()` all the time. https://github.com/llvm/llvm-project/pull/91317 ___

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread via cfe-commits
mydeveloperday wrote: I also think we need @owenca opinion https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread via cfe-commits
https://github.com/mydeveloperday commented: I don't have a major issue, but I think it needs a unit test otherwise we might forget how you are using it. https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. Now that I see you want to incorporate it into QtCreator I'm even more in favor of adding it. ;) https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread via cfe-commits
pointhex wrote: Done: https://github.com/llvm/llvm-project/issues/94205 https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread via cfe-commits
https://github.com/mydeveloperday edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits