]> granicus.if.org Git - llvm/commitdiff
[gn] Tag unneeded variable.
authorBryant Wong <llvm-commits@xorshift.org>
Fri, 12 Jul 2019 13:09:39 +0000 (13:09 +0000)
committerBryant Wong <llvm-commits@xorshift.org>
Fri, 12 Jul 2019 13:09:39 +0000 (13:09 +0000)
When only building targets without assembly parsers (e.g. `llvm_targets_to_build
= ["NVPTX"]`), `all_targets` is empty and causes GN to warn about an
assigned-but-unused variable.

Differential Revision: https://reviews.llvm.org/D31727

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365897 91177308-0d34-0410-b5e6-96231b3b80d8

utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

index 582e3eec7bfe63bb05eecbb017731d08d36fa116..f09d8a29ef4f0f57a699ab528cb3a77ab043ff3f 100644 (file)
@@ -383,6 +383,9 @@ template("write_target_def_file") {
     foreach(target, all_targets) {
       value = "$value${invoker.value}($target)\n"
     }
+    if (all_targets == []) {
+      not_needed(invoker, [ "value" ])
+    }
     values = [ "${invoker.key}=$value" ]
   }
 }