[cfe-dev] file handling

Suhas suhaslimaye at gmail.com
Thu Apr 12 19:19:23 PDT 2012


Do you mean Translation unit means compilation unit ?  If you are compiling
more than one c or cxx files using clang then
when single .c or .cxx is compiled , all function calls and function protos
and function definations within that file are obtained.

To get all function calls there is virtual function VisitCallExpr ( you can
all function calls within that single c file ) and
another function is VisitFunctionDecl  ( all functions i,e function body (
defination) and function prototypes handle by FunctionDecl Object)
I got hint from following and then i modified some code according to my
need ( I googled it for sample code and found
https://github.com/mozilla/dxr/blob/master/xref-tools/cxx-clang/dxr-index.cpp.
There are some very useful functions there
)



Suhas Limaye.
Pune.


On Thu, Apr 12, 2012 at 4:52 PM, akshay ratnaparkhi <ackk007 at gmail.com>wrote:

> Thanks suhas...
> I have again one problem that how can i handle the different translation
> units for retrieving the function names.
>
> by the way it is just informal, I am also from pune.
>
> On Thu, Apr 12, 2012 at 12:03 PM, Suhas <suhaslimaye at gmail.com> wrote:
>
>> use std::ofstream for writting text fie!
>>
>> Suhas Limaye.
>> Pune.
>>
>>
>> On Wed, Apr 11, 2012 at 10:17 AM, akshay ratnaparkhi <ackk007 at gmail.com>wrote:
>>
>>> Hi all,
>>>       Can any one tell me how to handle files in clang. I want to open
>>> the file in write mode and write some data in file. Can i use iostream
>>> ios:: file handling in clang plugin.
>>>  Thanks,
>>>       akshay
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120413/c99e3af3/attachment.html>


More information about the cfe-dev mailing list