[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevelop] languages/cpp/codecompletion: Try harder not to propose unwanted includes
From: Kevin Funk <kevin () kfunk ! org>
Date: 2014-01-31 17:28:37
Message-ID: E1W9HtN-0004sA-Qo () scm ! kde ! org
[Download RAW message or body]
Git commit 0d83f6368ccbf0838a0debbd681a5a74ac0f6f4f by Kevin Funk.
Committed on 31/01/2014 at 17:27.
Pushed by kfunk into branch 'master'.
Try harder not to propose unwanted includes
E.g. when typing 'new', this would currently result in proposing
including the header 'new' from /usr/include
M +7 -0 languages/cpp/codecompletion/missingincludeitem.cpp
http://commits.kde.org/kdevelop/0d83f6368ccbf0838a0debbd681a5a74ac0f6f4f
diff --git a/languages/cpp/codecompletion/missingincludeitem.cpp \
b/languages/cpp/codecompletion/missingincludeitem.cpp index 72b1cd2..5124fa1 100644
--- a/languages/cpp/codecompletion/missingincludeitem.cpp
+++ b/languages/cpp/codecompletion/missingincludeitem.cpp
@@ -215,6 +215,8 @@ QStringList candidateIncludeFiles(Declaration* decl) {
* Example: We have 'QState' in our source file, it is unknown
* This method then looks through the include paths used by @p source and returns \
all
* files matching the file name 'QState'
+ *
+ * @note DUChain must be locked
*/
QStringList candidateIncludeFilesFromNameMatcher(const QString& source, const \
QualifiedIdentifier& id) {
@@ -222,6 +224,11 @@ QStringList candidateIncludeFilesFromNameMatcher(const QString& \
source, const Qu QStringList result;
for (const IncludeItem& item : includeItems) {
if (item.name == id.toString() && !isBlacklistedInclude(item.url())) {
+ TopDUContext* top = DUChainUtils::standardContextForUrl(item.url());
+ // if this file was already parsed, and we don't find a declaration for id => \
discard + if (top && top->findDeclarations(id).isEmpty()) {
+ continue;
+ }
result << item.url().toLocalFile();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic