<div dir="ltr"><div class="gmail_extra">On Fri, Aug 30, 2013 at 10:45 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
================<br>
Comment at: lib/Sema/SemaLambda.cpp:101<br>
@@ -98,1 +100,3 @@<br>
+        (isa<FunctionDecl>(CurContext) &&<br>
+         Context.getTargetInfo().getCXXABI().isMicrosoft())) {<br>
       ManglingContextDecl = 0;<br>
----------------<br>
</div><div class="im">Eli Friedman wrote:<br>
> Why do you need to number anything in a function which isn't inline?  CodeGen can mangle static variables etc.  however it wants because they aren't externally visible.<br>
</div>I'm using these to number bits in a bitfield, not to mangle.  I have to use this mechanism to number the bits of inline functions, so it makes sense to use it to number bits of non inline functions too.  Otherwise I have to add back the CXXABIFunctionState code I had in the first version of this patch.<br>

<br>
I'm having a very hard time extracting this function from Sema and moving it over to AST/ItaniumCXXABI.cpp as John suggested.  It accesses a bunch of Sema fields.  Do you have any thoughts on how this should look in the long run?<br>
</blockquote><div><br></div><div>Any thoughts on this?  This is needed to avoid double initialization of llvm::outs/errs(), and factoring this one check out will require a massive migration of Eli's Itanium logic from Sema to AST.</div>
<div><br></div><div>OK to commit with a FIXME?  Or without one, since I generally find comments like "FIXME: refactor" to be useless.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I expect I will also need to number other things like scopes to handle your example of:<br>
  int bar();<br>
  inline void foo() {<br>
    static int f = bar();<br>
    { static int f = bar(); }<br>
  }<br>
<br>
These are differentiated by mangling in the current scope depth.  The first f is at level 2 (global 0?, param, local) and the second f is at level 3 (+1 local scope).  MicrosoftCXXNameMangler::mangleLocalName() attempts to implement this, but it is wrong.<br>

<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D1416" target="_blank">http://llvm-reviews.chandlerc.com/D1416</a><br>
</blockquote></div><br></div></div>