r363475 - Fixed the --print-supported-cpus test
Author: ziangwan725 Date: Fri Jun 14 16:34:40 2019 New Revision: 363475 URL: http://llvm.org/viewvc/llvm-project?rev=363475&view=rev Log: Fixed the --print-supported-cpus test Add constraints for the test that require specific backend targets to be registered. Remove trailing whitespace in the doc. Differential Revision: https://reviews.llvm.org/D63105 Modified: cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/test/Driver/print-supported-cpus.c Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=363475&r1=363474&r2=363475&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Fri Jun 14 16:34:40 2019 @@ -326,8 +326,8 @@ number of cross compilers, or may only s .. option:: --print-supported-cpus - Print out a list of supported processors for the given target (specified - through --target= or -arch ). If no target is + Print out a list of supported processors for the given target (specified + through --target= or -arch ). If no target is specified, the system default target will be used. .. option:: -march= Modified: cfe/trunk/test/Driver/print-supported-cpus.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-supported-cpus.c?rev=363475&r1=363474&r2=363475&view=diff == --- cfe/trunk/test/Driver/print-supported-cpus.c (original) +++ cfe/trunk/test/Driver/print-supported-cpus.c Fri Jun 14 16:34:40 2019 @@ -1,5 +1,6 @@ // Test that the --print-supported-cpus flag works +// REQUIRES: x86-registered-target // RUN: %clang --target=x86_64-unknown-linux-gnu \ // RUN: --print-supported-cpus 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-X86 @@ -7,6 +8,7 @@ // CHECK-X86: corei7 // CHECK-X86: Use -mcpu or -mtune to specify the target's processor. +// REQUIRES: arm-registered-target // RUN: %clang --target=arm-unknown-linux-android \ // RUN: --print-supported-cpus 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-ARM ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r363464 - Add --print-supported-cpus flag for clang.
Author: ziangwan725 Date: Fri Jun 14 14:42:21 2019 New Revision: 363464 URL: http://llvm.org/viewvc/llvm-project?rev=363464&view=rev Log: Add --print-supported-cpus flag for clang. This patch allows clang users to print out a list of supported CPU models using clang [--target=] --print-supported-cpus Then, users can select the CPU model to compile to using clang --target= -mcpu= a.c It is a handy feature to help cross compilation. Added: cfe/trunk/test/Driver/print-supported-cpus.c Modified: cfe/trunk/docs/ClangCommandLineReference.rst cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/include/clang/Frontend/FrontendOptions.h cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/tools/driver/cc1_main.cpp Modified: cfe/trunk/docs/ClangCommandLineReference.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=363464&r1=363463&r2=363464&view=diff == --- cfe/trunk/docs/ClangCommandLineReference.rst (original) +++ cfe/trunk/docs/ClangCommandLineReference.rst Fri Jun 14 14:42:21 2019 @@ -610,6 +610,10 @@ C++ standard library to use Generate code for the given target +.. option:: --print-supported-cpus + +Print supported cpu models for the given target + .. option:: -time Time individual commands Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=363464&r1=363463&r2=363464&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Fri Jun 14 14:42:21 2019 @@ -324,6 +324,12 @@ number of cross compilers, or may only s When building for iPhone OS, specify the minimum version supported by your application. +.. option:: --print-supported-cpus + + Print out a list of supported processors for the given target (specified + through --target= or -arch ). If no target is + specified, the system default target will be used. + .. option:: -march= Specify that Clang should generate code for a specific processor family Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=363464&r1=363463&r2=363464&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 14 14:42:21 2019 @@ -2632,6 +2632,10 @@ def : Separate<["--"], "no-system-header def s : Flag<["-"], "s">, Group; def target : Joined<["--"], "target=">, Flags<[DriverOption, CoreOption]>, HelpText<"Generate code for the given target">; +def _print_supported_cpus : Flag<["-", "--"], "print-supported-cpus">, + Group, Flags<[CC1Option, CoreOption]>, + HelpText<"Print supported cpu models for the given target (if target is not specified," + " it will print the supported cpus for the default target)">; def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>, HelpText<"Use the gcc toolchain at the given directory">; def time : Flag<["-"], "time">, Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=363464&r1=363463&r2=363464&view=diff == --- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original) +++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Fri Jun 14 14:42:21 2019 @@ -260,6 +260,9 @@ public: /// Show timers for individual actions. unsigned ShowTimers : 1; + /// print the supported cpus for the current target + unsigned PrintSupportedCPUs : 1; + /// Output time trace profile. unsigned TimeTrace : 1; Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=363464&r1=363463&r2=363464&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 14 14:42:21 2019 @@ -1671,7 +1671,8 @@ bool Driver::HandleImmediateArgs(const C } if (C.getArgs().hasArg(options::OPT_v) || - C.getArgs().hasArg(options::OPT__HASH_HASH_HASH)) { + C.getArgs().hasArg(options::OPT__HASH_HASH_HASH) || + C.getArgs().hasArg(options::OPT__print_supported_cpus)) { PrintVersion(C, llvm::errs()); SuppressMissingInputWarning = true; } @@ -3375,6 +3376,17 @@ void Driver::BuildActions(Compilation &C Args.ClaimAllArgs(options::OPT_cl_compile_Group); } + // If the use specify --print-supported-cpus, clang will only print out + // supported cpu names without doing c
r366972 - [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss
Author: ziangwan725 Date: Wed Jul 24 17:32:50 2019 New Revision: 366972 URL: http://llvm.org/viewvc/llvm-project?rev=366972&view=rev Log: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss Issue an warning when the code tries to do an implicit int -> float conversion, where the float type ha a narrower significant than the float type. The new warning is controlled by flag -Wimplicit-int-float-conversion, under -Wimplicit-float-conversion and -Wconversion. Differential Revision: https://reviews.llvm.org/D64666 Added: cfe/trunk/test/Sema/implicit-int-float-conversion.c Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/Sema/conversion.c cfe/trunk/test/Sema/ext_vector_casts.c Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=366972&r1=366971&r2=366972&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Jul 24 17:32:50 2019 @@ -62,7 +62,8 @@ def BoolConversion : DiagGroup<"bool-con def IntConversion : DiagGroup<"int-conversion">; def EnumConversion : DiagGroup<"enum-conversion">; def ImplicitIntConversion : DiagGroup<"implicit-int-conversion">; -def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion">; +def ImplicitIntFloatConversion : DiagGroup<"implicit-int-float-conversion">; +def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion", [ImplicitIntFloatConversion]>; def ImplicitFixedPointConversion : DiagGroup<"implicit-fixed-point-conversion">; def FloatOverflowConversion : DiagGroup<"float-overflow-conversion">; Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=366972&r1=366971&r2=366972&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 24 17:32:50 2019 @@ -3271,6 +3271,14 @@ def warn_impcast_float_integer : Warning "implicit conversion turns floating-point number into integer: %0 to %1">, InGroup, DefaultIgnore; +// Implicit int -> float conversion precision loss warnings. +def warn_impcast_integer_float_precision : Warning< + "implicit conversion from %0 to %1 may lose precision">, + InGroup, DefaultIgnore; +def warn_impcast_integer_float_precision_constant : Warning< + "implicit conversion from %2 to %3 changes value from %0 to %1">, + InGroup; + def warn_impcast_float_to_integer : Warning< "implicit conversion from %0 to %1 changes value from %2 to %3">, InGroup, DefaultIgnore; Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=366972&r1=366971&r2=366972&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 24 17:32:50 2019 @@ -11400,6 +11400,55 @@ CheckImplicitConversion(Sema &S, Expr *E } } + // If we are casting an integer type to a floating point type, we might + // lose accuracy if the floating point type has a narrower significand + // than the integer type. Issue warnings for that accuracy loss. + if (SourceBT && TargetBT && SourceBT->isIntegerType() && + TargetBT->isFloatingType()) { +// Determine the number of precision bits in the source integer type. +IntRange SourceRange = GetExprRange(S.Context, E, S.isConstantEvaluated()); +unsigned int SourcePrecision = SourceRange.Width; + +// Determine the number of precision bits in the +// target floating point type. +unsigned int TargetPrecision = llvm::APFloatBase::semanticsPrecision( + S.Context.getFloatTypeSemantics(QualType(TargetBT, 0))); + +if (SourcePrecision > 0 && TargetPrecision > 0 && +SourcePrecision > TargetPrecision) { + + llvm::APSInt SourceInt; + if (E->isIntegerConstantExpr(SourceInt, S.Context)) { +// If the source integer is a constant, convert it to the target +// floating point type. Issue a warning if the value changes +// during the whole conversion. +llvm::APFloat TargetFloatValue( + S.Context.getFloatTypeSemantics(QualType(TargetBT, 0))); +llvm::APFloat::opStatus ConversionStatus = + TargetFloatValue.convertFromAPInt(SourceInt, + SourceBT->isSignedInteger(), llvm::APFloat::rmNearestTiesToEven); + +if (ConversionStatus != llvm::APFloat::opOK) { + std::string PrettySourceValue = SourceInt.toString(1
r367497 - [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss
Author: ziangwan725 Date: Wed Jul 31 17:16:43 2019 New Revision: 367497 URL: http://llvm.org/viewvc/llvm-project?rev=367497&view=rev Log: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss Issue an warning when the code tries to do an implicit int -> float conversion, where the float type ha a narrower significant than the float type. The new warning is controlled by flag -Wimplicit-int-float-conversion, under -Wimplicit-float-conversion and -Wconversion. It is also silenced when c++11 narrowing warning is issued. Differential Revision: https://reviews.llvm.org/D64666 Added: cfe/trunk/test/Sema/implicit-int-float-conversion.c cfe/trunk/test/Sema/implicit-int-float-narrowing.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/Sema/conversion.c cfe/trunk/test/Sema/ext_vector_casts.c Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=367497&r1=367496&r2=367497&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Jul 31 17:16:43 2019 @@ -62,7 +62,8 @@ def BoolConversion : DiagGroup<"bool-con def IntConversion : DiagGroup<"int-conversion">; def EnumConversion : DiagGroup<"enum-conversion">; def ImplicitIntConversion : DiagGroup<"implicit-int-conversion">; -def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion">; +def ImplicitIntFloatConversion : DiagGroup<"implicit-int-float-conversion">; +def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion", [ImplicitIntFloatConversion]>; def ImplicitFixedPointConversion : DiagGroup<"implicit-fixed-point-conversion">; def FloatOverflowConversion : DiagGroup<"float-overflow-conversion">; Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=367497&r1=367496&r2=367497&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 31 17:16:43 2019 @@ -3266,6 +3266,14 @@ def warn_impcast_float_integer : Warning "implicit conversion turns floating-point number into integer: %0 to %1">, InGroup, DefaultIgnore; +// Implicit int -> float conversion precision loss warnings. +def warn_impcast_integer_float_precision : Warning< + "implicit conversion from %0 to %1 may lose precision">, + InGroup, DefaultIgnore; +def warn_impcast_integer_float_precision_constant : Warning< + "implicit conversion from %2 to %3 changes value from %0 to %1">, + InGroup; + def warn_impcast_float_to_integer : Warning< "implicit conversion from %0 to %1 changes value from %2 to %3">, InGroup, DefaultIgnore; Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=367497&r1=367496&r2=367497&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 31 17:16:43 2019 @@ -10200,7 +10200,8 @@ static bool IsSameFloatAfterCast(const A IsSameFloatAfterCast(value.getComplexFloatImag(), Src, Tgt)); } -static void AnalyzeImplicitConversions(Sema &S, Expr *E, SourceLocation CC); +static void AnalyzeImplicitConversions(Sema &S, Expr *E, SourceLocation CC, + bool IsListInit = false); static bool IsEnumConstOrFromMacro(Sema &S, Expr *E) { // Suppress cases where we are comparing against an enum constant. @@ -11161,9 +11162,10 @@ static bool isObjCSignedCharBool(Sema &S S.getLangOpts().ObjC && S.NSAPIObj->isObjCBOOLType(Ty); } -static void -CheckImplicitConversion(Sema &S, Expr *E, QualType T, SourceLocation CC, -bool *ICContext = nullptr) { +static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, +SourceLocation CC, +bool *ICContext = nullptr, +bool IsListInit = false) { if (E->isTypeDependent() || E->isValueDependent()) return; const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr(); @@ -11405,6 +11407,54 @@ CheckImplicitConversion(Sema &S, Expr *E } } + // If we are casting an integer type to a floating point type without + // initialization-list syntax, we might lose accuracy if the floating + // point type has a narrower significand than the integer type. + if (SourceBT && TargetBT && SourceBT->isIntegerType() &&
r367502 - [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss
Author: ziangwan725 Date: Wed Jul 31 18:39:21 2019 New Revision: 367502 URL: http://llvm.org/viewvc/llvm-project?rev=367502&view=rev Log: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss Fix one test case for it to be system-independent. Modified: cfe/trunk/test/Sema/implicit-int-float-conversion.c Modified: cfe/trunk/test/Sema/implicit-int-float-conversion.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-int-float-conversion.c?rev=367502&r1=367501&r2=367502&view=diff == --- cfe/trunk/test/Sema/implicit-int-float-conversion.c (original) +++ cfe/trunk/test/Sema/implicit-int-float-conversion.c Wed Jul 31 18:39:21 2019 @@ -8,13 +8,8 @@ void testAssignment() { float f = 22; double b = L; -#ifndef __ILP32__ - float ff = L;// expected-warning {{implicit conversion from 'long' to 'float' changes value from to 1312}} - float = UL; // expected-warning {{implicit conversion from 'unsigned long' to 'float' changes value from to 1312}} -#else - float ff = L;// expected-warning {{implicit conversion from 'long long' to 'float' changes value from to 1312}} - float = UL; // expected-warning {{implicit conversion from 'unsigned long long' to 'float' changes value from to 1312}} -#endif + float ff = L;// expected-warning {{changes value from to 1312}} + float = UL; // expected-warning {{changes value from to 1312}} long l = L; float fff = l; // expected-warning {{implicit conversion from 'long' to 'float' may lose precision}} @@ -23,11 +18,7 @@ void testAssignment() { void testExpression() { float a = 0.0f; -#ifndef __ILP32__ - float b = L + a; // expected-warning {{implicit conversion from 'long' to 'float' changes value from to 1312}} -#else - float b = L + a; // expected-warning {{implicit conversion from 'long long' to 'float' changes value from to 1312}} -#endif + float b = L + a; // expected-warning {{changes value from to 1312}} float g = + ; float c = + 2223; // expected-warning {{implicit conversion from 'int' to 'float' changes value from 4445 to }} @@ -42,11 +33,7 @@ void testExpression() { void testCNarrowing() { // Since this is a C file. C++11 narrowing is not in effect. // In this case, we should issue warnings. -#ifndef __ILP32__ - float a = {L}; // expected-warning {{implicit conversion from 'long' to 'float' changes value from to 1312}} -#else - float a = {L}; // expected-warning {{implicit conversion from 'long long' to 'float' changes value from to 1312}} -#endif + float a = {L}; // expected-warning {{changes value from to 1312}} long b = L; float c = {b}; // expected-warning {{implicit conversion from 'long' to 'float' may lose precision}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r364362 - print-supported-cpus quality of life patch.
Author: ziangwan725 Date: Tue Jun 25 16:57:14 2019 New Revision: 364362 URL: http://llvm.org/viewvc/llvm-project?rev=364362&view=rev Log: print-supported-cpus quality of life patch. Claim all input files so that clang does not give a warning. Add two short-cut aliases: -mcpu=? and -mtune=?. Modified: cfe/trunk/docs/ClangCommandLineReference.rst cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/print-supported-cpus.c Modified: cfe/trunk/docs/ClangCommandLineReference.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=364362&r1=364361&r2=364362&view=diff == --- cfe/trunk/docs/ClangCommandLineReference.rst (original) +++ cfe/trunk/docs/ClangCommandLineReference.rst Tue Jun 25 16:57:14 2019 @@ -2168,6 +2168,8 @@ Link stack frames through backchain on S .. option:: -mcpu=, -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to -mcpu=hexagonv62), -mv65 (equivalent to -mcpu=hexagonv65) +Use -mcpu=? to see a list of supported cpu models. + .. option:: -mcrc, -mno-crc Allow use of CRC instructions (ARM/Mips only) @@ -2302,6 +2304,8 @@ The thread model to use, e.g. posix, sin .. option:: -mtune= +Use -mtune=? to see a list of supported cpu models. + .. option:: -mtvos-version-min=, -mappletvos-version-min= .. option:: -municode Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=364362&r1=364361&r2=364362&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Tue Jun 25 16:57:14 2019 @@ -330,6 +330,10 @@ number of cross compilers, or may only s through --target= or -arch ). If no target is specified, the system default target will be used. +.. option:: -mcpu=?, -mtune=? + + Aliases of --print-supported-cpus + .. option:: -march= Specify that Clang should generate code for a specific processor family Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=364362&r1=364361&r2=364362&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Tue Jun 25 16:57:14 2019 @@ -2648,6 +2648,8 @@ def _print_supported_cpus : Flag<["-", " Group, Flags<[CC1Option, CoreOption]>, HelpText<"Print supported cpu models for the given target (if target is not specified," " it will print the supported cpus for the default target)">; +def mcpu_EQ_QUESTION : Flag<["-"], "mcpu=?">, Alias<_print_supported_cpus>; +def mtune_EQ_QUESTION : Flag<["-"], "mtune=?">, Alias<_print_supported_cpus>; def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>, HelpText<"Use the gcc toolchain at the given directory">; def time : Flag<["-"], "time">, Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=364362&r1=364361&r2=364362&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Tue Jun 25 16:57:14 2019 @@ -3377,15 +3377,21 @@ void Driver::BuildActions(Compilation &C Args.ClaimAllArgs(options::OPT_cl_compile_Group); } - // If the use specify --print-supported-cpus, clang will only print out - // supported cpu names without doing compilation. + // if the user specify --print-supported-cpus, or use -mcpu=?, or use + // -mtune=? (aliases), clang will only print out supported cpu names + // without doing compilation. if (Arg *A = Args.getLastArg(options::OPT__print_supported_cpus)) { -Actions.clear(); // the compilation now has only two phases: Input and Compile // use the --prints-supported-cpus flag as the dummy input to cc1 +Actions.clear(); Action *InputAc = C.MakeAction(*A, types::TY_C); Actions.push_back( C.MakeAction(InputAc, types::TY_Nothing)); +// claim all the input files to prevent argument unused warnings +for (auto &I : Inputs) { + const Arg *InputArg = I.second; + InputArg->claim(); +} } // Claim ignored clang-cl options. Modified: cfe/trunk/test/Driver/print-supported-cpus.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-supported-cpus.c?rev=364362&r1=364361&r2=364362&view=diff == --- cfe/trunk/test/Driver/print-supported-cpus.c (original) +++ cfe/trunk/test/Driver/print-suppor