mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 11:25:35 +02:00
Bug 261417. Fix and test case.
This commit is contained in:
parent
b741929843
commit
d55331cf8e
2 changed files with 13 additions and 10 deletions
|
@ -2263,13 +2263,12 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// void test(int a[]) {
|
// void test(int a[]) {
|
||||||
// func(&a);
|
// func(&a);
|
||||||
// }
|
// }
|
||||||
public void _testArrayPointer_261417() throws Exception {
|
public void testArrayPointer_261417() throws Exception {
|
||||||
final boolean[] isCpps= {false, true};
|
|
||||||
String code= getAboveComment();
|
String code= getAboveComment();
|
||||||
for (boolean isCpp : isCpps) {
|
BindingAssertionHelper baC= new BindingAssertionHelper(code, false);
|
||||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
baC.assertNonProblem("func(&a)", 4, IFunction.class);
|
||||||
ba.assertNonProblem("func(&a)", 4, ICPPFunction.class);
|
BindingAssertionHelper baCpp= new BindingAssertionHelper(code, true);
|
||||||
}
|
baCpp.assertNonProblem("func(&a)", 4, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int f() {}
|
// int f() {}
|
||||||
|
|
|
@ -162,10 +162,10 @@ public class SemanticUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Descends into type containers, stopping at pointer-to-member types if
|
* Descends into type containers, stopping at pointer-to-member types if specified.
|
||||||
* specified.
|
|
||||||
* @param type the root type
|
* @param type the root type
|
||||||
* @param lastPointerType if non-null, the deepest pointer type encounter is stored in element zero
|
* @param lastPointerType if non-null, the deepest pointer or array type encountered
|
||||||
|
* is stored in element zero.
|
||||||
* @param stopAtPointerToMember if true, do not descend into ICPPPointerToMember types
|
* @param stopAtPointerToMember if true, do not descend into ICPPPointerToMember types
|
||||||
* @return the deepest type in a type container sequence
|
* @return the deepest type in a type container sequence
|
||||||
*/
|
*/
|
||||||
|
@ -186,12 +186,16 @@ public class SemanticUtil {
|
||||||
lastPointerType[0]= type;
|
lastPointerType[0]= type;
|
||||||
}
|
}
|
||||||
type= ((IPointerType) type).getType();
|
type= ((IPointerType) type).getType();
|
||||||
|
} else if (type instanceof IArrayType) {
|
||||||
|
if (lastPointerType != null) {
|
||||||
|
lastPointerType[0]= type;
|
||||||
|
}
|
||||||
|
type= ((IArrayType) type).getType();
|
||||||
} else if (type instanceof ICPPReferenceType) {
|
} else if (type instanceof ICPPReferenceType) {
|
||||||
type= ((ICPPReferenceType) type).getType();
|
type= ((ICPPReferenceType) type).getType();
|
||||||
} else {
|
} else {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return e.getProblem();
|
return e.getProblem();
|
||||||
|
|
Loading…
Add table
Reference in a new issue