[PATCH] D25227: [clang-move] Move comments which are associated with the moved class.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 03:55:45 PDT 2016


ioeric added a comment.

This is great!



> ClangMove.cpp:70-74
> +  if (SM->getLocForEndOfFile(LocInfo.first)
> +      == EndLoc)
> +    return EndLoc;
> +  // Include the trailing newline character "\n".
> +  return EndLoc.getLocWithOffset(1);

Maybe:

  return (SM->getLocForEndOfFile(LocInfo.first) == EndLoc) ? EndLoc : EndLoc.getLocWithOffset(1);

> ClangMove.cpp:343
>    for (const auto &MovedDecl : RemovedDecls) {
> -    auto EndLoc = getLocForEndOfDecl(MovedDecl.Decl, MovedDecl.SM);
> +    auto Range = GetFullRange(MovedDecl.SM, MovedDecl.Decl);
>      clang::tooling::Replacement RemoveReplacement(

Looks like `GetFullRange` is called twice on the same Decl: one for creating insertion replacement and one for deletion replacement. This seems to be a duplicate.

https://reviews.llvm.org/D25227





More information about the cfe-commits mailing list