[cfe-dev] parsing llvm type strings from an in-memory string

Francis Visoiu Mistrih via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 18 09:34:42 PST 2017


Hi,

> On 18 Dec 2017, at 16:01, Seth Goldstein via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> For various reasons, I want to be able to use the `LLParser` machinery to create `Type` objects.  So, I need to create an LLParser which will parse a string, instead of a reading it from a file.  If I was doing this in clang, then I think I would need to use an instance of `InMemoryFileSystem` which inherits from `FileSystem`.  
> 
> However, I want to do this in an llvm pass.  Any suggestions?

You can find some functions that might do this in include/llvm/AsmParser/Parser.h, probably

> Type *parseType(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots = nullptr);


might be what you’re looking for.

Cheers,

— 
Francis Visoiu Mistrih

> 
> --------------
> Seth Copen Goldstein
> Carnegie Mellon University
> Computer Science Dept
> 7111 GHC
> 412-268-3828
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list