[PATCH] D112647: [clang-apply-replacements] Correctly handle relative paths

Adrian Vogelsgesang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 27 11:50:33 PDT 2021


avogelsgesang created this revision.
Herald added a subscriber: carlosgalvezp.
avogelsgesang requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

The fixes from the YAML file can refer to relative paths.
Those relative paths are meant to be resolved relative to the
corresponding `build directory`.
However, `clang-apply-replacements` currently interprets all
paths relative to its own working directory. This causes issues,
e.g., when `clang-apply-replacements` is run from outside of
the original build directory.

This commit adjusts `clang-apply-replacements` to take the build
directory into account when resolving relative file paths.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112647

Files:
  clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
  clang-tools-extra/test/clang-apply-replacements/Inputs/relative-paths/basic.h
  clang-tools-extra/test/clang-apply-replacements/Inputs/relative-paths/file1.yaml
  clang-tools-extra/test/clang-apply-replacements/Inputs/relative-paths/file2.yaml
  clang-tools-extra/test/clang-apply-replacements/relative-paths.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112647.382740.patch
Type: text/x-patch
Size: 5773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211027/815e1745/attachment.bin>


More information about the cfe-commits mailing list