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