<div dir="ltr">Can you explain why this works at all?  Why aren't the counters emitted as linkonce_odr globals?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 4:39 PM, Alex L <span dir="ltr"><<a href="mailto:arphaman@gmail.com" target="_blank">arphaman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre>This is needed to ensure that the profile counters are emitted <br>for all functions and methods.<br>
</pre><pre><br>-------------- next part --------------<br>Index: lib/CodeGen/CodeGenModule.cpp<br>===================================================================<br>
--- lib/CodeGen/CodeGenModule.cpp       (revision 209698)<br>+++ lib/CodeGen/CodeGenModule.cpp    (working copy)<br>@@ -1073,6 +1073,8 @@<br>   if (LangOpts.EmitAllDecls)<br>     return false;<br> <br>+  if(CodeGenOpts.ProfileInstrGenerate && isa<FunctionDecl>(Global))<br>

+    return false;<br>   return !getContext().DeclMustBeEmitted(Global);<br> }<br> <br>@@ -3028,6 +3030,16 @@<br>     break;<br> <br>   // C++ Decls<br>+  case Decl::CXXRecord: {<br>+    if(!CodeGenOpts.ProfileInstrGenerate)<br>

+      break;<br>+    CXXRecordDecl *Record = cast<CXXRecordDecl>(D);<br>+    for(CXXRecordDecl::method_iterator I = Record->method_begin(); I != Record->method_end(); ++I) {<br>+      if(I->hasBody())<br>
+        EmitTopLevelDecl(*I);<br>
+    }<br>+    break;<br>+  }<br>   case Decl::Namespace:<br>     EmitNamespace(cast<NamespaceDecl>(D));<br>     break;<br><br><br></pre></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>