search for: dummytype

Displaying 3 results from an estimated 3 matches for "dummytype".

2017 Jun 09
2
Subclassing LLVM Type
...ng if it was possible to create a Dummy Type by subclassing LLVM Type. I do not want to create a new type or even do much with this dummy type , all I need is a placeholder type until I generate IR. I want to use this approach as most of my AST is already configured to accept a Type* and not a DummyType* ( which is my own class ) I explored this a bit and did manage to create one. ========== DummyType class ========= class DummyType : public llvm::Type { private: std::string typeIdentifier; public: DummyType(const std::string& typeIdentifier,TypeID tyId):typeIdentifier(typeIdentifier),Ty...
2017 Jun 09
2
Subclassing LLVM Type
...2017 at 15:29, Jajoo, Malhar via llvm-dev <llvm-dev at lists.llvm.org> wrote: > Thanks for that , I have read the documentation on this , but I would like to know > if it would be the right thing to do , ie , changing the enum within llvm::Type Well, I find the idea of a non-canonical DummyType slightly disturbing (I don't think it's something we'd ever support officially). But you might be able to make it work and if you need dyn_cast then modifying that enum is about the only way to get it. Do you know that there's such a thing as an "opaque type" in LLVM, by...
2017 Jun 09
2
Subclassing LLVM Type
...gt; wrote: > > Is there some way around this ( without suggesting a change to my entire > AST ) ? > > LLVM has its own lightweight dynamic casting infrastructure which the > Type hierarchy already makes use of. > > You have to implement a "classof" function in your DummyType > definition. That means you'll need a new type ID. Appropriating an > unused one is slightly dodgy, but probably OK in practice if you're > careful. > > After that you'd write "dyn_cast" instead of "dynamic_cast", since > that's what the LLVM v...