aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/objc.c
blob: b0353a5de7bb6536664ed886d7be86e47f47a0bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

/* Compiler implementation of the D programming language
 * Copyright (C) 2015-2020 by The D Language Foundation, All Rights Reserved
 * written by Michel Fortin
 * http://www.digitalmars.com
 * Distributed under the Boost Software License, Version 1.0.
 * http://www.boost.org/LICENSE_1_0.txt
 * https://github.com/D-Programming-Language/dmd/blob/master/src/objc_stubs.c
 */

#include "objc.h"
#include "aggregate.h"
#include "scope.h"

class FuncDeclaration;

// MARK: ObjcSelector

ObjcSelector::ObjcSelector(const char *, size_t, size_t)
{
    printf("Should never be called when D_OBJC is false\n");
    assert(0);
}

ObjcSelector *ObjcSelector::lookup(const char *)
{
    printf("Should never be called when D_OBJC is false\n");
    assert(0);
    return NULL;
}

ObjcSelector *ObjcSelector::lookup(const char *, size_t, size_t)
{
    printf("Should never be called when D_OBJC is false\n");
    assert(0);
    return NULL;
}

ObjcSelector *ObjcSelector::create(FuncDeclaration *)
{
    printf("Should never be called when D_OBJC is false\n");
    assert(0);
    return NULL;
}

class UnsupportedObjc : public Objc
{
    void setObjc(ClassDeclaration *cd)
    {
        cd->error("Objective-C classes not supported");
    }

    void setObjc(InterfaceDeclaration *id)
    {
        id->error("Objective-C interfaces not supported");
    }

    void setSelector(FuncDeclaration *, Scope *)
    {
        // noop
    }

    void validateSelector(FuncDeclaration *)
    {
        // noop
    }

    void checkLinkage(FuncDeclaration *)
    {
        // noop
    }
};

static Objc *_objc;

Objc *objc()
{
    return _objc;
}

void Objc::_init()
{
    _objc = new UnsupportedObjc();
}