| 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 #ifndef TOOLS_GN_SUBSTITUTION_TYPE_H_ | 5 #ifndef TOOLS_GN_SUBSTITUTION_TYPE_H_ |
| 6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ | 6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 class Err; | 10 class Err; |
| 11 class ParseNode; | 11 class ParseNode; |
| 12 | 12 |
| 13 // Keep kSubstitutionNames, kSubstitutionNinjaNames and the | 13 // Keep kSubstitutionNames, kSubstitutionNinjaNames and the |
| 14 // IsValid*Substutition functions in sync if you change anything here. | 14 // IsValid*Substitution functions in sync if you change anything here. |
| 15 enum SubstitutionType { | 15 enum SubstitutionType { |
| 16 SUBSTITUTION_LITERAL = 0, | 16 SUBSTITUTION_LITERAL = 0, |
| 17 | 17 |
| 18 // The index of the first pattern. To loop overal all patterns, go from here | 18 // The index of the first pattern. To loop overal all patterns, go from here |
| 19 // until NUM_TYPES. | 19 // until NUM_TYPES. |
| 20 SUBSTITUTION_FIRST_PATTERN, | 20 SUBSTITUTION_FIRST_PATTERN, |
| 21 | 21 |
| 22 // These map to Ninja's {in} and {out} variables. | 22 // These map to Ninja's {in} and {out} variables. |
| 23 SUBSTITUTION_SOURCE = SUBSTITUTION_FIRST_PATTERN, // {{source}} | 23 SUBSTITUTION_SOURCE = SUBSTITUTION_FIRST_PATTERN, // {{source}} |
| 24 SUBSTITUTION_OUTPUT, // {{output}} | 24 SUBSTITUTION_OUTPUT, // {{output}} |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // Converts the substitution type bitfield (with a true set for each required | 87 // Converts the substitution type bitfield (with a true set for each required |
| 88 // item) to a vector of the types listed. Does not include LITERAL. | 88 // item) to a vector of the types listed. Does not include LITERAL. |
| 89 void FillVector(std::vector<SubstitutionType>* vect) const; | 89 void FillVector(std::vector<SubstitutionType>* vect) const; |
| 90 | 90 |
| 91 bool used[SUBSTITUTION_NUM_TYPES]; | 91 bool used[SUBSTITUTION_NUM_TYPES]; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // Returns true if the given substitution pattern references the output | 94 // Returns true if the given substitution pattern references the output |
| 95 // directory. This is used to check strings that begin with a substitution to | 95 // directory. This is used to check strings that begin with a substitution to |
| 96 // verify that the produce a file in the output directory. | 96 // verify that they produce a file in the output directory. |
| 97 bool SubstitutionIsInOutputDir(SubstitutionType type); | 97 bool SubstitutionIsInOutputDir(SubstitutionType type); |
| 98 | 98 |
| 99 // Returns true if the given substitution is valid for the named purpose. | 99 // Returns true if the given substitution is valid for the named purpose. |
| 100 bool IsValidSourceSubstitution(SubstitutionType type); | 100 bool IsValidSourceSubstitution(SubstitutionType type); |
| 101 // Both compiler and linker tools. | 101 // Both compiler and linker tools. |
| 102 bool IsValidToolSubstutition(SubstitutionType type); | 102 bool IsValidToolSubstitution(SubstitutionType type); |
| 103 bool IsValidCompilerSubstitution(SubstitutionType type); | 103 bool IsValidCompilerSubstitution(SubstitutionType type); |
| 104 bool IsValidCompilerOutputsSubstitution(SubstitutionType type); | 104 bool IsValidCompilerOutputsSubstitution(SubstitutionType type); |
| 105 bool IsValidLinkerSubstitution(SubstitutionType type); | 105 bool IsValidLinkerSubstitution(SubstitutionType type); |
| 106 bool IsValidLinkerOutputsSubstitution(SubstitutionType type); | 106 bool IsValidLinkerOutputsSubstitution(SubstitutionType type); |
| 107 bool IsValidCopySubstitution(SubstitutionType type); | 107 bool IsValidCopySubstitution(SubstitutionType type); |
| 108 | 108 |
| 109 // Like the "IsValid..." version above but checks a list of types and sets a | 109 // Like the "IsValid..." version above but checks a list of types and sets a |
| 110 // an error blaming the given source if the test fails. | 110 // an error blaming the given source if the test fails. |
| 111 bool EnsureValidSourcesSubstitutions( | 111 bool EnsureValidSourcesSubstitutions( |
| 112 const std::vector<SubstitutionType>& types, | 112 const std::vector<SubstitutionType>& types, |
| 113 const ParseNode* origin, | 113 const ParseNode* origin, |
| 114 Err* err); | 114 Err* err); |
| 115 | 115 |
| 116 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ | 116 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ |
| OLD | NEW |