mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content assist displays anonymous types, bug 204758.
This commit is contained in:
parent
8e3a44eafe
commit
0fcdd959b4
4 changed files with 27 additions and 8 deletions
|
@ -110,7 +110,9 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
|
||||||
IParameter[] pars= f.getParameters();
|
IParameter[] pars= f.getParameters();
|
||||||
assertEquals(1, pars.length);
|
assertEquals(1, pars.length);
|
||||||
IType type= pars[0].getType();
|
IType type= pars[0].getType();
|
||||||
assertTrue(type instanceof ICompositeType);
|
assertInstance(type, ITypedef.class);
|
||||||
|
type= ((ITypedef) type).getType();
|
||||||
|
assertInstance(type, ICompositeType.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef enum {
|
// typedef enum {
|
||||||
|
@ -130,9 +132,10 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
|
||||||
IParameter[] pars= f.getParameters();
|
IParameter[] pars= f.getParameters();
|
||||||
assertEquals(1, pars.length);
|
assertEquals(1, pars.length);
|
||||||
IType type= pars[0].getType();
|
IType type= pars[0].getType();
|
||||||
|
assertInstance(type, ITypedef.class);
|
||||||
|
type= ((ITypedef) type).getType();
|
||||||
|
assertInstance(type, IEnumeration.class);
|
||||||
assertTrue(type instanceof IEnumeration);
|
assertTrue(type instanceof IEnumeration);
|
||||||
// type= ((ITypedef) type).getType();
|
|
||||||
// assertTrue(type instanceof IEnumeration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// int globalVar;
|
// int globalVar;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
|
||||||
import org.eclipse.cdt.core.index.IIndexFile;
|
import org.eclipse.cdt.core.index.IIndexFile;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
||||||
|
@ -60,8 +59,6 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IIndexFragment
|
||||||
try {
|
try {
|
||||||
if(!(param instanceof IProblemBinding)) {
|
if(!(param instanceof IProblemBinding)) {
|
||||||
IType type = param.getType();
|
IType type = param.getType();
|
||||||
while(type instanceof ITypedef)
|
|
||||||
type = ((ITypedef)type).getType();
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
||||||
db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
|
db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
|
||||||
|
|
|
@ -157,6 +157,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
// struct {int a3;} a4;
|
// struct {int a3;} a4;
|
||||||
// int b;
|
// int b;
|
||||||
// };
|
// };
|
||||||
|
// typedef enum {__nix} _e204758;
|
||||||
|
// void _f204758(_e204758 x);
|
||||||
|
|
||||||
|
|
||||||
public CompletionTests(String name) {
|
public CompletionTests(String name) {
|
||||||
|
@ -1166,4 +1168,10 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b", "s206450"};
|
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b", "s206450"};
|
||||||
assertCompletionResults(expected);
|
assertCompletionResults(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void test() {_f204758/*cursor*/
|
||||||
|
public void testTypedefToAnonymous_Bug204758() throws Exception {
|
||||||
|
final String[] expected= {"_f204758(_e204758 x) : void"};
|
||||||
|
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
@ -142,6 +141,10 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
// struct {int a3;} a4;
|
// struct {int a3;} a4;
|
||||||
// int b;
|
// int b;
|
||||||
// };
|
// };
|
||||||
|
// #ifdef bug204758
|
||||||
|
// typedef enum {__nix} _e204758;
|
||||||
|
// void _f204758(_e204758 x);
|
||||||
|
// #endif
|
||||||
|
|
||||||
//{DisturbWith.c}
|
//{DisturbWith.c}
|
||||||
// int gTemp;
|
// int gTemp;
|
||||||
|
@ -951,4 +954,12 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b"};
|
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b"};
|
||||||
assertCompletionResults(expected);
|
assertCompletionResults(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #define bug204758
|
||||||
|
///*include*/
|
||||||
|
// void test() {_f204758/*cursor*/
|
||||||
|
public void testTypedefToAnonymous_Bug204758() throws Exception {
|
||||||
|
final String[] expected= {"_f204758(_e204758)"};
|
||||||
|
assertCompletionResults(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue