From 7b74497da52b06e1ca28493919794ce221d7c246 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Fri, 21 Mar 2014 17:31:31 +0100 Subject: [PATCH] Expose all files included in PCH/PCM to FileManager. Else, FileManager will fopen(), Preprocessor will notice that there is a defined code guard and not enter the source file, thus leaving the file handle unclosed. Now FileEntry will know that a file comes from a PCh/PCM and not open it when asking for its stat. (cherry picked from commit 100b2f3f103467bace9ba2b62cde62f70888db47) Conflicts: interpreter/llvm/src/tools/clang/lib/Serialization/ASTReader.cpp --- .../tools/clang/lib/Serialization/ASTReader.cpp | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/interpreter/llvm/src/tools/clang/lib/Serialization/ASTReader.cpp b/interpreter/llvm/src/tools/clang/lib/Serialization/ASTReader.cpp index e6a05c5..8905897 100644 --- a/interpreter/llvm/src/tools/clang/lib/Serialization/ASTReader.cpp +++ b/interpreter/llvm/src/tools/clang/lib/Serialization/ASTReader.cpp @@ -2305,31 +2305,27 @@ ASTReader::ReadControlBlock(ModuleFile &F, const HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts(); + bool Validate = !DisableValidation && + (ValidateSystemInputs || !HSOpts.ModulesValidateOncePerBuildSession || + F.InputFilesValidationTimestamp <= HSOpts.BuildSessionTimestamp); + bool Complain = Validate && (ClientLoadCapabilities & ARR_OutOfDate) == 0; // All user input files reside at the index range [0, Record[1]), and // system input files reside at [Record[1], Record[0]). // Record is the one from INPUT_FILE_OFFSETS. unsigned NumInputs = Record[0]; unsigned NumUserInputs = Record[1]; + unsigned NComplain = NumUserInputs; + if (ValidateSystemInputs || + (HSOpts.ModulesValidateOncePerBuildSession && F.Kind == MK_Module)) + NComplain = NumInputs; - if (!DisableValidation && - (ValidateSystemInputs || !HSOpts.ModulesValidateOncePerBuildSession || - F.InputFilesValidationTimestamp <= HSOpts.BuildSessionTimestamp)) { - bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0; + if (!Complain) + NComplain = 0; - // If we are reading a module, we will create a verification timestamp, - // so we verify all input files. Otherwise, verify only user input - // files. - - unsigned N = NumUserInputs; - if (ValidateSystemInputs || - (HSOpts.ModulesValidateOncePerBuildSession && F.Kind == MK_Module)) - N = NumInputs; - - for (unsigned I = 0; I < N; ++I) { - InputFile IF = getInputFile(F, I+1, Complain); - if (!IF.getFile() || IF.isOutOfDate()) - return OutOfDate; - } + for (unsigned I = 0; I < NumInputs; ++I) { + InputFile IF = getInputFile(F, I+1, I < NComplain); + if (Validate && (!IF.getFile() || IF.isOutOfDate())) + return OutOfDate; } if (Listener) -- 1.8.2