本文整理汇总了C++中IndexedString::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ IndexedString::isEmpty方法的具体用法?C++ IndexedString::isEmpty怎么用?C++ IndexedString::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IndexedString
的用法示例。
在下文中一共展示了IndexedString::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: quickOpenDeclaration
void QuickOpenPlugin::quickOpenDeclaration()
{
if(jumpToSpecialObject())
return;
KDevelop::DUChainReadLocker lock( DUChain::lock() );
Declaration* decl = cursorDeclaration();
if(!decl) {
qCDebug(PLUGIN_QUICKOPEN) << "Found no declaration for cursor, cannot jump";
return;
}
decl->activateSpecialization();
IndexedString u = decl->url();
KTextEditor::Cursor c = decl->rangeInCurrentRevision().start();
if(u.isEmpty()) {
qCDebug(PLUGIN_QUICKOPEN) << "Got empty url for declaration" << decl->toString();
return;
}
lock.unlock();
core()->documentController()->openDocument(u.toUrl(), c);
}
示例2: visitUnaryExpression
void UseBuilder::visitUnaryExpression( UnaryExpressionAst* node )
{
IndexedString includeFile = getIncludeFileForNode(node, m_editor);
if ( !includeFile.isEmpty() ) {
QualifiedIdentifier identifier(includeFile.str());
DUChainWriteLocker lock(DUChain::lock());
foreach ( Declaration* dec, currentContext()->topContext()->findDeclarations(identifier) ) {
if ( dec->kind() == Declaration::Import ) {
newUse(node->includeExpression, DeclarationPointer(dec));
return;
}
}
}
示例3: buildDUChain
ReferencedTopDUContext ClangHelpers::buildDUChain(CXFile file, const Imports& imports, const ParseSession& session,
TopDUContext::Features features, IncludeFileContexts& includedFiles,
ClangIndex* index)
{
if (includedFiles.contains(file)) {
return {};
}
// prevent recursion
includedFiles.insert(file, {});
// ensure DUChain for imports are build properly
foreach(const auto& import, imports.values(file)) {
buildDUChain(import.file, imports, session, features, includedFiles, index);
}
const IndexedString path(QDir(ClangString(clang_getFileName(file)).toString()).canonicalPath());
if (path.isEmpty()) {
// may happen when the file gets removed before the job is run
return {};
}
const auto& environment = session.environment();
bool update = false;
UrlParseLock urlLock(path);
ReferencedTopDUContext context;
{
DUChainWriteLocker lock;
context = DUChain::self()->chainForDocument(path, &environment);
if (!context) {
context = ::createTopContext(path, environment);
} else {
update = true;
}
includedFiles.insert(file, context);
if (update) {
auto envFile = ClangParsingEnvironmentFile::Ptr(dynamic_cast<ClangParsingEnvironmentFile*>(context->parsingEnvironmentFile().data()));
Q_ASSERT(envFile);
if (!envFile->needsUpdate(&environment) && envFile->featuresSatisfied(features)) {
return context;
} else {
//TODO: don't attempt to update if this environment is worse quality than the outdated one
if (index && envFile->environmentQuality() < environment.quality()) {
index->pinTranslationUnitForUrl(environment.translationUnitUrl(), path);
}
envFile->setEnvironment(environment);
envFile->setModificationRevision(ModificationRevision::revisionForFile(context->url()));
}
context->clearImportedParentContexts();
}
context->setFeatures(features);
foreach(const auto& import, imports.values(file)) {
Q_ASSERT(includedFiles.contains(import.file));
auto ctx = includedFiles.value(import.file);
if (!ctx) {
// happens for cyclic imports
continue;
}
context->addImportedParentContext(ctx, import.location);
}
context->updateImportsCache();
}
const auto problems = session.problemsForFile(file);
{
DUChainWriteLocker lock;
context->setProblems(problems);
}
Builder::visit(session.unit(), file, includedFiles, update);
return context;
}
示例4: buildDUChain
ReferencedTopDUContext ClangHelpers::buildDUChain(CXFile file, const Imports& imports, const ParseSession& session,
TopDUContext::Features features, IncludeFileContexts& includedFiles,
ClangIndex* index, const std::function<bool()>& abortFunction)
{
if (includedFiles.contains(file)) {
return {};
}
if (abortFunction && abortFunction()) {
return {};
}
// prevent recursion
includedFiles.insert(file, {});
// ensure DUChain for imports are build properly
foreach(const auto& import, imports.values(file)) {
buildDUChain(import.file, imports, session, features, includedFiles, index, abortFunction);
}
const IndexedString path(QDir(ClangString(clang_getFileName(file)).toString()).canonicalPath());
if (path.isEmpty()) {
// may happen when the file gets removed before the job is run
return {};
}
const auto& environment = session.environment();
bool update = false;
UrlParseLock urlLock(path);
ReferencedTopDUContext context;
{
DUChainWriteLocker lock;
context = DUChain::self()->chainForDocument(path, &environment);
if (!context) {
context = ::createTopContext(path, environment);
} else {
update = true;
}
includedFiles.insert(file, context);
if (update) {
auto envFile = ClangParsingEnvironmentFile::Ptr(dynamic_cast<ClangParsingEnvironmentFile*>(context->parsingEnvironmentFile().data()));
Q_ASSERT(envFile);
if (!envFile)
return context;
/* NOTE: When we are here, then either the translation unit or one of its headers was changed.
* Thus we must always update the translation unit to propagate the change(s).
* See also: https://bugs.kde.org/show_bug.cgi?id=356327
* This assumes that headers are independent, we may need to improve that in the future
* and also update header files more often when other files included therein got updated.
*/
if (path != environment.translationUnitUrl() && !envFile->needsUpdate(&environment) && envFile->featuresSatisfied(features)) {
return context;
} else {
//TODO: don't attempt to update if this environment is worse quality than the outdated one
if (index && envFile->environmentQuality() < environment.quality()) {
index->pinTranslationUnitForUrl(environment.translationUnitUrl(), path);
}
envFile->setEnvironment(environment);
envFile->setModificationRevision(ModificationRevision::revisionForFile(context->url()));
}
context->clearImportedParentContexts();
}
context->setFeatures(features);
foreach(const auto& import, imports.values(file)) {
auto ctx = includedFiles.value(import.file);
if (!ctx) {
// happens for cyclic imports
continue;
}
context->addImportedParentContext(ctx, import.location);
}
context->updateImportsCache();
}
const auto problems = session.problemsForFile(file);
{
DUChainWriteLocker lock;
context->setProblems(problems);
}
Builder::visit(session.unit(), file, includedFiles, update);
DUChain::self()->emitUpdateReady(path, context);
return context;
}