Hi,<br><br>  Here's another attempt to solve __builtin_va_arg issue.<br>In this patch, there is a special check for C++ and va_list as<br>record type:<br><br>  } else if (VaListType->isRecordType() && getLangOpts().CPlusPlus) {<br>
    // If va_list is a record type and we are compiling under C++ mode,<br>    // then we should check the argument by copy assignment operator.<br>    InitializedEntity Entity<br>      = InitializedEntity::InitializeParameter(Context,<br>
          Context.getLValueReferenceType(VaListType), false);<br>    ExprResult Init = PerformCopyInitialization(Entity, SourceLocation(), E);<br>    if (Init.isInvalid())<br>      return ExprError();<br>    E = Init.takeAs<Expr>();<br>
<br>With this patch, I can get the same assembly result.  However, I'm not<br>familiar with InitializedEntity.  Please have a look.<br><br>Sincerely,<br>Logan<br><br><br><div class="gmail_quote">On Thu, Oct 18, 2012 at 9:22 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@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 class="im">On Wed, Oct 17, 2012 at 6:00 PM, Weiming Zhao <<a href="mailto:weimingz@codeaurora.org">weimingz@codeaurora.org</a>> wrote:<br>

> Hi Eli,<br>
><br>
> Thanks for your info.<br>
><br>
> Do you mean, in ActOnVAArg or BuildVAArgExpr, it needs<br>
> InitializationSequence, InitializedEntity if va_list is a record type? (I'm<br>
> not familiar with this)<br>
<br>
</div>In C++, yes; it's the same sort of check we would perform if you<br>
called a function like "void f(va_list&);".  (In C, the existing check<br>
is fine.)<br>
<br>
A testcase would be to make sure we print a reasonable error message<br>
for the following in C++:<br>
<br>
__builtin_va_list a();<br>
int b() {<br>
  return __builtin_va_arg(a(), int);<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>