Index: cfe/trunk/include/clang/Driver/Options.td =================================================================== --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -2270,7 +2270,14 @@ def static : Flag<["-", "--"], "static">, Flags<[NoArgumentUnused]>; def std_default_EQ : Joined<["-"], "std-default=">; def std_EQ : Joined<["-", "--"], "std=">, Flags<[CC1Option]>, - Group, HelpText<"Language standard to compile for">; + Group, HelpText<"Language standard to compile for">, + ValuesCode<[{ + const char *Values = + #define LANGSTANDARD(id, name, lang, desc, features) name "," + #define LANGSTANDARD_ALIAS(id, alias) alias "," + #include "clang/Frontend/LangStandards.def" + ; + }]>; def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>, HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">; def sub__library : JoinedOrSeparate<["-"], "sub_library">; Index: cfe/trunk/test/Driver/autocomplete.c =================================================================== --- cfe/trunk/test/Driver/autocomplete.c +++ cfe/trunk/test/Driver/autocomplete.c @@ -95,3 +95,5 @@ // NOWARNING: -Wno-invalid-pp-token // RUN: %clang --autocomplete=-analyzer-checker, | FileCheck %s -check-prefix=ANALYZER // ANALYZER: unix.Malloc +// RUN: %clang --autocomplete=-std=, | FileCheck %s -check-prefix=STDVAL +// STDVAL: c99 Index: llvm/trunk/utils/TableGen/OptParserEmitter.cpp =================================================================== --- llvm/trunk/utils/TableGen/OptParserEmitter.cpp +++ llvm/trunk/utils/TableGen/OptParserEmitter.cpp @@ -308,11 +308,11 @@ if (isa(R.getValueInit("ValuesCode"))) continue; OS << "{\n"; + OS << "bool ValuesWereAdded;\n"; OS << R.getValueAsString("ValuesCode"); OS << "\n"; for (const std::string &Pref : R.getValueAsListOfStrings("Prefixes")) { - OS << "bool ValuesWereAdded = "; - OS << "Opt.addValues("; + OS << "ValuesWereAdded = Opt.addValues("; std::string S = (Pref + R.getValueAsString("Name")).str(); write_cstring(OS, S); OS << ", Values);\n";