[PATCH] D63295: [clang][HeaderSearch] Shorten paths for includes in mainfile's directory

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 07:41:14 PDT 2019


hokein added a comment.

Discussed it offline, technically taking the main file directory into account when shorten the #include path would not break the compiler, but it may introduce issues violating the code style -- in clangd codebase, we prefer to use "#include "<subdir_under_clangd>/header.h" style, e.g. `index/background.cc` uses `#include "index/Background.h"`, with this patch we will  shorten the include as `#include "background.h"`, so we don't count the the `index/background.h` as included (a new `#include "background.h"` will be inserted).

One possible solution is that we could use the main file directory as a last fallback (if we are not able to shorten the #included path using any search-header directories, we try to use the main-file directory).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63295





More information about the cfe-commits mailing list