1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Bug 245030.

This commit is contained in:
Sergey Prigogin 2008-08-24 04:03:05 +00:00
parent e8efeee1b0
commit ca322a621a
4 changed files with 14 additions and 17 deletions

View file

@ -894,7 +894,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// A a; // A a;
// func(&a, &A::m); // func(&a, &A::m);
// } // }
public void _testFunctionTemplate_245030() throws Exception { public void testFunctionTemplate_245030() throws Exception {
IBinding b0= getBindingFromASTName("func(&a, &A::m)", 4); IBinding b0= getBindingFromASTName("func(&a, &A::m)", 4);
assertInstance(b0, ICPPTemplateInstance.class); assertInstance(b0, ICPPTemplateInstance.class);
assertInstance(b0, ICPPFunction.class); assertInstance(b0, ICPPFunction.class);

View file

@ -773,8 +773,7 @@ public class CPPTemplates {
* @throws DOMException * @throws DOMException
*/ */
static protected Object[] deduceTemplateFunctionArguments(ICPPFunctionTemplate primaryTemplate, static protected Object[] deduceTemplateFunctionArguments(ICPPFunctionTemplate primaryTemplate,
IASTParameterDeclaration[] ps, ICPPASTTemplateId id) throws DOMException IASTParameterDeclaration[] ps, ICPPASTTemplateId id) throws DOMException {
{
ICPPTemplateParameter[] templateParameters = primaryTemplate.getTemplateParameters(); ICPPTemplateParameter[] templateParameters = primaryTemplate.getTemplateParameters();
IType[] arguments= createTemplateArgumentArray(id); IType[] arguments= createTemplateArgumentArray(id);
IType[] result = new IType[templateParameters.length]; IType[] result = new IType[templateParameters.length];
@ -1450,7 +1449,7 @@ public class CPPTemplates {
} }
ObjectMap map= new ObjectMap(specArgs.length); ObjectMap map= new ObjectMap(specArgs.length);
int len= all ? specArgs.length : Math.min(specArgs.length, args.length); int len= all ? specArgs.length : Math.min(specArgs.length, args.length);
for (int j=0; j<len; j++) { for (int j= 0; j < len; j++) {
try { try {
if (!deduceTemplateArgument(map, specArgs[j], args[j])) { if (!deduceTemplateArgument(map, specArgs[j], args[j])) {
return null; return null;

View file

@ -1,17 +1,18 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2008 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding; import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.CompositePointerType; import org.eclipse.cdt.internal.core.index.composite.CompositePointerType;
@ -23,8 +24,8 @@ class CompositeCPPPointerToMemberType extends CompositePointerType implements IC
super(pointerToMemberType, cf); super(pointerToMemberType, cf);
} }
public ICPPClassType getMemberOfClass() { public IType getMemberOfClass() {
IIndexFragmentBinding rbinding = (IIndexFragmentBinding) ((ICPPPointerToMemberType) type).getMemberOfClass(); IIndexFragmentBinding rbinding = (IIndexFragmentBinding) ((ICPPPointerToMemberType) type).getMemberOfClass();
return (ICPPClassType) cf.getCompositeBinding(rbinding); return (IType) cf.getCompositeBinding(rbinding);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,13 +8,13 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.PointerTypeClone; import org.eclipse.cdt.internal.core.index.PointerTypeClone;
@ -60,13 +60,10 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT
return IIndexCPPBindingConstants.CPP_POINTER_TO_MEMBER_TYPE; return IIndexCPPBindingConstants.CPP_POINTER_TO_MEMBER_TYPE;
} }
public ICPPClassType getMemberOfClass() { public IType getMemberOfClass() {
try { try {
int rec; int rec = pdom.getDB().getInt(record + TYPE);
rec = pdom.getDB().getInt(record + TYPE); return (IType) getLinkage().getNode(rec);
if (rec != 0) {
return new PDOMCPPClassType(pdom, rec);
}
} catch (CoreException e) { } catch (CoreException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
} }