Index: tools/gn/command_gen.cc |
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc |
index eceb8df09f867c28ed8a45733e8a01b418ee016a..56d3e98524b74a3102b91638a118f03e4e6f24f5 100644 |
--- a/tools/gn/command_gen.cc |
+++ b/tools/gn/command_gen.cc |
@@ -71,18 +71,34 @@ void PrintInvalidGeneratedInput(const Builder* builder, |
const std::vector<const Target*>& targets) { |
std::string err; |
+ // Only show the toolchain labels (which can be confusing) if something |
+ // isn't the default. |
+ bool show_toolchains = false; |
+ const Label& default_toolchain = |
+ targets[0]->settings()->default_toolchain_label(); |
+ for (const Target* target : targets) { |
+ if (target->settings()->toolchain_label() != default_toolchain) { |
+ show_toolchains = true; |
+ break; |
+ } |
+ } |
+ |
+ const Target* generator = FindTargetThatGeneratesFile(builder, file); |
+ if (generator && |
+ generator->settings()->toolchain_label() != default_toolchain) |
+ show_toolchains = true; |
+ |
const std::string target_str = targets.size() > 1 ? "targets" : "target"; |
err += "The file:\n"; |
err += " " + file.value() + "\n"; |
err += "is listed as an input or source for the " + target_str + ":\n"; |
for (const Target* target : targets) |
- err += " " + target->label().GetUserVisibleName(false) + "\n"; |
+ err += " " + target->label().GetUserVisibleName(show_toolchains) + "\n"; |
- const Target* generator = FindTargetThatGeneratesFile(builder, file); |
if (generator) { |
err += "but this file was not generated by any dependencies of the " + |
target_str + ". The target\nthat generates the file is:\n "; |
- err += generator->label().GetUserVisibleName(false); |
+ err += generator->label().GetUserVisibleName(show_toolchains); |
} else { |
err += "but no targets in the build generate that file."; |
} |