parsing llvm type strings from an in-memory string

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?

Hi,

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,