1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
Partial fix for Bug37002 - Order of Offsetables is wrong 

TESTS
	Added DOMTests::testOrder().
This commit is contained in:
John Camelon 2003-04-28 16:01:38 +00:00
parent fcc7499f2e
commit 771d05100d
4 changed files with 32 additions and 0 deletions

View file

@ -807,6 +807,7 @@ public class DOMBuilder implements IParserCallback
TemplateDeclaration d = new TemplateDeclaration( (IScope)container, exported );
if( container instanceof IAccessable )
d.setVisibility( ((IAccessable)container).getVisibility() );
d.setStartingOffset( exported.getOffset() );
return d;
}
@ -824,6 +825,7 @@ public class DOMBuilder implements IParserCallback
TemplateDeclaration decl = (TemplateDeclaration)templateDecl;
decl.setLastToken(lastToken);
decl.getOwnerScope().addDeclaration(decl);
decl.setTotalLength(lastToken.getOffset() + lastToken.getLength() - decl.getStartingOffset() );
}
/* (non-Javadoc)

View file

@ -1,3 +1,6 @@
2003-04-28 John Camelon
Partial fix for Bug37002 - Order of Offsetables is wrong
2003-04-27 John Camelon
Partial fix for Bug 36932 - RTS: Parser fails on "new" in ctor initializer
Fixed Bug 36704 - Problem parsing Loki's Reference Typelist.h

View file

@ -1,3 +1,6 @@
2003-04-28 John Camelon
Added DOMTests::testOrder().
2003-04-28 Peter Graves
* model/org/eclipse/cdt/core/model/tests/BinaryTests:
Updated to remove a few small errors, and deal with some changes

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.internal.core.dom.ConstructorChain;
import org.eclipse.cdt.internal.core.dom.ConstructorChainElement;
import org.eclipse.cdt.internal.core.dom.ConstructorChainElementExpression;
import org.eclipse.cdt.internal.core.dom.DeclSpecifier;
import org.eclipse.cdt.internal.core.dom.Declaration;
import org.eclipse.cdt.internal.core.dom.Declarator;
import org.eclipse.cdt.internal.core.dom.ElaboratedTypeSpecifier;
import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier;
@ -1755,5 +1756,28 @@ public class DOMTests extends BaseDOMTest {
parse(code.toString());
}
public void testOrder() throws Exception
{
Writer code = new StringWriter();
code.write( "#define __SGI_STL_INTERNAL_ALGOBASE_H\n" );
code.write( "#include <string.h>\n" );
code.write( "template <class _Tp>\n" );
code.write( "inline void swap(_Tp& __a, _Tp& __b) {\n" );
code.write( "__STL_REQUIRES(_Tp, _Assignable);\n" );
code.write( "_Tp __tmp = __a;\n" );
code.write( "__a = __b;\n" );
code.write( "__b = __tmp;\n" );
code.write( "}\n" );
Iterator i = parse( code.toString(), true, true ).iterateOffsetableElements();
assertTrue( i.hasNext() );
assertTrue( i.next() instanceof Macro );
assertTrue( i.hasNext() );
assertTrue( i.next() instanceof Inclusion );
assertTrue( i.hasNext() );
assertTrue( i.next() instanceof Declaration );
assertFalse( i.hasNext() );
}
}