Add -print-targets to print the registered targets

Differential Revision: https://reviews.llvm.org/D79565
This commit is contained in:
Yaxun (Sam) Liu 2020-04-30 17:41:54 -04:00
parent a1fd188223
commit cf2fb13932
3 changed files with 8 additions and 0 deletions

View File

@ -130,6 +130,7 @@ Modified Compiler Flags
- ``-fno-char8_t`` now disables the ``char8_t`` keyword, not just the use of
``char8_t`` as the character type of ``u8`` literals. This restores the
Clang 8 behavior that regressed in Clang 9 and 10.
- -print-targets has been added to print the registered targets.
New Pragmas in Clang
--------------------

View File

@ -2804,6 +2804,8 @@ def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
HelpText<"Print the resource directory pathname">;
def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
HelpText<"Print the paths used for finding libraries and programs">;
def print_targets : Flag<["-", "--"], "print-targets">,
HelpText<"Print the registered targets">;
def private__bundle : Flag<["-"], "private_bundle">;
def pthreads : Flag<["-"], "pthreads">;
def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>,

View File

@ -1815,6 +1815,11 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
return false;
}
if (C.getArgs().hasArg(options::OPT_print_targets)) {
llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs());
return false;
}
return true;
}