Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -130,6 +130,7 @@ - ``-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 -------------------- Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -2804,6 +2804,8 @@ 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]>, Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -1815,6 +1815,11 @@ return false; } + if (C.getArgs().hasArg(options::OPT_print_targets)) { + llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs()); + return false; + } + return true; }