mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 04:45:38 +02:00
Bug 442742 - "Organize Includes" removes a header required for a
namespace alias
This commit is contained in:
parent
01fcf452a7
commit
98e2f01a97
2 changed files with 16 additions and 0 deletions
|
@ -348,6 +348,19 @@ public class BindingClassifierTest extends OneSourceMultipleHeadersTestCase {
|
|||
assertDeclared();
|
||||
}
|
||||
|
||||
// namespace ns1 {
|
||||
// namespace ns2 {
|
||||
// class A {};
|
||||
// }
|
||||
// }
|
||||
// namespace ns = ns1::ns2;
|
||||
|
||||
// ns::A a;
|
||||
public void testNamespaceAlias() throws Exception {
|
||||
assertDefined("A", "ns");
|
||||
assertDeclared();
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// A(const char* s);
|
||||
// };
|
||||
|
|
|
@ -103,6 +103,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
|
@ -1020,6 +1021,8 @@ public class BindingClassifier {
|
|||
* or an empty list if no such binding is available.
|
||||
*/
|
||||
private Set<IBinding> getRequiredBindings(IBinding binding) {
|
||||
if (binding instanceof ICPPNamespaceAlias)
|
||||
return Collections.singleton(binding);
|
||||
if (binding instanceof ICPPNamespace)
|
||||
return Collections.emptySet();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue