diff options
Diffstat (limited to 'src/printer')
-rw-r--r-- | src/printer/printer.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/printer/printer.cpp b/src/printer/printer.cpp index 19d14eb09..927fd1d13 100644 --- a/src/printer/printer.cpp +++ b/src/printer/printer.cpp @@ -127,25 +127,31 @@ void Printer::toStream(std::ostream& out, const SkolemList& sks) const Printer* Printer::getPrinter(OutputLanguage lang) { - if(lang == language::output::LANG_AUTO) { - // Infer the language to use for output. - // - // Options can be null in certain circumstances (e.g., when printing - // the singleton "null" expr. So we guard against segfault - if(not Options::isCurrentNull()) { - if(options::outputLanguage.wasSetByUser()) { - lang = options::outputLanguage(); + if (lang == language::output::LANG_AUTO) + { + // Infer the language to use for output. + // + // Options can be null in certain circumstances (e.g., when printing + // the singleton "null" expr. So we guard against segfault + if (not Options::isCurrentNull()) + { + if (Options::current().wasSetByUser(options::outputLanguage)) + { + lang = options::outputLanguage(); + } + if (lang == language::output::LANG_AUTO + && Options::current().wasSetByUser(options::inputLanguage)) + { + lang = language::toOutputLanguage(options::inputLanguage()); + } + } + if (lang == language::output::LANG_AUTO) + { + lang = language::output::LANG_SMTLIB_V2_6; // default } - if(lang == language::output::LANG_AUTO && options::inputLanguage.wasSetByUser()) { - lang = language::toOutputLanguage(options::inputLanguage()); - } - } - if (lang == language::output::LANG_AUTO) - { - lang = language::output::LANG_SMTLIB_V2_6; // default - } } - if(d_printers[lang] == NULL) { + if (d_printers[lang] == nullptr) + { d_printers[lang] = makePrinter(lang); } return d_printers[lang].get(); |