This is an archive of the discontinued LLVM Phabricator instance.

[gn] Tag unneeded variable.
ClosedPublic

Authored by bryant on Jul 12 2019, 2:32 AM.

Details

Reviewers
thakis
phosek
Summary

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.

Diff Detail

Event Timeline

bryant created this revision.Jul 12 2019, 2:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2019, 2:32 AM
thakis accepted this revision.Jul 12 2019, 4:57 AM

Thanks!

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

nit: I'd keep the loop out of the if and do

  if (all_targets == []) {
    not_needed(invoker, [ "value" ])
  }
``

after the loop instead.
This revision is now accepted and ready to land.Jul 12 2019, 4:57 AM
bryant updated this revision to Diff 209471.Jul 12 2019, 6:05 AM

Moved for-loop out of branch.

bryant marked an inline comment as done.Jul 12 2019, 6:06 AM
thakis accepted this revision.Jul 12 2019, 10:27 AM

lgtm, thanks. Do you need someone to land this?

I checked this in at https://reviews.llvm.org/rL365897 but made a copy-paste mistake that referenced https://reviews.llvm.org/D31727 in the commit message instead of this differential. ):

thakis closed this revision.Jul 13 2019, 6:19 PM