Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Stornelli2019-09-28 07:07:04 +0000
committerMarco Stornelli2019-10-06 07:32:08 +0000
commita781cdf342c02cc507bd7754566eb4ce6c30cf62 (patch)
tree87e49f833a9db6ee3080085513d6e3d703d17c58 /core/org.eclipse.cdt.core.tests
parenta71a413500e2e2c29a6384bd2a375b2144582f21 (diff)
downloadorg.eclipse.cdt-a781cdf342c02cc507bd7754566eb4ce6c30cf62.tar.gz
org.eclipse.cdt-a781cdf342c02cc507bd7754566eb4ce6c30cf62.tar.xz
org.eclipse.cdt-a781cdf342c02cc507bd7754566eb4ce6c30cf62.zip
Bug 343274 - Fix VariableReadWriteFlags errors
Read and write flags weren't correctly set for array access. Change-Id: I2c54b270895514f3681903709498aa9344a5bc7e Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java
index 2f024e8cd33..5eb63ee3714 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java
@@ -229,4 +229,20 @@ public class VariableReadWriteFlagsTest extends AST2TestBase {
a.assertReadWriteFlags("variadic(waldo)", "waldo", READ);
a.assertReadWriteFlags("variadic(&waldo)", "waldo", READ | WRITE);
}
+
+ // int arr[5];
+ // int test() {
+ // arr[0];
+ // arr[0] = 1;
+ // int a;
+ // a = arr[0];
+ // return arr[0];
+ // }
+ public void testArraySubscript() throws Exception {
+ AssertionHelper a = getCPPAssertionHelper();
+ a.assertReadWriteFlags("arr[0];", "arr", READ);
+ a.assertReadWriteFlags("arr[0] = 1", "arr", READ | WRITE);
+ a.assertReadWriteFlags("a = arr[0];", "arr", READ);
+ a.assertReadWriteFlags("return arr[0];", "arr", READ);
+ }
}

Back to the top