1 //===-- Base class for header generation commands ---------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_UTILS_HDRGEN_COMMAND_H
10 #define LLVM_LIBC_UTILS_HDRGEN_COMMAND_H
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/Support/SourceMgr.h"
28 typedef llvm::SmallVector
<llvm::StringRef
, 4> ArgVector
;
34 const llvm::SourceMgr
&SrcMgr
;
37 ErrorReporter(llvm::SMLoc L
, llvm::SourceMgr
&SM
) : Loc(L
), SrcMgr(SM
) {}
39 [[noreturn
]] void printFatalError(llvm::Twine Msg
) const {
40 SrcMgr
.PrintMessage(Loc
, llvm::SourceMgr::DK_Error
, Msg
);
47 virtual void run(llvm::raw_ostream
&OS
, const ArgVector
&Args
,
48 llvm::StringRef StdHeader
, llvm::RecordKeeper
&Records
,
49 const ErrorReporter
&Reporter
) const = 0;
52 } // namespace llvm_libc
54 #endif // LLVM_LIBC_UTILS_HDRGEN_COMMAND_H