[LLVMdev] InstVisitor: RetType

Vladimir Prus ghost at cs.msu.su
Wed May 31 06:15:51 PDT 2006


Hi, 
the docs for InstVisitor say that if RetType != void, one has to override
visitInstruction. What is the reason for that? It's valid to define
visitInstruction like that:

   RetTy visitInstruction(Instruction &I) { return RetTy(); } 

so assuming RetTy has a sensible default constructor, user won't need to
override visitInstruction. Note that the above will work when RetTy ==
void, as checked by gcc and como, and confirmed by C++ standard.

Of course, RetTy() might not be a reasonable value for all cases, but that
can be left to user. Am I missing something?

- Volodya





More information about the llvm-dev mailing list