<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 20, 2009, at 12:22 PM, Roberto Bagnara wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>steve naroff wrote:<br><blockquote type="cite">On Feb 20, 2009, at 11:26 AM, Paolo Bolzoni wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">dear cfe list,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">According to the clang AST the two parameters' type of this function<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">declaration are the same:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">int f(int a[], int* b);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">while it makes sense, I'd like to distinguish.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Is it not possible?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite">Not currently. Here is a comment from Sema::Sema::ActOnParamDeclarator():<br></blockquote><blockquote type="cite">  // Perform the default function/array conversion (C99 6.7.5.3p[7,8]).<br></blockquote><blockquote type="cite">  // Doing the promotion here has a win and a loss. The win is the type for<br></blockquote><blockquote type="cite">  // both Decl's and DeclRefExpr's will match (a convenient invariant for the<br></blockquote><blockquote type="cite">  // code generator). The loss is the orginal type isn't preserved. For example:<br></blockquote><blockquote type="cite">  //<br></blockquote><blockquote type="cite">  // void func(int parmvardecl[5]) { // convert "int [5]" to "int *"<br></blockquote><blockquote type="cite">  //    int blockvardecl[5];<br></blockquote><blockquote type="cite">  //    sizeof(parmvardecl);  // size == 4<br></blockquote><blockquote type="cite">  //    sizeof(blockvardecl); // size == 20<br></blockquote><blockquote type="cite">  // }<br></blockquote><blockquote type="cite">  //<br></blockquote><blockquote type="cite">  // For expressions, all implicit conversions are captured using the<br></blockquote><blockquote type="cite">  // ImplicitCastExpr AST node (we have no such mechanism for Decl's).<br></blockquote><blockquote type="cite">  //<br></blockquote><blockquote type="cite">  // FIXME: If a source translation tool needs to see the original type, then<br></blockquote><blockquote type="cite">  // we need to consider storing both types (in ParmVarDecl)...<br></blockquote><blockquote type="cite">  // HTH,<br></blockquote><br>Thanks Steve.  In our case we need to see the original type: there are<br>coding rules that we need to check where the distincion is crucial.<br>For instance:<br><br>int f(int a[], int* b) {<br>   a[0] = 0;     /* Compliant. */<br>   b[5] = 0;     /* Not Compliant: as b was not declared as an array,<br>                                   MISRA rule 17.4 is violated.  */<br>}<br><br>How difficult would be to address the FIXME above?</div></blockquote><div><br></div><div>Actually, I think it's already been done:-)</div><div><br></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-style-span" style="background-color: transparent;">See OriginalParmVarDecl, which is a subclass of ParmVarDecl.</span></font></div><div><br></div><div>Does this solve your problem?</div><div><br></div><div>snaroff</div></div><div><br></div><div><br></div><div><br><blockquote type="cite"><div><br>Best,<br><br>   Roberto<br><br>-- <br>Prof. Roberto Bagnara<br>Computer Science Group<br>Department of Mathematics, University of Parma, Italy<br><a href="http://www.cs.unipr.it/~bagnara/">http://www.cs.unipr.it/~bagnara/</a><br>mailto:bagnara@cs.unipr.it<br></div></blockquote></div><br></body></html>