When type/function is defined in the middle of the file, previuosly we
would sometimes insert a "using" line before that definition, leading to
a compilation error. With this fix, we pick a point after such
definition in translation unit.
This is not perfect solution. For example, it still doesn't handle
"using namespace" directives. It is, however, a significant improvement.
why not check for this below? as usings are sorted, we expect LastUsingLoc to be after this point. so maybe change the if below to:
if(LastUsingLoc.isValid() && (!MustInsertAfterLoc.isValid() || SM.isBeforeInTranslationUnit(MustInsertAfterLoc, LastUsingLoc)))