]> granicus.if.org Git - clang/commit
[Preamble] Reuse preamble even if an unsaved file does not exist
authorNikolai Kosjar <nikolai.kosjar@qt.io>
Tue, 21 May 2019 07:26:59 +0000 (07:26 +0000)
committerNikolai Kosjar <nikolai.kosjar@qt.io>
Tue, 21 May 2019 07:26:59 +0000 (07:26 +0000)
commit29994b0c63a40f9c97c664170244a7bba5ecc15e
tree6154685cce6c7714d89cf77e889d58539fdf8348
parentcc6493e85b03bc13560dfa6de1cd609b9ba7b4ec
[Preamble] Reuse preamble even if an unsaved file does not exist

When a preamble is created an unsaved file not existing on disk is
already part of PrecompiledPreamble::FilesInPreamble. However, when
checking whether the preamble can be re-used, a failed stat of such an
unsaved file invalidated the preamble, which led to pointless and time
consuming preamble regenerations on subsequent reparses.

Do not require anymore that unsaved files should exist on disk.

This avoids costly preamble invalidations depending on timing issues for
the cases where the file on disk might be removed just to be regenerated
a bit later.

It also allows an IDE to provide in-memory files that might not exist on
disk, e.g. because the build system hasn't generated those yet.

Differential Revision: https://reviews.llvm.org/D41005

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361226 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Frontend/ASTUnit.h
lib/Frontend/ASTUnit.cpp
lib/Frontend/PrecompiledPreamble.cpp
unittests/Frontend/PCHPreambleTest.cpp