forked from qt-creator/qt-creator
C++: fix replacing dot(.) with arrow(->)
Fix replacing operator dot(.) with operator arrow(->) for typedef pointer. Task-number: QTCREATORBUG-8488 Change-Id: Ic4462bc437a4aa37adfed4fa50b32d9bc20fe194 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -978,10 +978,23 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
}
|
||||
} else if (accessOp == T_DOT) {
|
||||
if (replacedDotOperator) {
|
||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
// replace . with ->
|
||||
*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();
|
||||
*replacedDotOperator = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user