[PATCH] Allow compiler invocation to have a previously set Preprocessor and ASTContext
Neil Henning
llvm at neil-henning.co.uk
Fri Sep 13 01:59:24 PDT 2013
There have been no comments/concerns raised, so how can I get this
committed to trunk?
Thanks for your help,
-Neil Henning.
On 11/09/2013 10:26, Neil Henning wrote:
> 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.
>
> This patch allows a Preprocessor or ASTContext to previously have been
> set.
>
> Any comments would be appreciated,
> -Neil Henning.
>
> Patch (also attached);
>> Index: lib/Frontend/FrontendAction.cpp
>> ===================================================================
>> --- lib/Frontend/FrontendAction.cpp (revision 190499)
>> +++ lib/Frontend/FrontendAction.cpp (working copy)
>> @@ -265,7 +265,8 @@
>> }
>>
>> // Set up the preprocessor.
>> - CI.createPreprocessor();
>> + if(!CI.hasPreprocessor())
>> + CI.createPreprocessor();
>>
>> // Inform the diagnostic client we are processing a source file.
>> CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(),
>> @@ -279,7 +280,8 @@
>> // Create the AST context and consumer unless this is a
>> preprocessor only
>> // action.
>> if (!usesPreprocessorOnly()) {
>> - CI.createASTContext();
>> + if(!CI.hasASTContext())
>> + CI.createASTContext();
>>
>> OwningPtr<ASTConsumer> Consumer(
>> CreateWrappedASTConsumer(CI,
>> InputFile));
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130913/5e0e44ab/attachment.html>
More information about the cfe-commits
mailing list