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

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-09-07 16:52:00 -04:00
commit 15f99f12c1
13 changed files with 105 additions and 101 deletions

View file

@ -20,6 +20,7 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.utils.EFSExtensionManager; import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
/** /**
* Tests the EFSExtensionManager and EFSExtensionProvider classes, as well as the EFSExtensionProvider extension point. * Tests the EFSExtensionManager and EFSExtensionProvider classes, as well as the EFSExtensionProvider extension point.
@ -235,7 +236,11 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI); String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
assertEquals(path, "c:/foo"); if (Platform.getOS().equals(Platform.WS_WIN32)) {
assertEquals(path, "c:/foo");
} else {
assertEquals(path, "/c:/foo");
}
} }
public void testGetPathFromURI() { public void testGetPathFromURI() {
@ -248,7 +253,11 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI); String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
assertEquals(path, "c:/foo"); if (Platform.getOS().equals(Platform.WS_WIN32)) {
assertEquals(path, "c:/foo");
} else {
assertEquals(path, "/c:/foo");
}
} }
public void testExtension() { public void testExtension() {

View file

@ -20,23 +20,26 @@ package org.eclipse.cdt.core.model;
public interface IInclude extends ICElement, ISourceReference, ISourceManipulation { public interface IInclude extends ICElement, ISourceReference, ISourceManipulation {
/** /**
* Returns the name that of the included file. * Returns the name that of the included file.
* For example, for the statement <code>"#include <stdio.h></code>, * For example, for the statement {@code #include <stdio.h>},
* this returns <code>"stdio.h"</code>. * this returns {@code "stdio.h"}.
*/ */
String getIncludeName(); public String getIncludeName();
/** /**
* Returns whether the included was search on "standard places" like /usr/include first . * Returns whether the included was search on "standard places" like /usr/include first .
* An include is standard if it starts with <code>"\<"</code>. * An include is standard if it starts with {@code '<'}.
* For example, <code>"#include \<stdio.h\>"</code> returns true and * For example, {@code #include <stdio.h>} returns {@code true} and
* <code>"#include "foobar.h"</code> returns false. * {@code #include "foobar.h"} returns {@code false}.
*/ */
boolean isStandard(); public boolean isStandard();
/**
* The inverse of {@link #isStandard()}
*/
public boolean isLocal();
public String getFullFileName(); public String getFullFileName();
public boolean isLocal();
/** /**
* @return whether this include directive was resolved and followed. * @return whether this include directive was resolved and followed.
*/ */

View file

@ -16,7 +16,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IInclude; import org.eclipse.cdt.core.model.IInclude;
public class Include extends SourceManipulation implements IInclude { public class Include extends SourceManipulation implements IInclude {
private String fullPath; private String fullPath;
private final boolean standard; private final boolean standard;
private boolean fIsResolved= true; private boolean fIsResolved= true;
@ -44,9 +43,6 @@ public class Include extends SourceManipulation implements IInclude {
return fullPath; return fullPath;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.IInclude#isLocal()
*/
@Override @Override
public boolean isLocal() { public boolean isLocal() {
return !isStandard(); return !isStandard();
@ -64,17 +60,11 @@ public class Include extends SourceManipulation implements IInclude {
fIsResolved= resolved; fIsResolved= resolved;
} }
/*
* @see org.eclipse.cdt.core.model.IInclude#isResolved()
*/
@Override @Override
public boolean isResolved() { public boolean isResolved() {
return fIsResolved; return fIsResolved;
} }
/*
* @see org.eclipse.cdt.internal.core.model.CElement#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (other instanceof IInclude && equals(this, (IInclude) other)) { if (other instanceof IInclude && equals(this, (IInclude) other)) {

View file

@ -6,15 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - initial API and implementation * Andrew Ferguson (Symbian) - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.index; package org.eclipse.cdt.core.index;
import java.net.URI; import java.net.URI;
/** /**
* Files in the index are (conceptually) partitioned into workspace and non-workspace (external) files. * Files in the index are (conceptually) partitioned into workspace and non-workspace (external)
* Clients can obtain instances of IIndexFileLocation implementations from {@link IndexLocationFactory} * files. Clients can obtain instances of IIndexFileLocation implementations from
* {@link IndexLocationFactory}. Two index file locations are considered equal if their URIs are
* equal.
* *
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.index; package org.eclipse.cdt.core.index;

View file

@ -6,19 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
public interface IIndexFragmentFileSet { public interface IIndexFragmentFileSet {
/** /**
* Returns whether the file-set contains the file of the local binding. * Returns whether the file-set contains the file of the local binding.
* @throws CoreException * @throws CoreException
*/ */
boolean containsFileOfLocalBinding(IIndexFragmentBinding fb) throws CoreException; boolean containsFileOfLocalBinding(IIndexFragmentBinding binding) throws CoreException;
/** /**
* Adds the fragment file to the file-set. * Adds the fragment file to the file-set.

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
@ -150,7 +150,7 @@ public class IndexFileSet implements IIndexFileSet {
int j= ok.nextSetBit(0); int j= ok.nextSetBit(0);
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
result[i]= bindings[j]; result[i]= bindings[j];
j= ok.nextSetBit(j+1); j= ok.nextSetBit(j + 1);
} }
return result; return result;
} }
@ -172,9 +172,6 @@ public class IndexFileSet implements IIndexFileSet {
return invert; return invert;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.index.IIndexFileSet#invert()
*/
@Override @Override
public IIndexFileSet invert() { public IIndexFileSet invert() {
if (fInverse == null) { if (fInverse == null) {

View file

@ -398,34 +398,42 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
return array == null ? CharArrayUtils.EMPTY_CHAR_ARRAY : array; return array == null ? CharArrayUtils.EMPTY_CHAR_ARRAY : array;
} }
/**
* Returns include search path for a given current directory and a IScannerInfo.
* @param directory the current directory
* @param info scanner information, or {@code null} if not available
* @return the include search path
*/
public static IncludeSearchPath configureIncludeSearchPath(File directory, IScannerInfo info) { public static IncludeSearchPath configureIncludeSearchPath(File directory, IScannerInfo info) {
boolean inhibitUseOfCurrentFileDirectory= false; boolean inhibitUseOfCurrentFileDirectory= false;
List<IncludeSearchPathElement> elements = new ArrayList<IncludeSearchPathElement>(); List<IncludeSearchPathElement> elements = new ArrayList<IncludeSearchPathElement>();
// Quote includes first if (info != null) {
if (info instanceof IExtendedScannerInfo) { // Quote includes first
final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info; if (info instanceof IExtendedScannerInfo) {
final String[] paths= einfo.getLocalIncludePath(); final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info;
if (paths != null) { final String[] paths= einfo.getLocalIncludePath();
for (String path : paths) { if (paths != null) {
if ("-".equals(path)) { //$NON-NLS-1$ for (String path : paths) {
inhibitUseOfCurrentFileDirectory= true; if ("-".equals(path)) { //$NON-NLS-1$
} else { inhibitUseOfCurrentFileDirectory= true;
elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), true)); } else {
} elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), true));
}
}
}
}
// Regular includes
String[] paths= info.getIncludePaths();
if (paths != null) {
for (String path : paths) {
if ("-".equals(path)) { //$NON-NLS-1$
inhibitUseOfCurrentFileDirectory= true;
} else {
elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), false));
}
} }
} }
}
// Regular includes
String[] paths= info.getIncludePaths();
if (paths != null) {
for (String path : paths) {
if ("-".equals(path)) { //$NON-NLS-1$
inhibitUseOfCurrentFileDirectory= true;
} else {
elements.add(new IncludeSearchPathElement(makeAbsolute(directory, path), false));
}
}
} }
return new IncludeSearchPath(elements, inhibitUseOfCurrentFileDirectory); return new IncludeSearchPath(elements, inhibitUseOfCurrentFileDirectory);
} }

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.List; import java.util.List;
/** /**
* Represents the include search path * Represents the include search path
*/ */
@ -20,7 +19,6 @@ public final class IncludeSearchPath {
private final boolean fInhibitUseOfCurrentFileDirectory; private final boolean fInhibitUseOfCurrentFileDirectory;
private final IncludeSearchPathElement[] fElements; private final IncludeSearchPathElement[] fElements;
IncludeSearchPath(List<IncludeSearchPathElement> elements, boolean inhibitUseOfCurrentFileDirectory) { IncludeSearchPath(List<IncludeSearchPathElement> elements, boolean inhibitUseOfCurrentFileDirectory) {
fElements= elements.toArray(new IncludeSearchPathElement[elements.size()]); fElements= elements.toArray(new IncludeSearchPathElement[elements.size()]);
fInhibitUseOfCurrentFileDirectory= inhibitUseOfCurrentFileDirectory; fInhibitUseOfCurrentFileDirectory= inhibitUseOfCurrentFileDirectory;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - initial API and implementation * Andrew Ferguson (Symbian) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom; package org.eclipse.cdt.internal.core.pdom.dom;
@ -44,23 +44,20 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
fIgnoreExternal= ignoreWSExternal; fIgnoreExternal= ignoreWSExternal;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#fromInternalFormat(java.lang.String)
*/
@Override @Override
public IIndexFileLocation fromInternalFormat(String raw) { public IIndexFileLocation fromInternalFormat(String raw) {
String fullPath = null; String fullPath = null;
URI uri= null; URI uri= null;
if(raw.startsWith(EXTERNAL)) { if (raw.startsWith(EXTERNAL)) {
try { try {
uri = new URI(raw.substring(EXTERNAL.length())); uri = new URI(raw.substring(EXTERNAL.length()));
} catch(URISyntaxException use) { } catch (URISyntaxException e) {
} }
} else { } else {
if (raw.startsWith(WS)) { if (raw.startsWith(WS)) {
fullPath= raw.substring(WS.length()); fullPath= raw.substring(WS.length());
} else { } else {
fullPath= fFullPathPrefix+raw; fullPath= fFullPathPrefix + raw;
} }
final IPath path= new Path(fullPath); final IPath path= new Path(fullPath);
if (path.segmentCount() > 1) { if (path.segmentCount() > 1) {
@ -71,13 +68,10 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
return uri == null ? null : new IndexFileLocation(uri, fullPath); return uri == null ? null : new IndexFileLocation(uri, fullPath);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#toRaw(java.net.URI)
*/
@Override @Override
public String toInternalFormat(IIndexFileLocation location) { public String toInternalFormat(IIndexFileLocation location) {
String fullPath= location.getFullPath(); String fullPath= location.getFullPath();
if(fullPath!=null) { if (fullPath != null) {
if (fullPath.startsWith(fFullPathPrefix)) { if (fullPath.startsWith(fFullPathPrefix)) {
return fullPath.substring(fFullPathPrefix.length()); return fullPath.substring(fFullPathPrefix.length());
} }
@ -87,6 +81,6 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
if (fIgnoreExternal) if (fIgnoreExternal)
return null; return null;
return EXTERNAL+location.getURI().toString(); return EXTERNAL + location.getURI().toString();
} }
} }

View file

@ -195,7 +195,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
return tu; return tu;
} }
private boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo, private static boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo,
ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) { ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) {
try { try {
String filePath = IndexLocationFactory.getAbsolutePath(file.getLocation()).toOSString(); String filePath = IndexLocationFactory.getAbsolutePath(file.getLocation()).toOSString();
@ -214,7 +214,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
return false; return false;
} }
private boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp, private static boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp,
IncludeSearchPath includeSearchPath, IncludeSearchPath includeSearchPath,
ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) throws CoreException { ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) throws CoreException {
String includeName = include.getFullName(); String includeName = include.getFullName();
@ -259,7 +259,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
/** /**
* Returns true if the file exists and is not older than the given timestamp. * Returns true if the file exists and is not older than the given timestamp.
*/ */
private boolean fileIsNotOlderThanTimestamp(String filename, long timestamp) { private static boolean fileIsNotOlderThanTimestamp(String filename, long timestamp) {
// We are subtracting 1 second from the timestamp to account for limited precision // We are subtracting 1 second from the timestamp to account for limited precision
// of File.lastModified() method and possible skew between clocks on a multi-CPU // of File.lastModified() method and possible skew between clocks on a multi-CPU
// system. This may produce false positives, but they are pretty harmless. // system. This may produce false positives, but they are pretty harmless.

View file

@ -8,14 +8,12 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui; package org.eclipse.cdt.ui;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
/** /**
* IncludesGrouping * IncludesGrouping
*/ */
@ -27,9 +25,6 @@ public class IncludesGrouping extends CElementGrouping {
tu = unit; tu = unit;
} }
/* (non-Javadoc)
* @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
*/
@Override @Override
public Object[] getChildren(Object object) { public Object[] getChildren(Object object) {
try { try {
@ -39,24 +34,18 @@ public class IncludesGrouping extends CElementGrouping {
return super.getChildren(object); return super.getChildren(object);
} }
/* (non-Javadoc)
* @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
*/
@Override @Override
public Object getParent(Object object) { public Object getParent(Object object) {
return tu; return tu;
} }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj instanceof IncludesGrouping) { if (obj instanceof IncludesGrouping) {
return tu.equals(((IncludesGrouping)obj).tu) ; return tu.equals(((IncludesGrouping) obj).tu) ;
} }
return false; return false;
} }

View file

@ -54,6 +54,7 @@ import org.eclipse.cdt.dsf.debug.service.IDsfBreakpointExtension;
import org.eclipse.cdt.dsf.debug.service.IRunControl; import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.cdt.dsf.debug.service.ISourceLookup; import org.eclipse.cdt.dsf.debug.service.ISourceLookup;
import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext; import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
@ -65,6 +66,7 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.BreakpointUpdatedEvent;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
import org.eclipse.cdt.dsf.mi.service.MIRunControl.SuspendedEvent; import org.eclipse.cdt.dsf.mi.service.MIRunControl.SuspendedEvent;
import org.eclipse.cdt.dsf.mi.service.breakpoint.actions.BreakpointActionAdapter; import org.eclipse.cdt.dsf.mi.service.breakpoint.actions.BreakpointActionAdapter;
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent;
@ -1340,21 +1342,34 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// Breakpoint actions // Breakpoint actions
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/** @since 4.2 */
@DsfServiceEventHandler
public void eventDispatched(ISuspendedDMEvent e) {
assert e instanceof IMIDMEvent;
if (e instanceof IMIDMEvent) {
Object miEvent = ((IMIDMEvent)e).getMIEvent();
if (miEvent instanceof MIBreakpointHitEvent) {
// This covers catchpoints, too
MIBreakpointHitEvent evt = (MIBreakpointHitEvent)miEvent;
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
if (miEvent instanceof MIWatchpointTriggerEvent) {
MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent)miEvent;
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
}
}
/**
* @deprecated Replaced by the generic {@link #eventDispatched(ISuspendedDMEvent)}
*/
@Deprecated
@DsfServiceEventHandler @DsfServiceEventHandler
public void eventDispatched(SuspendedEvent e) { public void eventDispatched(SuspendedEvent e) {
if (e.getMIEvent() instanceof MIBreakpointHitEvent) {
// This covers catchpoints, too
MIBreakpointHitEvent evt = (MIBreakpointHitEvent) e.getMIEvent();
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
if (e.getMIEvent() instanceof MIWatchpointTriggerEvent) {
MIWatchpointTriggerEvent evt = (MIWatchpointTriggerEvent) e.getMIEvent();
performBreakpointAction(evt.getDMContext(), evt.getNumber());
return;
}
} }
private void performBreakpointAction(final IDMContext context, int number) { private void performBreakpointAction(final IDMContext context, int number) {