[Clang][Lex] Extend HeaderSearch::LookupFile to control OpenFile behavior.
authorJun Zhang <jun@junz.org>
Sat, 6 Aug 2022 03:36:02 +0000 (11:36 +0800)
committerJun Zhang <jun@junz.org>
Sat, 6 Aug 2022 03:36:02 +0000 (11:36 +0800)
commit786b503f66b1a35f79312203fcb533ad27511982
tree0c0aa162af311a813cca976ee77a492be1249246
parente99ffe6ae86471b420c232be804d868c1dc83b50
[Clang][Lex] Extend HeaderSearch::LookupFile to control OpenFile behavior.

In the case of static compilation the file system is pretty much read-only
and taking a snapshot of it usually is sufficient. In the interactive C++
case the compilation is longer and people can create and include files, etc.
In that case we often do not want to open files or cache failures unless is
absolutely necessary.

This patch extends the original API call by forwarding some optional flags,
so we can continue use it in the previous way with no breakage.
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D131241
clang/include/clang/Lex/DirectoryLookup.h
clang/include/clang/Lex/HeaderSearch.h
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/HeaderSearch.cpp
clang/lib/Lex/PPDirectives.cpp