mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
NPE in type-comparison, bug 238614.
This commit is contained in:
parent
eba71c1297
commit
51c06fe8cc
3 changed files with 12 additions and 4 deletions
|
@ -94,7 +94,7 @@ public class PDOMCBugsTest extends BaseTestCase {
|
||||||
IFunctionType ft= (IFunctionType) type;
|
IFunctionType ft= (IFunctionType) type;
|
||||||
assertEquals("int (int)", ASTTypeUtil.getType(ft));
|
assertEquals("int (int)", ASTTypeUtil.getType(ft));
|
||||||
} else {
|
} else {
|
||||||
assertNull("expected null, got "+type, type);
|
assertTrue("expected ITypedef, got "+type, type == null || type instanceof ITypedef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1771,7 +1771,9 @@ public class CPPVisitor {
|
||||||
ICPPClassScope cScope = (ICPPClassScope) s;
|
ICPPClassScope cScope = (ICPPClassScope) s;
|
||||||
IType type = cScope.getClassType();
|
IType type = cScope.getClassType();
|
||||||
if (type instanceof ICPPClassTemplate) {
|
if (type instanceof ICPPClassTemplate) {
|
||||||
type = (IType) CPPTemplates.instantiateWithinClassTemplate((ICPPClassTemplate) type);
|
IBinding within = CPPTemplates.instantiateWithinClassTemplate((ICPPClassTemplate) type);
|
||||||
|
if (within instanceof ICPPClassType)
|
||||||
|
type = (ICPPClassType)within;
|
||||||
}
|
}
|
||||||
if (dtor.isConst() || dtor.isVolatile())
|
if (dtor.isConst() || dtor.isVolatile())
|
||||||
type = new CPPQualifierType(type, dtor.isConst(), dtor.isVolatile());
|
type = new CPPQualifierType(type, dtor.isConst(), dtor.isVolatile());
|
||||||
|
|
|
@ -169,7 +169,10 @@ public class SemanticUtil {
|
||||||
try {
|
try {
|
||||||
while( true ){
|
while( true ){
|
||||||
if( type instanceof ITypedef ) {
|
if( type instanceof ITypedef ) {
|
||||||
type= ((ITypedef)type).getType();
|
IType tt= ((ITypedef)type).getType();
|
||||||
|
if (tt == null)
|
||||||
|
return type;
|
||||||
|
type= tt;
|
||||||
} else if( type instanceof IQualifierType ) {
|
} else if( type instanceof IQualifierType ) {
|
||||||
type= ((IQualifierType)type).getType();
|
type= ((IQualifierType)type).getType();
|
||||||
} else if( stopAtPointerToMember && type instanceof ICPPPointerToMemberType )
|
} else if( stopAtPointerToMember && type instanceof ICPPPointerToMemberType )
|
||||||
|
@ -200,7 +203,10 @@ public class SemanticUtil {
|
||||||
try {
|
try {
|
||||||
while( true ){
|
while( true ){
|
||||||
if( type instanceof ITypedef ) {
|
if( type instanceof ITypedef ) {
|
||||||
type = ((ITypedef)type).getType();
|
IType tt= ((ITypedef)type).getType();
|
||||||
|
if (tt == null)
|
||||||
|
return type;
|
||||||
|
type= tt;
|
||||||
} else if( type instanceof IQualifierType ) {
|
} else if( type instanceof IQualifierType ) {
|
||||||
type = ((IQualifierType)type).getType();
|
type = ((IQualifierType)type).getType();
|
||||||
} else if( type instanceof ICPPReferenceType ) {
|
} else if( type instanceof ICPPReferenceType ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue