Index: include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- include/clang/Basic/DiagnosticDriverKinds.td +++ include/clang/Basic/DiagnosticDriverKinds.td @@ -230,6 +230,8 @@ "The last /TC or /TP option takes precedence over earlier instances">; def note_drv_address_sanitizer_debug_runtime : Note< "AddressSanitizer doesn't support linking with debug runtime libraries yet">; +def note_drv_supported_values : Note<"supported values are:">; +def note_drv_supported_value_with_description : Note<" %0 - %1">; def err_analyzer_config_no_value : Error< "analyzer-config option '%0' has a key but no value">; Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -1694,10 +1694,21 @@ .Case(alias, LangStandard::lang_##id) #include "clang/Frontend/LangStandards.def" .Default(LangStandard::lang_unspecified); - if (LangStd == LangStandard::lang_unspecified) + if (LangStd == LangStandard::lang_unspecified) { Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << A->getValue(); - else { + // Report all supported standards with description. + Diags.Report(diag::note_drv_supported_values); + for (unsigned KindValue = 0; + KindValue != LangStandard::lang_unspecified; + ++KindValue) + { + const LangStandard &Std = LangStandard::getLangStandardForKind( + static_cast(KindValue)); + Diags.Report(diag::note_drv_supported_value_with_description) + << Std.getName() << Std.getDescription(); + } + } else { // Valid standard, check to make sure language and standard are // compatible. const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);