[PATCH] Make tooling::Range more convenient.

Guillaume Papin guillaume.papin at epitech.eu
Tue Jul 16 11:10:15 PDT 2013


  My use is shown here: http://llvm-reviews.chandlerc.com/D1136#C26491NL138

  The relevant snippet is

    for (FileChangeRangesMap::iterator I = FileChangesMap.begin(),
                                       E = FileChangesMap.end();
         I != E; ++I) {
      FileChangeRanges &Ranges = I->getValue();

      for (FileChangeRanges::iterator I = Ranges.begin(), E = Ranges.end();
           I != E; ++I)
        I->Offset = tooling::shiftedCodePosition(Replaces, I->Offset);
    }

  Something like this could work too I guess:

    *I = tooling::Range(tooling::shiftedCodePosition(Replaces, I->Offset), I->Length);

  but it seems to me it's not that clear we are just updating the Offset.

  Anyway I have no strong opinion about this patch so if you think the interface should stay the way it is, I'm totally fine!

http://llvm-reviews.chandlerc.com/D1156



More information about the cfe-commits mailing list