Index: flang/lib/Lower/IntrinsicCall.cpp =================================================================== --- flang/lib/Lower/IntrinsicCall.cpp +++ flang/lib/Lower/IntrinsicCall.cpp @@ -646,7 +646,7 @@ /// lowering rules for an intrinsic need to be provided only if at least one /// argument must not be lowered by value. In which case, the lowering rules /// should be provided for all the intrinsic arguments for completeness. -static constexpr IntrinsicHandler handlers[]{ +static const IntrinsicHandler handlers[]{ {"abs", &I::genAbs}, {"achar", &I::genChar}, {"adjustl", Index: flang/test/Driver/driver-help-hidden.f90 =================================================================== --- flang/test/Driver/driver-help-hidden.f90 +++ flang/test/Driver/driver-help-hidden.f90 @@ -55,7 +55,8 @@ ! CHECK-NEXT: -print-effective-triple Print the effective target triple ! CHECK-NEXT: -print-target-triple Print the normalized target triple ! CHECK-NEXT: -P Disable linemarker output in -E mode -! CHECK-NEXT: -std= Language standard to compile for +! CHECK-NEXT: -std={c89,c90,iso9899:1990,iso9899:199409,gnu89,gnu90,c99,iso9899:1999,c9x,iso9899:199x,gnu99,gnu9x,c11,iso9899:2011,c1x,iso9899:201x,gnu11,gnu1x,c17,iso9899:2017,c18,iso9899:2018,gnu17,gnu18,c2x,gnu2x,c++98,c++03,gnu++98,gnu++03,c++11,c++0x,gnu++11,gnu++0x,c++14,c++1y,gnu++14,gnu++1y,c++17,c++1z,gnu++17,gnu++1z,c++20,c++2a,gnu++20,gnu++2a,c++2b,gnu++2b,cl1.0,cl,cl1.1,cl1.2,cl2.0,cl3.0,clc++1.0,clc++,clc++2021,CL,CL1.1,CL1.2,CL2.0,CL3.0,CLC++,CLC++1.0,CLC++2021,cuda,hip,hlsl,hlsl2015,hlsl2016,hlsl2017,hlsl2018,hlsl2021,hlsl202x,} +! CHECK-NEXT: Language standard to compile for ! CHECK-NEXT: -S Only run preprocess and compilation steps ! CHECK-NEXT: --target= Generate code for the given target ! CHECK-NEXT: -U Undefine macro Index: flang/test/Driver/driver-help.f90 =================================================================== --- flang/test/Driver/driver-help.f90 +++ flang/test/Driver/driver-help.f90 @@ -55,7 +55,8 @@ ! HELP-NEXT: -print-effective-triple Print the effective target triple ! HELP-NEXT: -print-target-triple Print the normalized target triple ! HELP-NEXT: -P Disable linemarker output in -E mode -! HELP-NEXT: -std= Language standard to compile for +! HELP-NEXT: -std={c89,c90,iso9899:1990,iso9899:199409,gnu89,gnu90,c99,iso9899:1999,c9x,iso9899:199x,gnu99,gnu9x,c11,iso9899:2011,c1x,iso9899:201x,gnu11,gnu1x,c17,iso9899:2017,c18,iso9899:2018,gnu17,gnu18,c2x,gnu2x,c++98,c++03,gnu++98,gnu++03,c++11,c++0x,gnu++11,gnu++0x,c++14,c++1y,gnu++14,gnu++1y,c++17,c++1z,gnu++17,gnu++1z,c++20,c++2a,gnu++20,gnu++2a,c++2b,gnu++2b,cl1.0,cl,cl1.1,cl1.2,cl2.0,cl3.0,clc++1.0,clc++,clc++2021,CL,CL1.1,CL1.2,CL2.0,CL3.0,CLC++,CLC++1.0,CLC++2021,cuda,hip,hlsl,hlsl2015,hlsl2016,hlsl2017,hlsl2018,hlsl2021,hlsl202x,} +! HELP-NEXT: Language standard to compile for ! HELP-NEXT: -S Only run preprocess and compilation steps ! HELP-NEXT: --target= Generate code for the given target ! HELP-NEXT: -U Undefine macro @@ -130,7 +131,8 @@ ! HELP-FC1-NEXT: -pedantic Warn on language extensions ! HELP-FC1-NEXT: -plugin Use the named plugin action instead of the default action (use "help" to list available options) ! HELP-FC1-NEXT: -P Disable linemarker output in -E mode -! HELP-FC1-NEXT: -std= Language standard to compile for +! HELP-FC1-NEXT: -std={c89,c90,iso9899:1990,iso9899:199409,gnu89,gnu90,c99,iso9899:1999,c9x,iso9899:199x,gnu99,gnu9x,c11,iso9899:2011,c1x,iso9899:201x,gnu11,gnu1x,c17,iso9899:2017,c18,iso9899:2018,gnu17,gnu18,c2x,gnu2x,c++98,c++03,gnu++98,gnu++03,c++11,c++0x,gnu++11,gnu++0x,c++14,c++1y,gnu++14,gnu++1y,c++17,c++1z,gnu++17,gnu++1z,c++20,c++2a,gnu++20,gnu++2a,c++2b,gnu++2b,cl1.0,cl,cl1.1,cl1.2,cl2.0,cl3.0,clc++1.0,clc++,clc++2021,CL,CL1.1,CL1.2,CL2.0,CL3.0,CLC++,CLC++1.0,CLC++2021,cuda,hip,hlsl,hlsl2015,hlsl2016,hlsl2017,hlsl2018,hlsl2021,hlsl202x,} +! HELP-FC1-NEXT: Language standard to compile for ! HELP-FC1-NEXT: -S Only run preprocess and compilation steps ! HELP-FC1-NEXT: -test-io Run the InputOuputTest action. Use for development and testing only. ! HELP-FC1-NEXT: -triple Specify target triple (e.g. i686-apple-darwin9) Index: llvm/include/llvm/Option/OptTable.h =================================================================== --- llvm/include/llvm/Option/OptTable.h +++ llvm/include/llvm/Option/OptTable.h @@ -127,6 +127,11 @@ return getInfo(id).MetaVar; } + /// Get the values this option can take. + const char *getOptionValues(OptSpecifier id) const { + return getInfo(id).Values; + } + /// Specify the environment variable where initial options should be read. void setInitialOptionsFromEnvironment(const char *E) { EnvVar = E; } Index: llvm/lib/Option/OptTable.cpp =================================================================== --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -570,7 +570,9 @@ case Option::JoinedAndSeparateClass: if (const char *MetaVarName = Opts.getOptionMetaVar(Id)) Name += MetaVarName; - else + else if (const char *Values = Opts.getOptionValues(Id)) { + Name += ("{" + Twine(Values) + "}").str(); + } else Name += ""; break; } Index: llvm/unittests/Option/OptionParsingTest.cpp =================================================================== --- llvm/unittests/Option/OptionParsingTest.cpp +++ llvm/unittests/Option/OptionParsingTest.cpp @@ -94,7 +94,27 @@ std::string Help; raw_string_ostream RSO(Help); T.printHelp(RSO, "test", "title!"); - EXPECT_NE(std::string::npos, Help.find("-A")); + std::string RefHelp = "OVERVIEW: title!\n" + "\n" + "USAGE: test\n" + "\n" + "OPTIONS:\n" + " -A The A option\n" + " --blarn The blarn option\n" + " -blorp The blorp option\n" + " -BB The B option\n" + " /cramb:CRAMB The cramb option\n" + " -C C The C option\n" + " /C C The C option\n" + " -doopf1 The doopf1 option\n" + " -doopf2 The doopf2 option\n" + " -DD The D option\n" + " --ermghERMGH The ermgh option\n" + " --fjormp The fjormp option\n" + " -F F The F option\n" + " -GG The G option\n" + " --with-values={1,2,3} A valuable option\n"; + EXPECT_EQ(Help, RefHelp); // Check usage line. T.printHelp(RSO, "name [options] file...", "title!"); Index: llvm/unittests/Option/Opts.td =================================================================== --- llvm/unittests/Option/Opts.td +++ llvm/unittests/Option/Opts.td @@ -37,6 +37,7 @@ def Doopf2 : Flag<["-"], "doopf2">, HelpText<"The doopf2 option">, Flags<[OptFlag2]>; def Ermgh : Joined<["--"], "ermgh">, HelpText<"The ermgh option">, MetaVarName<"ERMGH">, Flags<[OptFlag1]>; def Fjormp : Flag<["--"], "fjormp">, HelpText<"The fjormp option">, Flags<[OptFlag1]>; +def WithValues : Joined<["--"], "with-values=">, HelpText<"A valuable option">, Flags<[OptFlag1]>, Values<"1,2,3">; def Glorrmp_eq : Flag<["--"], "glorrmp=">;