1515
1616#include " backend_builder.h"
1717#include " blackboxes.h"
18- #include " log_stubs.h"
1918#include " slang/ast/Compilation.h"
2019#include " slang/ast/SemanticFacts.h"
2120#include " slang/ast/symbols/CompilationUnitSymbols.h"
@@ -37,10 +36,10 @@ using namespace slang_frontend; // NOLINT(google-build-using-namespace)
3736// Non-static so error.cc can call it from elaborateText. Not declared in
3837// driver.h because the source-buffer parameter is only useful to the test
3938// helper.
40- std::optional <Graph> elaborateImpl (utl::Logger* logger,
41- const std::vector<std::string>& args,
42- sta::dbSta* sta,
43- std::optional<std::string> buffer)
39+ std::unique_ptr <Graph> elaborateImpl (utl::Logger* logger,
40+ const std::vector<std::string>& args,
41+ sta::dbSta* sta,
42+ std::optional<std::string> buffer)
4443{
4544 slang::driver::Driver driver;
4645 driver.addStandardArgs ();
@@ -66,17 +65,17 @@ std::optional<Graph> elaborateImpl(utl::Logger* logger,
6665
6766 if (!driver.parseCommandLine (static_cast <int >(c_args.size ()),
6867 const_cast <char **>(c_args.data ()))) {
69- return std:: nullopt ;
68+ return nullptr ;
7069 }
7170
7271 fixup_options (settings, driver);
7372 if (!driver.processOptions ()) {
74- return std:: nullopt ;
73+ return nullptr ;
7574 }
7675 catch_forbidden_options (driver);
7776
7877 if (!driver.parseAllSources ()) {
79- return std:: nullopt ;
78+ return nullptr ;
8079 }
8180
8281 auto compilation = driver.createCompilation ();
@@ -91,12 +90,12 @@ std::optional<Graph> elaborateImpl(utl::Logger* logger,
9190
9291 if (driver.diagEngine .getNumErrors ()) {
9392 (void ) driver.reportDiagnostics (/* quiet=*/ false );
94- return std:: nullopt ;
93+ return nullptr ;
9594 }
9695
9796 if (settings.ast_compilation_only .value_or (false )) {
9897 (void ) driver.reportDiagnostics (/* quiet=*/ false );
99- return std:: nullopt ;
98+ return nullptr ;
10099 }
101100
102101 // We require exactly one top-level instance.
@@ -127,7 +126,7 @@ std::optional<Graph> elaborateImpl(utl::Logger* logger,
127126 slang::Diagnostics diags;
128127 diags.append_range (netlist.issued_diagnostics );
129128 diags.sort (driver.sourceManager );
130- for (int j = 0 ; j < ( int ) diags.size (); j++) {
129+ for (int j = 0 ; j < diags.size (); j++) {
131130 if (j > 0 && diags[j] == diags[j - 1 ]) {
132131 continue ;
133132 }
@@ -136,7 +135,7 @@ std::optional<Graph> elaborateImpl(utl::Logger* logger,
136135 }
137136
138137 if (!driver.reportDiagnostics (/* quiet=*/ false )) {
139- return std:: nullopt ;
138+ return nullptr ;
140139 }
141140
142141 // Extract the graph from the top netlist's backend.
@@ -145,9 +144,9 @@ std::optional<Graph> elaborateImpl(utl::Logger* logger,
145144 return std::move (builder->graph_ );
146145}
147146
148- std::optional <Graph> elaborate (utl::Logger* logger,
149- const std::vector<std::string>& args,
150- sta::dbSta* sta)
147+ std::unique_ptr <Graph> elaborate (utl::Logger* logger,
148+ const std::vector<std::string>& args,
149+ sta::dbSta* sta)
151150{
152151 return elaborateImpl (logger, args, sta, {});
153152}
0 commit comments