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.