mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Fixed Bug 84357 - [Offsets] bad offset for ICPPASTPointerToMember
This commit is contained in:
parent
cc0ca12dcf
commit
3e9fe50bc3
2 changed files with 11 additions and 4 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorFunctionStyleMacroDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorObjectStyleMacroDefinition;
|
||||
|
@ -209,7 +210,14 @@ public class DOMLocationTests extends AST2BaseTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void testBug84357() throws Exception {
|
||||
String code = "class X { int a;\n};\nint X:: * pmi = &X::a;"; //$NON-NLS-1$
|
||||
IASTTranslationUnit tu = parse( code, ParserLanguage.CPP );
|
||||
IASTSimpleDeclaration pmi = (IASTSimpleDeclaration) tu.getDeclarations()[1];
|
||||
IASTDeclarator d = pmi.getDeclarators()[0];
|
||||
IASTPointerOperator p = d.getPointerOperators()[0];
|
||||
assertSoleLocation( p, code.indexOf( "X:: *") , "X:: *".length()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
public void testBug84367() throws Exception {
|
||||
String code = "void foo( int );"; //$NON-NLS-1$
|
||||
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
|
||||
|
|
|
@ -548,9 +548,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
if (nameDuple != null) {
|
||||
IASTName name = createName(nameDuple);
|
||||
ICPPASTPointerToMember p2m = createPointerToMember(isRestrict);
|
||||
((ASTNode) p2m).setOffsetAndLength(starOffset, nameDuple
|
||||
.getEndOffset()
|
||||
- starOffset);
|
||||
((ASTNode) p2m).setOffsetAndLength(nameDuple.getFirstToken().getOffset(), last
|
||||
.getEndOffset() - nameDuple.getFirstToken().getOffset() );
|
||||
p2m.setConst(isConst);
|
||||
p2m.setVolatile(isVolatile);
|
||||
p2m.setName(name);
|
||||
|
|
Loading…
Add table
Reference in a new issue