static Document::Ptr getParsedDocument(const QString &fileName, CppModelManagerInterface::WorkingCopy &workingCopy, Snapshot &snapshot)
{
    QString src;
    if (workingCopy.contains(fileName)) {
        src = workingCopy.source(fileName);
    } else {
        QFile file(fileName);
        if (file.open(QFile::ReadOnly))
            src = QTextStream(&file).readAll(); // ### FIXME
    }

    QByteArray source = snapshot.preprocessedCode(src, fileName);

    Document::Ptr doc = snapshot.documentFromSource(source, fileName);
    doc->check();
    snapshot.insert(doc);
    return doc;
}