[LLVMdev] llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.

Surinder surifilms at gmail.com
Sun Jan 30 20:55:42 PST 2011


I have written a new pass, it compiles ok but crashes when i run it
with error (llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid
&& "pid cannot be 0"' failed.).

The pass is :

using namespace llvm;
namespace
{
  struct Dfl : public FunctionPass {
    static char ID;
    Dfl() : FunctionPass(ID) { }
    virtual bool runOnFunction(Function &F) {
      bool modified=false;
      errs() << "In Dfl for Function : " << F.getName();
      if (F.empty()) errs() << " is empty."  << "\n";
      else errs()  << "\n";
      return modified;
    };
    // pass interface to other passes
    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
       AU.addRequired<DominatorTree>();
    }
  };  // end struc Dfl
  // Identifier variable for the pass
  char Dfl::ID = 0;
  // Register the pass
  static RegisterPass<Dfl> X("dfl","emit cfg in dfl format"
                             , false, false);
}



More information about the llvm-dev mailing list