Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] (no subject)


Core:
        In completeParseASTFactory.getExpressionResultType(): Added the support
        for _expression_ types: PM_DOTSTAR, PM_ARROWSTAR, CONDITIONALEXPRESSION
Tests:
        Added more success test cases to CompleteParseASTExpressionTest
        and more failure test cases to FailedCompleteParseASTExpressionTest
        in testing PM_DOTSTAR, PM_ARROWSTAR, CONDITIONALEXPRESSION
Hoda Amer
Staff Software Engineer
Rational Software - IBM Software Group


Index: .classpath
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/.classpath,v
retrieving revision 1.12
diff -u -r1.12 .classpath
--- .classpath	12 Sep 2003 18:19:05 -0000	1.12
+++ .classpath	17 Sep 2003 20:26:08 -0000
@@ -6,6 +6,7 @@
     <classpathentry kind="src" path="src/"/>
     <classpathentry kind="src" path="utils/"/>
     <classpathentry kind="src" path="parser/"/>
+    <classpathentry kind="src" path="dom/"/>
     <classpathentry kind="src" path="search/"/>
     <classpathentry kind="src" path="dependency/"/>
     <classpathentry kind="src" path="/org.eclipse.core.resources"/>
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.130
diff -u -r1.130 ChangeLog
--- parser/ChangeLog	16 Sep 2003 15:34:43 -0000	1.130
+++ parser/ChangeLog	17 Sep 2003 20:26:09 -0000
@@ -1,3 +1,7 @@
+2003-09-17 Hoda Amer
+	In completeParseASTFactory.getExpressionResultType(): Added the support 
+	for expression types: PM_DOTSTAR, PM_ARROWSTAR, CONDITIONALEXPRESSION
+		
 2003-09-16 John Camelon
 	Implement CompleteParse IASTFunction::previouslyDeclared(). 
 
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.41
diff -u -r1.41 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	16 Sep 2003 15:34:43 -0000	1.41
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	17 Sep 2003 20:26:10 -0000
@@ -789,8 +789,13 @@
 			 symbol = lookupQualifiedName( startingScope, typeId, references, false );
         }
 		// "a.m" or "a->m : lookup m in the scope of the declaration of a        
-		if ((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION) 
-		|| (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)){
+		if((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION) 
+		|| (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
+		|| (kind == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
+		|| (kind == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)		
+		|| (kind == IASTExpression.Kind.PM_DOTSTAR)
+		|| (kind == IASTExpression.Kind.PM_ARROWSTAR)
+		){
 			TypeInfo lhsInfo = (TypeInfo) ((ASTExpression)lhs).getResultType().iterator().next();
 			ISymbol containingScope = (ISymbol) lhsInfo.getTypeSymbol().getTypeSymbol();
 			if(containingScope != null){
@@ -822,11 +827,49 @@
         							
         return expression;
     }
+    /*
+     * Conditional Expression conversion
+     */
+     protected TypeInfo conditionalExpressionConversions(TypeInfo second, TypeInfo third){
+     	TypeInfo info = new TypeInfo();
+     	if(second.equals(third)){
+     		info = second;
+     		return info;
+     	}
+     	if((second.getType() == TypeInfo.t_void) && (third.getType() != TypeInfo.t_void)){
+     		info = third;
+     		return info;	
+     	}
+		if((second.getType() != TypeInfo.t_void) && (third.getType() == TypeInfo.t_void)){
+			info = second;
+			return info;	
+		}
+		if((second.getType() == TypeInfo.t_void) && (third.getType() == TypeInfo.t_void)){
+			info = second;
+			return info;	
+		}
+		try{
+	     	info = ParserSymbolTable.getConditionalOperand(second, third);
+	     	return info;
+		} catch(ParserSymbolTableException e){
+			// empty info
+			return info;
+		}
+     }
 	/*
 	 * Apply the usual arithmetic conversions to find out the result of an expression 
 	 * that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
 	 */
 	protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs){
+		
+		// if you have a variable of type basic type, then we need to go to the basic type first
+		while( (lhs.getType() == TypeInfo.t_type) && (lhs.getTypeSymbol() != null)){
+			lhs = lhs.getTypeSymbol().getTypeInfo();  
+		}
+		while( (rhs.getType() == TypeInfo.t_type) && (rhs.getTypeSymbol() != null)){
+			rhs = rhs.getTypeSymbol().getTypeInfo();  
+		}
+
 		TypeInfo info = new TypeInfo();
 		if( 
 		   ( lhs.checkBit(TypeInfo.isLong)  && lhs.getType() == TypeInfo.t_double)
@@ -894,7 +937,12 @@
 		
 		// types that resolve to void
 		if ((expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_EMPTY)
-		|| (expression.getExpressionKind() == IASTExpression.Kind.THROWEXPRESSION)) {
+		|| (expression.getExpressionKind() == IASTExpression.Kind.THROWEXPRESSION) 
+		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_DOT_DESTRUCTOR) 
+		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_ARROW_DESTRUCTOR)
+		|| (expression.getExpressionKind() == IASTExpression.Kind.DELETE_CASTEXPRESSION)
+		|| (expression.getExpressionKind() == IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION)
+		){
 			info.setType(TypeInfo.t_void);
 			result.add(info);
 			return result;
@@ -1000,8 +1048,7 @@
 		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_TYPEID_TYPEID)
 		){
 			info.setType(TypeInfo.t_type);
-			if(symbol != null)
-				info.setTypeSymbol(symbol);			
+			info.setTypeSymbol(symbol);			
 			result.add(info);
 			return result;
 		}
@@ -1027,9 +1074,22 @@
 			result.add(info);
 			return result;
 		}
+		// subscript
+//		if (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_SUBSCRIPT){
+//			List lhsResult = ((ASTExpression)expression.getLHSExpression()).getResultType();
+//			if( lhsResult.iterator().hasNext())
+//				info = (TypeInfo)lhsResult.iterator().next();
+//			if ((info != null) && (info.getTypeSymbol() != null)){
+//				info.addPtrOperator(new TypeInfo.PtrOp(TypeInfo.PtrOp.t_pointer));				
+//			}
+//			result.add(info);
+//			return result;
+//		}
 		// the dot and the arrow resolves to the type of the member
 		if ((expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION)
 		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
+		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
+		|| (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)
 		){
 			if(symbol != null){
 				info = new TypeInfo(symbol.getTypeInfo());			
@@ -1037,6 +1097,22 @@
 				return result;
 			}
 		}
+		// the dot* and the arrow* are the same as dot/arrow + unary star
+		if ((expression.getExpressionKind() == IASTExpression.Kind.PM_DOTSTAR)
+		|| (expression.getExpressionKind() == IASTExpression.Kind.PM_ARROWSTAR)
+		){
+			List rhsResult = ((ASTExpression)expression.getRHSExpression()).getResultType();
+			if( rhsResult.iterator().hasNext())
+				info = (TypeInfo)rhsResult.iterator().next();
+			if (info != null){
+				info.addPtrOperator(new TypeInfo.PtrOp(TypeInfo.PtrOp.t_pointer));				
+			}
+			if(symbol != null){
+				info.setTypeSymbol(symbol);
+			}						
+			result.add(info);
+			return result;
+		}
 		// this
 		if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_THIS){
 			if(symbol != null)
@@ -1047,6 +1123,18 @@
 				result.add(info);
 				return result;
 			}
+		}
+		// conditional
+		if (expression.getExpressionKind() == IASTExpression.Kind.CONDITIONALEXPRESSION){
+			ASTExpression right = (ASTExpression)expression.getRHSExpression();  
+			ASTExpression third = (ASTExpression)expression.getThirdExpression();
+			if((right != null ) && (third != null)){
+				TypeInfo rightType =(TypeInfo)right.getResultType().iterator().next();
+				TypeInfo thirdType =(TypeInfo)third.getResultType().iterator().next();
+				info = conditionalExpressionConversions(rightType, thirdType);   
+				result.add(info);
+				return result;
+			}
 		}		
 		// new 
 /*		if((expression.getExpressionKind() == IASTExpression.Kind.NEW_NEWTYPEID)
@@ -1073,13 +1161,7 @@
 			ASTExpression right = (ASTExpression)expression.getRHSExpression();  
 			if((left != null ) && (right != null)){
 				TypeInfo leftType =(TypeInfo)left.getResultType().iterator().next();
-				while( (leftType.getType() == TypeInfo.t_type) && (leftType.getTypeSymbol() != null)){
-					leftType = leftType.getTypeSymbol().getTypeInfo();  
-				}
 				TypeInfo rightType =(TypeInfo)right.getResultType().iterator().next();
-				while( (rightType.getType() == TypeInfo.t_type) && (rightType.getTypeSymbol() != null)){
-					rightType = rightType.getTypeSymbol().getTypeInfo();  
-				}
 				info = usualArithmeticConversions(leftType, rightType);   
 				result.add(info);
 				return result;
@@ -1676,6 +1758,7 @@
 				isDestructor = true;
 			}
 		}
+
 		symbol.setIsForwardDeclaration(!isFunctionDefinition);
 		boolean previouslyDeclared = false; 
 		
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	16 Sep 2003 17:31:43 -0000	1.100
+++ ChangeLog	17 Sep 2003 20:26:30 -0000
@@ -1,3 +1,8 @@
+2003-09-17 Hoda Amer
+	Added more success test cases to CompleteParseASTExpressionTest
+	and more failure test cases to FailedCompleteParseASTExpressionTest
+	in testing PM_DOTSTAR, PM_ARROWSTAR, CONDITIONALEXPRESSION
+	
 2003-09-17 Bogdan Gheorghe
 	Added asserts to all index lookups in IndexManagerTests
 	Fixed testAddNewFileToIndex
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java,v
retrieving revision 1.3
diff -u -r1.3 FailedCompleteParseASTExpressionTest.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java	11 Sep 2003 18:06:15 -0000	1.3
+++ failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java	17 Sep 2003 20:26:30 -0000
@@ -10,6 +10,14 @@
 ***********************************************************************/
 package org.eclipse.cdt.core.parser.failedTests;
 
+import java.util.Iterator;
+
+import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTFunction;
+import org.eclipse.cdt.core.parser.ast.IASTMethod;
+import org.eclipse.cdt.core.parser.ast.IASTReference;
+import org.eclipse.cdt.core.parser.ast.IASTVariable;
 import org.eclipse.cdt.core.parser.tests.CompleteParseBaseTest;
 
 /**
@@ -32,5 +40,139 @@
     {
         super(name);
     }
-       
+    
+//	public void testPostfixSubscriptA_Bug43238() throws Exception
+//	{
+//		Iterator i = parse ("int pa[10][5] ; \n int f(int ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( callback.getReferences().size(), 1 ); // should be = 2
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		//assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}
+//	public void testPostfixSubscriptB_Bug43238() throws Exception
+//	{
+//		Iterator i = parse ("int* pa[10][5] ; \n int f(int* ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( callback.getReferences().size(), 1 ); // should be = 2
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		//assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}
+//	public void testPostfixSubscriptWithReferences_Bug43238() throws Exception
+//	{
+//		Iterator i = parse ("class A{}; \n A *pa[10][5] ; \n int f(A* ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+//		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}	
+	public void testConditionalExpression_Bug43159() throws Exception { 
+		Iterator i = parse( "int foo(bool); int foo(int); int a = 10, b = 4, c = 2; int x = foo( a > 5 ? b : c );").getDeclarations();
+		IASTFunction foo1 = (IASTFunction)i.next();
+		IASTFunction foo2 = (IASTFunction)i.next(); 
+		IASTVariable a = (IASTVariable)i.next();
+		IASTVariable b = (IASTVariable)i.next();
+		IASTVariable c = (IASTVariable)i.next();
+		IASTVariable x = (IASTVariable)i.next();
+		assertFalse( i.hasNext() );
+		assertEquals( callback.getReferences().size(), 3 ); // should be 4
+		Iterator references =callback.getReferences().iterator();
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), a ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), b ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), c ); 
+		//assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
+		assertFalse( references.hasNext() );	
+	}
+	
+	public void testConditionalExpressionWithReferencesB_Bug43106() throws Exception { 
+		Iterator i = parse( "class A{}; class B : public A{}; int foo(); int foo(A&); A a ; B b; int c = 0; int x = foo( c > 5 ? b : a );").getDeclarations();
+		IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
+		IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
+		IASTFunction foo1 = (IASTFunction)i.next();
+		IASTFunction foo2 = (IASTFunction)i.next(); 
+		IASTVariable a = (IASTVariable)i.next();
+		IASTVariable b = (IASTVariable)i.next();
+		IASTVariable c = (IASTVariable)i.next();
+		IASTVariable x = (IASTVariable)i.next();
+		assertFalse( i.hasNext() );
+		assertEquals( callback.getReferences().size(), 7 ); // should be 8
+		Iterator references =callback.getReferences().iterator();
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), clb );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), c ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), b ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), a ); 
+		//assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
+		assertFalse( references.hasNext() );	
+	}
+	public void testPMDotStarPointerToMemberFunction_Bug43242() throws Exception
+	{
+		Iterator i = parse ("class A { int m(int); }; \n A a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a.*pm)(5));").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator members = getDeclarations(cl);
+		IASTMethod method = (IASTMethod)members.next();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		Iterator references = callback.getReferences().iterator();
+		assertEquals( callback.getReferences().size(), 5 ); // should be 6
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), method );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), a );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), pm );
+//		assertEquals( ((IASTReference) references.next()).getReferencedElement(), f2 );				
+	}
+	public void testPMArrowStarPointerToMemberFunction_Bug43242() throws Exception
+	{
+		Iterator i = parse ("class A { int m(int); }; \n A * a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a->*pm)(5));").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator members = getDeclarations(cl);
+		IASTMethod method = (IASTMethod)members.next();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		Iterator references = callback.getReferences().iterator();
+		assertEquals( callback.getReferences().size(), 5 ); // should be 6
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), method );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), a );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), pm );
+//		assertEquals( ((IASTReference) references.next()).getReferencedElement(), f2 );				
+	}  
+	public void testUnaryStarCastexpressionPointerToFunction_Bug43241() throws Exception
+	{
+		Iterator i = parse ("int m(int); \n int *pm = &m; \n int f(){} \n int f(int); \n int x = f((*pm)(5));").getDeclarations();
+		IASTFunction m = (IASTFunction) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		Iterator references = callback.getReferences().iterator();
+		assertEquals( callback.getReferences().size(), 2 ); // should be 3
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), m );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), pm );
+//		assertEquals( ((IASTReference) references.next()).getReferencedElement(), f2 );				
+	}
+	    
 }
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java,v
retrieving revision 1.4
diff -u -r1.4 CompleteParseASTExpressionTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java	16 Sep 2003 14:45:34 -0000	1.4
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java	17 Sep 2003 20:26:31 -0000
@@ -169,8 +169,61 @@
 		assertEquals( ar1.getReferencedElement(), a );
 		assertEquals( fr1.getReferencedElement(), f1 );
 	}
-	// Kind POSTFIX_SUBSCRIPT
-	 
+	// Kind POSTFIX_SUBSCRIPT	
+//	public void testPostfixSubscript() throws Exception
+//	{
+//		Iterator i = parse ("int pa[10]; \n int f(int ia){} \n int f(void); \n int x = f(pa[1]);").getDeclarations();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( callback.getReferences().size(), 2 );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}
+//		
+// 	public void testPostfixSubscriptA() throws Exception
+//	{
+//		Iterator i = parse ("int pa[10][5] ; \n int f(int ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( callback.getReferences().size(), 2 ); // should be = 2
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}	 
+//  
+// 	public void testPostfixSubscriptB() throws Exception
+//	{
+//		Iterator i = parse ("int* pa[10][5] ; \n int f(int* ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( callback.getReferences().size(), 2 ); // should be = 2
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}	
+//	
+//	public void testPostfixSubscriptWithReferences() throws Exception
+//	{
+//		Iterator i = parse ("class A{}; \n A *pa[10][5] ; \n int f(A* ia){} \n int f(void); \n int x = f(pa[1][2]);").getDeclarations();
+//		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+//		IASTVariable pa  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals( ((IASTClassReference) references.next()).getReferencedElement(), cl );
+//		assertEquals( ((IASTClassReference) references.next()).getReferencedElement(), cl );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), pa );
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), f1 );
+//	}
+	
 	// Kind POSTFIX_FUNCTIONCALL : return type of called function
 	public void testPostfixFunctioncallBug42822() throws Exception
 	{
@@ -198,6 +251,24 @@
 		assertEquals( callback.getReferences().size(), 1 ); 
 	}
 	// Kind POSTFIX_TYPENAME_IDENTIFIER
+//	public void testPostfixTypenameIdentifier() throws Exception{
+//		Iterator i = parse( "class A {}; \n int foo(); int foo( A a ); \n int x = foo( typename A(); );").getDeclarations();
+//		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator members = getDeclarations(cl);
+//		IASTField m = (IASTField)members.next();
+//		Iterator references = callback.getReferences().iterator();
+//		IASTClassReference clr= (IASTClassReference)references.next();
+//		assertEquals(clr.getReferencedElement(), cl);
+//		IASTVariableReference ar = (IASTVariableReference)references.next();
+//		assertEquals(ar.getReferencedElement(), a);
+//		IASTFieldReference mr = (IASTFieldReference) references.next();
+//		assertEquals(mr.getReferencedElement(), m);
+//		IASTFunctionReference fr = (IASTFunctionReference) references.next();
+//		assertEquals(fr.getReferencedElement(), f2);   		
+//	}
 	
 	// Kind POSTFIX_TYPENAME_TEMPLATEID
 	
@@ -284,23 +355,23 @@
 	}
 	
 	// Kind POSTFIX_DYNAMIC_CAST 
-/*	public void testPostfixDynamicCast() throws Exception{
-		Iterator i = parse( "class A {}; class B : public A{}; \n B * b; \n int foo(); int foo( A* ); \n int x = foo( dynamic_cast<A*>(b) );").getDeclarations();
-		IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		IASTVariable b  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-		Iterator references = callback.getReferences().iterator();
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), clb);
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), b);
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
-		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), f2);
-	}
-*/	
+//	public void testPostfixDynamicCast() throws Exception{
+//		Iterator i = parse( "class A {}; class B : public A{}; \n B * b; \n int foo(); int foo( A* ); \n int x = foo( dynamic_cast<A*>(b) );").getDeclarations();
+//		IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+//		IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+//		IASTVariable b  = (IASTVariable) i.next();
+//		IASTFunction f1 = (IASTFunction) i.next();
+//		IASTFunction f2 = (IASTFunction) i.next();
+//		IASTVariable x  = (IASTVariable) i.next();
+//		Iterator references = callback.getReferences().iterator();
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), clb);
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), b);
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), cla);
+//		assertEquals(((IASTClassReference)references.next()).getReferencedElement(), f2);
+//	}
+	
 	// Kind POSTFIX_REINTERPRET_CAST
 	// Kind POSTFIX_STATIC_CAST
 	// Kind POSTFIX_CONST_CAST
@@ -491,26 +562,59 @@
 	// Kind NEW_NEWTYPEID                
 	// Kind NEW_TYPEID                   
 	// There are so many ways to call new, only this case is handeled.
-/*	public void testNewTypeId() throws Exception { 
-		Iterator i = parse( "class A{}; void foo(); int foo( A a ); int x = foo( new A() );").getDeclarations();
-		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
-		IASTFunction foo = (IASTFunction)i.next();
-		IASTFunction foo2 = (IASTFunction)i.next(); 
-		IASTVariable x = (IASTVariable)i.next();
-		assertFalse( i.hasNext() );
-		//assertEquals( callback.getReferences().size(), 3 );
-		Iterator references =callback.getReferences().iterator();
-		IASTClassReference clr1 = (IASTClassReference) references.next();
-		IASTClassReference clr2 = (IASTClassReference) references.next();
-		assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
-		assertFalse( references.hasNext() );
-	}
-*/
+//	public void testNewTypeId() throws Exception { 
+//		Iterator i = parse( "class A{}; void foo(); int foo( A a ); int x = foo( new A() );").getDeclarations();
+//		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
+//		IASTFunction foo = (IASTFunction)i.next();
+//		IASTFunction foo2 = (IASTFunction)i.next(); 
+//		IASTVariable x = (IASTVariable)i.next();
+//		assertFalse( i.hasNext() );
+//		//assertEquals( callback.getReferences().size(), 3 );
+//		Iterator references =callback.getReferences().iterator();
+//		IASTClassReference clr1 = (IASTClassReference) references.next();
+//		IASTClassReference clr2 = (IASTClassReference) references.next();
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
+//		assertFalse( references.hasNext() );
+//	}
+
 	// Kind DELETE_CASTEXPRESSION        
 	// Kind DELETE_VECTORCASTEXPRESSION  
 	// Kind CASTEXPRESSION               
 	// Kind PM_DOTSTAR                   
+	public void testPMDotStar() throws Exception
+	{
+		Iterator i = parse ("class A { int m; }; \n A a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a.*pm);").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		Iterator references = callback.getReferences().iterator();
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), a );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), pm );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), f2 );
+			
+	}
+
 	// Kind PM_ARROWSTAR          
+	public void testPMArrowStar() throws Exception
+	{
+		Iterator i = parse ("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		Iterator references = callback.getReferences().iterator();
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), cl );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), a );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), pm );
+		assertEquals( ((IASTReference) references.next()).getReferencedElement(), f2 );
+				
+	}
 	       
 	// Kind MULTIPLICATIVE_MULTIPLY : usual arithmetic conversions
 	public void testMultiplicativeMultiply() throws Exception { 
@@ -786,7 +890,48 @@
 		assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
 		assertFalse( references.hasNext() );	
 	}
-	// Kind CONDITIONALEXPRESSION      
+	// Kind CONDITIONALEXPRESSION : conditional Expression Conversions     
+//	public void testConditionalExpression() throws Exception { 
+//		Iterator i = parse( "int foo(bool); int foo(int); int a = 10, b = 4, c = 2; int x = foo( a > 5 ? b : c );").getDeclarations();
+//		IASTFunction foo1 = (IASTFunction)i.next();
+//		IASTFunction foo2 = (IASTFunction)i.next(); 
+//		IASTVariable a = (IASTVariable)i.next();
+//		IASTVariable b = (IASTVariable)i.next();
+//		IASTVariable c = (IASTVariable)i.next();
+//		IASTVariable x = (IASTVariable)i.next();
+//		assertFalse( i.hasNext() );
+//		assertEquals( callback.getReferences().size(), 4 );
+//		Iterator references =callback.getReferences().iterator();
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), a ); 
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), b ); 
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), c ); 
+//		assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
+//		assertFalse( references.hasNext() );	
+//	}
+	// Kind CONDITIONALEXPRESSION with references : conditional Expression Conversions      
+	public void testConditionalExpressionWithReferencesA() throws Exception { 
+		Iterator i = parse( "class A{}; class B : public A{}; int foo(); int foo(A*); A *a ; B *b; int c = 0; int x = foo( c > 5 ? b : a );").getDeclarations();
+		IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
+		IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();		
+		IASTFunction foo1 = (IASTFunction)i.next();
+		IASTFunction foo2 = (IASTFunction)i.next(); 
+		IASTVariable a = (IASTVariable)i.next();
+		IASTVariable b = (IASTVariable)i.next();
+		IASTVariable c = (IASTVariable)i.next();
+		IASTVariable x = (IASTVariable)i.next();
+		assertFalse( i.hasNext() );
+		assertEquals( callback.getReferences().size(), 8 );
+		Iterator references =callback.getReferences().iterator();
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), cla );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), clb );
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), c ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), b ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), a ); 
+		assertEquals( ((IASTReference)references.next()).getReferencedElement(), foo2 ); 
+		assertFalse( references.hasNext() );	
+	}
 	
 	// Kind THROWEXPRESSION
 	            
Index: suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java,v
retrieving revision 1.19
diff -u -r1.19 AutomatedIntegrationSuite.java
--- suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java	12 Sep 2003 19:11:22 -0000	1.19
+++ suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java	17 Sep 2003 20:26:31 -0000
@@ -27,6 +27,7 @@
 import org.eclipse.cdt.core.model.tests.ElementDeltaTests;
 import org.eclipse.cdt.core.model.tests.WorkingCopyTests;
 import org.eclipse.cdt.core.parser.failedTests.ASTFailedTests;
+import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTExpressionTest;
 import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
 import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
 import org.eclipse.cdt.core.search.tests.SearchTestSuite;
@@ -94,7 +95,7 @@
 		suite.addTestSuite(ASTFailedTests.class);
 		suite.addTestSuite(STLFailedTests.class);
 		suite.addTestSuite(CModelElementsFailedTests.class);
-//		suite.addTestSuite(FailedCompleteParseASTExpressionTest.class);
+		suite.addTestSuite(FailedCompleteParseASTExpressionTest.class);
 
 		// Last test to trigger report generation
 		suite.addTest(suite.new GenerateReport("generateReport"));

Back to the top