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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "tools/gn/err.h" | 10 #include "tools/gn/err.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // All valid compiler outputs plus the output extension. | 201 // All valid compiler outputs plus the output extension. |
202 return IsValidCompilerOutputsSubstitution(type) || | 202 return IsValidCompilerOutputsSubstitution(type) || |
203 type == SUBSTITUTION_OUTPUT_EXTENSION; | 203 type == SUBSTITUTION_OUTPUT_EXTENSION; |
204 } | 204 } |
205 | 205 |
206 bool IsValidCopySubstitution(SubstitutionType type) { | 206 bool IsValidCopySubstitution(SubstitutionType type) { |
207 return IsValidToolSubstitution(type) || | 207 return IsValidToolSubstitution(type) || |
208 type == SUBSTITUTION_SOURCE; | 208 type == SUBSTITUTION_SOURCE; |
209 } | 209 } |
210 | 210 |
| 211 bool IsValidCompileXCassetsSubstitution(SubstitutionType type) { |
| 212 return IsValidToolSubstitution(type) || |
| 213 type == SUBSTITUTION_LINKER_INPUTS; |
| 214 } |
| 215 |
211 bool EnsureValidSourcesSubstitutions( | 216 bool EnsureValidSourcesSubstitutions( |
212 const std::vector<SubstitutionType>& types, | 217 const std::vector<SubstitutionType>& types, |
213 const ParseNode* origin, | 218 const ParseNode* origin, |
214 Err* err) { | 219 Err* err) { |
215 for (size_t i = 0; i < types.size(); i++) { | 220 for (size_t i = 0; i < types.size(); i++) { |
216 if (!IsValidSourceSubstitution(types[i])) { | 221 if (!IsValidSourceSubstitution(types[i])) { |
217 *err = Err(origin, "Invalid substitution type.", | 222 *err = Err(origin, "Invalid substitution type.", |
218 "The substitution " + std::string(kSubstitutionNames[types[i]]) + | 223 "The substitution " + std::string(kSubstitutionNames[types[i]]) + |
219 " isn't valid for something\n" | 224 " isn't valid for something\n" |
220 "operating on a source file such as this."); | 225 "operating on a source file such as this."); |
221 return false; | 226 return false; |
222 } | 227 } |
223 } | 228 } |
224 return true; | 229 return true; |
225 } | 230 } |
OLD | NEW |