mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03:00

* WIP: Objective-C support * Further work on implementation * ObjC dynamic cast * Add swift stub class attribute * Classes, protocols and ivars * Fix compilation issues * Fix objc ir codegen * Add objc linker option * Add swift stub classref get ir gen * Minor cleanup * Fix objc link flag being added on non-darwin platforms * Refactor objc gen * remove use of std::nullopt * Emit protocol tables * Remove unused variable * Formatting * Fix build in release mode. Thanks for nothing, c++. * Fix consistency * Fix dynamic casts * Fix tocall parentfd ref and arm msgsend call * Make instance variables work * Implicitly add isa pointer to objc classes. * Fix protocol referencing & allow pragma mangle * Fix protocol linkage * Fix direct call support * always generate var type for methods * Fix test 16096a * Fix extern ivar symbol gen, retain method decls * Remove arm32 and x86 support * Check method and ivar info before pushing to member list * Make ObjcMethod info untyped. * Make ivar and method gen more robust * Generate optional protocol symbols * Use bitcasting instead of creating multiple type defs * Fix invalid protocol list struct gen * More codegen robustness * emit protocol table as const * Make protocol table anon struct * Fix callable type, generate protocol_list_t properly. * Cast vthis to argtype * Handle protorefs and classrefs properly * seperate label ref and deref * Fix method lookup * Enable objective-c tests * Enable objc_call_static test * Scan both classes and protocols for method ref * Enable objective-c tests on arm as well. * supress objc linker warning in tests * Fix class and protocol gen structure * Fix objc_protocol_sections test * ObjcMethod only get callee for functions with bodies * Fix protocol class method gen * Make ObjcMethod anon again * Fix missing emit calls * Fix classref gen * Implement some of the requested changes * Enable compilable tests * Fix property selector gen, ugly hack for final funcs. * Fix segfault in referencing fd->type * Refactor implementation * Fix null references in class and method lookup * include unordered_map * Get functionality on-par with prev impl. * Fix super context calls * Move -L-w flag to d_do_test and use IN_LLVM in objc.d/h * add LDC version tag to -L-w flag * Update CHANGELOG.md
70 lines
No EOL
2.2 KiB
C++
70 lines
No EOL
2.2 KiB
C++
//===-- gen/llvm.h - Common LLVM includes and aliases -----------*- C++ -*-===//
|
||
//
|
||
// LDC – the LLVM D compiler
|
||
//
|
||
// This file is distributed under the BSD-style LDC license. See the LICENSE
|
||
// file for details.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
//
|
||
// Pulls in commonly used LLVM headers and provides shorthands for some LLVM
|
||
// types.
|
||
//
|
||
// TODO: Consider removing this file; the aliases mostly make code more
|
||
// cumbersome to read for people familiar with LLVM anyway.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
|
||
#pragma once
|
||
|
||
#include "llvm/IR/Type.h"
|
||
#include "llvm/IR/DerivedTypes.h"
|
||
#include "llvm/IR/Constants.h"
|
||
#include "llvm/IR/IntrinsicInst.h"
|
||
#include "llvm/IR/CallingConv.h"
|
||
#include "llvm/IR/GlobalVariable.h"
|
||
#include "llvm/IR/Function.h"
|
||
#include "llvm/IR/Module.h"
|
||
#include "llvm/IR/Value.h"
|
||
#include "llvm/IR/Attributes.h"
|
||
#include "llvm/IR/DataLayout.h"
|
||
#include "llvm/IR/IRBuilder.h"
|
||
#include "llvm/IR/DebugInfo.h"
|
||
|
||
using llvm::APFloat;
|
||
using llvm::APInt;
|
||
using llvm::IRBuilder;
|
||
|
||
#if LDC_LLVM_VER >= 1900
|
||
#define GET_INTRINSIC_DECL(_X, _TY) \
|
||
(llvm::Intrinsic::getDeclaration(&gIR->module, llvm::Intrinsic::_X, _TY))
|
||
#else
|
||
#define GET_INTRINSIC_DECL(_X, _TY) \
|
||
(llvm::Intrinsic::getDeclaration(&gIR->module, llvm::Intrinsic::_X))
|
||
#endif
|
||
|
||
// shortcuts for the common llvm types
|
||
|
||
#define LLType llvm::Type
|
||
#define LLFunctionType llvm::FunctionType
|
||
#define LLPointerType llvm::PointerType
|
||
#define LLStructType llvm::StructType
|
||
#define LLArrayType llvm::ArrayType
|
||
#define LLIntegerType llvm::IntegerType
|
||
#define LLOpaqueType llvm::OpaqueType
|
||
|
||
#define LLValue llvm::Value
|
||
#define LLGlobalValue llvm::GlobalValue
|
||
#define LLGlobalVariable llvm::GlobalVariable
|
||
#define LLFunction llvm::Function
|
||
|
||
#define LLConstant llvm::Constant
|
||
#define LLConstantStruct llvm::ConstantStruct
|
||
#define LLConstantArray llvm::ConstantArray
|
||
#define LLConstantInt llvm::ConstantInt
|
||
#define LLConstantFP llvm::ConstantFP
|
||
|
||
#define LLSmallVector llvm::SmallVector
|
||
|
||
#define LLConstantList std::vector<LLConstant *>
|
||
#define LLStringRef llvm::StringRef |