Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAnton Leherbauer2009-05-25 04:02:37 -0400
committerAnton Leherbauer2009-05-25 04:02:37 -0400
commit2bf225f6df74823a94ce16ac241821e28f51b34a (patch)
tree169b9a3ffb6b25ffd01539da2f97d44eff04fb73 /core
parentd6767953a968d788f5c34706a2fdae70f618b4c1 (diff)
downloadorg.eclipse.cdt-2bf225f6df74823a94ce16ac241821e28f51b34a.tar.gz
org.eclipse.cdt-2bf225f6df74823a94ce16ac241821e28f51b34a.tar.xz
org.eclipse.cdt-2bf225f6df74823a94ce16ac241821e28f51b34a.zip
Bug 274490 - Return type stored in the ICElement- IFunctionDeclaration contains method qualifiers as well
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelBuilderBugsTest.java9
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/cmodel/CModelBuilderTest.cpp4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java57
3 files changed, 40 insertions, 30 deletions
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelBuilderBugsTest.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelBuilderBugsTest.java
index 2180e1f9447..cb1008d6fec 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelBuilderBugsTest.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelBuilderBugsTest.java
@@ -15,6 +15,7 @@ import junit.framework.Test;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IStructure;
import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -67,4 +68,12 @@ public class CModelBuilderBugsTest extends BaseTestCase {
assertEquals("decl", functions[1].getElementName());
}
+ public void testModelBuilderBug274490() throws Exception {
+ IStructure clazz= (IStructure) fTU.getElement("Bug274490");
+ assertNotNull(clazz);
+ ICElement[] methods= clazz.getChildren();
+ assertEquals(2, methods.length);
+ assertEquals("int", ((IFunctionDeclaration) methods[0]).getReturnType());
+ assertEquals("const char*", ((IFunctionDeclaration) methods[1]).getReturnType());
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/resources/cmodel/CModelBuilderTest.cpp b/core/org.eclipse.cdt.core.tests/resources/cmodel/CModelBuilderTest.cpp
index 35a7f1f8086..c876b0e79b7 100644
--- a/core/org.eclipse.cdt.core.tests/resources/cmodel/CModelBuilderTest.cpp
+++ b/core/org.eclipse.cdt.core.tests/resources/cmodel/CModelBuilderTest.cpp
@@ -10,3 +10,7 @@ namespace nsTest {
void nsTest::inlined2() {}; // wrong label in outline: nsTest::inlined(): void
void nsTest::decl2(); // label in outline (ok): decl(): void
}
+class Bug274490 {
+ virtual int m();
+ inline const char* m2() const;
+};
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java
index da3f2580857..b684c212ad0 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
* 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
@@ -39,13 +39,11 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
@@ -60,7 +58,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.parser.Keywords;
@@ -475,35 +472,35 @@ public class ASTStringUtil {
if (declSpecifier.isConst()) {
buffer.append(Keywords.CONST).append(' ');
}
- if (declSpecifier.isVolatile()) {
- buffer.append(Keywords.VOLATILE).append(' ');
- }
+// if (declSpecifier.isVolatile()) {
+// buffer.append(Keywords.VOLATILE).append(' ');
+// }
// if (declSpecifier.isInline()) {
// buffer.append(Keywords.INLINE).append(' ');
// }
- if (declSpecifier instanceof ICASTDeclSpecifier) {
- final ICASTDeclSpecifier cDeclSpec= (ICASTDeclSpecifier)declSpecifier;
- if (cDeclSpec.isRestrict()) {
- buffer.append(Keywords.RESTRICT).append(' ');
- }
- } else if (declSpecifier instanceof ICPPASTDeclSpecifier) {
- final ICPPASTDeclSpecifier cppDeclSpec= (ICPPASTDeclSpecifier)declSpecifier;
- if (cppDeclSpec.isFriend()) {
- buffer.append(Keywords.FRIEND).append(' ');
- }
- if (cppDeclSpec.isVirtual()) {
- buffer.append(Keywords.VIRTUAL).append(' ');
- }
- if (cppDeclSpec.isExplicit()) {
- buffer.append(Keywords.EXPLICIT).append(' ');
- }
- if (declSpecifier instanceof IGPPASTDeclSpecifier) {
- final IGPPASTDeclSpecifier gppDeclSpec= (IGPPASTDeclSpecifier)declSpecifier;
- if (gppDeclSpec.isRestrict()) {
- buffer.append(Keywords.RESTRICT).append(' ');
- }
- }
- }
+// if (declSpecifier instanceof ICASTDeclSpecifier) {
+// final ICASTDeclSpecifier cDeclSpec= (ICASTDeclSpecifier)declSpecifier;
+// if (cDeclSpec.isRestrict()) {
+// buffer.append(Keywords.RESTRICT).append(' ');
+// }
+// } else if (declSpecifier instanceof ICPPASTDeclSpecifier) {
+// final ICPPASTDeclSpecifier cppDeclSpec= (ICPPASTDeclSpecifier)declSpecifier;
+// if (cppDeclSpec.isFriend()) {
+// buffer.append(Keywords.FRIEND).append(' ');
+// }
+// if (cppDeclSpec.isVirtual()) {
+// buffer.append(Keywords.VIRTUAL).append(' ');
+// }
+// if (cppDeclSpec.isExplicit()) {
+// buffer.append(Keywords.EXPLICIT).append(' ');
+// }
+// if (declSpecifier instanceof IGPPASTDeclSpecifier) {
+// final IGPPASTDeclSpecifier gppDeclSpec= (IGPPASTDeclSpecifier)declSpecifier;
+// if (gppDeclSpec.isRestrict()) {
+// buffer.append(Keywords.RESTRICT).append(' ');
+// }
+// }
+// }
// storage class
// final int storageClass= declSpecifier.getStorageClass();
// switch (storageClass) {

Back to the top