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

Yubo Xie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 07:52:58 PDT 2019


xyb created this revision.
xyb added a reviewer: alexfh.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

Clang-tidy supports output diagnostics from header files if user
specifies --header-filter. But it can't handle relative path well.
For example, the folder structure of a project is:

  // a.h is in /src/a/a.h
  #include "../b/b.h"
  
  // b.h is in /src/b/b.h
  ...
  
  // c.cpp is in /src/c.cpp
  #include "a/a.h"

Now, we set --header-filter as --header-filter=/a/. That means we only
want to check header files under /src/a/ path, and ignore header files
uder /src/b/ path, but in current implementation, clang-tidy will check
/src/b/b.h also, because the name of b.h used in clang-tidy is
/src/a/../b/b.h.

This change tries to fix this issue.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D67501

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/test/clang-tidy/Inputs/file-filter/subfolder_a/header.h
  clang-tools-extra/test/clang-tidy/Inputs/file-filter/subfolder_b/header.h
  clang-tools-extra/test/clang-tidy/Inputs/file-filter/subfolder_c/header.h
  clang-tools-extra/test/clang-tidy/file-filter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67501.219919.patch
Type: text/x-patch
Size: 8813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190912/e6f3fba4/attachment.bin>


More information about the cfe-commits mailing list