[PATCH] D67501: [clang-tidy] Fix relative path in header-filter.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 06:51:26 PDT 2019


alexfh added a comment.

In D67501#1678962 <https://reviews.llvm.org/D67501#1678962>, @gribozavr wrote:

> Sorry, I reverted this patch in r372601.
>
> Unfortunately, it makes paths printed in clang-tidy'd diagnostics inconsistent with what `-header-filter` operates on.
>
> For example, imagine that `file-filter.cpp` includes `header_alias.h`, which is a symlink to `header.h`. The diagnostics printed by clang-tidy refer to `header_alias.h`, however, after this patch, `-header-filter` logic calls `realpath()` and operates on `header.h` -- making it very difficult for users to understand how exactly to set up filters.
>
> Also, note that paths in diagnostics don't collapse `foo/..` or symlinks.
>
> We should only change both sides of path handling simultaneously (paths in diagnostics and paths in filters). However, since getting the user's preferred path is potentially very difficult when symlinks are present, I'm not sure if anything can be done here. Maybe only collapsing `foo/..` would be viable?


Even collapsing `foo/..` may be problematic , if `foo` is a symlink.

  $ mkdir -p a/b/c
  $ ln -s a/b/c d
  $ ls
  a d
  $ ls a/..
  a d
  $ ls d/..
  c


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67501/new/

https://reviews.llvm.org/D67501





More information about the cfe-commits mailing list