I will explain my example a bit further maybe I wasn't understood. The orders 
of a "batch" of replacements, returned by a transform is not important, 
`tooling::applyAllReplacements()` (or some other tooling functions) handle that 
correctly. The issue for me is that nothing seems to enforce an order for the 
transforms.

  If I take my example again but explain more in details:

  The YAML format I used is hypothetical and I'm not sure the 
LoopConvert/UseAuto transforms work like this.

  Given:

      for (std::vector<int>::iterator I = V.begin(), E = V.end(); I != E; ++I)
          std::cout << *I << std::endl;

  First LoopConvert is applied:

  ```
    - TransformID:     LoopConvertTransform
      Offset:          5
      Length:          66
      ReplacementText: "auto &elem : V"

    - TransformID:     LoopConvertTransform
      Offset:          90
      Length:          2
      ReplacementText: "elem"
  ```

  Then UseAuto is applied with the given content:

    for (auto &elem : V)
      std::cout << elem << std::endl;

  This is the final content, UseAuto doesn't generate any replacement.

  -----------------------------------------------------------------------------

  Now the YAML if the replacements are done in the reversed order (first 
UseAuto, then LoopConvert).

      for (std::vector<int>::iterator I = V.begin(), E = V.end(); I != E; ++I)
          std::cout << *I << std::endl;

  UseAuto replacements first:

  ```
    - TransformID:     UseAutoTransform
      Offset:          5
      Length:          26
      ReplacementText: "auto"
  ```

  The iterator is transformed and we have the following input for loop convert:

    for (auto I = V.begin(), E = V.end(); I != E; ++I)
        std::cout << *I << std::endl;

  LoopConvert YAML is:

  ```
    - TransformID:     LoopConvertTransform
      Offset:          5
      Length:          44
      ReplacementText: "for (auto &elem : V)"

    - TransformID:     LoopConvertTransform
      Offset:          68
      Length:          2
      ReplacementText: "elem"
  ```

  As you can see the YAML is different. IMHO the order should be enforced in 
some way (maybe it's just a matter of numbering the "batches of replacements" 
produced by a transform).

http://llvm-reviews.chandlerc.com/D1142
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to