0
|
1 module dmd.DebugCondition;
|
|
2
|
|
3 import dmd.DVCondition;
|
|
4 import dmd.Module;
|
|
5 import dmd.Identifier;
|
|
6 import dmd.Scope;
|
|
7 import dmd.ScopeDsymbol;
|
|
8 import dmd.OutBuffer;
|
|
9 import dmd.HdrGenState;
|
|
10 import dmd.Array;
|
|
11 import dmd.String;
|
|
12 import dmd.Global;
|
|
13
|
|
14 import dmd.condition.util.findCondition;
|
|
15
|
|
16 class DebugCondition : DVCondition
|
|
17 {
|
|
18 static void setGlobalLevel(uint level)
|
|
19 {
|
|
20 assert(false);
|
|
21 }
|
|
22
|
|
23 static void addGlobalIdent(const(char)* ident)
|
|
24 {
|
|
25 assert(false);
|
|
26 }
|
|
27
|
|
28 static void addPredefinedGlobalIdent(const(char)* ident)
|
|
29 {
|
|
30 assert(false);
|
|
31 }
|
|
32
|
|
33 this(Module mod, uint level, Identifier ident)
|
|
34 {
|
|
35 super(mod, level, ident);
|
|
36 }
|
|
37
|
72
|
38 override bool include(Scope sc, ScopeDsymbol s)
|
0
|
39 {
|
|
40 //printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel);
|
|
41 if (inc == 0)
|
|
42 {
|
|
43 inc = 2;
|
|
44
|
|
45 if (ident)
|
|
46 {
|
|
47 if (findCondition(mod.debugids, ident))
|
|
48 inc = 1;
|
|
49 else if (findCondition(global.params.debugids, ident))
|
|
50 inc = 1;
|
|
51 else
|
|
52 {
|
|
53 if (!mod.debugidsNot)
|
|
54 mod.debugidsNot = new Array();
|
|
55
|
|
56 mod.debugidsNot.push(cast(void*)new String(ident.toChars()));
|
|
57 }
|
|
58 }
|
|
59 else if (level <= global.params.debuglevel || level <= mod.debuglevel)
|
|
60 inc = 1;
|
|
61 }
|
|
62
|
|
63 return (inc == 1);
|
|
64 }
|
|
65
|
72
|
66 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
67 {
|
|
68 assert(false);
|
|
69 }
|
72
|
70 }
|