Community
Participate
Working Groups
Build Identifier: M20100909-0800 If any child node of an IASTStatement (except for Compund statements) is a macro then the refactoring infrastructure will not apply any changes made to another child node. The following function call demonstrates the bug. I want replace the last actual argument of the MPI_Isend function with another expression: MPI_Isend(message, strlen(message) + 1, MPI_CHAR, 1, 42, MPI_COMM_WORLD, &waitreq2); However, since MPI_CHAR is a macro the ASTWriterVisitor decides to write the statement directly, and aborts further processing in its sub-tree. The code in question is line 185-187 in visit(IASTStatement statement) in ASTWriterVisitor.java. Here, the method StatementWriter.writeMixedStatement is called to print the statement directly, without the modifications in its subtree, if it contains a macro. On the next line, 188, provisions are made in the case where the statement itself is a macro. I can not easily work around this by just replacing the whole statement, as I do not know which actual I need to modify (I discover this by searching for all variables for a binding). Reproducible: Always Steps to Reproduce: 1. Create a statement containing a macro in one actual argument 2. Use ASTRewriter.replace (remove works too) to replace one actual argument 3. Apply the rewriter and observe that the modification was lost
Created attachment 186696 [details] Removes a check that directly prints verbatim statements with macro sub-nodes Is the code to directly print statements containing various macros correct, and what is its purpose? It seems that it may be unnecessary as the macros will be dealt with anyway when the sub-nodes are visited by the printer. The attached patch removes this check altogether, which fixes my problem. Does this break another case I have failed to anticipate?
Fixed together with bug 363244.