[LLVMdev] Distinguish Global variables from functions

RAHUL GOYAL rahulgoyal34 at gmail.com
Thu Jun 3 10:44:08 PDT 2010


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/20100603/92c3d516/attachment.html>


More information about the llvm-dev mailing list