Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2014-08-27 21:14:59 +0000
committerSergey Prigogin2014-08-27 21:44:06 +0000
commit98e2f01a972e41e5530690a73be57b08a04e8338 (patch)
treedc17a08f953936986cf9ef16c3eb72761e6ea370
parent01fcf452a79ae3bbd9253059e868d3d05f1e6c55 (diff)
downloadorg.eclipse.cdt-98e2f01a972e41e5530690a73be57b08a04e8338.tar.gz
org.eclipse.cdt-98e2f01a972e41e5530690a73be57b08a04e8338.tar.xz
org.eclipse.cdt-98e2f01a972e41e5530690a73be57b08a04e8338.zip
Bug 442742 - "Organize Includes" removes a header required for a
namespace alias
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java3
2 files changed, 16 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
index ccee2c7c1e8..a4f8afe32e1 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/includes/BindingClassifierTest.java
@@ -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);
// };
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
index 72286ab5758..199c09434af 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
@@ -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();

Back to the top