[cfe-dev] Rewriting question

jahanian fjahanian at apple.com
Wed Aug 21 07:57:33 PDT 2013


As an example, you can look at RewriteObjCMethodDecl which builds a c function declaration and the caller,
then replaces the method declaration with this string; as in:

RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr);
    SourceLocation LocStart = OMD->getLocStart();
    SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();

    const char *startBuf = SM->getCharacterData(LocStart);
    const char *endBuf = SM->getCharacterData(LocEnd);
    ReplaceText(LocStart, endBuf-startBuf, ResultStr);

- fariborz

On Aug 21, 2013, at 1:23 AM, Vincent R. <forumer at smartmobili.com> wrote:

> Le 20.08.2013 21:06, jahanian a écrit :
>> Modern rewriter translates objective-c syntax for messaging into c
>> function APIs which
>> implement the messaging. ASTs are those for a c function call. It does
>> not introduce any
>> new AST. If you want to translate into other languages not
>> supported (in AST) by clang, your only choice is to rewriter the
>> messaging syntax
>> directly into their c# representation.
> 
> Yes and how do I rewrite the messaging syntax directly ? What file or function is involved to do it ?
> 





More information about the cfe-dev mailing list