mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Distinction of deferred instances, bug 264367.
This commit is contained in:
parent
76fda4d2c5
commit
cb8e6623fd
3 changed files with 30 additions and 8 deletions
|
@ -3780,8 +3780,27 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
// int* iptr;
|
||||
// any(CT<int>(iptr));
|
||||
// }
|
||||
public void testConstructorTemplateInClassTemplate() throws Exception {
|
||||
public void testConstructorTemplateInClassTemplate_264314() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||
}
|
||||
|
||||
// template <typename T> class XT {};
|
||||
// template <typename T> void func(T t, XT<typename T::A> a) {}
|
||||
// template <typename T, typename S> void func(S s, XT<typename S::A> a, T t) {}
|
||||
//
|
||||
// class X {typedef int A;};
|
||||
// class Y {typedef X A;};
|
||||
//
|
||||
// void test() {
|
||||
// X x; Y y;
|
||||
// XT<int> xint; XT<X> xy;
|
||||
// func(x, xint);
|
||||
// func(y, xy, xint);
|
||||
// }
|
||||
public void testDistinctDeferredInstances_264367() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5821,8 +5821,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
private long memoryUsed() {
|
||||
System.gc();System.gc();System.gc();System.gc();System.gc();
|
||||
private long memoryUsed() throws InterruptedException {
|
||||
System.gc();Thread.sleep(200);System.gc();
|
||||
final Runtime runtime = Runtime.getRuntime();
|
||||
return runtime.totalMemory()-runtime.freeMemory();
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ public class ASTTypeUtil {
|
|||
// 101114 fix, do not display class, and for consistency don't display struct/union as well
|
||||
if (type instanceof ICPPClassType) {
|
||||
try {
|
||||
String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type));
|
||||
String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type, normalize));
|
||||
result.append(qn);
|
||||
} catch (DOMException e) {
|
||||
result.append(getNameForAnonymous((ICompositeType) type));
|
||||
|
@ -651,13 +651,12 @@ public class ASTTypeUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static String[] getQualifiedNameForAnonymous(ICPPBinding binding) throws DOMException {
|
||||
private static String[] getQualifiedNameForAnonymous(ICPPBinding binding, boolean normalize) throws DOMException {
|
||||
LinkedList<String> result= new LinkedList<String>();
|
||||
result.addFirst(getNameForAnonymous(binding));
|
||||
|
||||
IBinding owner= binding.getOwner();
|
||||
while(owner instanceof ICPPNamespace || owner instanceof ICPPClassType) {
|
||||
while(owner instanceof ICPPNamespace || owner instanceof IType) {
|
||||
char[] name= owner.getNameCharArray();
|
||||
if (name == null || name.length == 0) {
|
||||
if (!(binding instanceof ICPPNamespace)) {
|
||||
|
@ -666,9 +665,13 @@ public class ASTTypeUtil {
|
|||
result.addFirst(new String(altname));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (normalize && owner instanceof IType) {
|
||||
result.addFirst(getType((IType) owner, normalize));
|
||||
} else {
|
||||
result.addFirst(new String(name));
|
||||
}
|
||||
}
|
||||
owner= owner.getOwner();
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
|
|
Loading…
Add table
Reference in a new issue