1 /**
2 Copyright: Copyright (c) 2018, Joakim Brännström. All rights reserved.
3 License: MPL-2
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 
6 This Source Code Form is subject to the terms of the Mozilla Public License,
7 v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
8 one at http://mozilla.org/MPL/2.0/.
9 */
10 module dextool.plugin.mutate.backend.mutation_type.dcc;
11 
12 import dextool.plugin.mutate.backend.mutation_type.lcr;
13 import dextool.plugin.mutate.backend.mutation_type.ror;
14 import dextool.plugin.mutate.backend.type;
15 import dextool.clang_extensions : OpKind;
16 
17 Mutation.Kind[] dccBranchMutations() @safe pure nothrow {
18     return dccBranchMutationsRaw.dup;
19 }
20 
21 Mutation.Kind[] dccCaseMutations() @safe pure nothrow {
22     return dccCaseMutationsRaw.dup;
23 }
24 
25 immutable bool[OpKind] isDcc;
26 immutable Mutation.Kind[] dccBranchMutationsRaw;
27 immutable Mutation.Kind[] dccCaseMutationsRaw;
28 
29 shared static this() {
30     with (OpKind) {
31         bool[OpKind] is_dcc;
32         foreach (k; isLcr.byKey)
33             is_dcc[k] = true;
34         foreach (k; isRor.byKey)
35             is_dcc[k] = true;
36 
37         isDcc = cast(immutable) is_dcc.dup;
38     }
39 
40     with (Mutation.Kind) {
41         dccBranchMutationsRaw = [dccTrue, dccFalse];
42         dccCaseMutationsRaw = [dccBomb];
43     }
44 }