diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/IncludesTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/IncludesTests.java new file mode 100644 index 00000000000..b54f40bcd87 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/IncludesTests.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2006 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.pdom.tests; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.internal.core.pdom.PDOM; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile; +import org.eclipse.core.runtime.IPath; + +/** + * @author Doug Schaefer + * + */ +public class IncludesTests extends PDOMTestBase { + + protected ICProject project; + + protected void setUp() throws Exception { + project = createProject("includesTests"); + } + + public void test1() throws Exception { + PDOM pdom = (PDOM) CCorePlugin.getPDOMManager().getPDOM(project); + IPath loc = project.getProject().getLocation().append("I2.h"); + PDOMFile file = pdom.getFile(loc.toOSString()); + assertNotNull(file); + PDOMFile[] allIncludedBy = file.getAllIncludedBy(); + assertEquals(9, allIncludedBy.length); // i.e. all of them + } + +} diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/PDOMTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/PDOMTestBase.java index 643583ba034..9f82dd1fa0d 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/PDOMTestBase.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/PDOMTestBase.java @@ -74,6 +74,7 @@ public class PDOMTestBase extends TestCase { return IOverwriteQuery.ALL; } }); + importOp.setCreateContainerStructure(false); try { importOp.run(monitor); } catch (Exception e) { diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/pr147903.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/pr147903.cpp new file mode 100644 index 00000000000..9181763ca9c --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/pr147903.cpp @@ -0,0 +1,21 @@ +namespace pr147903 { + + class testRef + { + }; + + class test3 { + public: + void foo(testRef[]); + void bar(testRef*); + }; + + void (* aFPtr)(testRef[]); + + void (* aFPtr1)(testRef*); + + namespace n { + extern void (* aFPtr1)(testRef[]); + }; + +} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.cpp new file mode 100644 index 00000000000..1d006fdb474 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.cpp @@ -0,0 +1,6 @@ +#include "I1.h" + +I1::I1() +{} +I1::~I1() +{} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.h b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.h new file mode 100644 index 00000000000..9720b7b1ae0 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I1.h @@ -0,0 +1,13 @@ +#ifndef I1_H +#define I1_H + +#include "I2.h" + +class I1{ +public: + + I1(); + ~I1(); +}; + +#endif // I1_H diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.cpp new file mode 100644 index 00000000000..28bdd9c2ac2 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.cpp @@ -0,0 +1,6 @@ +#include "I2.h" + +I2::I2() +{} +I2::~I2() +{} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.h b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.h new file mode 100644 index 00000000000..c1ae30a19b2 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I2.h @@ -0,0 +1,14 @@ +#ifndef I2_H +#define I2_H + +//#include "I3.h" + +class I2{ +public: + + I2(); + ~I2(); +}; + + +#endif // I2_H diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.cpp new file mode 100644 index 00000000000..091c17e6cc5 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.cpp @@ -0,0 +1,6 @@ +#include "I3.h" + +I3::I3() +{} +I3::~I3() +{} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.h b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.h new file mode 100644 index 00000000000..10b0667a8e4 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I3.h @@ -0,0 +1,13 @@ +#ifndef I3_H +#define I3_H + +#include "I4.h" + +class I3{ +public: + + I3(); + ~I3(); +}; + +#endif // I3_H diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.cpp new file mode 100644 index 00000000000..693cccb1131 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.cpp @@ -0,0 +1,6 @@ +#include "I4.h" + +I4::I4() +{} +I4::~I4() +{} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.h b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.h new file mode 100644 index 00000000000..129839e81e1 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I4.h @@ -0,0 +1,13 @@ +#ifndef I4_H +#define I4_H + +#include "I5.h" + +class I4{ +public: + + I4(); + ~I4(); +}; + +#endif // I4_H diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.cpp new file mode 100644 index 00000000000..b003103bd80 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.cpp @@ -0,0 +1,6 @@ +#include "I5.h" + +I5::I5() +{} +I5::~I5() +{} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.h b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.h new file mode 100644 index 00000000000..800e8e14d77 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/includesTests/I5.h @@ -0,0 +1,13 @@ +#ifndef I5_H +#define I5_H + +#include "I1.h" + +class I5{ +public: + + I5(); + ~I5(); +}; + +#endif // I5_H