Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2008-04-15 07:39:11 -0400
committerMarkus Schorn2008-04-15 07:39:11 -0400
commit54eba1ba200418097a68e7449ff00a669c75dd46 (patch)
tree3741ef1fe7b4bd694adb4ac4b572ac4cea8a2847 /core
parent51f43ad2c5fbc221325da1867538d06d2979bb78 (diff)
downloadorg.eclipse.cdt-54eba1ba200418097a68e7449ff00a669c75dd46.tar.gz
org.eclipse.cdt-54eba1ba200418097a68e7449ff00a669c75dd46.tar.xz
org.eclipse.cdt-54eba1ba200418097a68e7449ff00a669c75dd46.zip
Restrict references, bug 227110.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java11
2 files changed, 14 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
index 2b4bb14e2b2..0891c1167e0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
@@ -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);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index c6881faa3b4..64c9c11ccdd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -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;
}

Back to the top