• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/language/duchain

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • language
  • duchain
  • navigation
usescollector.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2008 David Nolden <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17  */
18 
19 #include "usescollector.h"
20 #include <interfaces/icore.h>
21 #include <interfaces/ilanguagecontroller.h>
22 #include <language/duchain/parsingenvironment.h>
23 #include <language/duchain/duchainlock.h>
24 #include <language/duchain/duchain.h>
25 #include <interfaces/iprojectcontroller.h>
26 #include <interfaces/idocumentcontroller.h>
27 #include <language/duchain/duchainutils.h>
28 #include <language/duchain/types/indexedtype.h>
29 #include <language/duchain/classfunctiondeclaration.h>
30 #include <backgroundparser/parsejob.h>
31 #include <backgroundparser/backgroundparser.h>
32 #include "../classmemberdeclaration.h"
33 #include "../abstractfunctiondeclaration.h"
34 #include "../functiondefinition.h"
35 #include <debug.h>
36 #include <interfaces/iuicontroller.h>
37 #include <codegen/coderepresentation.h>
38 #include <sublime/message.h>
39 #include <KLocalizedString>
40 
41 using namespace KDevelop;
42 
44 static Identifier destructorForName(const Identifier& name)
45 {
46  QString str = name.identifier().str();
47  if (str.startsWith(QLatin1Char('~')))
48  return Identifier(str);
49  return Identifier(QLatin1Char('~') + str);
50 }
51 
53 
54 template <class ImportanceChecker>
55 void collectImporters(ImportanceChecker& checker, ParsingEnvironmentFile* current,
56  QSet<ParsingEnvironmentFile*>& visited, QSet<ParsingEnvironmentFile*>& collected)
57 {
58  //Ignore proxy-contexts while collecting. Those build a parallel and much more complicated structure.
59  if (current->isProxyContext())
60  return;
61 
62  if (visited.contains(current))
63  return;
64 
65  visited.insert(current);
66  if (checker(current))
67  collected.insert(current);
68 
69  const auto importers = current->importers();
70  for (const ParsingEnvironmentFilePointer& importer : importers) {
71  if (importer.data())
72  collectImporters(checker, importer.data(), visited, collected);
73  else
74  qCDebug(LANGUAGE) << "missing environment-file, strange";
75  }
76 }
77 
80 void allImportedFiles(ParsingEnvironmentFilePointer file, QSet<IndexedString>& set,
81  QSet<ParsingEnvironmentFilePointer>& visited)
82 {
83  const auto imports = file->imports();
84  for (const ParsingEnvironmentFilePointer& import : imports) {
85  if (!import) {
86  qCDebug(LANGUAGE) << "warning: missing import";
87  continue;
88  }
89  if (!visited.contains(import)) {
90  visited.insert(import);
91  set.insert(import->url());
92  allImportedFiles(import, set, visited);
93  }
94  }
95 }
96 
97 void UsesCollector::setCollectConstructors(bool process)
98 {
99  m_collectConstructors = process;
100 }
101 
102 void UsesCollector::setProcessDeclarations(bool process)
103 {
104  m_processDeclarations = process;
105 }
106 
107 void UsesCollector::setCollectOverloads(bool collect)
108 {
109  m_collectOverloads = collect;
110 }
111 
112 void UsesCollector::setCollectDefinitions(bool collect)
113 {
114  m_collectDefinitions = collect;
115 }
116 
117 QList<IndexedDeclaration> UsesCollector::declarations()
118 {
119  return m_declarations;
120 }
121 
122 bool UsesCollector::isReady() const
123 {
124  return m_waitForUpdate.size() == m_updateReady.size();
125 }
126 
127 bool UsesCollector::shouldRespectFile(const IndexedString& document)
128 {
129  return ( bool )ICore::self()->projectController()->findProjectForUrl(document.toUrl()) ||
130  ( bool )ICore::self()->documentController()->documentForUrl(document.toUrl());
131 }
132 
133 struct ImportanceChecker
134 {
135  explicit ImportanceChecker(UsesCollector& collector) : m_collector(collector)
136  {
137  }
138  bool operator ()(ParsingEnvironmentFile* file)
139  {
140  return m_collector.shouldRespectFile(file->url());
141  }
142  UsesCollector& m_collector;
143 };
144 
145 void UsesCollector::startCollecting()
146 {
147  DUChainReadLocker lock(DUChain::lock());
148 
149  if (Declaration* decl = m_declaration.data()) {
150  if (m_collectDefinitions) {
151  if (auto* def = dynamic_cast<FunctionDefinition*>(decl)) {
152  //Jump from definition to declaration
153  Declaration* declaration = def->declaration();
154  if (declaration)
155  decl = declaration;
156  }
157  }
158 
160  QList<Declaration*> decls;
161 
162  if (m_collectOverloads && decl->context()->owner() && decl->context()->type() == DUContext::Class) {
163  //First find the overridden base, and then all overriders of that base.
164  while (Declaration* overridden = DUChainUtils::overridden(decl))
165  decl = overridden;
166  uint maxAllowedSteps = 10000;
167  decls += DUChainUtils::overriders(decl->context()->owner(), decl, maxAllowedSteps);
168  if (maxAllowedSteps == 10000) {
170  }
171  }
172 
173  decls << decl;
174 
176  QSet<IndexedDeclaration> allDeclarations;
177 
178  for (Declaration* overload : qAsConst(decls)) {
179  m_declarations = DUChainUtils::collectAllVersions(overload);
180  for (const IndexedDeclaration& d : qAsConst(m_declarations)) {
181  if (!d.data() || d.data()->id() != overload->id())
182  continue;
183  allDeclarations.insert(d);
184 
185  if (m_collectConstructors && d.data() && d.data()->internalContext() &&
186  d.data()->internalContext()->type() == DUContext::Class) {
187  const QList<Declaration*> constructors = d.data()->internalContext()->findLocalDeclarations(
188  d.data()->identifier(), CursorInRevision::invalid(), nullptr,
189  AbstractType::Ptr(), DUContext::OnlyFunctions);
190  for (Declaration* constructor : constructors) {
191  auto* classFun = dynamic_cast<ClassFunctionDeclaration*>(constructor);
192  if (classFun && classFun->isConstructor())
193  allDeclarations.insert(IndexedDeclaration(constructor));
194  }
195 
196  Identifier destructorId = destructorForName(d.data()->identifier());
197 
198  const QList<Declaration*> destructors = d.data()->internalContext()->findLocalDeclarations(
199  destructorId, CursorInRevision::invalid(), nullptr,
200  AbstractType::Ptr(), DUContext::OnlyFunctions);
201  for (Declaration* destructor : destructors) {
202  auto* classFun = dynamic_cast<ClassFunctionDeclaration*>(destructor);
203  if (classFun && classFun->isDestructor())
204  allDeclarations.insert(IndexedDeclaration(destructor));
205  }
206  }
207  }
208  }
209 
211  if (m_collectDefinitions) {
212  for (const IndexedDeclaration d : qAsConst(allDeclarations)) {
213  Declaration* definition = FunctionDefinition::definition(d.data());
214  if (definition) {
215  qCDebug(LANGUAGE) << "adding definition";
216  allDeclarations.insert(IndexedDeclaration(definition));
217  }
218  }
219  }
220 
221  m_declarations.clear();
222 
224  QList<ReferencedTopDUContext> candidateTopContexts;
225  candidateTopContexts.reserve(allDeclarations.size());
226  m_declarations.reserve(allDeclarations.size());
227  for (const IndexedDeclaration d : qAsConst(allDeclarations)) {
228  m_declarations << d;
229  m_declarationTopContexts.insert(d.indexedTopContext());
230  //We only collect declarations with the same type here..
231  candidateTopContexts << d.indexedTopContext().data();
232  }
233 
234  ImportanceChecker checker(*this);
235 
236  QSet<ParsingEnvironmentFile*> visited;
237  QSet<ParsingEnvironmentFile*> collected;
238 
239  qCDebug(LANGUAGE) << "count of source candidate top-contexts:" << candidateTopContexts.size();
240 
243  if (decl->inSymbolTable()) {
244  //The declaration can only be used from other contexts if it is in the symbol table
245  for (const ReferencedTopDUContext& top : qAsConst(candidateTopContexts)) {
246  if (top->parsingEnvironmentFile()) {
247  collectImporters(checker, top->parsingEnvironmentFile().data(), visited, collected);
248  //In C++, visibility is not handled strictly through the import-structure.
249  //It may happen that an object is visible because of an earlier include.
250  //We can not perfectly handle that, but we can at least handle it if the header includes
251  //the header that contains the declaration. That header may be parsed empty due to header-guards,
252  //but we still need to pick it up here.
253  const QList<ParsingEnvironmentFilePointer> allVersions = DUChain::self()->allEnvironmentFiles(
254  top->url());
255  for (const ParsingEnvironmentFilePointer& version : allVersions)
256  collectImporters(checker, version.data(), visited, collected);
257  }
258  }
259  }
260  KDevelop::ParsingEnvironmentFile* file = decl->topContext()->parsingEnvironmentFile().data();
261  if (!file)
262  return;
263 
264  if (checker(file))
265  collected.insert(file);
266 
267  {
268  QSet<ParsingEnvironmentFile*> filteredCollected;
269  QMap<IndexedString, bool> grepCache;
270  // Filter the collected files by performing a grep
271  for (ParsingEnvironmentFile* file : qAsConst(collected)) {
272  IndexedString url = file->url();
273  QMap<IndexedString, bool>::iterator grepCacheIt = grepCache.find(url);
274  if (grepCacheIt == grepCache.end()) {
275  CodeRepresentation::Ptr repr = KDevelop::createCodeRepresentation(url);
276  if (repr) {
277  QVector<KTextEditor::Range> found = repr->grep(decl->identifier().identifier().str());
278  grepCacheIt = grepCache.insert(url, !found.isEmpty());
279  }
280  }
281  if (grepCacheIt.value())
282  filteredCollected << file;
283  }
284 
285  qCDebug(LANGUAGE) << "Collected contexts for full re-parse, before filtering: " << collected.size() <<
286  " after filtering: " << filteredCollected.size();
287  collected = filteredCollected;
288  }
289 
292  QSet<IndexedString> rootFiles;
293  QSet<IndexedString> allFiles;
294  for (ParsingEnvironmentFile* importer : qAsConst(collected)) {
295  QSet<IndexedString> allImports;
296  QSet<ParsingEnvironmentFilePointer> visited;
297  allImportedFiles(ParsingEnvironmentFilePointer(importer), allImports, visited);
298  //Remove all files from the "root" set that are imported by this one
300  rootFiles -= allImports;
301  allFiles += allImports;
302  allFiles.insert(importer->url());
303  rootFiles.insert(importer->url());
304  }
305 
306  emit maximumProgressSignal(rootFiles.size());
307  maximumProgress(rootFiles.size());
308 
309  //If we used the AllDeclarationsContextsAndUsesRecursive flag here, we would compute way too much. This way we only
310  //set the minimum-features selectively on the files we really require them on.
311  for (ParsingEnvironmentFile* file : qAsConst(collected)) {
312  m_staticFeaturesManipulated.insert(file->url());
313  }
314 
315  m_staticFeaturesManipulated.insert(decl->url());
316 
317  const auto currentFeaturesManipulated = m_staticFeaturesManipulated;
318  for (const IndexedString& file : currentFeaturesManipulated) {
319  ParseJob::setStaticMinimumFeatures(file, TopDUContext::AllDeclarationsContextsAndUses);
320  }
321 
322  m_waitForUpdate = rootFiles;
323 
324  for (const IndexedString& file : qAsConst(rootFiles)) {
325  qCDebug(LANGUAGE) << "updating root file:" << file.str();
326  DUChain::self()->updateContextForUrl(file, TopDUContext::AllDeclarationsContextsAndUses, this);
327  }
328  } else {
329  emit maximumProgressSignal(0);
330  maximumProgress(0);
331  }
332 }
333 
334 void UsesCollector::maximumProgress(uint max)
335 {
336  Q_UNUSED(max);
337 }
338 
339 UsesCollector::UsesCollector(IndexedDeclaration declaration) : m_declaration(declaration)
340  , m_collectOverloads(true)
341  , m_collectDefinitions(true)
342  , m_collectConstructors(false)
343  , m_processDeclarations(true)
344 {
345 }
346 
347 UsesCollector::~UsesCollector()
348 {
349  ICore::self()->languageController()->backgroundParser()->revertAllRequests(this);
350 
351  const auto currentFeaturesManipulated = m_staticFeaturesManipulated;
352  for (const IndexedString& file : currentFeaturesManipulated) {
353  ParseJob::unsetStaticMinimumFeatures(file, TopDUContext::AllDeclarationsContextsAndUses);
354  }
355 }
356 
357 void UsesCollector::progress(uint processed, uint total)
358 {
359  Q_UNUSED(processed);
360  Q_UNUSED(total);
361 }
362 
363 void UsesCollector::updateReady(const KDevelop::IndexedString& url, KDevelop::ReferencedTopDUContext topContext)
364 {
365  DUChainReadLocker lock(DUChain::lock());
366 
367  if (!topContext) {
368  qCDebug(LANGUAGE) << "failed updating" << url.str();
369  } else {
370  if (topContext->parsingEnvironmentFile() && topContext->parsingEnvironmentFile()->isProxyContext()) {
372  const auto importedParentContexts = topContext->importedParentContexts();
373  for (const DUContext::Import& import : importedParentContexts) {
374  if (import.context(nullptr) && import.context(nullptr)->topContext()->parsingEnvironmentFile() &&
375  !import.context(nullptr)->topContext()->parsingEnvironmentFile()->isProxyContext()) {
376  if ((import.context(nullptr)->topContext()->features() &
377  TopDUContext::AllDeclarationsContextsAndUses)) {
378  ReferencedTopDUContext newTop(import.context(nullptr)->topContext());
379  topContext = newTop;
380  break;
381  }
382  }
383  }
384 
385  if (topContext->parsingEnvironmentFile() && topContext->parsingEnvironmentFile()->isProxyContext()) {
386  qCDebug(LANGUAGE) << "got bad proxy-context for" << url.str();
387  topContext = nullptr;
388  }
389  }
390  }
391 
392  if (m_waitForUpdate.contains(url) && !m_updateReady.contains(url)) {
393  m_updateReady << url;
394  m_checked.clear();
395 
396  emit progressSignal(m_updateReady.size(), m_waitForUpdate.size());
397  progress(m_updateReady.size(), m_waitForUpdate.size());
398  }
399 
400  if (!topContext || !topContext->parsingEnvironmentFile()) {
401  qCDebug(LANGUAGE) << "bad top-context";
402  return;
403  }
404 
405  if (!m_staticFeaturesManipulated.contains(url))
406  return; //Not interesting
407 
408  if (!(topContext->features() & TopDUContext::AllDeclarationsContextsAndUses)) {
413  qCWarning(LANGUAGE) << "WARNING: context" << topContext->url().str() << "does not have the required features!!";
414  // TODO no i18n?
415  const QString messageText = QLatin1String("Updating ") +
416  ICore::self()->projectController()->prettyFileName(topContext->url().toUrl(), KDevelop::IProjectController::FormatPlain) + QLatin1String(" failed!");
417  auto* message = new Sublime::Message(messageText, Sublime::Message::Warning);
418  message->setAutoHide(0);
419  ICore::self()->uiController()->postMessage(message);
420  return;
421  }
422 
423  if (topContext->parsingEnvironmentFile()->needsUpdate()) {
424  qCWarning(LANGUAGE) << "WARNING: context" << topContext->url().str() << "is not up to date!";
425  const auto prettyFileName = ICore::self()->projectController()->prettyFileName(topContext->url().toUrl(), KDevelop::IProjectController::FormatPlain);
426  const auto messageText = i18n("%1 still needs an update!", prettyFileName);
427  auto* message = new Sublime::Message(messageText, Sublime::Message::Warning);
428  message->setAutoHide(0);
429  ICore::self()->uiController()->postMessage(message);
430 // return;
431  }
432 
433  IndexedTopDUContext indexed(topContext.data());
434  if (m_checked.contains(indexed))
435  return;
436 
437  if (!topContext.data()) {
438  qCDebug(LANGUAGE) << "updated top-context is zero:" << url.str();
439  return;
440  }
441 
442  m_checked.insert(indexed);
443 
444  if (m_declaration.data() && ((m_processDeclarations && m_declarationTopContexts.contains(indexed)) ||
445  DUChainUtils::contextHasUse(topContext.data(), m_declaration.data()))) {
446  if (!m_processed.contains(topContext->url())) {
447  m_processed.insert(topContext->url());
448  lock.unlock();
449  emit processUsesSignal(topContext);
450  processUses(topContext);
451  lock.lock();
452  }
453  } else {
454  if (!m_declaration.data()) {
455  qCDebug(LANGUAGE) << "declaration has become invalid";
456  }
457  }
458 
459  QList<KDevelop::ReferencedTopDUContext> imports;
460 
461  const auto importedParentContexts = topContext->importedParentContexts();
462  for (const DUContext::Import& imported : importedParentContexts) {
463  if (imported.context(nullptr) && imported.context(nullptr)->topContext())
464  imports << KDevelop::ReferencedTopDUContext(imported.context(nullptr)->topContext());
465  }
466 
467  for (const KDevelop::ReferencedTopDUContext& import : qAsConst(imports)) {
468  IndexedString url = import->url();
469  lock.unlock();
470  updateReady(url, import);
471  lock.lock();
472  }
473 }
474 
475 IndexedDeclaration UsesCollector::declaration() const
476 {
477  return m_declaration;
478 }
duchainlock.h
KDevelop::IndexedTopDUContext
Allows simple indirect access to top-contexts with on-demand loading.
Definition: indexedtopducontext.h:35
QSet
QVector::isEmpty
bool isEmpty() const
KDevelop::DUChainReadLocker
Customized read locker for the definition-use chain.
Definition: duchainlock.h:114
KDevelop::UsesCollector::declarations
QList< IndexedDeclaration > declarations()
The declarations that were used as base for the search For classes this contains forward-declarations...
Definition: usescollector.cpp:117
KDevelop::UsesCollector::startCollecting
void startCollecting()
This must be called to start the actual collecting!
Definition: usescollector.cpp:145
QMap::iterator
KDevelop::DUChain::lock
static DUChainLock * lock()
Retrieve the read write lock for the entire definition-use chain.
Definition: duchain.cpp:1283
duchainutils.h
KDevelop::AbstractType::Ptr
TypePtr< AbstractType > Ptr
Definition: abstracttype.h:91
KDevelop::ParsingEnvironmentFile::imports
QList< QExplicitlySharedDataPointer< ParsingEnvironmentFile > > imports() const
Returns the parsing-environment information of all imports of the coupled TopDUContext.
Definition: parsingenvironment.cpp:189
KDevelop::ReferencedTopDUContext
KDevelop can unload unused top-context at any time.
Definition: topducontext.h:59
KDevelop::DUChainUtils::collectAllVersions
KDEVPLATFORMLANGUAGE_EXPORT QList< IndexedDeclaration > collectAllVersions(Declaration *decl)
Uses the persistent symbol table to find all occurrences of this declaration, based on its identifier...
Definition: duchainutils.cpp:454
KDevelop::TopDUContext::importedParentContexts
QVector< Import > importedParentContexts() const override
Returns the list of imported parent contexts for this context.
Definition: topducontext.cpp:1024
KDevelop::UsesCollector::shouldRespectFile
virtual bool shouldRespectFile(const IndexedString &url)
Override this to decide whether a file should be respect while computation.
Definition: usescollector.cpp:127
KDevelop::DUChain::updateContextForUrl
void updateContextForUrl(const IndexedString &document, TopDUContext::Features minFeatures, QObject *notifyReady=nullptr, int priority=1) const
Makes sure the standard-context for the given url is up-to-date.
Definition: duchain.cpp:1839
QExplicitlySharedDataPointer::data
T * data() const
QList
KDevelop::TypePtr< AbstractType >
KDevelop::DUChainUtils::overriders
KDEVPLATFORMLANGUAGE_EXPORT QList< Declaration * > overriders(const Declaration *currentClass, const Declaration *overriddenDeclaration, uint &maxAllowedSteps)
Gets all functions that override the function overriddenDeclaration, starting the search at currentCl...
Definition: duchainutils.cpp:530
QSet::size
int size() const
KDevelop::UsesCollector
A helper base-class for collecting the top-contexts that contain all uses of a declaration The most i...
Definition: usescollector.h:33
KDevelop::ParsingEnvironmentFile::isProxyContext
bool isProxyContext() const
A language-specific flag used by C++ to mark one context as a proxy of another.
Definition: parsingenvironment.cpp:177
KDevelop::TopDUContext::parsingEnvironmentFile
QExplicitlySharedDataPointer< ParsingEnvironmentFile > parsingEnvironmentFile() const
Definition: topducontext.cpp:567
KDevelop::ParsingEnvironmentFile::importers
QList< QExplicitlySharedDataPointer< ParsingEnvironmentFile > > importers() const
Returns the parsing-environment information of all importers of the coupled TopDUContext.
Definition: parsingenvironment.cpp:219
KDevelop::Declaration
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
QExplicitlySharedDataPointer< ParsingEnvironmentFile >
QList::reserve
void reserve(int alloc)
KDevelop::UsesCollector::~UsesCollector
~UsesCollector() override
Definition: usescollector.cpp:347
KDevelop::ParsingEnvironmentFile::needsUpdate
virtual bool needsUpdate(const ParsingEnvironment *environment=nullptr) const
Can additionally use language-specific information to decide whether the top-context that has this da...
Definition: parsingenvironment.cpp:87
QMap::insert
iterator insert(const Key &key, const T &value)
KDevelop::UsesCollector::setCollectDefinitions
void setCollectDefinitions(bool collectDefinition)
If this is true, all definitions are loaded too, and part of the processed declarations.
Definition: usescollector.cpp:112
QList::size
int size() const
QMap::end
iterator end()
KDevelop::TopDUContext::features
Features features() const
Returns the currently active features of this top-context. The features will include AST if ast() is ...
Definition: topducontext.cpp:605
KDevelop::TopDUContext::url
IndexedString url() const override
Definition: topducontext.cpp:1228
KDevelop::IndexedDeclaration
Represents a declaration only by its global indices.
Definition: indexeddeclaration.h:33
QMap::find
iterator find(const Key &key)
KDevelop::Identifier::identifier
const IndexedString identifier() const
Definition: identifier.cpp:520
QString
collectImporters
void collectImporters(ImportanceChecker &checker, ParsingEnvironmentFile *current, QSet< ParsingEnvironmentFile * > &visited, QSet< ParsingEnvironmentFile * > &collected)
Definition: usescollector.cpp:55
KDevelop::DUContext::OnlyFunctions
When this is given, only function-declarations are returned.
Definition: ducontext.h:128
KDevelop::DUChainUtils::overridden
KDEVPLATFORMLANGUAGE_EXPORT Declaration * overridden(const Declaration *decl)
Returns the declaration that is overridden by the given one, or zero.
Definition: duchainutils.cpp:587
KDevelop::IndexedDeclaration::declaration
Declaration * declaration() const
Definition: indexeddeclaration.cpp:44
KDevelop::UsesCollector::isReady
bool isReady() const
Definition: usescollector.cpp:122
KDevelop::ParsingEnvironmentFile::topContext
TopDUContext * topContext() const override
Convenience-function that returns the top-context.
Definition: parsingenvironment.cpp:150
usescollector.h
QLatin1String
KDevelop::ParsingEnvironmentFile::url
KDevelop::IndexedString url() const override
Definition: parsingenvironment.cpp:81
KDevelop::Identifier
Represents a single unqualified identifier.
Definition: identifier.h:150
KDevelop::DUContext::Class
A context that declares class members.
Definition: ducontext.h:105
indexedtype.h
KDevelop::UsesCollector::setCollectOverloads
void setCollectOverloads(bool collect)
If this is true, the complete overload-chain is computed, and the uses of all overloaded functions to...
Definition: usescollector.cpp:107
KDevelop::UsesCollector::progressSignal
void progressSignal(uint, uint)
QSet::contains
bool contains(const T &value) const
KDevelop::TopDUContext::AllDeclarationsContextsAndUses
Definition: topducontext.h:198
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KDevelop::ParsingEnvironmentFile
This represents all information about a specific parsed file that is needed to match the file to a pa...
Definition: parsingenvironment.h:118
destructorForName
static Identifier destructorForName(const Identifier &name)
Definition: usescollector.cpp:44
KDevelop::IndexedDeclaration::data
Declaration * data() const
Definition: indexeddeclaration.h:47
KDevelop::UsesCollector::setProcessDeclarations
void setProcessDeclarations(bool process)
Use this to set whether processUses should also be called on contexts that only contain a declaration...
Definition: usescollector.cpp:102
QMap
allImportedFiles
void allImportedFiles(ParsingEnvironmentFilePointer file, QSet< IndexedString > &set, QSet< ParsingEnvironmentFilePointer > &visited)
The returned set does not include the file itself.
Definition: usescollector.cpp:80
KDevelop::UsesCollector::setCollectConstructors
void setCollectConstructors(bool process)
If the searched declaration is a class, this can be used to decide whether constructors searched as w...
Definition: usescollector.cpp:97
QLatin1Char
duchain.h
KDevelop::ReferencedTopDUContext::data
TopDUContext * data() const
Definition: topducontext.h:68
classfunctiondeclaration.h
KDevelop
Definition: abstractfunctiondeclaration.cpp:27
KDevelop::UsesCollector::UsesCollector
UsesCollector(IndexedDeclaration declaration)
Definition: usescollector.cpp:339
QSet::insert
const_iterator insert(const T &value)
KDevelop::FunctionDefinition::definition
static Declaration * definition(const Declaration *decl)
Find the definition for the given declaration, if one exists.
Definition: functiondefinition.cpp:85
KDevelop::DUChain::allEnvironmentFiles
QList< ParsingEnvironmentFilePointer > allEnvironmentFiles(const IndexedString &document)
Returns the list of the environment-infos of all versions of the given document.
Definition: duchain.cpp:1515
parsingenvironment.h
QVector
KDevelop::ParsingEnvironmentFilePointer
QExplicitlySharedDataPointer< ParsingEnvironmentFile > ParsingEnvironmentFilePointer
Definition: duchain.h:40
KDevelop::UsesCollector::processUsesSignal
void processUsesSignal(const KDevelop::ReferencedTopDUContext &)
KDevelop::UsesCollector::declaration
IndexedDeclaration declaration() const
Definition: usescollector.cpp:475
KDevelop::UsesCollector::maximumProgressSignal
void maximumProgressSignal(uint)
KDevelop::DUChainUtils::contextHasUse
KDEVPLATFORMLANGUAGE_EXPORT bool contextHasUse(DUContext *context, Declaration *declaration)
Returns whether the given context or any of its child-contexts contain a use of the given declaration...
Definition: duchainutils.cpp:561
KDevelop::DUChain::self
static DUChain * self()
Returns the global static instance.
Definition: duchain.cpp:1230
KDevelop::DUContext::Import
Represents an imported parent context.
Definition: ducontext.h:256
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 23:38:35 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/duchain

Skip menu "kdevplatform/language/duchain"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal