<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 6, 2014, at 4:59 PM, Argyrios Kyrtzidis <<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">On Mar 6, 2014, at 4:48 PM, Ben Langmuir <<a href="mailto:blangmuir@apple.com">blangmuir@apple.com</a>> wrote:</div><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>On Mar 5, 2014, at 7:54 PM, Argyrios Kyrtzidis <<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>> wrote:<br><br><blockquote type="cite">@@ -2014,13 +2074,17 @@ ASTReader::ReadControlBlock(ModuleFile &F,<br>      // files.<br>      unsigned NumInputs = Record[0];<br>      unsigned NumUserInputs = Record[1];<br>-        unsigned N = ValidateSystemInputs ||<br>-                             (HSOpts.ModulesValidateOncePerBuildSession &&<br>-                              F.Kind == MK_Module)<br>-                         ? NumInputs<br>-                         : NumUserInputs;<br>+        unsigned N = NumUserInputs;<br>+        if (ValidateSystemInputs ||<br>+            (Listener && Listener->needsInputFileVisitation()) ||<br>+            (HSOpts.ModulesValidateOncePerBuildSession && F.Kind == MK_Module))<br>+          N = NumInputs;<br>+<br>      for (unsigned I = 0; I < N; ++I) {<br>        InputFile IF = getInputFile(F, I+1, Complain);<br>+          if (const FileEntry *F = IF.getFile())<br>+            Listener->visitInputFile(F->getName(), I >= NumUserInputs);<br>        if (!IF.getFile() || IF.isOutOfDate())<br>          return OutOfDate;<br>      }<br><br>The code here combines validation with reporting the dependencies and things start getting problematic..<br><br>One issue is that earlier there is this check:<br><br>   if (!DisableValidation &&<br>       (!HSOpts.ModulesValidateOncePerBuildSession ||<br>        F.InputFilesValidationTimestamp <= HSOpts.BuildSessionTimestamp)) {<br><br>so no dependencies are going to get reported if we are skipping validation.<br><br>Another issue is that even if we don't need to report the system dependencies we still go through all the system headers and stat them to get an InputFile to pass to the Listener.<br><br>I'd suggest separating the validation block from the "reporting dependencies".<br>Also, inside ASTReader::getInputFile() there is the code to get the file path string from the record ID; factor this out into a separate function and use that to go through and report the dependencies (to avoid stat'ing).<br>I believe we always store absolute paths in the module files so this should work for reporting the dependencies.<br></blockquote><br>I’ve gone with this approach.  We will end up reading the filename, size, etc. information twice for any file that we are both validating *and* outputting dependency info for.  I would like to avoid that, but I didn’t see a nice way to factor the code for that while still keeping the validation and dependency stuff separate.  I’m not sure if this overhead matters in practice, and it will only affect clients that validate input files and print dependency info.<br></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">As far as building, dependency info will be always requested, but we may skip validation during a build session.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">But it seems unfortunate that we go through all the system headers even though we don't need them, how about changing needsInputFileVisitation() to also return whether it needs all files or just the user ones ?</div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote><div><br></div><div>Okay, I’ve done that in the attached patch.  It was cleaner to just add a new function needsSystem…().</div><div><br></div><div></div></div></body></html>