blob: 263a4100567d3ba2024872049a2bfbe45f9f648f [file] [log] [blame]
Ted Kremenek78002122011-10-29 00:12:39 +00001//===--- SerializedDiagnosticPrinter.cpp - Serializer for diagnostics -----===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include <vector>
Ted Kremenek78002122011-10-29 00:12:39 +000011#include "llvm/Support/raw_ostream.h"
12#include "llvm/ADT/StringRef.h"
13#include "llvm/ADT/SmallString.h"
14#include "llvm/ADT/DenseSet.h"
15#include "clang/Basic/SourceManager.h"
16#include "clang/Basic/FileManager.h"
17#include "clang/Basic/Diagnostic.h"
18#include "clang/Basic/Version.h"
19#include "clang/Frontend/SerializedDiagnosticPrinter.h"
20
21using namespace clang;
Ted Kremenekfdd0ced2011-11-05 00:09:57 +000022using namespace clang::serialized_diags;
Ted Kremenek78002122011-10-29 00:12:39 +000023
24namespace {
25
26/// \brief A utility class for entering and exiting bitstream blocks.
27class BlockEnterExit {
28 llvm::BitstreamWriter &Stream;
29public:
30 BlockEnterExit(llvm::BitstreamWriter &stream, unsigned blockID,
31 unsigned codelen = 3)
32 : Stream(stream) {
33 Stream.EnterSubblock(blockID, codelen);
34 }
35 ~BlockEnterExit() {
36 Stream.ExitBlock();
37 }
38};
39
40class AbbreviationMap {
41 llvm::DenseMap<unsigned, unsigned> Abbrevs;
42public:
43 AbbreviationMap() {}
44
45 void set(unsigned recordID, unsigned abbrevID) {
46 assert(Abbrevs.find(recordID) == Abbrevs.end()
47 && "Abbreviation already set.");
48 Abbrevs[recordID] = abbrevID;
49 }
50
51 unsigned get(unsigned recordID) {
52 assert(Abbrevs.find(recordID) != Abbrevs.end() &&
53 "Abbreviation not set.");
54 return Abbrevs[recordID];
55 }
56};
57
58typedef llvm::SmallVector<uint64_t, 64> RecordData;
59typedef llvm::SmallVectorImpl<uint64_t> RecordDataImpl;
60
61class SDiagsWriter : public DiagnosticConsumer {
62public:
63 SDiagsWriter(DiagnosticsEngine &diags, llvm::raw_ostream *os)
Ted Kremenek59b61612011-11-05 00:09:47 +000064 : Stream(Buffer), OS(os), Diags(diags), inNonNoteDiagnostic(false)
Ted Kremenek78002122011-10-29 00:12:39 +000065 {
66 EmitPreamble();
67 };
68
69 ~SDiagsWriter() {}
70
71 void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
72 const Diagnostic &Info);
73
74 void EndSourceFile();
75
76 DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
77 // It makes no sense to clone this.
78 return 0;
79 }
80
81private:
82 /// \brief Emit the preamble for the serialized diagnostics.
83 void EmitPreamble();
84
85 /// \brief Emit the BLOCKINFO block.
86 void EmitBlockInfoBlock();
Ted Kremenek0d34e6e2011-11-05 00:10:11 +000087
Ted Kremenek2a20b4f2011-11-05 00:10:01 +000088 /// \brief Emit a record for a CharSourceRange.
89 void EmitCharSourceRange(CharSourceRange R);
90
Ted Kremenek3baf63d2011-11-05 00:10:07 +000091 /// \brief Emit the string information for the category for a diagnostic.
92 unsigned getEmitCategory(unsigned DiagID);
93
94 /// \brief Emit the string information for diagnostic flags.
95 unsigned getEmitDiagnosticFlag(DiagnosticsEngine::Level DiagLevel,
96 const Diagnostic &Info);
Ted Kremenek0dbadc42011-11-05 00:10:04 +000097
Ted Kremenek0d34e6e2011-11-05 00:10:11 +000098 /// \brief Emit (lazily) the file string and retrieved the file identifier.
99 unsigned getEmitFile(SourceLocation Loc);
100
101 /// \brief Add SourceLocation information the specified record.
102 void AddLocToRecord(SourceLocation Loc, RecordDataImpl &Record);
103
Ted Kremenek78002122011-10-29 00:12:39 +0000104 /// \brief The version of the diagnostics file.
105 enum { Version = 1 };
106
107 /// \brief The byte buffer for the serialized content.
108 std::vector<unsigned char> Buffer;
109
110 /// \brief The BitStreamWriter for the serialized diagnostics.
111 llvm::BitstreamWriter Stream;
112
113 /// \brief The name of the diagnostics file.
114 llvm::OwningPtr<llvm::raw_ostream> OS;
115
116 /// \brief The DiagnosticsEngine tied to all diagnostic locations.
117 DiagnosticsEngine &Diags;
118
119 /// \brief The set of constructed record abbreviations.
120 AbbreviationMap Abbrevs;
121
122 /// \brief A utility buffer for constructing record content.
123 RecordData Record;
124
125 /// \brief A text buffer for rendering diagnostic text.
126 llvm::SmallString<256> diagBuf;
127
128 /// \brief The collection of diagnostic categories used.
129 llvm::DenseSet<unsigned> Categories;
130
131 /// \brief The collection of files used.
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000132 llvm::DenseMap<const FileEntry *, unsigned> Files;
Ted Kremenek45d92752011-11-05 00:09:50 +0000133
134 typedef llvm::DenseMap<const void *, std::pair<unsigned, llvm::StringRef> >
135 DiagFlagsTy;
136
137 /// \brief Map for uniquing strings.
138 DiagFlagsTy DiagFlags;
Ted Kremenek78002122011-10-29 00:12:39 +0000139
Ted Kremenek59b61612011-11-05 00:09:47 +0000140 /// \brief Flag indicating whether or not we are in the process of
141 /// emitting a non-note diagnostic.
142 bool inNonNoteDiagnostic;
Ted Kremenek78002122011-10-29 00:12:39 +0000143};
144} // end anonymous namespace
145
146namespace clang {
147namespace serialized_diags {
148DiagnosticConsumer *create(llvm::raw_ostream *OS, DiagnosticsEngine &Diags) {
149 return new SDiagsWriter(Diags, OS);
150}
151} // end namespace serialized_diags
152} // end namespace clang
153
154//===----------------------------------------------------------------------===//
155// Serialization methods.
156//===----------------------------------------------------------------------===//
157
158/// \brief Emits a block ID in the BLOCKINFO block.
159static void EmitBlockID(unsigned ID, const char *Name,
160 llvm::BitstreamWriter &Stream,
161 RecordDataImpl &Record) {
162 Record.clear();
163 Record.push_back(ID);
164 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
165
166 // Emit the block name if present.
167 if (Name == 0 || Name[0] == 0)
168 return;
169
170 Record.clear();
171
172 while (*Name)
173 Record.push_back(*Name++);
174
175 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_BLOCKNAME, Record);
176}
177
178/// \brief Emits a record ID in the BLOCKINFO block.
179static void EmitRecordID(unsigned ID, const char *Name,
180 llvm::BitstreamWriter &Stream,
181 RecordDataImpl &Record){
182 Record.clear();
183 Record.push_back(ID);
184
185 while (*Name)
186 Record.push_back(*Name++);
187
188 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, Record);
189}
190
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000191void SDiagsWriter::AddLocToRecord(SourceLocation Loc,
192 RecordDataImpl &Record) {
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000193 if (Loc.isInvalid()) {
194 // Emit a "sentinel" location.
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000195 Record.push_back((unsigned) 0); // File.
196 Record.push_back(~(unsigned)0); // Line.
197 Record.push_back(~(unsigned)0); // Column.
198 Record.push_back(~(unsigned)0); // Offset.
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000199 return;
200 }
201
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000202 SourceManager &SM = Diags.getSourceManager();
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000203 Loc = SM.getSpellingLoc(Loc);
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000204 Record.push_back(getEmitFile(Loc));
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000205 Record.push_back(SM.getSpellingLineNumber(Loc));
206 Record.push_back(SM.getSpellingColumnNumber(Loc));
207
208 std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
209 FileID FID = LocInfo.first;
210 unsigned FileOffset = LocInfo.second;
211 Record.push_back(FileOffset);
212}
213
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000214unsigned SDiagsWriter::getEmitFile(SourceLocation Loc) {
215 SourceManager &SM = Diags.getSourceManager();
216 assert(Loc.isValid());
217 const std::pair<FileID, unsigned> &LocInfo = SM.getDecomposedLoc(Loc);
218 const FileEntry *FE = SM.getFileEntryForID(LocInfo.first);
219 if (!FE)
220 return 0;
221
222 unsigned &entry = Files[FE];
223 if (entry)
224 return entry;
225
226 // Lazily generate the record for the file.
227 entry = Files.size();
228 RecordData Record;
229 Record.push_back(RECORD_FILENAME);
230 Record.push_back(entry);
231 Record.push_back(FE->getSize());
232 Record.push_back(FE->getModificationTime());
233 StringRef Name = FE->getName();
234 Record.push_back(Name.size());
235 Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_FILENAME), Record, Name);
236
237 return entry;
238}
239
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000240void SDiagsWriter::EmitCharSourceRange(CharSourceRange R) {
241 Record.clear();
242 Record.push_back(RECORD_SOURCE_RANGE);
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000243 AddLocToRecord(R.getBegin(), Record);
244 AddLocToRecord(R.getEnd(), Record);
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000245 Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_SOURCE_RANGE), Record);
246}
247
Ted Kremenek78002122011-10-29 00:12:39 +0000248/// \brief Emits the preamble of the diagnostics file.
249void SDiagsWriter::EmitPreamble() {
Ted Kremenek78002122011-10-29 00:12:39 +0000250 // Emit the file header.
251 Stream.Emit((unsigned)'D', 8);
Ted Kremenek069f9c22011-11-05 00:09:53 +0000252 Stream.Emit((unsigned) Version, 32 - 8);
253
Ted Kremenek78002122011-10-29 00:12:39 +0000254 EmitBlockInfoBlock();
255}
256
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000257static void AddSourceLocationAbbrev(llvm::BitCodeAbbrev *Abbrev) {
258 using namespace llvm;
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000259 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // File ID.
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000260 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line.
261 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column.
262 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Offset;
263}
Ted Kremenek78002122011-10-29 00:12:39 +0000264void SDiagsWriter::EmitBlockInfoBlock() {
265 Stream.EnterBlockInfoBlock(3);
266
267 // ==---------------------------------------------------------------------==//
268 // The subsequent records and Abbrevs are for the "Diagnostic" block.
269 // ==---------------------------------------------------------------------==//
270
Ted Kremenek45d92752011-11-05 00:09:50 +0000271 EmitBlockID(BLOCK_DIAG, "Diag", Stream, Record);
272 EmitRecordID(RECORD_DIAG, "DiagInfo", Stream, Record);
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000273 EmitRecordID(RECORD_SOURCE_RANGE, "SrcRange", Stream, Record);
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000274 EmitRecordID(RECORD_CATEGORY, "CatName", Stream, Record);
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000275 EmitRecordID(RECORD_DIAG_FLAG, "DiagFlag", Stream, Record);
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000276 EmitRecordID(RECORD_FILENAME, "FileName", Stream, Record);
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000277
Ted Kremenek78002122011-10-29 00:12:39 +0000278 // Emit Abbrevs.
279 using namespace llvm;
280
281 // Emit abbreviation for RECORD_DIAG.
282 BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
283 Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG));
Ted Kremenek45d92752011-11-05 00:09:50 +0000284 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Diag level.
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000285 AddSourceLocationAbbrev(Abbrev);
Ted Kremenek45d92752011-11-05 00:09:50 +0000286 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Category.
287 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped Diag ID.
Ted Kremenek78002122011-10-29 00:12:39 +0000288 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
289 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Diagnostc text.
290 Abbrevs.set(RECORD_DIAG, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000291
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000292 // Emit abbrevation for RECORD_CATEGORY.
293 Abbrev = new BitCodeAbbrev();
294 Abbrev->Add(BitCodeAbbrevOp(RECORD_CATEGORY));
295 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Category ID.
296 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); // Text size.
297 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Category text.
298 Abbrevs.set(RECORD_CATEGORY, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
299
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000300 // Emit abbrevation for RECORD_SOURCE_RANGE.
301 Abbrev = new BitCodeAbbrev();
302 Abbrev->Add(BitCodeAbbrevOp(RECORD_SOURCE_RANGE));
303 AddSourceLocationAbbrev(Abbrev);
304 AddSourceLocationAbbrev(Abbrev);
305 Abbrevs.set(RECORD_SOURCE_RANGE,
306 Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000307
308 // Emit the abbreviation for RECORD_DIAG_FLAG.
309 Abbrev = new BitCodeAbbrev();
310 Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG_FLAG));
311 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped Diag ID.
312 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
313 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Flag name text.
314 Abbrevs.set(RECORD_DIAG_FLAG, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG,
315 Abbrev));
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000316
317 // Emit the abbreviation for RECORD_FILENAME.
Ted Kremenek78002122011-10-29 00:12:39 +0000318 Abbrev = new BitCodeAbbrev();
Ted Kremenek28eac522011-11-05 00:09:43 +0000319 Abbrev->Add(BitCodeAbbrevOp(RECORD_FILENAME));
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000320 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped file ID.
321 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Size.
322 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Modifcation time.
Ted Kremenek78002122011-10-29 00:12:39 +0000323 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
324 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // File name text.
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000325 Abbrevs.set(RECORD_FILENAME, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG,
Ted Kremenek78002122011-10-29 00:12:39 +0000326 Abbrev));
327
328 Stream.ExitBlock();
329}
330
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000331unsigned SDiagsWriter::getEmitCategory(unsigned int DiagID) {
332 unsigned category = DiagnosticIDs::getCategoryNumberForDiag(DiagID);
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000333
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000334 if (Categories.count(category))
335 return category;
336
337 Categories.insert(category);
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000338
339 // We use a local version of 'Record' so that we can be generating
340 // another record when we lazily generate one for the category entry.
341 RecordData Record;
342 Record.push_back(RECORD_CATEGORY);
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000343 Record.push_back(category);
344 StringRef catName = DiagnosticIDs::getCategoryNameFromID(category);
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000345 Record.push_back(catName.size());
346 Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_CATEGORY), Record, catName);
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000347
348 return category;
349}
350
351unsigned SDiagsWriter::getEmitDiagnosticFlag(DiagnosticsEngine::Level DiagLevel,
352 const Diagnostic &Info) {
353 if (DiagLevel == DiagnosticsEngine::Note)
354 return 0; // No flag for notes.
355
356 StringRef FlagName = DiagnosticIDs::getWarningOptionForDiag(Info.getID());
357 if (FlagName.empty())
358 return 0;
359
360 // Here we assume that FlagName points to static data whose pointer
361 // value is fixed. This allows us to unique by diagnostic groups.
362 const void *data = FlagName.data();
363 std::pair<unsigned, StringRef> &entry = DiagFlags[data];
364 if (entry.first == 0) {
365 entry.first = DiagFlags.size();
366 entry.second = FlagName;
367
368 // Lazily emit the string in a separate record.
369 RecordData Record;
370 Record.push_back(RECORD_DIAG_FLAG);
371 Record.push_back(entry.first);
372 Record.push_back(FlagName.size());
373 Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG_FLAG),
374 Record, FlagName);
375 }
376
377 return entry.first;
Ted Kremenek0dbadc42011-11-05 00:10:04 +0000378}
379
Ted Kremenek78002122011-10-29 00:12:39 +0000380void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
381 const Diagnostic &Info) {
382
Ted Kremenek59b61612011-11-05 00:09:47 +0000383 if (DiagLevel != DiagnosticsEngine::Note) {
384 if (inNonNoteDiagnostic) {
385 // We have encountered a non-note diagnostic. Finish up the previous
386 // diagnostic block before starting a new one.
387 Stream.ExitBlock();
388 }
389 inNonNoteDiagnostic = true;
390 }
391
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000392 Stream.EnterSubblock(BLOCK_DIAG, 4);
Ted Kremenek78002122011-10-29 00:12:39 +0000393
394 // Emit the RECORD_DIAG record.
395 Record.clear();
396 Record.push_back(RECORD_DIAG);
397 Record.push_back(DiagLevel);
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000398 AddLocToRecord(Info.getLocation(), Record);
Ted Kremenek3baf63d2011-11-05 00:10:07 +0000399 // Emit the category string lazily and get the category ID.
400 Record.push_back(getEmitCategory(Info.getID()));
401 // Emit the diagnostic flag string lazily and get the mapped ID.
402 Record.push_back(getEmitDiagnosticFlag(DiagLevel, Info));
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000403 // Emit the diagnostic text.
Ted Kremenek78002122011-10-29 00:12:39 +0000404 diagBuf.clear();
405 Info.FormatDiagnostic(diagBuf); // Compute the diagnostic text.
406 Record.push_back(diagBuf.str().size());
407 Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG), Record, diagBuf.str());
Ted Kremenek78002122011-10-29 00:12:39 +0000408
Ted Kremenek2a20b4f2011-11-05 00:10:01 +0000409 ArrayRef<CharSourceRange> Ranges = Info.getRanges();
410 for (ArrayRef<CharSourceRange>::iterator it=Ranges.begin(), ei=Ranges.end();
411 it != ei; ++it) {
412 EmitCharSourceRange(*it);
413 }
414
Ted Kremenek78002122011-10-29 00:12:39 +0000415 // FIXME: emit fixits
Ted Kremenek59b61612011-11-05 00:09:47 +0000416
417 if (DiagLevel == DiagnosticsEngine::Note) {
418 // Notes currently cannot have child diagnostics. Complete the
419 // diagnostic now.
420 Stream.ExitBlock();
421 }
Ted Kremenek78002122011-10-29 00:12:39 +0000422}
423
Ted Kremenek78002122011-10-29 00:12:39 +0000424void SDiagsWriter::EndSourceFile() {
Ted Kremenek59b61612011-11-05 00:09:47 +0000425 if (inNonNoteDiagnostic) {
426 // Finish off any diagnostics we were in the process of emitting.
427 Stream.ExitBlock();
428 inNonNoteDiagnostic = false;
429 }
Ted Kremenek0d34e6e2011-11-05 00:10:11 +0000430
Ted Kremenek78002122011-10-29 00:12:39 +0000431 // Write the generated bitstream to "Out".
432 OS->write((char *)&Buffer.front(), Buffer.size());
433 OS->flush();
434
435 OS.reset(0);
436}
437