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

Unified Diff: tools/gn/value_extractors.cc

Issue 48523006: GN: Separately track labels and origins for lists of stuff (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/value_extractors.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value_extractors.cc
diff --git a/tools/gn/value_extractors.cc b/tools/gn/value_extractors.cc
index c2ca28527429d92d144192a66f21edf06bd3290b..5d11bc46b0a2df88de2bac2f967b8f4925c07283 100644
--- a/tools/gn/value_extractors.cc
+++ b/tools/gn/value_extractors.cc
@@ -55,15 +55,17 @@ struct RelativeDirConverter {
const SourceDir& current_dir;
};
-struct LabelResolver {
+// Fills the label part of a LabelPtrPair, leaving the pointer null.
+template<typename T> struct LabelResolver {
LabelResolver(const SourceDir& current_dir_in,
const Label& current_toolchain_in)
: current_dir(current_dir_in),
current_toolchain(current_toolchain_in) {}
- bool operator()(const Value& v, Label* out, Err* err) const {
+ bool operator()(const Value& v, LabelPtrPair<T>* out, Err* err) const {
if (!v.VerifyTypeIs(Value::STRING, err))
return false;
- *out = Label::Resolve(current_dir, current_toolchain, v, err);
+ out->label = Label::Resolve(current_dir, current_toolchain, v, err);
+ out->origin = v.origin();
return !err->has_error();
}
const SourceDir& current_dir;
@@ -108,8 +110,19 @@ bool ExtractListOfRelativeDirs(const BuildSettings* build_settings,
bool ExtractListOfLabels(const Value& value,
const SourceDir& current_dir,
const Label& current_toolchain,
- std::vector<Label>* dest,
+ LabelConfigVector* dest,
Err* err) {
return ListValueExtractor(value, dest, err,
- LabelResolver(current_dir, current_toolchain));
+ LabelResolver<Config>(current_dir,
+ current_toolchain));
+}
+
+bool ExtractListOfLabels(const Value& value,
+ const SourceDir& current_dir,
+ const Label& current_toolchain,
+ LabelTargetVector* dest,
+ Err* err) {
+ return ListValueExtractor(value, dest, err,
+ LabelResolver<Target>(current_dir,
+ current_toolchain));
}
« no previous file with comments | « tools/gn/value_extractors.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698