[PATCH] Allow compiler invocation to have a previously set Preprocessor and ASTContext
Neil Henning
llvm at neil-henning.co.uk
Mon Sep 23 00:40:37 PDT 2013
Hey Pete,
You are correct - just unifying the behaviour as you said.
I do not have commit access, would be very helpful if you could pull it in!
Cheers,
-Neil.
On 19/09/2013 19:45, Pete Cooper wrote:
> Hi Neil
>
> This looks like you’re just making Preprocessor and ASTContext behave
> like FileManager and SourceManager already do. That is, clang already
> has this:
>
>
> if(!CI.hasFileManager())
> CI.createFileManager();
> if(!CI.hasSourceManager())
> CI.createSourceManager(CI.getFileManager());
>
> I assume you don’t have commit access. I’m happy to commit this
> change if no-one has any objections.
>
> Thanks,
> Pete
> On Sep 13, 2013, at 1:59 AM, Neil Henning <llvm at neil-henning.co.uk
> <mailto:llvm at neil-henning.co.uk>> wrote:
>
>> 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
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu <mailto: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/20130923/626adfca/attachment.html>
More information about the cfe-commits
mailing list