Hi, I am trying to compile the Hello World pass (described at http://llvm.org/docs/WritingAnLLVMPass.html#basiccode) in an LLVM Project and I get an error, 'no match for ‘operator<<’ at line llvm::cerr << "*Hello: *" << F.getName() << "\n"; But when I looked up in the LLVM API Documentation, I think "<<" operator is not overloaded for the StringRef class returned by getName() of the Function class. If I replace the above line with llvm::cerr << "*Hello: *" << F.getName().str() << "\n"; it compiles fine. I was just wondering if its a bug in the document describing the Hello World pass or am I referring it incorrectly? Thanks, Rakesh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090904/7ba14265/attachment.html>
Yeah, I just had to make a similar change to some of the code in my pass. I think the API changed and no one bothered to update the docs. --Patrick Rakesh Komuravelli wrote:> Hi, > > I am trying to compile the Hello World pass (described > at http://llvm.org/docs/WritingAnLLVMPass.html#basiccode) in an LLVM > Project and I get an error, 'no match for ‘operator<<’ at line > llvm::cerr << "/Hello: /" << F.getName() << "\n"; > > But when I looked up in the LLVM API Documentation, I think "<<" operator is not overloaded for the StringRef class returned by getName() of the Function class. If I replace the above line with > llvm::cerr << "/Hello: /" << F.getName().str() << "\n"; > it compiles fine. I was just wondering if its a bug in the document describing the Hello World pass or am I referring it incorrectly? > > Thanks, > Rakesh > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Sep 4, 2009, at 10:29 AM, Rakesh Komuravelli wrote:> Hi, > > I am trying to compile the Hello World pass (described at http://llvm.org/docs/WritingAnLLVMPass.html#basiccode > ) in an LLVM Project and I get an error, 'no match for ‘operator<<’ > at line > llvm::cerr << "Hello: " << F.getName() << "\n"; > But when I looked up in the LLVM API Documentation, I think "<<" > operator is not overloaded for the StringRef class returned by > getName() of the Function class. If I replace the above line with > llvm::cerr << "Hello: " << F.getName().str() << "\n"; > it compiles fine. I was just wondering if its a bug in the document > describing the Hello World pass or am I referring it incorrectly?I updated the documentation. You should use errs() From raw_ostream.h now, thanks. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090907/0aa3b5cf/attachment.html>