Fix formatting of COMPILER_FLAGS in generated project
Ensure that the formatting is the same as the one used by Xcode
to make comparing generated project with the upgraded version
easier.
Bug: chromium/1071055
Change-Id: I80fffe42983845c784f462afd40f338988d08ca9
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/8082
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
diff --git a/src/gn/xcode_object.cc b/src/gn/xcode_object.cc
index 56b28a7..d10adf6 100644
--- a/src/gn/xcode_object.cc
+++ b/src/gn/xcode_object.cc
@@ -177,6 +177,18 @@
out << value->Reference();
}
+void PrintValue(std::ostream& out, IndentRules rules, CompilerFlags flags) {
+ out << "{COMPILER_FLAGS = \"";
+ switch (flags) {
+ case CompilerFlags::HELP:
+ out << "--help";
+ break;
+ case CompilerFlags::NONE:
+ break;
+ }
+ out << "\"; }";
+}
+
template <typename ObjectClass>
void PrintValue(std::ostream& out,
IndentRules rules,
@@ -439,11 +451,8 @@
out << indent_str << Reference() << " = {";
PrintProperty(out, rules, "isa", ToString(Class()));
PrintProperty(out, rules, "fileRef", file_reference_);
- if (compiler_flag_ == CompilerFlags::HELP) {
- std::map<std::string, std::string> settings = {
- {"COMPILER_FLAGS", "--help"},
- };
- PrintProperty(out, rules, "settings", settings);
+ if (compiler_flag_ != CompilerFlags::NONE) {
+ PrintProperty(out, rules, "settings", compiler_flag_);
}
out << "};\n";
}