| 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 26 matching lines...) Expand all Loading... |
| 37 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC | 37 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC |
| 38 "{{defines}}", // SUBSTITUTION_DEFINES | 38 "{{defines}}", // SUBSTITUTION_DEFINES |
| 39 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS | 39 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS |
| 40 | 40 |
| 41 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS | 41 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS |
| 42 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE | 42 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE |
| 43 "{{ldflags}}", // SUBSTITUTION_LDFLAGS | 43 "{{ldflags}}", // SUBSTITUTION_LDFLAGS |
| 44 "{{libs}}", // SUBSTITUTION_LIBS | 44 "{{libs}}", // SUBSTITUTION_LIBS |
| 45 "{{output_extension}}", // SUBSTITUTION_OUTPUT_EXTENSION | 45 "{{output_extension}}", // SUBSTITUTION_OUTPUT_EXTENSION |
| 46 "{{solibs}}", // SUBSTITUTION_SOLIBS | 46 "{{solibs}}", // SUBSTITUTION_SOLIBS |
| 47 |
| 48 "{{response_file_name}}", // SUBSTITUTION_RSP_FILE_NAME |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 const char* kSubstitutionNinjaNames[SUBSTITUTION_NUM_TYPES] = { | 51 const char* kSubstitutionNinjaNames[SUBSTITUTION_NUM_TYPES] = { |
| 50 nullptr, // SUBSTITUTION_LITERAL | 52 nullptr, // SUBSTITUTION_LITERAL |
| 51 | 53 |
| 52 "in", // SUBSTITUTION_SOURCE | 54 "in", // SUBSTITUTION_SOURCE |
| 53 "out", // SUBSTITUTION_OUTPUT | 55 "out", // SUBSTITUTION_OUTPUT |
| 54 | 56 |
| 55 "source_name_part", // SUBSTITUTION_NAME_PART | 57 "source_name_part", // SUBSTITUTION_NAME_PART |
| 56 "source_file_part", // SUBSTITUTION_FILE_PART | 58 "source_file_part", // SUBSTITUTION_FILE_PART |
| (...skipping 21 matching lines...) Expand all Loading... |
| 78 | 80 |
| 79 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These | 81 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These |
| 80 // are used in different contexts and are named differently to keep things | 82 // are used in different contexts and are named differently to keep things |
| 81 // clear, but they both expand to the "set of input files" for a build rule. | 83 // clear, but they both expand to the "set of input files" for a build rule. |
| 82 "in", // SUBSTITUTION_LINKER_INPUTS | 84 "in", // SUBSTITUTION_LINKER_INPUTS |
| 83 "in_newline", // SUBSTITUTION_LINKER_INPUTS_NEWLINE | 85 "in_newline", // SUBSTITUTION_LINKER_INPUTS_NEWLINE |
| 84 "ldflags", // SUBSTITUTION_LDFLAGS | 86 "ldflags", // SUBSTITUTION_LDFLAGS |
| 85 "libs", // SUBSTITUTION_LIBS | 87 "libs", // SUBSTITUTION_LIBS |
| 86 "output_extension", // SUBSTITUTION_OUTPUT_EXTENSION | 88 "output_extension", // SUBSTITUTION_OUTPUT_EXTENSION |
| 87 "solibs", // SUBSTITUTION_SOLIBS | 89 "solibs", // SUBSTITUTION_SOLIBS |
| 90 |
| 91 "rspfile", // SUBSTITUTION_RSP_FILE_NAME |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 SubstitutionBits::SubstitutionBits() : used() { | 94 SubstitutionBits::SubstitutionBits() : used() { |
| 91 } | 95 } |
| 92 | 96 |
| 93 void SubstitutionBits::MergeFrom(const SubstitutionBits& other) { | 97 void SubstitutionBits::MergeFrom(const SubstitutionBits& other) { |
| 94 for (size_t i = 0; i < SUBSTITUTION_NUM_TYPES; i++) | 98 for (size_t i = 0; i < SUBSTITUTION_NUM_TYPES; i++) |
| 95 used[i] |= other.used[i]; | 99 used[i] |= other.used[i]; |
| 96 } | 100 } |
| 97 | 101 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (!IsValidSourceSubstitution(types[i])) { | 187 if (!IsValidSourceSubstitution(types[i])) { |
| 184 *err = Err(origin, "Invalid substitution type.", | 188 *err = Err(origin, "Invalid substitution type.", |
| 185 "The substitution " + std::string(kSubstitutionNames[i]) + | 189 "The substitution " + std::string(kSubstitutionNames[i]) + |
| 186 " isn't valid for something\n" | 190 " isn't valid for something\n" |
| 187 "operating on a source file such as this."); | 191 "operating on a source file such as this."); |
| 188 return false; | 192 return false; |
| 189 } | 193 } |
| 190 } | 194 } |
| 191 return true; | 195 return true; |
| 192 } | 196 } |
| OLD | NEW |