1 //===-- The main header generation class ------------------------*- 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_GENERATOR_H
10 #define LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringRef.h"
19 #include <unordered_map>
33 llvm::StringRef HeaderDefFile
;
34 const std::vector
<std::string
> &EntrypointNameList
;
35 llvm::StringRef StdHeader
;
36 std::unordered_map
<std::string
, std::string
> &ArgMap
;
38 std::unique_ptr
<Command
> IncludeFileCmd
;
39 std::unique_ptr
<Command
> PublicAPICmd
;
41 Command
*getCommandHandler(llvm::StringRef CommandName
);
43 void parseCommandArgs(llvm::StringRef ArgStr
, ArgVector
&Args
);
45 void printError(llvm::StringRef Msg
);
48 Generator(const std::string
&DefFile
, const std::vector
<std::string
> &EN
,
49 const std::string
&Header
,
50 std::unordered_map
<std::string
, std::string
> &Map
)
51 : HeaderDefFile(DefFile
), EntrypointNameList(EN
), StdHeader(Header
),
54 void generate(llvm::raw_ostream
&OS
, llvm::RecordKeeper
&Records
);
55 void generateDecls(llvm::raw_ostream
&OS
, llvm::RecordKeeper
&Records
);
58 } // namespace llvm_libc
60 #endif // LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H