[flang] Fix build breakage

Original-commit: flang-compiler/f18@72d003f89d
Reviewed-on: https://github.com/flang-compiler/f18/pull/323
This commit is contained in:
Eric Schweitz 2019-03-11 09:16:01 -07:00
parent 70d55c0ce2
commit cf18b7a6bd
3 changed files with 12 additions and 9 deletions

View File

@ -16,7 +16,13 @@
namespace Fortran::FIR {
std::optional<llvm::raw_ostream *> GraphWriter::defaultOutput_{std::nullopt};
llvm::raw_ostream *GraphWriter::defaultOutput_;
GraphWriter::~GraphWriter() {
if (defaultOutput_) {
defaultOutput_->flush();
}
}
void GraphWriter::dumpHeader() { output_ << "digraph G {\n"; }
void GraphWriter::dumpFooter() { output_ << "}\n"; }

View File

@ -49,12 +49,8 @@ public:
private:
GraphWriter(llvm::raw_ostream &output) : output_{output} {}
~GraphWriter() {
if (defaultOutput_) {
delete *defaultOutput_;
defaultOutput_ = std::nullopt;
}
}
~GraphWriter();
void dump(Program &program);
void dump(Procedure &procedure, bool box = false);
void dump(Region &region, bool box = false);
@ -77,7 +73,7 @@ private:
return buffer.str();
}
static llvm::raw_ostream &getOutput() {
return defaultOutput_ ? *defaultOutput_.value() : llvm::outs();
return defaultOutput_ ? *defaultOutput_ : llvm::outs();
}
unsigned count_{0u};
@ -86,7 +82,7 @@ private:
bool isEntry_{false};
bool isExit_{false};
std::map<BasicBlock *, unsigned> blockIds_;
static std::optional<llvm::raw_ostream *> defaultOutput_;
static llvm::raw_ostream * defaultOutput_;
};
}

View File

@ -21,5 +21,6 @@ target_link_libraries(f18
FortranParser
FortranEvaluate
FortranSemantics
FortranFIR
${LLVM_COMMON_LIBS}
)