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

Unified Diff: tools/gn/xcode_object.cc

Issue 2574333002: [Refactor Xcode Objects] Enable generating per file '--help' compiler flag (Closed)
Patch Set: Created 4 years 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/xcode_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/xcode_object.cc
diff --git a/tools/gn/xcode_object.cc b/tools/gn/xcode_object.cc
index dc5bfb86a7a942b60bf0956dc6df6be0d024ef87..f040fbc323ccf07609a9bb1dedac7b297ac9feef 100644
--- a/tools/gn/xcode_object.cc
+++ b/tools/gn/xcode_object.cc
@@ -365,8 +365,11 @@ void PBXAggregateTarget::Print(std::ostream& out, unsigned indent) const {
// PBXBuildFile ---------------------------------------------------------------
PBXBuildFile::PBXBuildFile(const PBXFileReference* file_reference,
- const PBXSourcesBuildPhase* build_phase)
- : file_reference_(file_reference), build_phase_(build_phase) {
+ const PBXSourcesBuildPhase* build_phase,
+ const HelpCompilerFlagEnabled help_flag_enabled)
+ : file_reference_(file_reference),
+ build_phase_(build_phase),
+ help_flag_enabled_(help_flag_enabled) {
DCHECK(file_reference_);
DCHECK(build_phase_);
}
@@ -387,6 +390,12 @@ void PBXBuildFile::Print(std::ostream& out, unsigned indent) const {
out << indent_str << Reference() << " = {";
PrintProperty(out, rules, "isa", ToString(Class()));
PrintProperty(out, rules, "fileRef", file_reference_);
+ if (help_flag_enabled_ == HelpCompilerFlagEnabled::HELP_FLAG_ENABLED) {
+ std::map<std::string, std::string> settings = {
+ {"COMPILER_FLAGS", "-h"},
justincohen 2016/12/14 20:00:17 Is it -h or --help ?
liaoyuke 2016/12/14 20:29:23 Thank you for catching it! I meant to type "-help"
liaoyuke 2016/12/14 20:29:23 Done.
+ };
+ PrintProperty(out, rules, "settings", settings);
+ }
out << "};\n";
}
@@ -560,10 +569,11 @@ PBXNativeTarget::PBXNativeTarget(const std::string& name,
PBXNativeTarget::~PBXNativeTarget() {}
void PBXNativeTarget::AddFileForIndexing(
- const PBXFileReference* file_reference) {
+ const PBXFileReference* file_reference,
+ const PBXBuildFile::HelpCompilerFlagEnabled help_flag_enabled) {
DCHECK(file_reference);
- source_build_phase_->AddBuildFile(
- base::MakeUnique<PBXBuildFile>(file_reference, source_build_phase_));
+ source_build_phase_->AddBuildFile(base::MakeUnique<PBXBuildFile>(
+ file_reference, source_build_phase_, help_flag_enabled));
}
PBXObjectClass PBXNativeTarget::Class() const {
@@ -607,7 +617,9 @@ PBXProject::PBXProject(const std::string& name,
PBXProject::~PBXProject() {}
-void PBXProject::AddSourceFile(const std::string& source_path) {
+void PBXProject::AddSourceFile(
+ const std::string& source_path,
+ const PBXBuildFile::HelpCompilerFlagEnabled help_flag_enabled) {
PBXFileReference* file_reference = sources_->AddSourceFile(source_path);
base::StringPiece ext = FindExtension(&source_path);
if (!IsSourceFileForIndexing(ext))
@@ -631,7 +643,7 @@ void PBXProject::AddSourceFile(const std::string& source_path) {
}
DCHECK(target_for_indexing_);
- target_for_indexing_->AddFileForIndexing(file_reference);
+ target_for_indexing_->AddFileForIndexing(file_reference, help_flag_enabled);
}
void PBXProject::AddAggregateTarget(const std::string& name,
« no previous file with comments | « tools/gn/xcode_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698