HomePhabricator

[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names

Authored by kadircet on Aug 1 2020, 9:55 AM.

Description

[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names

The logic was using incorrect flag versions. For example:

  • -target= can't be a prefix, it must be --target=.
  • --driver-mode can't appear on its own, value must be attached to it.

While fixing those, also changes the append logic to make use of new
--target=X format instead of the legacy -target X version.

In addition to that makes use of the OPTTable instead of hardcoded strings to
make sure helper also gets updated if clang's options are modified.

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