<p dir="ltr">Yep that addresses my concerns... </p>
<div class="gmail_quote">On Mar 3, 2014 4:47 PM, "Ben Langmuir" <<a href="mailto:blangmuir@apple.com">blangmuir@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div>On Feb 27, 2014, at 8:00 AM, Argyrios Kyrtzidis <<a href="mailto:kyrtzidis@apple.com" target="_blank">kyrtzidis@apple.com</a>> wrote:</div><br><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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>On Feb 27, 2014, at 4:43 AM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:</div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing: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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 27, 2014 at 1:37 PM, Manuel Klimek<span> </span><span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span><span> </span>wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><div>On Wed, Feb 12, 2014 at 11:22 PM, Douglas Gregor<span> </span><span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><br>On Feb 12, 2014, at 2:21 PM, Rafael Ávila de Espíndola <<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br><br>><br>><br>> ================<br>> Comment at: include/clang/Basic/FileManager.h:122<br>
> @@ -121,2 +121,3 @@<br>> class FileManager : public RefCountedBase<FileManager> {<br>> +  IntrusiveRefCntPtr<AbstractFileSystem> FS;<br>>   FileSystemOptions FileSystemOpts;<br>> ----------------<br>
> Why is the reference count necessary? Given its nature I would expect the FS to outlive the file manger, in which case the FileManager could have just a pointer to the FileSystem.<br><br><br></div>The FS is likely to get shared among a number of FileManagers in different compiler instances within a thread. Yes, we could try to establish and maintain relationships among these, but it’s simpler and costs us effectively nothing to make this ref-counted.<br>
</blockquote><div><br></div></div></div><div>Just to follow up:</div><div>I found one more argument against making this ref-counted:</div><div>The constructor of FileManager that uses the default "real" file system is now actively thread hostile (you cannot create a FileManager per thread without locking). I think that's rather unexpected.</div>
</div></div></div></blockquote><div><br></div><div>And even worse, because RealFileSystem is an implementation detail, and getRealFileSystem returns a ref counted pointer by value, I cannot see any way to get me a RealFileSystem without locking.</div>
<div><br></div></div></div></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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing: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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
I propose we introduce a RefCountedBase that is using atomic reference count (either change RefCountedBase or add a new class), and have FileSystem use that.</div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
</blockquote><div><br></div><div>Makes sense to me.  Manuel, does this address your concern?</div><div><br></div><div>Ben</div><br><blockquote type="cite"><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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Cheers,</div><div>/Manuel</div></div></div></div></blockquote></blockquote></div><br></div></blockquote></div>