diff --git a/src/sw/driver/driver.cpp b/src/sw/driver/driver.cpp index 1edcf581..15c20dd8 100644 --- a/src/sw/driver/driver.cpp +++ b/src/sw/driver/driver.cpp @@ -411,6 +411,23 @@ std::vector> Driver::detectInputs(const path &p, InputTyp for (auto &c : comments) { + if (c.starts_with("//cpp") || c.starts_with("// cpp")) + { + auto fn = path{SW_BINARY_DIR} / "spec" / p.stem() += std::format("_{}.cpp", std::hash()(p)); + write_file_if_different(fn, c); + + SpecificationFiles f; + f.addFile("sw.cpp", fn, c); + auto spec = std::make_unique(f); + auto i = std::make_unique(swctx, *this, std::move(spec)); + i->fe_type = FrontendType::Sw; + i->source_dir = p.parent_path(); + LOG_TRACE(logger, "using inline " << toString(i->fe_type) << " frontend for input " << p); + inputs.push_back(std::move(i)); + + return inputs; + } + try { SpecificationFiles f;