[LLVMdev] Distinguish Global variables from functions

RAHUL GOYAL rahulgoyal34 at gmail.com
Thu Jun 3 12:22:58 PDT 2010


hii

Please find attached herewith the "hello.cpp" file. also one interesting
point is that if i declare the global variable "x" after  any function
declaration then it is not printed .

Rahul

On Thu, Jun 3, 2010 at 11:14 PM, RAHUL GOYAL <rahulgoyal34 at gmail.com> wrote:

> Hey all...
>
> I was writing a Function pass to print all the functions using
> runonFunction()  method .but it is printing one global variable "x" at the
> same time which i just dont know how is getting there.how can i avoid "x"
> from printing?? . Here is the framgment of code of my pass
>
> namespace {
>   // Hello - The first implementation, without getAnalysisUsage.
>   struct Test2 : public FunctionPass {
>     static char ID; // Pass identification, replacement for typeid
>     Test2() : FunctionPass (&ID) {}
>
>     virtual bool runOnFunction(Function &BB) {
>       errs() << "Test1: "<<BB.getName()<<" ";
>     if (BB.empty())
>     errs()<<"true"<<"\n";
>     else
>     errs()<<"false"<<"\n";
>       return false;
>     }
>   };
> }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100604/b9c3285c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.cpp
Type: text/x-c++src
Size: 186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100604/b9c3285c/attachment.cpp>


More information about the llvm-dev mailing list