diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index 01307672f68..3c8b87741d4 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,6 @@ +2004-01-27 Andrew Niefer + Added CompleteParseASTTest.testCBoolAsParameter + 2004-01-26 John Camelon Updated clients to use new Scanner logging service. Added ScannerTestCase.testBug46402(). diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java index 40b9095fa94..e152da730f2 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java @@ -986,6 +986,25 @@ public class CompleteParseASTTest extends CompleteParseBaseTest assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getType(), IASTSimpleTypeSpecifier.Type._BOOL ); } + public void testCBoolAsParameter() throws Exception + { + Iterator i = parse( "void f( _Bool b ) {} " + + "_Bool g( _Bool b ) {} " + + "void main(){" + + " _Bool b; " + + " f(b);" + + " f( g( (_Bool) 1 ) );" + + "}", + true, ParserLanguage.C ).getDeclarations(); + + IASTFunction f = (IASTFunction) i.next(); + IASTFunction g = (IASTFunction) i.next(); + IASTFunction main = (IASTFunction) i.next(); + IASTVariable b = (IASTVariable) getDeclarations( main ).next(); + + assertAllReferences( 4, createTaskList( new Task( f, 2 ), new Task( b ), new Task( g ) ) ); + } + public void testBug44510() throws Exception { Iterator i = parse( "int initialize(); " + diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog-parser b/core/org.eclipse.cdt.core/parser/ChangeLog-parser index 3987fd42c45..09e7122205f 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog-parser +++ b/core/org.eclipse.cdt.core/parser/ChangeLog-parser @@ -1,3 +1,13 @@ +2004-01-27 Andrew Niefer + Updates to handle _Bool + - modified CompleteParseASTFactory.getParameterTypeInfo + CompleteParseASTFactory.createReference + CompleteParseASTFactory.usualArithmeticConversions + CompleteParseASTFactory.getTypeKind + Parser.typeId + TypeFilter.shouldAccept + TypeInfo.equals + 2004-01-26 John Camelon Added traceLogs into Scanner. Fixed Bug 46402 : expression evaluation error on branch not taken diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java index ec1e5cb87e2..104567e5cb0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java @@ -4078,7 +4078,13 @@ public abstract class Parser implements IParser consume(); break; - + case IToken.t__Bool : + if( encounteredType ) break simpleMods; + encounteredType = true; + kind = IASTSimpleTypeSpecifier.Type._BOOL; + consume(); + break; + default : break simpleMods; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index f775e982f64..ce614c3e7c7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -699,7 +699,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto ( symbol.getType() == TypeInfo.t_int ) || ( symbol.getType() == TypeInfo.t_float )|| ( symbol.getType() == TypeInfo.t_double ) || - ( symbol.getType() == TypeInfo.t_void ) ) + ( symbol.getType() == TypeInfo.t_void ) || + ( symbol.getType() == TypeInfo.t__Bool) ) { if( symbol.getContainingSymbol().getType() == TypeInfo.t_class || @@ -977,8 +978,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto rhs = rhs.getTypeSymbol().getTypeInfo(); } - if( !lhs.isType(TypeInfo.t_bool, TypeInfo.t_enumerator ) && - !rhs.isType(TypeInfo.t_bool, TypeInfo.t_enumerator ) ) + if( !lhs.isType(TypeInfo.t__Bool, TypeInfo.t_enumerator ) && + !rhs.isType(TypeInfo.t__Bool, TypeInfo.t_enumerator ) ) { throw new ASTSemanticException(); } @@ -1751,6 +1752,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto type.setType(TypeInfo.t_wchar_t); else if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME ) type.setType(TypeInfo.t_type); + else if( kind == IASTSimpleTypeSpecifier.Type._BOOL ){ + type.setType( TypeInfo.t__Bool ); + } else throw new ASTSemanticException(); } @@ -2728,6 +2732,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTSimpleTypeSpecifier.Type type = id.getKind(); if( type == IASTSimpleTypeSpecifier.Type.BOOL ) return TypeInfo.t_bool; + else if( type == IASTSimpleTypeSpecifier.Type._BOOL ) + return TypeInfo.t__Bool; else if( type == IASTSimpleTypeSpecifier.Type.CHAR ) return TypeInfo.t_char; else if( type == IASTSimpleTypeSpecifier.Type.DOUBLE ) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java index 7ac4ab4c9bb..5aafdaa7a65 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java @@ -74,7 +74,7 @@ public class TypeFilter { return false; } } - else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t_bool, TypeInfo.t_void ) ) + else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t__Bool, TypeInfo.t_void ) ) { if( ( acceptedKinds.contains( LookupKind.VARIABLES ) && !symbolIsMember && !symbolIsLocal ) || ( acceptedKinds.contains( LookupKind.LOCAL_VARIABLES ) && !symbolIsMember && symbolIsLocal ) || diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java index 84c91b0131e..2f77cd0afa6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java @@ -479,8 +479,8 @@ public class TypeInfo { result &= _typeDeclaration.equals( type._typeDeclaration ); } else { if( _typeDeclaration != null && type._typeDeclaration != null && - _typeDeclaration.isType( TypeInfo.t_bool, TypeInfo.t_void ) && - type._typeDeclaration.isType( TypeInfo.t_bool, TypeInfo.t_void ) ) + _typeDeclaration.isType( TypeInfo.t__Bool, TypeInfo.t_void ) && + type._typeDeclaration.isType( TypeInfo.t__Bool, TypeInfo.t_void ) ) { //if typeDeclaration is a basic type, then only need the types the same result &= ( _typeDeclaration.getType() == type._typeDeclaration.getType() );