[cfe-dev] Need some brief explanation about llvm::MemoryBuffer and llvm::SourceMgr

Journeyer J. Joh oosaprogrammer at gmail.com
Mon Jan 14 01:57:35 PST 2013


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
----------------------------------------



More information about the cfe-dev mailing list