aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/ResolveExpression.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2013-05-24 16:22:08 +0200
committerEike Ziller <[email protected]>2013-05-24 16:22:08 +0200
commit1c34b266fb86a591eb9d7ef406780073e0d6a647 (patch)
tree627e7641741b6f2ac0de72932d17a51826f79056 /src/libs/cplusplus/ResolveExpression.cpp
parente6c822882038f1f7df93ee319b391326fe3b2f02 (diff)
parent75aeb5866816e2dccea8b226ed31f0df9cdbfb45 (diff)
Merge remote-tracking branch 'origin/2.8'
Diffstat (limited to 'src/libs/cplusplus/ResolveExpression.cpp')
-rw-r--r--src/libs/cplusplus/ResolveExpression.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 029bcee00d4..55e1d694928 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -697,6 +697,14 @@ bool ResolveExpression::visit(CallAST *ast)
// Constructor call
FullySpecifiedType ctorTy = control()->namedType(classTy->name());
addResult(ctorTy, scope);
+ } else if (Template *templateTy = ty->asTemplateType()) {
+ // template function
+ if (Symbol *declaration = templateTy->declaration()) {
+ if (Function *funTy = declaration->asFunction()) {
+ if (maybeValidPrototype(funTy, actualArgumentCount))
+ addResult(funTy->returnType().simplified(), scope);
+ }
+ }
}
}
@@ -938,6 +946,18 @@ private:
ClassOrNamespace *_binding;
};
+static bool isTypeTypedefed(const FullySpecifiedType &originalTy,
+ const FullySpecifiedType &typedefedTy)
+{
+ return ! originalTy.isEqualTo(typedefedTy);
+}
+
+static bool areOriginalAndTypedefedTypePointer(const FullySpecifiedType &originalTy,
+ const FullySpecifiedType &typedefedTy)
+{
+ return originalTy->isPointerType() && typedefedTy->isPointerType();
+}
+
ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &baseResults,
int accessOp,
bool *replacedDotOperator) const
@@ -1027,23 +1047,12 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
}
} else if (accessOp == T_DOT) {
if (replacedDotOperator) {
- *replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
- // replace . with ->
- if (PointerType *ptrTy = originalType->asPointerType()) {
- // case when original type is a pointer and
- // typedef is for type
- // e.g.:
- // typedef S SType;
- // SType *p;
- ty = ptrTy->elementType();
- }
- else if (PointerType *ptrTy = ty->asPointerType()) {
- // case when original type is a type and
- // typedef is for pointer of type
- // e.g.:
- // typedef S* SPTR;
- // SPTR p;
- ty = ptrTy->elementType();
+ if (! isTypeTypedefed(originalType, ty)
+ || ! areOriginalAndTypedefedTypePointer(originalType, ty)) {
+ *replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
+ if (PointerType *ptrTy = ty->asPointerType()) {
+ ty = ptrTy->elementType();
+ }
}
}