Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-11-11 12:43:26 +0000
committerMarkus Schorn2008-11-11 12:43:26 +0000
commitedeb6f1af14fa0a5eaba55bc0c0ca84be90c8f7d (patch)
tree8629a12e69a4c94c246cb6680dec1c95c944717d /core/org.eclipse.cdt.core.tests
parent0700a8fe6898d2f519d40ab5e9c40306d6cb225d (diff)
downloadorg.eclipse.cdt-edeb6f1af14fa0a5eaba55bc0c0ca84be90c8f7d.tar.gz
org.eclipse.cdt-edeb6f1af14fa0a5eaba55bc0c0ca84be90c8f7d.tar.xz
org.eclipse.cdt-edeb6f1af14fa0a5eaba55bc0c0ca84be90c8f7d.zip
Support for parameter annotations by Sebastian Moss, bug 254520.
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CFunctionTests.java17
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java10
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c1
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp1
4 files changed, 26 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CFunctionTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CFunctionTests.java
index 623bac1b99a..0e194ad729f 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CFunctionTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CFunctionTests.java
@@ -1,14 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation.
+ * Copyright (c) 2006, 2008 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
*******************************************************************************/
-
package org.eclipse.cdt.internal.pdom.tests;
import junit.framework.Test;
@@ -36,12 +35,14 @@ public class CFunctionTests extends PDOMTestBase {
return suite(CFunctionTests.class);
}
+ @Override
protected void setUp() throws Exception {
project = createProject("functionTests");
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
pdom.acquireReadLock();
}
+ @Override
protected void tearDown() throws Exception {
pdom.releaseReadLock();
if (project != null) {
@@ -84,4 +85,14 @@ public class CFunctionTests extends PDOMTestBase {
assertTrue(params[1].getType() instanceof ICBasicType);
assertTrue(params[2].getType() instanceof ICBasicType);
}
+
+ public void testFunctionWithRegisterParam() throws Exception {
+ IBinding[] bindings = findQualifiedName(pdom, "storageClassCFunction");
+ assertEquals(1, bindings.length);
+ IFunction f= (IFunction) bindings[0];
+ IParameter[] params= f.getParameters();
+ assertEquals(2, params.length);
+ assertEquals(true, params[0].isRegister());
+ assertEquals(false, params[1].isRegister());
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java
index a0cfce22d09..d93def16046 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java
@@ -111,6 +111,16 @@ public class CPPFunctionTests extends PDOMTestBase {
assertEquals("p3", parameters[2].getName());
}
+ public void testStorageClassSpecParameters() throws Exception {
+ IBinding[] bindings = findQualifiedName(pdom, "storageClassCPPFunction");
+ assertEquals(1, bindings.length);
+ ICPPFunction function = (ICPPFunction) bindings[0];
+ IParameter[] parameters = function.getParameters();
+ assertEquals(2, parameters.length);
+ assertEquals(true, parameters[0].isRegister());
+ assertEquals(true, parameters[1].isAuto());
+ }
+
public void testExternCPPFunction() throws Exception {
IBinding[] bindings = findQualifiedName(pdom, "externCPPFunction");
assertEquals(1, bindings.length);
diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c
index e8364076689..8ee78772ddc 100644
--- a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c
+++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c
@@ -5,6 +5,7 @@ inline void inlineCFunction(long p1);
void varArgsCFunction(int p1, ...);
const void constCFunction();
volatile void volatileCFunction();
+void storageClassCFunction(register int p1, int p2);
void voidCFunction();
int intCFunction();
diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp
index 41edbcd4e75..bd5ef3c900e 100644
--- a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp
+++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp
@@ -1,4 +1,5 @@
double normalCPPFunction(int p1, char p2, float p3);
+void storageClassCPPFunction(register int p1, auto int p2);
static int staticCPPFunction(double p1);
extern float externCPPFunction(int p1);
inline void inlineCPPFunction(long p1);

Back to the top