<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 March 2014 10:46, Justin Bogner <span dir="ltr"><<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: bogner<br>
Date: Fri Mar 21 12:46:22 2014<br>
New Revision: 204489<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204489&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204489&view=rev</a><br>
Log:<br>
ProfileData: Introduce InstrProfWriter using the naive text format<br>
<br>
This isn't a format we'll want to write out in practice, but moving it<br>
to the writer library simplifies llvm-profdata and isolates it from<br>
further changes to the format.<br>
<br>
This also allows us to update the tests to not rely on the text output<br>
format.<br>
</blockquote><div><br></div><div>[...]</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Added: llvm/trunk/lib/ProfileData/InstrProfWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfWriter.cpp?rev=204489&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfWriter.cpp?rev=204489&view=auto</a><br>


==============================================================================<br>
--- llvm/trunk/lib/ProfileData/InstrProfWriter.cpp (added)<br>
+++ llvm/trunk/lib/ProfileData/InstrProfWriter.cpp Fri Mar 21 12:46:22 2014<br>
@@ -0,0 +1,58 @@<br>
+//=-- InstrProfWriter.cpp - Instrumented profiling writer -------------------=//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This file contains support for writing profiling data for clang's<br>
+// instrumentation based PGO and coverage.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "llvm/ProfileData/InstrProfWriter.h"<br>
+#include "llvm/Support/Endian.h"<br>
+<br>
+using namespace llvm;<br>
+<br>
+error_code InstrProfWriter::addFunctionCounts(StringRef FunctionName,<br>
+                                              uint64_t FunctionHash,<br>
+                                              ArrayRef<uint64_t> Counters) {<br>
+  auto Where = FunctionData.find(FunctionName);<br>
+  if (Where == FunctionData.end()) {<br>
+    // If this is the first time we've seen this function, just add it.<br>
+    FunctionData[FunctionName] = {FunctionHash, Counters};<br>
+    return instrprof_error::success;;<br></blockquote><div><br></div><div>Extra bonus semicolon!</div><div><br></div><div>Nick</div><div><br></div></div></div></div>