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

Unified Diff: tools/gn/ninja_binary_target_writer.cc

Issue 1361173004: [GN]: Add asmflags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Brett’s comments Created 5 years, 3 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/misc/vim/syntax/gn.vim ('k') | tools/gn/substitution_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_binary_target_writer.cc
diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc
index 3a08e57964e9cbb367cfaa2e820fdb100a1fbbe2..b7dace7ab0afcee76a7e287501c2d3e6374fe0e9 100644
--- a/tools/gn/ninja_binary_target_writer.cc
+++ b/tools/gn/ninja_binary_target_writer.cc
@@ -351,12 +351,7 @@ void NinjaBinaryTargetWriter::Run() {
&pch_obj_files : &pch_other_files;
// Treat all pch output files as explicit dependencies of all
- // compiles. Some notes:
- //
- // - Only the language-specific one is required for any specific compile, but
- // that's more difficult to express and the additional logic doesn't buy
- // much reduced parallelism. Just list them all (there's usually only one
- // anyway).
+ // compiles that support them. Some notes:
//
// - On Windows, the .pch file is the input to the compile, not the
// precompiled header's corresponding object file that we're using here.
@@ -420,8 +415,13 @@ void NinjaBinaryTargetWriter::WriteCompilerVars(
bool has_precompiled_headers =
target_->config_values().has_precompiled_headers();
- // Some toolchains pass cflags to the assembler since it's the same command.
EscapeOptions opts = GetFlagOptions();
+ if (used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) {
+ WriteOneFlag(SUBSTITUTION_ASMFLAGS, false, Toolchain::TYPE_NONE,
+ &ConfigValues::asmflags, opts);
+ }
+ // TODO(andybons): Remove SOURCE_S and SOURCE_ASM checks once asmflags is
+ // used.
if (used_types.Get(SOURCE_C) || used_types.Get(SOURCE_CPP) ||
used_types.Get(SOURCE_M) || used_types.Get(SOURCE_MM) ||
used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) {
@@ -678,17 +678,20 @@ void NinjaBinaryTargetWriter::WriteSources(
// with the naming scheme specified in GetWindowsPCHObjectExtension or
// GetGCCPCHOutputExtension.
const Tool* tool = target_->toolchain()->GetTool(tool_type);
- for (const auto& dep : pch_deps) {
- const std::string& output_value = dep.value();
- std::string output_extension;
- if (tool->precompiled_header_type() == Tool::PCH_MSVC) {
- output_extension = GetWindowsPCHObjectExtension(tool_type);
- } else if (tool->precompiled_header_type() == Tool::PCH_GCC) {
- output_extension = GetGCCPCHOutputExtension(tool_type);
- }
- if (output_value.compare(output_value.size() - output_extension.size(),
- output_extension.size(), output_extension) == 0) {
- deps.push_back(dep);
+ if (tool->precompiled_header_type() != Tool::PCH_NONE) {
+ for (const auto& dep : pch_deps) {
+ const std::string& output_value = dep.value();
+ std::string output_extension;
+ if (tool->precompiled_header_type() == Tool::PCH_MSVC) {
+ output_extension = GetWindowsPCHObjectExtension(tool_type);
+ } else if (tool->precompiled_header_type() == Tool::PCH_GCC) {
+ output_extension = GetGCCPCHOutputExtension(tool_type);
+ }
+ if (output_value.compare(output_value.size() -
+ output_extension.size(), output_extension.size(),
+ output_extension) == 0) {
+ deps.push_back(dep);
+ }
}
}
WriteCompilerBuildLine(source, deps, order_only_dep, tool_type,
« no previous file with comments | « tools/gn/misc/vim/syntax/gn.vim ('k') | tools/gn/substitution_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698