Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: tools/gn/substitution_type.h

Issue 2627703002: Validate GN substitutions in args and rsp files. (Closed)
Patch Set: Format Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/substitution_type.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool SubstitutionIsInOutputDir(SubstitutionType type); 111 bool SubstitutionIsInOutputDir(SubstitutionType type);
112 112
113 // Returns true if the given substitution pattern references the bundle 113 // Returns true if the given substitution pattern references the bundle
114 // directory. This is used to check strings that begin with a substitution to 114 // directory. This is used to check strings that begin with a substitution to
115 // verify that they produce a file in the bundle directory. 115 // verify that they produce a file in the bundle directory.
116 bool SubstitutionIsInBundleDir(SubstitutionType type); 116 bool SubstitutionIsInBundleDir(SubstitutionType type);
117 117
118 // Returns true if the given substitution is valid for the named purpose. 118 // Returns true if the given substitution is valid for the named purpose.
119 bool IsValidBundleDataSubstitution(SubstitutionType type); 119 bool IsValidBundleDataSubstitution(SubstitutionType type);
120 bool IsValidSourceSubstitution(SubstitutionType type); 120 bool IsValidSourceSubstitution(SubstitutionType type);
121 bool IsValidScriptArgsSubstitution(SubstitutionType type);
122
121 // Both compiler and linker tools. 123 // Both compiler and linker tools.
122 bool IsValidToolSubstitution(SubstitutionType type); 124 bool IsValidToolSubstitution(SubstitutionType type);
123 bool IsValidCompilerSubstitution(SubstitutionType type); 125 bool IsValidCompilerSubstitution(SubstitutionType type);
124 bool IsValidCompilerOutputsSubstitution(SubstitutionType type); 126 bool IsValidCompilerOutputsSubstitution(SubstitutionType type);
125 bool IsValidLinkerSubstitution(SubstitutionType type); 127 bool IsValidLinkerSubstitution(SubstitutionType type);
126 bool IsValidLinkerOutputsSubstitution(SubstitutionType type); 128 bool IsValidLinkerOutputsSubstitution(SubstitutionType type);
127 bool IsValidALinkSubstitution(SubstitutionType type); 129 bool IsValidALinkSubstitution(SubstitutionType type);
128 bool IsValidCopySubstitution(SubstitutionType type); 130 bool IsValidCopySubstitution(SubstitutionType type);
129 bool IsValidCompileXCassetsSubstitution(SubstitutionType type); 131 bool IsValidCompileXCassetsSubstitution(SubstitutionType type);
130 132
131 // Like the "IsValid..." version above but checks a list of types and sets a 133 // Validates that each substitution type in the vector passes the given
132 // an error blaming the given source if the test fails. 134 // is_valid_subst predicate. Returns true on success. On failure, fills in the
133 bool EnsureValidSourcesSubstitutions( 135 // error object with an appropriate message and returns false.
136 bool EnsureValidSubstitutions(
134 const std::vector<SubstitutionType>& types, 137 const std::vector<SubstitutionType>& types,
138 bool (*is_valid_subst)(SubstitutionType),
135 const ParseNode* origin, 139 const ParseNode* origin,
136 Err* err); 140 Err* err);
137 141
138 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ 142 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_
OLDNEW
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/substitution_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698