[libcxx-commits] [PATCH] D119561: [libc++] Replace `#include ""` with `<>` in libcxx/src/. NFCI

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 11 12:50:57 PST 2022


Quuxplusone added a comment.

In D119561#3315057 <https://reviews.llvm.org/D119561#3315057>, @EricWF wrote:

>> Our best guess is that the two syntaxes should have exactly equivalent effects,
>
> They don't. You can use `clang++ -E -x c++ - -v < /dev/null` to view the search path order for the various include types.
>
> The point of writing includes in the source directory using quotes is to ensure we pick up our local headers, and not something installed along a system path.

Let's suppose for the sake of argument that `#include "vector"` picks up the correct local `libcxx/include/vector` while `#include <vector>` would have picked up the wrong header.
Then, when //inside the local `libcxx/include/vector` itself// we see `#include <memory>` or `#include <__utility/forward.h>` or whatever, wouldn't //that// necessarily pick up the wrong header?
How could it be OK to use `<>` inside the library headers themselves, but not to use `<>` in src/ when building the library?

There are also enough places we do this by accident already

  $ git grep '#include <' ../libcxx/src/ | wc -l
        91

and we're not hearing complaints of breakage from anyone yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119561



More information about the libcxx-commits mailing list