1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 417243 - Organize Includes inserts unnecessary include for the

header declaring a function parameter type
This commit is contained in:
Sergey Prigogin 2013-09-13 19:02:56 -07:00
parent 37d52ad572
commit dffb9aa514
2 changed files with 15 additions and 0 deletions

View file

@ -258,6 +258,18 @@ public class BindingClassifierTest extends OneSourceMultipleHeadersTestCase {
assertDeclared("f");
}
// typedef int int32;
// void f(int32* p);
// void test(int i) {
// f(&i);
// }
public void testFunctionCallWithTypedef() throws Exception {
getPreferenceStore().setValue(PreferenceConstants.FORWARD_DECLARE_FUNCTIONS, false);
assertDefined("f");
assertDeclared();
}
// struct A {
// A(void* p);
// };

View file

@ -535,6 +535,9 @@ public class BindingClassifier {
}
private void declareFunction(IFunction function, IASTInitializerClause[] arguments) {
if (!canForwardDeclare(function))
defineBinding(function);
// Handle return or expression type of the function or constructor call.
IType returnType = function.getType().getReturnType();
if (!(returnType instanceof IPointerType) && !(returnType instanceof ICPPReferenceType)) {