Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/clangsupport.cpp
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Line(s) | 335 | { | |||
---|---|---|---|---|---|
337 | DUChainReadLocker lock; | 337 | DUChainReadLocker lock; | ||
338 | if (import.first) { | 338 | if (import.first) { | ||
339 | return qMakePair(import.first->url().toUrl(), KTextEditor::Cursor(0,0)); | 339 | return qMakePair(import.first->url().toUrl(), KTextEditor::Cursor(0,0)); | ||
340 | } | 340 | } | ||
341 | 341 | | |||
342 | return {{}, KTextEditor::Cursor::invalid()}; | 342 | return {{}, KTextEditor::Cursor::invalid()}; | ||
343 | } | 343 | } | ||
344 | 344 | | |||
345 | QWidget* ClangSupport::specialLanguageObjectNavigationWidget(const QUrl &url, const KTextEditor::Cursor& position) | 345 | QPair<QWidget*, KTextEditor::Range> ClangSupport::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position) | ||
346 | { | 346 | { | ||
347 | DUChainReadLocker lock; | 347 | DUChainReadLocker lock; | ||
348 | const QPair<TopDUContextPointer, Use> macroExpansion = macroExpansionForPosition(url, position); | 348 | const QPair<TopDUContextPointer, Use> macroExpansion = macroExpansionForPosition(url, position); | ||
349 | if (macroExpansion.first) { | 349 | if (macroExpansion.first) { | ||
350 | Declaration* declaration = macroExpansion.second.usedDeclaration(macroExpansion.first.data()); | 350 | Declaration* declaration = macroExpansion.second.usedDeclaration(macroExpansion.first.data()); | ||
351 | const MacroDefinition::Ptr macroDefinition(dynamic_cast<MacroDefinition*>(declaration)); | 351 | const MacroDefinition::Ptr macroDefinition(dynamic_cast<MacroDefinition*>(declaration)); | ||
352 | Q_ASSERT(macroDefinition); | 352 | Q_ASSERT(macroDefinition); | ||
353 | auto rangeInRevision = macroExpansion.first->transformFromLocalRevision(macroExpansion.second.m_range.start); | 353 | auto rangeInRevision = macroExpansion.first->transformFromLocalRevision(macroExpansion.second.m_range.start); | ||
354 | return new ClangNavigationWidget(macroDefinition, DocumentCursor(IndexedString(url), rangeInRevision)); | 354 | return { | ||
355 | new ClangNavigationWidget(macroDefinition, DocumentCursor(IndexedString(url), rangeInRevision)), | ||||
356 | macroExpansion.second.m_range.castToSimpleRange() | ||||
357 | }; | ||||
355 | } | 358 | } | ||
356 | 359 | | |||
357 | const QPair<TopDUContextPointer, KTextEditor::Range> import = importedContextForPosition(url, position); | 360 | const QPair<TopDUContextPointer, KTextEditor::Range> import = importedContextForPosition(url, position); | ||
358 | 361 | | |||
359 | if (import.first) { | 362 | if (import.first) { | ||
360 | return import.first->createNavigationWidget(); | 363 | return {import.first->createNavigationWidget(), import.second}; | ||
361 | } | 364 | } | ||
362 | return nullptr; | 365 | return {nullptr, KTextEditor::Range::invalid()}; | ||
363 | } | 366 | } | ||
364 | 367 | | |||
365 | TopDUContext* ClangSupport::standardContext(const QUrl &url, bool /*proxyContext*/) | 368 | TopDUContext* ClangSupport::standardContext(const QUrl &url, bool /*proxyContext*/) | ||
366 | { | 369 | { | ||
367 | ClangParsingEnvironment env; | 370 | ClangParsingEnvironment env; | ||
368 | return DUChain::self()->chainForDocument(url, &env); | 371 | return DUChain::self()->chainForDocument(url, &env); | ||
369 | } | 372 | } | ||
370 | 373 | | |||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |