Better documentation / restrictions on enum values for Declaration IDs

Milian Wolff mail at milianw.de
Mon Jun 14 13:49:07 UTC 2010


On Monday, 14. June 2010 15:36:33 Milian Wolff wrote:
> On Monday, 14. June 2010 15:20:21 David Nolden wrote:
> > Yes I guess we should document it. However clashing IDs should lead to
> > an assertion very early, in the exact moment that the declaration is
> > registered to the DUChain (which usually is done during static
> > initialization), so at least the problem is not hard to debug.
> > 
> > The problem is that, for efficiency reasons, the values shouldn't
> > become too high, as currently KDevelop uses a simple array to map
> > declaration-ids to their factories, and using something slower like a
> > hash-map in that very frequently accessed place would suck.
> > 
> > So maybe we should just enumerate all the languages that come into our
> > mind, and give each language a range of 10 IDs. Should it ever be
> > required, we can then assign additional ranges, but we should manage
> > them centrally to prevent clashes.
> 
> I'll document the languages we have right now and assign them ranges of 10.
> 
> I hope we don't get much more in PHP since we already have 8 I think ;-)
> 
> BTW: Anything stored in the DUChain has such a Identity, right? Also
> contexts etc. pp., or?

The ranges are currently quite a mess and not really ordered by language. See 
bottom of this mail for a list. What I see is that I have to fix erlang. And 
Java is imo too low, isn't it? Or should I pack XML, Erlang into 40 and 50? 
CSharp into 60?


milianw at jongleur:~/projects/kde4$ ack-grep "\bIdentity\s*="                                  

####### XML

quanta/languages/xml/language/duchain/elementdeclaration.h
97:        Identity = 90

####### CPP

kdevelop/languages/cpp/cppduchain/templatedeclaration.h
282:      Identity = BaseDeclaration::Identity + 50

kdevelop/languages/cpp/cppduchain/templateparameterdeclaration.h
64:    Identity = 18

kdevelop/languages/cpp/cppduchain/qpropertydeclaration.h
197:    Identity = 75

kdevelop/languages/cpp/cppduchain/qtfunctiondeclaration.h
42:    Identity = 74

kdevelop/languages/cpp/cppduchain/cppducontext.h
640:      Identity = BaseContext::Identity + 50

kdevelop/languages/cpp/cppduchain/environmentmanager.h
302:      Identity = 73

kdevelop/languages/cpp/cppduchain/cpptypes.h
102:    Identity = 18
148:    Identity = 23

########## PHP

php/duchain/phpducontext.h
65:        Identity = BaseContext::Identity + 51

php/duchain/types/structuretype.h
76:        Identity = 51

php/duchain/types/integraltypeextended.h
63:        Identity = 50

php/duchain/declarations/variabledeclaration.h
69:        Identity = 83

php/duchain/declarations/functiondeclaration.h
66:        Identity = 86

php/duchain/declarations/namespacedeclaration.h
65:        Identity = 87

php/duchain/declarations/classdeclaration.h
68:        Identity = 85

php/duchain/declarations/classmethoddeclaration.h
75:        Identity = 84

####### ERLANG

erlang/duchain/declarations/variabledeclaration.h
67:        Identity = 83

erlang/duchain/declarations/functiondeclaration.h
66:        Identity = 86

###### KDEVPLATFORM

kdevplatform/language/duchain/duchainbase.h
124:    Identity = 1

kdevplatform/language/duchain/classfunctiondeclaration.h
116:    Identity = 14

kdevplatform/language/duchain/classmemberdeclaration.h
92:    Identity = 9

kdevplatform/language/duchain/parsingenvironment.h
213:      Identity = 11

kdevplatform/language/duchain/aliasdeclaration.h
87:    Identity = 6

kdevplatform/language/duchain/ducontext.h
705:    Identity = 2

kdevplatform/language/duchain/functiondeclaration.h
82:    Identity = 12

kdevplatform/language/duchain/classdeclaration.h
127:    Identity = 17

kdevplatform/language/duchain/declaration.h
418:    Identity = 7

kdevplatform/language/duchain/types/structuretype.h
66:    Identity = 6

kdevplatform/language/duchain/types/unsuretype.h
77:    Identity = 39

kdevplatform/language/duchain/types/enumerationtype.h
56:    Identity = 21

kdevplatform/language/duchain/types/integraltype.h
101:    Identity = 2

kdevplatform/language/duchain/types/delayedtype.h
87:    Identity = 8

kdevplatform/language/duchain/types/enumeratortype.h
58:    Identity = 20

kdevplatform/language/duchain/types/arraytype.h
87:    Identity = 7

kdevplatform/language/duchain/types/constantintegraltype.h
94:    Identity = 14

kdevplatform/language/duchain/types/referencetype.h
77:    Identity = 4

kdevplatform/language/duchain/types/abstracttype.h
203:    Identity = 1

kdevplatform/language/duchain/types/functiontype.h
128:    Identity = 5

kdevplatform/language/duchain/types/typealiastype.h
66:    Identity = 9

kdevplatform/language/duchain/types/pointertype.h
77:    Identity = 3

kdevplatform/language/duchain/forwarddeclaration.h
80:    Identity = 10

kdevplatform/language/duchain/topducontext.h
198:    Identity = 4

kdevplatform/language/duchain/functiondefinition.h
56:      Identity = 21

kdevplatform/language/duchain/namespacealiasdeclaration.h
73:    Identity = 13

kdevplatform/language/interfaces/iproblem.h
147:        Identity = 15

##### JAVA

java/duchain/ducontext.h
42:    Identity = 32

java/duchain/classdeclaration.h
107:    Identity = 30

java/duchain/topducontext.h
45:    Identity = 31

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100614/83cf6a96/attachment.sig>


More information about the KDevelop-devel mailing list