d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / d / dmd / root / object.h
blob8e505f036c79e33db67bf06c5ec98b381ec8df39
2 /* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
3 * written by Walter Bright
4 * https://www.digitalmars.com
5 * Distributed under the Boost Software License, Version 1.0.
6 * https://www.boost.org/LICENSE_1_0.txt
7 * https://github.com/dlang/dmd/blob/master/src/dmd/root/object.h
8 */
10 #pragma once
12 #include "dsystem.h"
13 #include "dcompat.h"
15 typedef size_t hash_t;
17 struct OutBuffer;
19 enum DYNCAST
21 DYNCAST_OBJECT,
22 DYNCAST_EXPRESSION,
23 DYNCAST_DSYMBOL,
24 DYNCAST_TYPE,
25 DYNCAST_IDENTIFIER,
26 DYNCAST_TUPLE,
27 DYNCAST_PARAMETER,
28 DYNCAST_STATEMENT,
29 DYNCAST_CONDITION,
30 DYNCAST_TEMPLATEPARAMETER,
31 DYNCAST_INITIALIZER
35 * Root of our class library.
37 class RootObject
39 public:
40 RootObject() { }
42 virtual bool equals(const RootObject * const o) const;
44 /**
45 * Pretty-print an Object. Useful for debugging the old-fashioned way.
47 virtual const char *toChars() const;
48 /// This function is `extern(D)` and should not be called from C++,
49 /// as the ABI does not match on some platforms
50 virtual DString toString();
52 /**
53 * Used as a replacement for dynamic_cast. Returns a unique number
54 * defined by the library user. For Object, the return value is 0.
56 virtual DYNCAST dyncast() const;