OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/substitution_type.h" | 5 #include "tools/gn/substitution_type.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 "{{source_gen_dir}}", // SUBSTITUTION_SOURCE_GEN_DIR | 21 "{{source_gen_dir}}", // SUBSTITUTION_SOURCE_GEN_DIR |
22 "{{source_out_dir}}", // SUBSTITUTION_SOURCE_OUT_DIR | 22 "{{source_out_dir}}", // SUBSTITUTION_SOURCE_OUT_DIR |
23 | 23 |
24 "{{label}}", // SUBSTITUTION_LABEL | 24 "{{label}}", // SUBSTITUTION_LABEL |
25 "{{root_gen_dir}}", // SUBSTITUTION_ROOT_GEN_DIR | 25 "{{root_gen_dir}}", // SUBSTITUTION_ROOT_GEN_DIR |
26 "{{root_out_dir}}", // SUBSTITUTION_ROOT_OUT_DIR | 26 "{{root_out_dir}}", // SUBSTITUTION_ROOT_OUT_DIR |
27 "{{target_gen_dir}}", // SUBSTITUTION_TARGET_GEN_DIR | 27 "{{target_gen_dir}}", // SUBSTITUTION_TARGET_GEN_DIR |
28 "{{target_out_dir}}", // SUBSTITUTION_TARGET_OUT_DIR | 28 "{{target_out_dir}}", // SUBSTITUTION_TARGET_OUT_DIR |
29 "{{target_output_name}}", // SUBSTITUTION_TARGET_OUTPUT_NAME | 29 "{{target_output_name}}", // SUBSTITUTION_TARGET_OUTPUT_NAME |
30 | 30 |
| 31 "{{asmflags}}", // SUBSTITUTION_ASMFLAGS |
31 "{{cflags}}", // SUBSTITUTION_CFLAGS | 32 "{{cflags}}", // SUBSTITUTION_CFLAGS |
32 "{{cflags_c}}", // SUBSTITUTION_CFLAGS_C | 33 "{{cflags_c}}", // SUBSTITUTION_CFLAGS_C |
33 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC | 34 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC |
34 "{{cflags_objc}}", // SUBSTITUTION_CFLAGS_OBJC | 35 "{{cflags_objc}}", // SUBSTITUTION_CFLAGS_OBJC |
35 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC | 36 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC |
36 "{{defines}}", // SUBSTITUTION_DEFINES | 37 "{{defines}}", // SUBSTITUTION_DEFINES |
37 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS | 38 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS |
38 | 39 |
39 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS | 40 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS |
40 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE | 41 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE |
(...skipping 16 matching lines...) Expand all Loading... |
57 "source_gen_dir", // SUBSTITUTION_SOURCE_GEN_DIR | 58 "source_gen_dir", // SUBSTITUTION_SOURCE_GEN_DIR |
58 "source_out_dir", // SUBSTITUTION_SOURCE_OUT_DIR | 59 "source_out_dir", // SUBSTITUTION_SOURCE_OUT_DIR |
59 | 60 |
60 "label", // SUBSTITUTION_LABEL | 61 "label", // SUBSTITUTION_LABEL |
61 "root_gen_dir", // SUBSTITUTION_ROOT_GEN_DIR | 62 "root_gen_dir", // SUBSTITUTION_ROOT_GEN_DIR |
62 "root_out_dir", // SUBSTITUTION_ROOT_OUT_DIR | 63 "root_out_dir", // SUBSTITUTION_ROOT_OUT_DIR |
63 "target_gen_dir", // SUBSTITUTION_TARGET_GEN_DIR | 64 "target_gen_dir", // SUBSTITUTION_TARGET_GEN_DIR |
64 "target_out_dir", // SUBSTITUTION_TARGET_OUT_DIR | 65 "target_out_dir", // SUBSTITUTION_TARGET_OUT_DIR |
65 "target_output_name", // SUBSTITUTION_TARGET_OUTPUT_NAME | 66 "target_output_name", // SUBSTITUTION_TARGET_OUTPUT_NAME |
66 | 67 |
| 68 "asmflags", // SUBSTITUTION_ASMFLAGS |
67 "cflags", // SUBSTITUTION_CFLAGS | 69 "cflags", // SUBSTITUTION_CFLAGS |
68 "cflags_c", // SUBSTITUTION_CFLAGS_C | 70 "cflags_c", // SUBSTITUTION_CFLAGS_C |
69 "cflags_cc", // SUBSTITUTION_CFLAGS_CC | 71 "cflags_cc", // SUBSTITUTION_CFLAGS_CC |
70 "cflags_objc", // SUBSTITUTION_CFLAGS_OBJC | 72 "cflags_objc", // SUBSTITUTION_CFLAGS_OBJC |
71 "cflags_objcc", // SUBSTITUTION_CFLAGS_OBJCC | 73 "cflags_objcc", // SUBSTITUTION_CFLAGS_OBJCC |
72 "defines", // SUBSTITUTION_DEFINES | 74 "defines", // SUBSTITUTION_DEFINES |
73 "include_dirs", // SUBSTITUTION_INCLUDE_DIRS | 75 "include_dirs", // SUBSTITUTION_INCLUDE_DIRS |
74 | 76 |
75 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These | 77 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These |
76 // are used in different contexts and are named differently to keep things | 78 // are used in different contexts and are named differently to keep things |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 type == SUBSTITUTION_ROOT_OUT_DIR || | 128 type == SUBSTITUTION_ROOT_OUT_DIR || |
127 type == SUBSTITUTION_TARGET_GEN_DIR || | 129 type == SUBSTITUTION_TARGET_GEN_DIR || |
128 type == SUBSTITUTION_TARGET_OUT_DIR || | 130 type == SUBSTITUTION_TARGET_OUT_DIR || |
129 type == SUBSTITUTION_TARGET_OUTPUT_NAME; | 131 type == SUBSTITUTION_TARGET_OUTPUT_NAME; |
130 } | 132 } |
131 | 133 |
132 bool IsValidCompilerSubstitution(SubstitutionType type) { | 134 bool IsValidCompilerSubstitution(SubstitutionType type) { |
133 return IsValidToolSubstutition(type) || | 135 return IsValidToolSubstutition(type) || |
134 IsValidSourceSubstitution(type) || | 136 IsValidSourceSubstitution(type) || |
135 type == SUBSTITUTION_SOURCE || | 137 type == SUBSTITUTION_SOURCE || |
| 138 type == SUBSTITUTION_ASMFLAGS || |
136 type == SUBSTITUTION_CFLAGS || | 139 type == SUBSTITUTION_CFLAGS || |
137 type == SUBSTITUTION_CFLAGS_C || | 140 type == SUBSTITUTION_CFLAGS_C || |
138 type == SUBSTITUTION_CFLAGS_CC || | 141 type == SUBSTITUTION_CFLAGS_CC || |
139 type == SUBSTITUTION_CFLAGS_OBJC || | 142 type == SUBSTITUTION_CFLAGS_OBJC || |
140 type == SUBSTITUTION_CFLAGS_OBJCC || | 143 type == SUBSTITUTION_CFLAGS_OBJCC || |
141 type == SUBSTITUTION_DEFINES || | 144 type == SUBSTITUTION_DEFINES || |
142 type == SUBSTITUTION_INCLUDE_DIRS; | 145 type == SUBSTITUTION_INCLUDE_DIRS; |
143 } | 146 } |
144 | 147 |
145 bool IsValidCompilerOutputsSubstitution(SubstitutionType type) { | 148 bool IsValidCompilerOutputsSubstitution(SubstitutionType type) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (!IsValidSourceSubstitution(types[i])) { | 180 if (!IsValidSourceSubstitution(types[i])) { |
178 *err = Err(origin, "Invalid substitution type.", | 181 *err = Err(origin, "Invalid substitution type.", |
179 "The substitution " + std::string(kSubstitutionNames[i]) + | 182 "The substitution " + std::string(kSubstitutionNames[i]) + |
180 " isn't valid for something\n" | 183 " isn't valid for something\n" |
181 "operating on a source file such as this."); | 184 "operating on a source file such as this."); |
182 return false; | 185 return false; |
183 } | 186 } |
184 } | 187 } |
185 return true; | 188 return true; |
186 } | 189 } |
OLD | NEW |