More hacking on mapDiagnosticRanges to make it handle more cases.
This still isn't quite right, but it fixes a crash. I factored out findCommonParent because we need it on the result of getImmediateExpansionRange: for a function macro, the beginning and end of an expansion range can come out of different macros/macro arguments, which means the resulting range is a complete mess to handle consistently. I also made some changes to how findCommonParent works; it works somewhat better in some cases, and somewhat worse in others, but I think overall it's a better balance. I'm coming to the conclusion that mapDiagnosticRanges isn't using the right algorithm, though: chasing the caret is fundamentally more complicated than any algorithm which only considers one FileID for the caret can handle because each SourceLocation doesn't really have a single parent. We need to follow the same path of choosing expansion locations and spelling locations which the caret used to come up with the correct range in the general case. Fixes <rdar://problem/12847524>. llvm-svn: 170049
Loading
Please register or sign in to comment