-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
23 lines (18 loc) · 963 Bytes
/
main.cpp
File metadata and controls
23 lines (18 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "SolidLang.h"
cl::OptionCategory Compiler("Compiler options");
cl::opt<std::string> InputFile(cl::Positional, cl::desc("<input filename>"), cl::init("-"), cl::cat(Compiler));
cl::opt<std::string> OutputFile("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"),
cl::cat(Compiler));
cl::opt<bool> PrintIR("IR", cl::desc("Print generated LLVM IR"), cl::cat(Compiler));
int main(int argc, char **argv) {
cl::HideUnrelatedOptions(Compiler);
cl::ParseCommandLineOptions(argc, argv, "The Solid Programming Language");
if (InputFile != "-" && OutputFile == "-") {
OutputFile = InputFile.substr(0, InputFile.find_last_of("."));
}
if (OutputFile != "-" && OutputFile.substr(OutputFile.size() - 2) != std::string(".o")) {
OutputFile += ".o";
}
auto SolidLang = std::make_unique<class SolidLang>(InputFile, OutputFile, PrintIR);
return SolidLang->Start();
}