[PATCH] D126673: [FileCheck][NFC] Refactor FileCheckDiag into class hierarchy

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 12:04:48 PDT 2022


jdenny created this revision.
jdenny added reviewers: probinson, thopre, jhenderson.
Herald added subscribers: kosarev, hiraditya.
Herald added a project: All.
jdenny requested review of this revision.
Herald added a project: LLVM.

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 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` is then freer to evolve more
independently in the way it reasons about emitted diagnostics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126673

Files:
  llvm/include/llvm/FileCheck/FileCheck.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/FileCheck/FileCheckImpl.h
  llvm/unittests/FileCheck/FileCheckTest.cpp
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126673.432967.patch
Type: text/x-patch
Size: 54412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220530/a89f91c9/attachment.bin>


More information about the llvm-commits mailing list