<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 18, 2014, at 12:05 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>Documentation update:</div><div><br></div>+   Clang also accepts a module map file with the name ``module.map``, but this will be deprecated in the future. When both ``module.modulemap`` and ``module.map`` files are present, the ``module.modulemap`` file will be used.<br>
<div><br></div><div>"Will be deprecated in the future" doesn't make much sense to me. The only functional meaning of "deprecated" here is "we intend to remove this some day", so in that sense, if it'll be deprecated in the future, then it's already deprecated now. Perhaps:</div>
<div><br></div><div>+   For compatibility with previous releases, if a module map file named ``module.modulemap`` is not found, Clang will also search for a file named ``module.map``. This behavior is deprecated and we plan to eventually remove it.</div></div></blockquote><div><br></div><div>Makes sense, I’ll use that.</div></div><div><br><blockquote type="cite"><div dir="ltr">
<div><br></div><div><br></div><div><div>+  StringRef Filename = llvm::sys::path::filename(ModuleMapPath);</div><div>+  SmallString<128>  PrivateFilename(Directory->getName());</div><div>+  if (Filename == "module.map")</div>
<div>+    llvm::sys::path::append(PrivateFilename, "module_private.map");</div><div>+  else if (Filename == "module.modulemap")</div><div>+    llvm::sys::path::append(PrivateFilename, "module.private.modulemap");</div>
<div>+  else</div><div>+    return nullptr;</div></div><div><br></div><div>Maybe use StringSwitch?</div></div></blockquote><div>StringSwitch does not work very well here, because in the ‘Default’ case we want to return early.</div><br><blockquote type="cite"><div dir="ltr"><div><br></div><div><br></div><div><div>+  // Continue to allow module.map</div><div>+  ModuleMapFileName.erase(ModuleMapFileName.begin() + ModuleMapDirNameLen,</div>
<div>+                          ModuleMapFileName.end());</div><div>+</div><div>+  llvm::sys::path::append(ModuleMapFileName, "module.map");</div><div>+  return FileMgr.getFile(ModuleMapFileName);</div></div><div>
<br></div><div>This makes a slightly dubious assumption about what llvm::sys::path:append does to the string (that it only appends at the character level). Even though that assumption turns out to be correct (for now, at least), I'd prefer to not rely on it here.</div></div></blockquote><div><br></div><div>I’m not sure I agree that sys::path::append should ever be allowed to modify the rest of the string, but I think what you’ve said applies equally well to the rest of this function, so I’m happy to just reassign the string.</div><div><br></div><div>Thanks,</div><div><br></div><div>Ben</div><br><blockquote type="cite"><div dir="ltr">
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 11:24 AM, Ben Langmuir <span dir="ltr"><<a href="mailto:blangmuir@apple.com" target="_blank">blangmuir@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On Mar 18, 2014, at 10:48 AM, Ben Langmuir <<a href="mailto:blangmuir@apple.com">blangmuir@apple.com</a>> wrote:<br>
<br>
><br>
> On Mar 18, 2014, at 10:19 AM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br>
><br>
>> On Tue, Mar 18, 2014 at 4:52 PM, Ben Langmuir <<a href="mailto:blangmuir@apple.com">blangmuir@apple.com</a>> wrote:<br>
>>> Thanks Argyrios.  Richard & Dmitri: just to confirm - are you okay with me<br>
>>> committing this now, or did either of you intend to review the patch first?<br>
>><br>
>> +  // For frameworks, the preferred spelling is Modules/module.modulemap.<br>
>> +  // Otherwise it is just module.modulemap.<br>
>><br>
>> ... Otherwise it is just "module.map" at the framework root.<br>
><br>
> WIll do.<br>
><br>
>><br>
>> Apart from that, two comments:<br>
>><br>
>> 1. There is also the "module_private.map" thing.  Do we want to rename<br>
>> that file as well?<br>
><br>
> That is done in this patch as well - see loadModuleMapFileImpl.  If we find ‘module.modulemap’ we will look for ‘module.private.modulemap’.  If we find ‘module.map’, we will look for ‘module_private.map’.<br>
><br>
>><br>
>> 2. I don't immediately see how DirectoryHasModuleMap interacts with<br>
>> frameworks now.  Does it contain only root framework directories or<br>
>> 'Module' subdirectories as well?  Could you add a sub framework test<br>
>> to test this logic in hasModuleMap?<br>
><br>
> Hmm, I didn’t think about this.  Right now only the ‘Modules’ subdirectory will be in DirectoryHasModuleMap unless we are going through hasModuleMap, in which case I believe they will both be there.  This is probably safe, as we will not load the module map more than once, but it would be better to also add the framework directory so that we detect this earlier - I’ll make that happen and add the test case you suggest.<br>

<br>
</div></div>Actually we don’t use hasModuleMap when searching for a sub framework.  We go through hasModuleMap anytime we search a ‘normal’ directory.  If you still think there’s a missing test I’m open to suggestion though.<br>

<span class="HOEnZb"><font color="#888888"><br>
Ben<br>
</font></span><div class="im HOEnZb">><br>
> Ben<br>
><br>
>><br>
>> Dmitri<br>
>><br>
>> --<br>
>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>