Index: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp =================================================================== --- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp +++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp @@ -245,19 +245,27 @@ void emitOptionName(StringRef Prefix, const Record *Option, raw_ostream &OS) { // Find the arguments to list after the option. unsigned NumArgs = getNumArgsForKind(Option->getValueAsDef("Kind"), Option); + bool HasMetaVarName = !Option->isValueUnset("MetaVarName"); std::vector Args; - if (!Option->isValueUnset("MetaVarName")) + if (HasMetaVarName) Args.push_back(Option->getValueAsString("MetaVarName")); else if (NumArgs == 1) Args.push_back(""); - while (Args.size() < NumArgs) { - Args.push_back(("").str()); - // Use '--args ...' if any number of args are allowed. - if (Args.size() == 2 && NumArgs == UnlimitedArgs) { - Args.back() += "..."; - break; + // Fill up arguments if this option didn't provide a meta var name or it + // supports an unlimited number of arguments. We can't see how many arguments + // already are in a meta var name, so assume it has right number. This is + // needed for JoinedAndSeparate options so that there arent't too many + // arguments. + if (!HasMetaVarName || NumArgs == UnlimitedArgs) { + while (Args.size() < NumArgs) { + Args.push_back(("").str()); + // Use '--args ...' if any number of args are allowed. + if (Args.size() == 2 && NumArgs == UnlimitedArgs) { + Args.back() += "..."; + break; + } } }