[cfe-commits] Opening Parser internals for 3rd parties
Douglas Gregor
dgregor at apple.com
Fri Sep 14 09:42:29 PDT 2012
On Sep 14, 2012, at 8:21 AM, Axel Naumann <Axel.Naumann at cern.ch> wrote:
> Hi Doug,
>
> On 09/11/2012 08:13 AM, Douglas Gregor wrote:
>> On Aug 30, 2012, at 6:05 AM, Axel Naumann <Axel.Naumann at cern.ch>
>> wrote:
>>> To implement (performant) string based lookup functionality we'd
>>> like to call some Parser functions that are currently inaccessible.
>>
>> I'm fine with the general notion of opening up the parser more, but
>> what specific functions are you looking for?
>
> Great news! We use these members of Parser:
>
> ConsumeToken
> EnterScope
> ExitScope
> getTypeAnnotation
> NextToken
> NotTypeCast
> ParseAssignmentExpression
> ParseTypeName
> ParseUnqualifiedId
> SkipUntil
> TryAnnotateCXXScopeToken
> TryAnnotateTypeOrScopeToken
> TypeCastState
>
>
> The functionality we use those for is:
>
> * get QualType from string
> * get DeclContext from string
> * find FunctionDecl from function name and parameter types passed as string
> * find FunctionDecl from function name and argument expressions passed
> as string
>
> If you want to see how we use these Parser functions then please have a
> look at the code:
> <http://root.cern.ch/viewvc/trunk/interpreter/cling/lib/Interpreter/LookupHelper.cpp?view=markup>.
>
> Are there higher-level functions that we should have used, and that
> nonetheless do not modify the AST? If not, can above functions be made
> accessible? (I'm not claiming that this is the final list, though :-)
I don't think we have any higher-level functions for these operations, although the first in particular would be completely reasonable to add. In any case, you can go ahead and make those functions public.
- Doug
More information about the cfe-commits
mailing list