<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hey Pete,<br>
      <br>
      You are correct - just unifying the behaviour as you said.<br>
      <br>
      I do not have commit access, would be very helpful if you could
      pull it in!<br>
      <br>
      Cheers,<br>
      -Neil.<br>
      <br>
      On 19/09/2013 19:45, Pete Cooper wrote:<br>
    </div>
    <blockquote
      cite="mid:BDB884C1-AB09-4CFE-A331-4C806BF94ECC@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Hi Neil
      <div><br>
      </div>
      <div>This looks like you’re just making Preprocessor and
        ASTContext behave like FileManager and SourceManager already do.
        That is, clang already has this:</div>
      <div><br>
      </div>
      <div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          min-height: 13px;"><br>
        </div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          color: rgb(49, 89, 93);"><span style="color: #000000">  </span><span
            style="color: #bb2ca2">if</span><span style="color: #000000">
            (!CI.</span>hasFileManager<span style="color: #000000">())</span></div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          color: rgb(49, 89, 93);"><span style="color: #000000">    CI.</span>createFileManager<span
            style="color: #000000">();</span></div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          color: rgb(49, 89, 93);"><span style="color: #000000">  </span><span
            style="color: #bb2ca2">if</span><span style="color: #000000">
            (!CI.</span>hasSourceManager<span style="color: #000000">())</span></div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          color: rgb(49, 89, 93);"><span style="color: #000000">    CI.</span>createSourceManager<span
            style="color: #000000">(CI.</span>getFileManager<span
            style="color: #000000">());</span></div>
        <div style="margin: 0px; font-size: 11px; font-family: Menlo;
          color: rgb(49, 89, 93);"><span style="color: #000000"><br>
          </span></div>
        <div style="margin: 0px;"><font face="Menlo"><span
              style="font-size: 11px;">I assume you don’t have commit
              access.  I’m happy to commit this change if no-one has any
              objections.</span></font></div>
        <div style="margin: 0px;"><font face="Menlo"><span
              style="font-size: 11px;"><br>
            </span></font></div>
        <div style="margin: 0px;"><font face="Menlo"><span
              style="font-size: 11px;">Thanks,</span></font></div>
        <div style="margin: 0px;"><font face="Menlo"><span
              style="font-size: 11px;">Pete</span></font></div>
        <div>
          <div>On Sep 13, 2013, at 1:59 AM, Neil Henning <<a
              moz-do-not-send="true"
              href="mailto:llvm@neil-henning.co.uk">llvm@neil-henning.co.uk</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">
            <meta content="text/html; charset=windows-1252"
              http-equiv="Content-Type">
            <div text="#000000" bgcolor="#FFFFFF">
              <div class="moz-cite-prefix">There have been no
                comments/concerns raised, so how can I get this
                committed to trunk?<br>
                <br>
                Thanks for your help,<br>
                -Neil Henning.<br>
                <br>
                On 11/09/2013 10:26, Neil Henning wrote:<br>
              </div>
              <blockquote cite="mid:52303746.6050807@neil-henning.co.uk"
                type="cite">CompilerInvocation can have a previously set
                FileManager and SourceManager, but not a Preprocessor or
                ASTContext. This stops Clang drivers from being able to
                declare their own Preprocessor and ASTContext before
                calling using FrontendAction's BeginSourceFile to
                compile. <br>
                <br>
                This patch allows a Preprocessor or ASTContext to
                previously have been set. <br>
                <br>
                Any comments would be appreciated, <br>
                -Neil Henning. <br>
                <br>
                Patch (also attached); <br>
                <blockquote type="cite">Index:
                  lib/Frontend/FrontendAction.cpp <br>
                  ===================================================================

                  <br>
                  --- lib/Frontend/FrontendAction.cpp    (revision
                  190499) <br>
                  +++ lib/Frontend/FrontendAction.cpp    (working copy)
                  <br>
                  @@ -265,7 +265,8 @@ <br>
                     } <br>
                  <br>
                     // Set up the preprocessor. <br>
                  -  CI.createPreprocessor(); <br>
                  +  if(!CI.hasPreprocessor()) <br>
                  +    CI.createPreprocessor(); <br>
                  <br>
                     // Inform the diagnostic client we are processing a
                  source file. <br>
                    
                  CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(),
                  <br>
                  @@ -279,7 +280,8 @@ <br>
                     // Create the AST context and consumer unless this
                  is a preprocessor only <br>
                     // action. <br>
                     if (!usesPreprocessorOnly()) { <br>
                  -    CI.createASTContext(); <br>
                  +    if(!CI.hasASTContext()) <br>
                  +      CI.createASTContext(); <br>
                  <br>
                       OwningPtr<ASTConsumer> Consumer( <br>
                                                     
                  CreateWrappedASTConsumer(CI, InputFile)); <br>
                </blockquote>
                <br>
                <br>
                <fieldset class="mimeAttachmentHeader"></fieldset>
                <br>
                <pre wrap="">_______________________________________________
cfe-commits mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a>
</pre>
              </blockquote>
              <br>
            </div>
            _______________________________________________<br>
            cfe-commits mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
            <a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>