mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 12:15:09 -05:00
style(compiler): c++ formatting with github action (#22)
* style(compiler): c++ formatting with github action * style(compiler): update format script
This commit is contained in:
committed by
Quentin Bourgerie
parent
5164126447
commit
eef82a4713
@@ -11,52 +11,54 @@
|
||||
#include "zamalang/Dialect/MidLFHE/IR/MidLFHETypes.h"
|
||||
|
||||
struct CommandLineArgs {
|
||||
std::vector<std::string> inputs;
|
||||
std::string output;
|
||||
std::vector<std::string> inputs;
|
||||
std::string output;
|
||||
};
|
||||
|
||||
void parseCommandLine(int argc, char** argv, CommandLineArgs* args)
|
||||
{
|
||||
try {
|
||||
TCLAP::CmdLine cmd("zamacompiler", ' ', "0.0.1");
|
||||
// Input file names
|
||||
TCLAP::UnlabeledMultiArg<std::string> fileNames("file", "The input files", false, "file");
|
||||
cmd.add(fileNames);
|
||||
void parseCommandLine(int argc, char **argv, CommandLineArgs *args) {
|
||||
try {
|
||||
TCLAP::CmdLine cmd("zamacompiler", ' ', "0.0.1");
|
||||
// Input file names
|
||||
TCLAP::UnlabeledMultiArg<std::string> fileNames("file", "The input files",
|
||||
false, "file");
|
||||
cmd.add(fileNames);
|
||||
|
||||
// Output
|
||||
TCLAP::ValueArg<std::string> output("o","out","Place the output into the <file>",false, "","string");
|
||||
cmd.add(output);
|
||||
// Output
|
||||
TCLAP::ValueArg<std::string> output(
|
||||
"o", "out", "Place the output into the <file>", false, "", "string");
|
||||
cmd.add(output);
|
||||
|
||||
cmd.parse( argc, argv );
|
||||
args->output = output.getValue();
|
||||
args->inputs = fileNames.getValue();
|
||||
cmd.parse(argc, argv);
|
||||
args->output = output.getValue();
|
||||
args->inputs = fileNames.getValue();
|
||||
|
||||
} catch (TCLAP::ArgException &e) // catch exceptions
|
||||
{
|
||||
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
} catch (TCLAP::ArgException &e) // catch exceptions
|
||||
{
|
||||
std::cerr << "error: " << e.error() << " for arg " << e.argId()
|
||||
<< std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Parse command line arguments
|
||||
CommandLineArgs cmdLineArgs;
|
||||
parseCommandLine(argc, argv, &cmdLineArgs);
|
||||
// Parse command line arguments
|
||||
CommandLineArgs cmdLineArgs;
|
||||
parseCommandLine(argc, argv, &cmdLineArgs);
|
||||
|
||||
// Initialize the MLIR context
|
||||
mlir::MLIRContext context;
|
||||
// Load our Dialect in this MLIR Context.
|
||||
context.getOrLoadDialect<mlir::zamalang::HLFHE::HLFHEDialect>();
|
||||
context.getOrLoadDialect<mlir::zamalang::MidLFHE::MidLFHEDialect>();
|
||||
context.getOrLoadDialect<mlir::StandardOpsDialect>();
|
||||
// Initialize the MLIR context
|
||||
mlir::MLIRContext context;
|
||||
// Load our Dialect in this MLIR Context.
|
||||
context.getOrLoadDialect<mlir::zamalang::HLFHE::HLFHEDialect>();
|
||||
context.getOrLoadDialect<mlir::zamalang::MidLFHE::MidLFHEDialect>();
|
||||
context.getOrLoadDialect<mlir::StandardOpsDialect>();
|
||||
|
||||
// For all input file, parse and dump
|
||||
for (const auto& fileName: cmdLineArgs.inputs) {
|
||||
auto module = mlir::parseSourceFile<mlir::ModuleOp>(fileName, &context);
|
||||
if(!module) {
|
||||
exit(1);
|
||||
}
|
||||
module->dump();
|
||||
// For all input file, parse and dump
|
||||
for (const auto &fileName : cmdLineArgs.inputs) {
|
||||
auto module = mlir::parseSourceFile<mlir::ModuleOp>(fileName, &context);
|
||||
if (!module) {
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
module->dump();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user