1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge branch 'cdt_8_0' of ssh://rarohrba@git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git into cdt_8_0

This commit is contained in:
Randy Rohrbach 2011-09-02 12:05:47 -04:00
commit 68d329ec2a
7 changed files with 441 additions and 402 deletions

View file

@ -9469,4 +9469,25 @@ public class AST2CPPTests extends AST2BaseTest {
public void testAmbiguityResolution_Bug354599() throws Exception { public void testAmbiguityResolution_Bug354599() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// struct A {
// void method(A);
// };
//
// struct B : A {
// void method(B);
// using A::method;
// };
//
// struct C : B {
// };
//
// void test() {
// B b;
// C c;
// c.method(b);
// }
public void testAmbiguityResolution_Bug356268() throws Exception {
parseAndCheckBindings();
}
} }

View file

@ -210,7 +210,14 @@ public abstract class ArrayUtil {
} }
/** /**
* Assumes that both arrays contain nulls at the end, only. * Takes contents of the two arrays up to the first <code>null</code> element and concatenates
* them.
* @param c The type of the element of the returned array if there was not enough free space
* in the destination array.
* @param dest The destination array. The elements of the source array are added to this array
* if there is enough free space in it. May be <code>null</code>.
* @param source The source array. May not be <code>null</code>.
* @return The concatenated array, which may be the same as the first parameter.
*/ */
public static Object[] addAll(Class<?> c, Object[] dest, Object[] source) { public static Object[] addAll(Class<?> c, Object[] dest, Object[] source) {
if (source == null || source.length == 0) if (source == null || source.length == 0)
@ -246,8 +253,12 @@ public abstract class ArrayUtil {
} }
/** /**
* Concatenates two arrays skipping <code>null</code> elements. * Takes contents of the two arrays up to the first <code>null</code> element and concatenates
* Assumes that both arrays contain <code>null</code>s at the end, only. * them.
* @param dest The destination array. The elements of the source array are added to this array
* if there is enough free space in it. May be <code>null</code>.
* @param source The source array. May not be <code>null</code>.
* @return The concatenated array, which may be the same as the first parameter.
* @since 5.2 * @since 5.2
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -264,7 +275,8 @@ public abstract class ArrayUtil {
} }
if (dest == null || dest.length == 0) { if (dest == null || dest.length == 0) {
Class<? extends Object> c = dest != null ? dest.getClass().getComponentType() : source.getClass().getComponentType(); Class<? extends Object> c = dest != null ?
dest.getClass().getComponentType() : source.getClass().getComponentType();
dest = (T[]) Array.newInstance(c, numToAdd); dest = (T[]) Array.newInstance(c, numToAdd);
System.arraycopy(source, 0, dest, 0, numToAdd); System.arraycopy(source, 0, dest, 0, numToAdd);
return dest; return dest;

View file

@ -22,7 +22,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@ -56,8 +55,13 @@ class BaseClassLookup {
rootInfo.collectResultForContentAssist(data); rootInfo.collectResultForContentAssist(data);
} else { } else {
hideVirtualBases(rootInfo, infoMap); hideVirtualBases(rootInfo, infoMap);
IBinding[] result= rootInfo.collectResult(data, true, null); IBinding[] result= rootInfo.collectResult(data, true, IBinding.EMPTY_BINDING_ARRAY);
verifyResult(data, result); if (data.problem == null) {
data.foundItems = ArrayUtil.addAll((Object[]) data.foundItems, result);
} else if (result.length > 0) {
data.problem.setCandidateBindings(result);
}
// verifyResult(data, result);
} }
} }
@ -323,7 +327,7 @@ class BaseClassLookup {
} }
} }
public IBinding[] collectResult(LookupData data, boolean asVirtualBase, IBinding[] result) { private IBinding[] collectResult(LookupData data, boolean asVirtualBase, IBinding[] result) {
if (asVirtualBase) { if (asVirtualBase) {
if (fHiddenAsVirtualBase) if (fHiddenAsVirtualBase)
return result; return result;
@ -338,40 +342,26 @@ class BaseClassLookup {
return result; return result;
fCollected= true; fCollected= true;
result= (IBinding[]) ArrayUtil.addAll(IBinding.class, result, fBindings); int numBindingsToAdd = 0;
for (int i = 0; i < fBindings.length; i++) {
IBinding binding = fBindings[i];
if (binding == null)
break;
if (!ArrayUtil.contains(result, binding))
fBindings[numBindingsToAdd++] = binding;
}
if (numBindingsToAdd < fBindings.length)
fBindings[numBindingsToAdd] = null;
if (result.length > 0 && numBindingsToAdd > 0 && data.problem == null) {
// Matches are found in more than one base class - this is an indication of ambiguity.
data.problem= new ProblemBinding(data.astName,
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, result);
}
result= ArrayUtil.addAll(result, fBindings);
for (int i= 0; i < fChildren.size(); i++) { for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i); BaseClassLookup child = fChildren.get(i);
result= child.collectResult(data, fVirtual.get(i), result); result= child.collectResult(data, fVirtual.get(i), result);
} }
return result; return result;
} }
static void verifyResult(LookupData data, IBinding[] bindings) {
bindings= (IBinding[]) ArrayUtil.trim(IBinding.class, bindings);
if (bindings.length == 0)
return;
if (data.problem != null) {
data.problem.setCandidateBindings(bindings);
} else {
ICPPClassType uniqueOwner= null;
for (IBinding b : bindings) {
if (!(b instanceof IType)) {
IBinding owner= b.getOwner();
if (owner instanceof ICPPClassType) {
final ICPPClassType classOwner = (ICPPClassType) owner;
if (uniqueOwner == null) {
uniqueOwner= classOwner;
} else if (!uniqueOwner.isSameType(classOwner)) {
data.problem= new ProblemBinding(data.astName,
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, bindings);
return;
}
}
}
}
}
data.foundItems = ArrayUtil.addAll(Object.class, (Object[]) data.foundItems, bindings);
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2009 QNX Software Systems and others. * Copyright (c) 2004, 2011 QNX 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
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Marc Khouzam (Ericsson) - Check for a null threadId (Bug 356463)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints; package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
@ -474,7 +475,15 @@ public class GdbThreadFilterEditor {
new DataRequestMonitor<IThreadDMData>(ImmediateExecutor.getInstance(), rm) { new DataRequestMonitor<IThreadDMData>(ImmediateExecutor.getInstance(), rm) {
@Override @Override
public void handleSuccess() { public void handleSuccess() {
rm.setData(getData().getName()); final StringBuilder builder = new StringBuilder(getData().getName());
String containerId = getData().getId();
if (containerId != null) {
builder.append(" ["); //$NON-NLS-1$
builder.append(containerId);
builder.append("]"); //$NON-NLS-1$
}
rm.setData(builder.toString());
rm.done(); rm.done();
} }
}); });
@ -524,8 +533,14 @@ public class GdbThreadFilterEditor {
builder.append("["); //$NON-NLS-1$ builder.append("["); //$NON-NLS-1$
builder.append(((IMIExecutionDMContext)thread).getThreadId()); builder.append(((IMIExecutionDMContext)thread).getThreadId());
builder.append("] "); //$NON-NLS-1$ builder.append("] "); //$NON-NLS-1$
builder.append(getData().getId()); String threadId = getData().getId();
builder.append(getData().getName()); if (threadId != null) {
builder.append(threadId);
}
String threadName = getData().getName();
if (threadName != null) {
builder.append(threadName);
}
rm.setData(builder.toString()); rm.setData(builder.toString());
rm.done(); rm.done();

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true
Bundle-Version: 8.0.0.qualifier Bundle-Version: 8.0.1.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.0.0-SNAPSHOT</version> <version>8.0.1-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.gdbjtag.core</artifactId> <artifactId>org.eclipse.cdt.debug.gdbjtag.core</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 - 2010 QNX Software Systems and others. * Copyright (c) 2007 - 2011 QNX 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
@ -11,6 +11,7 @@
* Sage Electronic Engineering, LLC - bug 305943 * Sage Electronic Engineering, LLC - bug 305943
* - API generalization to become transport-independent (allow * - API generalization to become transport-independent (allow
* connections via serial ports and pipes). * connections via serial ports and pipes).
* John Dallaway - Wrong groupId during initialization (Bug 349736)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core; package org.eclipse.cdt.debug.gdbjtag.core;
@ -615,7 +616,7 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
public void execute(final RequestMonitor requestMonitor) { public void execute(final RequestMonitor requestMonitor) {
if (fSessionType != SessionType.CORE) { if (fSessionType != SessionType.CORE) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), null); IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
bpmService.startTrackingBreakpoints(bpTargetDmc, requestMonitor); bpmService.startTrackingBreakpoints(bpTargetDmc, requestMonitor);