summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppchecksymbols.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-04-11 18:27:52 +0200
committerEike Ziller <eike.ziller@digia.com>2013-04-11 18:27:52 +0200
commit9ff8979da32642e60029cb7cf8536eed6442c270 (patch)
tree4c1bb2288209c4c9b65408d7ec104747b278cd43 /src/plugins/cpptools/cppchecksymbols.cpp
parente6eb061293a63bf52fb34dc39016d0fa8bbbe12b (diff)
parent567098f210a7f73b98f02132a545bd5b5420e5a4 (diff)
downloadqt-creator-9ff8979da32642e60029cb7cf8536eed6442c270.tar.gz
Merge remote-tracking branch 'origin/2.7'
Conflicts: src/plugins/cpptools/cppchecksymbols.h src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp Change-Id: I887ba071fa637ad44e39bcae581738fa078a6612
Diffstat (limited to 'src/plugins/cpptools/cppchecksymbols.cpp')
-rw-r--r--src/plugins/cpptools/cppchecksymbols.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp
index 4e8bd9e3e5..6ae41a3784 100644
--- a/src/plugins/cpptools/cppchecksymbols.cpp
+++ b/src/plugins/cpptools/cppchecksymbols.cpp
@@ -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;
+}