Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit b2291e2a authored by Kevin Funk's avatar Kevin Funk

Clang: Fix crash in findDeclaration

This happens when KDevelop tries to load stale declarations, e.g. from
an unloaded language plugin.

See message:
[kdevelop(21511)/(kdevplatform.language) unknown(0): Cannot load a
top-context from file
- the required language-support for handling ID 100 is probably not
[kdevelop(21511)/(kdevelop.plugins.clang) unknown(0): Detected an
invalid declaration for "acos"

^ That last line was added as part of this patch.

0  KDevelop::Declaration::kind (this=0x0) at
1  0x00007fffc2f26ef4 in (anonymous namespace)::findDeclaration
(qid=..., ctx=..., position=..., handled=Python Exception <class
'gdb.error'> There is no member named next.:
) at
2  0x00007fffc2f2534e in ClangCodeCompletionContext::completionItems
(this=0x7fffa4003e40, abort=@0x7fffb2def7a8: false) at
3  0x00007fffc2f22729 in (anonymous
(this=0x3e72ed0, url=..., position=..., text=..., followingText=...) at
parent 529bd8ae
......@@ -510,6 +510,13 @@ Declaration* findDeclaration(const QualifiedIdentifier& qid, const DUContextPoin
for (auto it = decl.iterator(); it; ++it) {
auto declaration = it->declaration();
if (!declaration) {
// Mitigate problems such as: Cannot load a top-context from file "/home/kfunk/.cache/kdevduchain/kdevelop-{foo}/topcontexts/6085"
// - the required language-support for handling ID 55 is probably not loaded
qCWarning(KDEV_CLANG) << "Detected an invalid declaration for" << qid;
if (declaration->kind() == Declaration::Instance && !declaration->isFunctionDeclaration()) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment