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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 20:38:32 PDT 2024


================
@@ -4026,12 +4030,13 @@ Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
   // Reset possible inheritance
   Style.InheritsParentConfig = false;
 
-  auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {};
+  auto diagHandlerOrDropHandling =
+      DiagHandler ? DiagHandler : [](llvm::SMDiagnostic const &, void *) {};
 
   auto applyChildFormatTexts = [&](FormatStyle *Style) {
     for (const auto &MemBuf : llvm::reverse(ChildFormatTextToApply)) {
       auto EC = parseConfiguration(*MemBuf, Style, AllowUnknownOptions,
-                                   dropDiagnosticHandler);
+                                   diagHandlerOrDropHandling);
----------------
owenca wrote:

It seems we only need to pass `DiagHandler`.

https://github.com/llvm/llvm-project/pull/91317


More information about the cfe-commits mailing list