Journeyer J. Joh
2013-Jan-14 09:57 UTC
[LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
Hello list, I learned that under LLVM, #including of <iostream> is forbidden. Instead LLVM provides llvm::raw_ostream(for std::cout, std::cerr) and llvm::MemoryBuffer(for input stream). And using of llvm::raw_ostream is pretty easy but for me learning of how to use llvm::MemoryBuffer is pretty much difficult. I found a good sample code; utils/yaml2obj/yaml2obj.cpp. The function, main() in this file provides a hint which is not enough for me though. I still cannot figure out how to use llvm::MemoryBuffer. What I need is just a means of doing std::cin. Could someone explain about this? Thank you in advance. -- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ----------------------------------------
Justin Holewinski
2013-Jan-14 18:33 UTC
[LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
Is this for user prompts, or just reading data from stdin? You can use MemoryBuffer::getSTDIN to read the contents of stdin into a memory buffer. Then you can get the data pointer and size and read it in. As far as I know, there is not a good way to implement user prompts with the LLVM APIs. On Mon, Jan 14, 2013 at 4:57 AM, Journeyer J. Joh <oosaprogrammer at gmail.com>wrote:> Hello list, > > I learned that under LLVM, #including of <iostream> is forbidden. > Instead LLVM provides llvm::raw_ostream(for std::cout, std::cerr) and > llvm::MemoryBuffer(for input stream). > > And using of llvm::raw_ostream is pretty easy but for me learning of > how to use llvm::MemoryBuffer is pretty much difficult. > > I found a good sample code; utils/yaml2obj/yaml2obj.cpp. > The function, main() in this file provides a hint which is not enough > for me though. > > I still cannot figure out how to use llvm::MemoryBuffer. > What I need is just a means of doing std::cin. > > Could someone explain about this? > > Thank you in advance. > -- > ---------------------------------------- > Journeyer J. Joh > o o s a p r o g r a m m e r > a t > g m a i l d o t c o m > ---------------------------------------- > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130114/b709521a/attachment.html>
Journeyer J. Joh
2013-Jan-15 01:28 UTC
[LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
Hi Justin Holewinski,>> As far as I know, there is not a good way to implement user prompts with the LLVM APIs.This info helps me a lot. I tried to do a thing that is not possible. Thank you very much. Sincerely Journeyer 2013/1/15 Justin Holewinski <justin.holewinski at gmail.com>:> Is this for user prompts, or just reading data from stdin? You can use > MemoryBuffer::getSTDIN to read the contents of stdin into a memory buffer. > Then you can get the data pointer and size and read it in. As far as I > know, there is not a good way to implement user prompts with the LLVM APIs. > > > On Mon, Jan 14, 2013 at 4:57 AM, Journeyer J. Joh <oosaprogrammer at gmail.com> > wrote: >> >> Hello list, >> >> I learned that under LLVM, #including of <iostream> is forbidden. >> Instead LLVM provides llvm::raw_ostream(for std::cout, std::cerr) and >> llvm::MemoryBuffer(for input stream). >> >> And using of llvm::raw_ostream is pretty easy but for me learning of >> how to use llvm::MemoryBuffer is pretty much difficult. >> >> I found a good sample code; utils/yaml2obj/yaml2obj.cpp. >> The function, main() in this file provides a hint which is not enough >> for me though. >> >> I still cannot figure out how to use llvm::MemoryBuffer. >> What I need is just a means of doing std::cin. >> >> Could someone explain about this? >> >> Thank you in advance. >> -- >> ---------------------------------------- >> Journeyer J. Joh >> o o s a p r o g r a m m e r >> a t >> g m a i l d o t c o m >> ---------------------------------------- >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > -- > > Thanks, > > Justin Holewinski-- ---------------------------------------- Journeyer J. Joh o o s a p r o g r a m m e r a t g m a i l d o t c o m ----------------------------------------
Apparently Analagous Threads
- [LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
- [LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
- [LLVMdev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr
- [LLVMdev] git repository of the tutorial
- [LLVMdev] git repository of the tutorial