X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMC%2FMCLinkerOptimizationHint.h;h=50fd527ffe2a5219cd7afbd7e199f6e82cb06bdb;hb=c8be3734a35619cb559aeea9118776451e7897cc;hp=52b46131ea56cc3d37d916d65559d71e76f7fd33;hpb=190e0a1d6310f575c076e6062de221f12f05409f;p=oota-llvm.git diff --git a/include/llvm/MC/MCLinkerOptimizationHint.h b/include/llvm/MC/MCLinkerOptimizationHint.h index 52b46131ea5..50fd527ffe2 100644 --- a/include/llvm/MC/MCLinkerOptimizationHint.h +++ b/include/llvm/MC/MCLinkerOptimizationHint.h @@ -106,7 +106,6 @@ class MCLOHDirective { /// Emit this directive in @p OutStream using the information available /// in the given @p ObjWriter and @p Layout to get the address of the /// arguments within the object file. - /// This function is currently specialized for T = MCSymbol. void Emit_impl(raw_ostream &OutStream, const MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const; @@ -133,8 +132,19 @@ public: /// the given @p Layout. uint64_t getEmitSize(const MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const { - std::string Buffer; - raw_string_ostream OutStream(Buffer); + class raw_counting_ostream : public raw_ostream { + uint64_t Count; + + void write_impl(const char *, size_t size) override { Count += size; } + + uint64_t current_pos() const override { return Count; } + + public: + raw_counting_ostream() : Count(0) {} + ~raw_counting_ostream() { flush(); } + }; + + raw_counting_ostream OutStream; Emit_impl(OutStream, ObjWriter, Layout); return OutStream.tell(); }