[FileCheck][NFC] Introduce FileCheckDiagList for -dump-input (#195568) Problem ======= `FileCheckDiag` and its `enum MatchType` have outgrown their original purpose. The `-dump-input` presentation layer (in `llvm/utils/FileCheck/FileCheck.cpp`) and the FileCheck library's diagnostic emission (in `llvm/lib/FileCheck/FileCheck.cpp`) are too tightly coupled. The interactions are subtle to understand and maintain. It is difficult for the former to reason about the latter's emitted diagnostics in order to present them in the most readable manner. Solution ======== This patch is the first in an NFC series that removes `MatchType` from `FileCheckDiag` and refactors `FileCheckDiag` as the base class of a class hierarchy. That class hierarchy is designed to enable the FileCheck library to focus on communicating FileCheck diagnostic information clearly and completely without participating in the specific presentation decisions of `-dump-input`. `-dump-input` and any future diagnostic presentation layer that FileCheck might grow are then freer to evolve more independently in the way they reason about emitted diagnostics. Moreover, the hierarchy enables various `FileCheckDiag` objects not to carry various data not needed for the diagnostics they describe. This Patch ========== The main goal of this particular patch is to introduce the `FileCheckDiagList` class and to separate mostly mechanical changes from future patches to make them more readable. However, by itself, it does offer some small improvements: it encapsulates the `adjustPrevDiags` functionality, and it replaces the cryptic `ProcessMatchResult` function with more readable code. Why now? ======== FileCheck's input dumps have usability issues, including confusing verbosity and the need to look in the test file to see directive patterns. There has been a recent push in issue #77257 and in PRs linked from there to address these issues. This patch series is a first step in the most recent strategy discussed there. Actually, it is an older strategy that was started in [D126673](https://reviews.llvm.org/D126673) but never completed. The current patch series updates D126673 and splits it apart to facilitate the review. The actual usability improvements are implemented by patches that build on this series.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.