[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] Fwd: I need help on how to build and run clang programs
From:       Jonathan Roelofs via cfe-dev <cfe-dev () lists ! llvm ! org>
Date:       2016-03-25 14:39:21
Message-ID: 56F54D99.10908 () codesourcery ! com
[Download RAW message or body]

Please keep the mailing list cc'd in your replies.


On 3/25/16 3:43 AM, Rukayat Erinfolami wrote:
> Thanks a lot.
>
>  From what I read, in order to use a clang program to analyze a cpp
> code, I will first need to generate a .so file which I can use in a way
> like this - $ clang -Xclang -load -Xclang
> build/skeleton/*libSkeletonPass.so* something.c.

Ah, then this is what you're looking for:

http://clang.llvm.org/docs/ClangPlugins.html

The source for the example on that page is here:

https://github.com/llvm-mirror/clang/tree/master/examples/PrintFunctionNames


>
> I also want to ask if there is a specific format to write a clang
> program. Like in writing a Java program, I know that I can take the
> following steps:

Clang is /just/ a C/C++/ObjC/ObjC++ compiler. If you're familiar with 
development in any of those languages, then clang is more or less just a 
drop-in replacement for gcc.

>
> 1. I can write all my program in the method main.
> 2. Or I can have some methods and then call them in the method main.
> 3. I can also use global variables and so on.
>
> Thank you very much.
>
> On Thu, Mar 24, 2016 at 4:43 PM, Jonathan Roelofs
> <jonathan@codesourcery.com <mailto:jonathan@codesourcery.com>> wrote:
>
>
>     Oops. Sent it to the wrong list.
>
>
>
>     -------- Forwarded Message --------
>     Subject: Fwd: I need help on how to build and run clang programs
>     Date: Thu, 24 Mar 2016 10:42:05 -0600
>     From: Jonathan Roelofs <jonathan@codesourcery.com
>     <mailto:jonathan@codesourcery.com>>
>     Organization: CodeSourcery / Mentor Embedded
>     To: erinfolamiayomide@gmail.com <mailto:erinfolamiayomide@gmail.com>
>     CC: cfe-dev@cs.uiuc.edu <mailto:cfe-dev@cs.uiuc.edu> Developers
>     <cfe-dev@cs.uiuc.edu <mailto:cfe-dev@cs.uiuc.edu>>
>
>
>
>
>         -------- Forwarded Message --------
>         Subject: I need help on how to build and run clang programs
>         Date: Thu, 24 Mar 2016 03:32:01 -0700
>         From: erinfolamiayomide@gmail.com
>         <mailto:erinfolamiayomide@gmail.com>
>         To: jonathan@codesourcery.com <mailto:jonathan@codesourcery.com>
>
>         I am very new to Clang. I want to write a clang program that
>         helps me
>         print all the methods including constructor of a c++ code. I am
>
>
>     Have a look at clang::ASTFrontendAction and clang::ASTConsumer.
>
>         having problem identifying the right location to place my files,
>         what
>         exactly the cmakeList.txt should contain and also how to build the
>
>
>     It helps to look at other CMakeLists.txt files in the source tree are
>     doing. Usually copy+paste+modify does the trick.
>
>         clang code to generate a .so file.
>
>
>     Can you elaborate what you're trying to do here?
>
>
>         I need help, please.
>
>         Thank you.
>
>         _____________________________________ Sent from
>         http://clang-developers.42468.n3.nabble.com
>
>
>
>
>
>
>
>
>

-- 
Jon Roelofs
jonathan@codesourcery.com
CodeSourcery / Mentor Embedded
_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic