Object-Oriented-C | An Object Oriented framework for C I built from scratch | Websocket library
kandi X-RAY | Object-Oriented-C Summary
kandi X-RAY | Object-Oriented-C Summary
An Object Oriented framework for C I built from scratch
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Object-Oriented-C
Object-Oriented-C Key Features
Object-Oriented-C Examples and Code Snippets
Community Discussions
Trending Discussions on Object-Oriented-C
QUESTION
I am working on a custom front-end language using the LLVM c++ api and am adding a "class" definition construct to the language. The lexer and parser are written in C++ and LLVM c++ api is being used to generate IR code and compile to different machine backends. I can already define functions and variables, call functions and evaluate basic arithmetic with the custom front-end language.
In order to do add a "class" definition to the language, I am following the suggestion on https://mapping-high-level-constructs-to-llvm-ir.readthedocs.io/en/latest/object-oriented-constructs/classes.html
This suggests that we create a "structtype" to contain all the data members of the class and separately define a bunch of functions for the methods of the class (if I understand the link correctly).
Thus in my compiler code, I defined an AST node called "ClassAST" which contains the names and types for data members of the class and a collection of function definitions for the methods for the "class" being defined in the front-end language. The c++ code snippet for the AST node is as follows:
...ANSWER
Answered 2020-Nov-01 at 12:13Looking at the source code of Module::getTypeByName
, it looks up the name in the LLVMContext
instance. This means you don't have to add your type to the module and name lookup should work just fine, even through a Module
instance.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Object-Oriented-C
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page