Fixed accidental use of reserved identifier in r214709.
[oota-llvm.git] / include / llvm / MC / MCLinkerOptimizationHint.h
index 52b46131ea56cc3d37d916d65559d71e76f7fd33..50fd527ffe2a5219cd7afbd7e199f6e82cb06bdb 100644 (file)
@@ -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();
   }