| Index: tools/clang/blink_gc_plugin/JsonWriter.h
|
| diff --git a/tools/clang/blink_gc_plugin/JsonWriter.h b/tools/clang/blink_gc_plugin/JsonWriter.h
|
| index 3fe79103bbadbadc21770b707584ba1648462ed4..09504b3aaf9feb7e011d0740959aab6c61624a89 100644
|
| --- a/tools/clang/blink_gc_plugin/JsonWriter.h
|
| +++ b/tools/clang/blink_gc_plugin/JsonWriter.h
|
| @@ -7,12 +7,24 @@
|
|
|
| #include "llvm/Support/raw_ostream.h"
|
|
|
| +// TODO(hans): Remove this #ifdef after Clang is rolled past r234897.
|
| +#ifdef LLVM_FORCE_HEAD_REVISION
|
| +#define JSON_WRITER_STREAM std::unique_ptr<llvm::raw_ostream>
|
| +#else
|
| +#define JSON_WRITER_STREAM llvm::raw_fd_ostream*
|
| +#endif
|
| +
|
| // Helper to write information for the points-to graph.
|
| class JsonWriter {
|
| public:
|
| - static JsonWriter* from(std::unique_ptr<llvm::raw_ostream> os) {
|
| + static JsonWriter* from(JSON_WRITER_STREAM os) {
|
| return os ? new JsonWriter(std::move(os)) : 0;
|
| }
|
| +#ifndef LLVM_FORCE_HEAD_REVISION
|
| + ~JsonWriter() {
|
| + delete os_;
|
| + }
|
| +#endif
|
| void OpenList() {
|
| Separator();
|
| *os_ << "[";
|
| @@ -53,7 +65,7 @@ class JsonWriter {
|
| *os_ << "\"" << key << "\":\"" << val << "\"";
|
| }
|
| private:
|
| - JsonWriter(std::unique_ptr<llvm::raw_ostream> os) : os_(std::move(os)) {}
|
| + JsonWriter(JSON_WRITER_STREAM os) : os_(std::move(os)) {}
|
| void Separator() {
|
| if (state_.empty())
|
| return;
|
| @@ -63,7 +75,7 @@ class JsonWriter {
|
| }
|
| state_.top() = true;
|
| }
|
| - std::unique_ptr<llvm::raw_ostream> os_;
|
| + JSON_WRITER_STREAM os_;
|
| std::stack<bool> state_;
|
| };
|
|
|
|
|