[LLVMdev] print out instruction

David Eriksson twogood at users.sourceforge.net
Tue Nov 18 21:42:38 PST 2008


On Tue, 2008-11-18 at 18:54 -0500, Po-Chun Hsu wrote:
> When I try to print out a instruction by the following way, I am
> getting the error message below.
> Anyone knows what's the problem?
> 
> Instruction* inst;
> ...
> inst-print(cerr);
> 
> testbuild.cpp:178: error: no matching function for call to
> 'llvm::Instruction::print(llvm::OStream&)'
> /x/pchsu/llvm/llvm-2.4/include/llvm/Value.h:83: note: candidates are:
> void llvm::Value::print(std::ostream&,
> llvm::AssemblyAnnotationWriter*) const
> /x/pchsu/llvm/llvm-2.4/include/llvm/Value.h:84: note:
> void llvm::Value::print(llvm::raw_ostream&,
> llvm::AssemblyAnnotationWriter*) const

The "cerr" object exists in both "std and "llvm" namespaces, and you
have "using namspace" on both of these. Prefix cerr with the namespace
you want to use. If you want to use cerr from <iostream>, write
"std::cerr".


Cheers,

David
-- 




More information about the llvm-dev mailing list