In case user specified non-existent warning flag clang was suggesting an existing on that was in some cased very different. This patch should ensure that either a relevant warning flag is suggested or none (which is in line with unknown generic command line option handling).
Examples: warning: unknown warning option '-Whiskey'; did you mean '-Wpacked'? warning: unknown warning option '-Weverthin'; did you mean '-Wsection'? rdar://problem/37755482
I changed interface of DiagnosticIDs::getNearestOption() to return the edit distance between nonexistent flag and the closest exiting one. In principle this code is analogous to OptTable::findNearest() for generic command line options but I don't find them similar enough in order to factor out some shared implementation. I tentatively selected maximum edit distance as 2 (CompilerInvocation::CreateFromArgs() uses maximum edit distance of 1 for generic case).
Do we a test case that covers this line?