According to the documentation I can find[1], multiple __asm constructs are
separate statements. In particular, the documentation suggests that here:

void f() {
  if (false)
    __asm mov eax, ebx
  __asm mov ebx, eax
}

the second __asm statement is not controlled by the 'if'. If the
documentation is correct, we currently misparse this.

[1] http://msdn.microsoft.com/en-us/library/45yd4tzz(v=vs.110).aspx

On Mon, Aug 13, 2012 at 1:36 PM, Chandler Carruth <[email protected]>wrote:

> Just to explain perhaps a bit more, as I too agree with Eli and Chad
> here...
>
> On Mon, Aug 13, 2012 at 4:36 AM, João Matos <[email protected]>wrote:
>
>> I agree, it would be best to store one node per statement in the AST,
>> even if semantically they will be handled as one.
>>
>
> This is a pretty fundamental deviation from the model for the AST.
>
> We have AST nodes to represent the structural semantics of the program.
> Many of these do not even correspond to syntax in the source program. They
> are there to expose the underlying semantics of the structure after parsing
> has taken place. The inverse applies here: even though there may be syntax
> recognized by the parser that resembles that of multiple statements, if the
> actual semantic model is that of a single statement, the AST should reflect
> that.
>
> When you say "It would be best to store one node per statement in the AST"
> you are begging the question by assuming there are multiple statements in
> the source program. I think what Eli and Chad are arguing is that there is
> exactly one node per statement in the AST, and all of the inline asm
> instructions are part of a single statement due to their semantic model.
>
> None of this should preclude us exposing source locations and other
> information about the syntax used to spell the collection of assembly
> instructions that goes into the statement. We have more tools available
> than just Stmt nodes in the AST. =]
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to