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

Unified Diff: tools/gn/value_extractors.cc

Issue 516683002: Add GN variables for controlling header checking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@desc
Patch Set: merge Created 6 years, 4 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') | tools/gn/variables.h » ('j') | 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 7927b83dfed63d8e8a909e354ca3d3576a0d6e23..fe86bd3d61d88f4adfaf37eac14f823149608a24 100644
--- a/tools/gn/value_extractors.cc
+++ b/tools/gn/value_extractors.cc
@@ -101,12 +101,28 @@ struct RelativeDirConverter {
const SourceDir& current_dir;
};
-// Fills the label part of a LabelPtrPair, leaving the pointer null.
+// Fills in a label.
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 {
+ if (!v.VerifyTypeIs(Value::STRING, err))
+ return false;
+ *out = Label::Resolve(current_dir, current_toolchain, v, err);
+ return !err->has_error();
+ }
+ const SourceDir& current_dir;
+ const Label& current_toolchain;
+};
+
+// Fills the label part of a LabelPtrPair, leaving the pointer null.
+template<typename T> struct LabelPtrResolver {
+ LabelPtrResolver(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, LabelPtrPair<T>* out, Err* err) const {
if (!v.VerifyTypeIs(Value::STRING, err))
return false;
@@ -159,14 +175,14 @@ bool ExtractListOfLabels(const Value& value,
LabelTargetVector* dest,
Err* err) {
return ListValueExtractor(value, dest, err,
- LabelResolver<Target>(current_dir,
- current_toolchain));
+ LabelPtrResolver<Target>(current_dir,
+ current_toolchain));
}
bool ExtractListOfUniqueLabels(const Value& value,
const SourceDir& current_dir,
const Label& current_toolchain,
- UniqueVector<LabelConfigPair>* dest,
+ UniqueVector<Label>* dest,
Err* err) {
return ListValueUniqueExtractor(value, dest, err,
LabelResolver<Config>(current_dir,
@@ -176,11 +192,21 @@ bool ExtractListOfUniqueLabels(const Value& value,
bool ExtractListOfUniqueLabels(const Value& value,
const SourceDir& current_dir,
const Label& current_toolchain,
+ UniqueVector<LabelConfigPair>* dest,
+ Err* err) {
+ return ListValueUniqueExtractor(value, dest, err,
+ LabelPtrResolver<Config>(current_dir,
+ current_toolchain));
+}
+
+bool ExtractListOfUniqueLabels(const Value& value,
+ const SourceDir& current_dir,
+ const Label& current_toolchain,
UniqueVector<LabelTargetPair>* dest,
Err* err) {
return ListValueUniqueExtractor(value, dest, err,
- LabelResolver<Target>(current_dir,
- current_toolchain));
+ LabelPtrResolver<Target>(current_dir,
+ current_toolchain));
}
bool ExtractRelativeFile(const BuildSettings* build_settings,
« no previous file with comments | « tools/gn/value_extractors.h ('k') | tools/gn/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698