CommandLineArguments TranslationUnit::commandLineArguments() const { return CommandLineArguments(d->filePath.constData(), d->projectPart.arguments(), d->fileArguments, isVerboseModeEnabled()); }
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(); } }
CommandLineArguments TranslationUnitUpdater::commandLineArguments() const { return CommandLineArguments(m_in.filePath.constData(), m_in.projectArguments, m_in.fileArguments, isVerboseModeEnabled()); }
void TranslationUnitUpdater::createIndexIfNeeded() { if (!m_cxIndex) { const bool displayDiagnostics = isVerboseModeEnabled(); m_cxIndex = clang_createIndex(1, displayDiagnostics); } }
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; } } }
CXIndex TranslationUnit::index() const { checkIfNull(); if (!d->index) { const bool displayDiagnostics = isVerboseModeEnabled(); d->index = clang_createIndex(1, displayDiagnostics); } return d->index; }