[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevelop/languages/cpp/cppduchain
From: David Nolden <david.nolden.kde () art-master ! de>
Date: 2009-05-30 10:19:46
Message-ID: 1243678786.444923.18328.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 975455 by zwabel:
Do not create tons of "missing declaration" errors/warnings/assistants within \
templates.
M +13 -1 cppducontext.cpp
M +4 -0 cppducontext.h
M +9 -0 expressionvisitor.cpp
M +9 -1 name_visitor.cpp
M +4 -1 name_visitor.h
--- trunk/KDE/kdevelop/languages/cpp/cppduchain/cppducontext.cpp #975454:975455
@@ -63,8 +63,20 @@
}
}
+
+bool isTemplateDependent(DUContext* context)
+{
+ while(context && !context->owner())
+ context = context->parentContext();
+ if(context && context->owner())
+ return isTemplateDependent(context->owner());
+
+ return false;
+}
+
///@todo Make this faster
-bool isTemplateDependent(Declaration* decl) {
+bool isTemplateDependent(Declaration* decl)
+{
if( !decl )
return false;
TemplateDeclaration* templDecl = dynamic_cast<TemplateDeclaration*>(decl);
--- trunk/KDE/kdevelop/languages/cpp/cppduchain/cppducontext.h #975454:975455
@@ -694,6 +694,10 @@
IndexedInstantiationInformation m_instantiatedWith;
};
+///Returns whether the given declaration depends on a missing template-parameter
+bool isTemplateDependent(Declaration* decl);
+bool isTemplateDependent(DUContext* context);
+
}
#endif
--- trunk/KDE/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp #975454:975455
@@ -509,6 +509,15 @@
m_lastDeclarations = nameV.declarations();
if( m_lastDeclarations.isEmpty() || !m_lastDeclarations.first().data() ) {
+
+ if(Cpp::isTemplateDependent(m_currentContext) ) {
+ if(m_memberAccess || (node->qualified_names && nameV.foundSomething())) {
+ //Do nothing. Within a not instantiated template, we cannot be that sure
+ m_lastType.clear();
+ return;
+ }
+ }
+
MissingDeclarationType::Ptr missing(new MissingDeclarationType);
missing->setIdentifier(IndexedTypeIdentifier(nameV.identifier()));
--- trunk/KDE/kdevelop/languages/cpp/cppduchain/name_visitor.cpp #975454:975455
@@ -38,7 +38,7 @@
using namespace Cpp;
NameASTVisitor::NameASTVisitor(ParseSession* session, Cpp::ExpressionVisitor* \
visitor, const KDevelop::DUContext* context, const KDevelop::TopDUContext* source, \
const KDevelop::DUContext* localVisibilityContext, const SimpleCursor& position, \
KDevelop::DUContext::SearchFlags localSearchFlags, bool debug )
-: m_session(session), m_visitor(visitor), m_context(context), m_source(source), \
m_localContext(localVisibilityContext), m_find(m_context, m_source, localSearchFlags, \
SimpleCursor(position) ), m_debug(debug), m_finalName(0) +: m_session(session), \
m_visitor(visitor), m_context(context), m_source(source), \
m_localContext(localVisibilityContext), m_find(m_context, m_source, localSearchFlags, \
SimpleCursor(position) ), m_debug(debug), m_finalName(0), m_foundSomething(false) {
m_flags = localSearchFlags;
m_stopSearch = false;
@@ -138,6 +138,8 @@
}
_M_name.push(m_currentIdentifier);
+
+ m_foundSomething |= !m_find.lastDeclarations().isEmpty();
}
TypeSpecifierAST* NameASTVisitor::lastTypeSpecifier() const {
@@ -295,3 +297,9 @@
LOCKDUCHAIN;
m_find.closeQualifiedIdentifier();
}
+
+
+bool NameASTVisitor::foundSomething() const
+{
+ return m_foundSomething;
+}
--- trunk/KDE/kdevelop/languages/cpp/cppduchain/name_visitor.h #975454:975455
@@ -68,6 +68,9 @@
return m_stopSearch;
}
+ ///Whether at least one part of the scope could be resolved
+ bool foundSomething() const;
+
///This can be used from outside to only process the type of a template-argument.
///This NameASTVisitor will be in an invalid state after this is called, so don't \
continue using it! Cpp::ExpressionEvaluationResult \
processTemplateArgument(TemplateArgumentAST *node); @@ -88,7 +91,7 @@
bool m_debug;
UnqualifiedNameAST* m_finalName;
KDevelop::DUContext::SearchFlags m_flags;
- bool m_stopSearch;
+ bool m_stopSearch, m_foundSomething;
};
QString decode(ParseSession* session, AST* ast, bool without_spaces = false);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic