forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.7'
Conflicts: src/plugins/cpptools/cppchecksymbols.h src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp Change-Id: I887ba071fa637ad44e39bcae581738fa078a6612
This commit is contained in:
@@ -1227,6 +1227,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
|
||||
{
|
||||
unsigned startToken = ast->firstToken();
|
||||
bool isDestructor = false;
|
||||
bool isConstructor = false;
|
||||
if (DestructorNameAST *dtor = ast->asDestructorName()) {
|
||||
isDestructor = true;
|
||||
if (dtor->unqualified_name)
|
||||
@@ -1251,6 +1252,8 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
|
||||
if (isDestructor != c->name()->isDestructorNameId())
|
||||
continue;
|
||||
|
||||
isConstructor = isConstructorDeclaration(c);
|
||||
|
||||
Function *funTy = c->type()->asFunctionType();
|
||||
if (! funTy) {
|
||||
//Try to find a template function
|
||||
@@ -1283,7 +1286,9 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
|
||||
}
|
||||
|
||||
if (matchType != Match_None) {
|
||||
// decide how constructor and destructor should be highlighted
|
||||
if (highlightCtorDtorAsType
|
||||
&& (isConstructor || isDestructor)
|
||||
&& maybeType(ast->name)
|
||||
&& kind == SemanticInfo::FunctionUse) {
|
||||
return false;
|
||||
@@ -1386,3 +1391,12 @@ void CheckSymbols::flush()
|
||||
_usages.clear();
|
||||
_usages.reserve(cap);
|
||||
}
|
||||
|
||||
bool CheckSymbols::isConstructorDeclaration(Symbol *declaration)
|
||||
{
|
||||
Class *clazz = declaration->enclosingClass();
|
||||
if (clazz && clazz->name())
|
||||
return declaration->name()->isEqualTo(clazz->name());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user