void popLocation() {
PathDiagnosticLocation L = CLocs.back();
- if (L.asLocation().isFileID()) rawAddEdge(CLocs.back());
+ if (L.asLocation().isFileID()) {
+ // For contexts, we only one the first character as the range.
+ L = PathDiagnosticLocation(L.asLocation(), L.getManager());
+ rawAddEdge(CLocs.back());
+ }
CLocs.pop_back();
}
// Context does not contain the location. Flush it.
popLocation();
}
+
+ // If we reach here, there is no enclosing context. Just add the edge.
+ rawAddEdge(NewLoc);
}
void EdgeBuilder::addContext(const Stmt *S) {