[Workflow] Roll back some settings since they caused more issues
[llvm-project.git] / libc / utils / HdrGen / Generator.h
blob76a8a110832112b750b8d6dacf180ea545f4fa91
1 //===-- The main header generation class ------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H
10 #define LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H
12 #include "Command.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringRef.h"
17 #include <memory>
18 #include <string>
19 #include <unordered_map>
21 namespace llvm {
23 class raw_ostream;
24 class RecordKeeper;
26 } // namespace llvm
28 namespace llvm_libc {
30 class Command;
32 class Generator {
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);
47 public:
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),
52 ArgMap(Map) {}
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