[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 14 00:06:09 PDT 2024
================
@@ -4027,12 +4031,10 @@ Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
// Reset possible inheritance
Style.InheritsParentConfig = false;
- auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {};
-
auto applyChildFormatTexts = [&](FormatStyle *Style) {
for (const auto &MemBuf : llvm::reverse(ChildFormatTextToApply)) {
auto EC = parseConfiguration(*MemBuf, Style, AllowUnknownOptions,
- dropDiagnosticHandler);
+ DiagHandler);
----------------
owenca wrote:
```cpp
auto applyChildFormatTexts = [&](FormatStyle *Style) {
for (const auto &MemBuf : llvm::reverse(ChildFormatTextToApply)) {
- auto EC = parseConfiguration(*MemBuf, Style, AllowUnknownOptions,
- DiagHandler);
+ auto EC =
+ parseConfiguration(*MemBuf, Style, AllowUnknownOptions,
+ DiagHandler ? DiagHandler : dropDiagnosticHandler);
// It was already correctly parsed.
assert(!EC);
static_cast<void>(EC);
```
https://github.com/llvm/llvm-project/pull/91317
More information about the cfe-commits
mailing list