From fc5cee6fb896bc4d7a8b79dcde789e03c787bd89 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 8 Aug 2018 18:17:34 +0200 Subject: [PATCH] clangformat --- common/command.cc | 4 ++-- common/project.cc | 13 ++++++------- ecp5/project.cc | 8 +++----- generic/project.cc | 12 ++++-------- gui/basewindow.cc | 1 - gui/basewindow.h | 1 + gui/ecp5/mainwindow.cc | 12 +++++++----- gui/ecp5/mainwindow.h | 1 + gui/generic/mainwindow.cc | 3 ++- gui/ice40/mainwindow.cc | 2 +- ice40/project.cc | 8 ++++---- 11 files changed, 31 insertions(+), 34 deletions(-) diff --git a/common/command.cc b/common/command.cc index 9c2cc840..cf12df3a 100644 --- a/common/command.cc +++ b/common/command.cc @@ -35,8 +35,8 @@ #include "design_utils.h" #include "jsonparse.h" #include "log.h" +#include "timing.h" #include "version.h" -#include NEXTPNR_NAMESPACE_BEGIN @@ -244,7 +244,7 @@ int CommandHandler::exec() if (executeBeforeContext()) return 0; - + std::unique_ptr ctx; if (vm.count("load")) { ctx = project.load(vm["load"].as()); diff --git a/common/project.cc b/common/project.cc index 8e043f36..244ca761 100644 --- a/common/project.cc +++ b/common/project.cc @@ -17,12 +17,12 @@ * */ +#include "project.h" #include #include -#include "project.h" -#include "log.h" -#include "jsonparse.h" #include +#include "jsonparse.h" +#include "log.h" NEXTPNR_NAMESPACE_BEGIN @@ -34,10 +34,10 @@ void ProjectHandler::save(Context *ctx, std::string filename) root.put("project.name", boost::filesystem::basename(filename)); root.put("project.arch.name", ctx->archId().c_str(ctx)); root.put("project.arch.type", ctx->archArgsToId(ctx->archArgs()).c_str(ctx)); -/* root.put("project.input.json", );*/ + /* root.put("project.input.json", );*/ root.put("project.params.freq", int(ctx->target_freq / 1e6)); root.put("project.params.seed", ctx->rngstate); - saveArch(ctx,root); + saveArch(ctx, root); pt::write_json(f, root); } @@ -55,7 +55,6 @@ std::unique_ptr ProjectHandler::load(std::string filename) if (version != 1) log_error("Wrong project format version.\n"); - ctx = createContext(root); std::string arch_name = root.get("project.arch.name"); @@ -77,7 +76,7 @@ std::unique_ptr ProjectHandler::load(std::string filename) if (params.count("seed")) ctx->rngseed(params.get("seed")); } - loadArch(ctx.get(),root, proj.parent_path().string()); + loadArch(ctx.get(), root, proj.parent_path().string()); } catch (...) { log_error("Error loading project file.\n"); } diff --git a/ecp5/project.cc b/ecp5/project.cc index a9b48bbe..6c1f6a94 100644 --- a/ecp5/project.cc +++ b/ecp5/project.cc @@ -17,11 +17,11 @@ * */ +#include "project.h" #include #include -#include "project.h" -#include "log.h" #include +#include "log.h" NEXTPNR_NAMESPACE_BEGIN @@ -50,8 +50,6 @@ std::unique_ptr ProjectHandler::createContext(pt::ptree &root) return std::unique_ptr(new Context(chipArgs)); } -void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) -{ -} +void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) {} NEXTPNR_NAMESPACE_END diff --git a/generic/project.cc b/generic/project.cc index e412d8dc..8103e91f 100644 --- a/generic/project.cc +++ b/generic/project.cc @@ -17,16 +17,14 @@ * */ -#include #include "project.h" -#include "log.h" +#include #include +#include "log.h" NEXTPNR_NAMESPACE_BEGIN -void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) -{ -} +void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) {} std::unique_ptr ProjectHandler::createContext(pt::ptree &root) { @@ -34,8 +32,6 @@ std::unique_ptr ProjectHandler::createContext(pt::ptree &root) return std::unique_ptr(new Context(chipArgs)); } -void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) -{ -} +void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) {} NEXTPNR_NAMESPACE_END diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 98315ee9..857919ea 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -463,5 +463,4 @@ void BaseMainWindow::save_proj() } } - NEXTPNR_NAMESPACE_END diff --git a/gui/basewindow.h b/gui/basewindow.h index ef3e252c..6e8f8587 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -49,6 +49,7 @@ class BaseMainWindow : public QMainWindow virtual ~BaseMainWindow(); Context *getContext() { return ctx.get(); } void updateJsonLoaded(); + protected: void createMenusAndBars(); void disableActions(); diff --git a/gui/ecp5/mainwindow.cc b/gui/ecp5/mainwindow.cc index efaad364..e5a5f1ba 100644 --- a/gui/ecp5/mainwindow.cc +++ b/gui/ecp5/mainwindow.cc @@ -29,7 +29,8 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } NEXTPNR_NAMESPACE_BEGIN -MainWindow::MainWindow(std::unique_ptr context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), args, parent) +MainWindow::MainWindow(std::unique_ptr context, ArchArgs args, QWidget *parent) + : BaseMainWindow(std::move(context), args, parent) { initMainResource(); @@ -50,7 +51,8 @@ void MainWindow::newContext(Context *ctx) setWindowTitle(title.c_str()); } -void MainWindow::createMenu() { +void MainWindow::createMenu() +{ // Add arch specific actions actionLoadBase = new QAction("Open Base Config", this); actionLoadBase->setIcon(QIcon(":/icons/resources/open_base.png")); @@ -71,7 +73,7 @@ void MainWindow::createMenu() { menuDesign->addSeparator(); menuDesign->addAction(actionLoadBase); - menuDesign->addAction(actionSaveConfig); + menuDesign->addAction(actionSaveConfig); } static const ChipInfoPOD *get_chip_info(const RelPtr *ptr) { return ptr->get(); } @@ -96,8 +98,8 @@ static QStringList getSupportedPackages(ArchArgs::ArchArgsTypes chip) return packages; } - -void MainWindow::new_proj() { +void MainWindow::new_proj() +{ QMap arch; arch.insert("Lattice ECP5 25K", ArchArgs::LFE5U_25F); arch.insert("Lattice ECP5 45K", ArchArgs::LFE5U_45F); diff --git a/gui/ecp5/mainwindow.h b/gui/ecp5/mainwindow.h index d1d5a5a2..9460913c 100644 --- a/gui/ecp5/mainwindow.h +++ b/gui/ecp5/mainwindow.h @@ -47,6 +47,7 @@ class MainWindow : public BaseMainWindow void newContext(Context *ctx); void open_base(); void save_config(); + private: QAction *actionLoadBase; QAction *actionSaveConfig; diff --git a/gui/generic/mainwindow.cc b/gui/generic/mainwindow.cc index 050c0fb8..01eeb4ef 100644 --- a/gui/generic/mainwindow.cc +++ b/gui/generic/mainwindow.cc @@ -23,7 +23,8 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } NEXTPNR_NAMESPACE_BEGIN -MainWindow::MainWindow(std::unique_ptr context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), args, parent) +MainWindow::MainWindow(std::unique_ptr context, ArchArgs args, QWidget *parent) + : BaseMainWindow(std::move(context), args, parent) { initMainResource(); diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 4a2eaaa9..35ad5768 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -24,12 +24,12 @@ #include #include #include +#include #include "bitstream.h" #include "design_utils.h" #include "jsonparse.h" #include "log.h" #include "pcf.h" -#include static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } diff --git a/ice40/project.cc b/ice40/project.cc index 53401d63..d1f1674a 100644 --- a/ice40/project.cc +++ b/ice40/project.cc @@ -17,10 +17,10 @@ * */ -#include #include "project.h" -#include "log.h" +#include #include +#include "log.h" #include "pcf.h" NEXTPNR_NAMESPACE_BEGIN @@ -28,7 +28,7 @@ NEXTPNR_NAMESPACE_BEGIN void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) { root.put("project.arch.package", ctx->archArgs().package); - // if(!pcfFilename.empty()) + // if(!pcfFilename.empty()) // root.put("project.input.pcf", pcfFilename); } @@ -62,7 +62,7 @@ std::unique_ptr ProjectHandler::createContext(pt::ptree &root) void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) { auto input = root.get_child("project").get_child("input"); - boost::filesystem::path pcf = boost::filesystem::path(path) / input.get("pcf"); + boost::filesystem::path pcf = boost::filesystem::path(path) / input.get("pcf"); std::ifstream f(pcf.string()); if (!apply_pcf(ctx, f)) log_error("Loading PCF failed.\n");