コード例 #1
0
CommandLineArguments TranslationUnit::commandLineArguments() const
{
    return CommandLineArguments(d->filePath.constData(),
                                d->projectPart.arguments(),
                                d->fileArguments,
                                isVerboseModeEnabled());
}
コード例 #2
0
void TranslationUnit::createTranslationUnitIfNeeded() const
{
    if (!d->translationUnit) {
        d->translationUnit = CXTranslationUnit();

        const auto args = commandLineArguments();
        if (isVerboseModeEnabled())
            args.print();

        CXErrorCode errorCode = clang_parseTranslationUnit2(index(),
                                                            NULL,
                                                            args.data(),
                                                            args.count(),
                                                            unsavedFiles().cxUnsavedFiles(),
                                                            unsavedFiles().count(),
                                                            defaultOptions(),
                                                            &d->translationUnit);

        checkTranslationUnitErrorCode(errorCode);

        updateIncludeFilePaths();

        updateLastProjectPartChangeTimePoint();
    }
}
コード例 #3
0
CommandLineArguments TranslationUnitUpdater::commandLineArguments() const
{
    return CommandLineArguments(m_in.filePath.constData(),
                                m_in.projectArguments,
                                m_in.fileArguments,
                                isVerboseModeEnabled());
}
コード例 #4
0
void TranslationUnitUpdater::createIndexIfNeeded()
{
    if (!m_cxIndex) {
        const bool displayDiagnostics = isVerboseModeEnabled();
        m_cxIndex = clang_createIndex(1, displayDiagnostics);
    }
}
コード例 #5
0
void TranslationUnitUpdater::createTranslationUnitIfNeeded()
{
    if (!m_cxTranslationUnit) {
        m_cxTranslationUnit = CXTranslationUnit();

        const auto args = commandLineArguments();
        if (isVerboseModeEnabled())
            args.print();

        UnsavedFilesShallowArguments unsaved = m_in.unsavedFiles.shallowArguments();

        m_parseErrorCode = clang_parseTranslationUnit2(m_cxIndex,
                                                     NULL,
                                                     args.data(),
                                                     args.count(),
                                                     unsaved.data(),
                                                     unsaved.count(),
                                                     defaultParseOptions(),
                                                     &m_cxTranslationUnit);



        if (parseWasSuccessful()) {
            updateIncludeFilePaths();
            m_out.parseTimePoint = Clock::now();
        } else {
            qWarning() << "Parsing" << m_in.filePath << "failed:"
                       << errorCodeToText(m_parseErrorCode);
            m_out.hasParseOrReparseFailed = true;
        }
    }
}
コード例 #6
0
CXIndex TranslationUnit::index() const
{
    checkIfNull();

    if (!d->index) {
        const bool displayDiagnostics = isVerboseModeEnabled();
        d->index = clang_createIndex(1, displayDiagnostics);
    }

    return d->index;
}