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

Surinder surifilms at gmail.com
Sun Jan 30 21:34:09 PST 2011


Got the solution, &ID and not ID should be passed to  Dfl() :
FunctionPass(&ID) { }

On Mon, Jan 31, 2011 at 3:57 PM, Surinder <surifilms at gmail.com> wrote:
> llvm/include/llvm/Pass.h:93: llvm::Pass::Pass(llvm::PassKind,
> intptr_t): Assertion `pid && "pid cannot be 0"' failed.
>
>
> On Mon, Jan 31, 2011 at 3:55 PM, Surinder <surifilms at gmail.com> wrote:
>> 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