1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Restrict references, bug 227110.

This commit is contained in:
Markus Schorn 2008-04-15 11:39:11 +00:00
parent 51f43ad2c5
commit 54eba1ba20
2 changed files with 14 additions and 3 deletions

View file

@ -4531,4 +4531,10 @@ public class AST2Tests extends AST2BaseTest {
parseAndCheckBindings(code, ParserLanguage.CPP, true);
}
// struct X;
// void test(struct X* __restrict result);
public void testRestrictReference_Bug227110() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP, true);
}
}

View file

@ -556,10 +556,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
__attribute_decl_seq(supportAttributeSpecifiers, false);
if (LT(1) == IToken.tAMPER) {
int length = LA(1).getEndOffset() - LA(1).getOffset();
int o = consume().getOffset();
// boolean isRestrict= false;
IToken lastToken= consume();
final int from= lastToken.getOffset();
if (allowCPPRestrict && LT(1) == IToken.t_restrict) {
// isRestrict= true;
lastToken= consume();
}
ICPPASTReferenceOperator refOp = createReferenceOperator();
((ASTNode) refOp).setOffsetAndLength(o, length);
((ASTNode) refOp).setOffsetAndLength(from, lastToken.getEndOffset());
collection.add(refOp);
return;
}