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.core.runtime.IPath;
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.
@ -235,7 +236,11 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
if (Platform.getOS().equals(Platform.WS_WIN32)) {
assertEquals(path, "c:/foo");
} else {
assertEquals(path, "/c:/foo");
}
}
public void testGetPathFromURI() {
@ -248,7 +253,11 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
if (Platform.getOS().equals(Platform.WS_WIN32)) {
assertEquals(path, "c:/foo");
} else {
assertEquals(path, "/c:/foo");
}
}
public void testExtension() {

View file

@ -20,23 +20,26 @@ package org.eclipse.cdt.core.model;
public interface IInclude extends ICElement, ISourceReference, ISourceManipulation {
/**
* Returns the name that of the included file.
* For example, for the statement <code>"#include <stdio.h></code>,
* this returns <code>"stdio.h"</code>.
* For example, for the statement {@code #include <stdio.h>},
* this returns {@code "stdio.h"}.
*/
String getIncludeName();
public String getIncludeName();
/**
* Returns whether the included was search on "standard places" like /usr/include first .
* An include is standard if it starts with <code>"\<"</code>.
* For example, <code>"#include \<stdio.h\>"</code> returns true and
* <code>"#include "foobar.h"</code> returns false.
* An include is standard if it starts with {@code '<'}.
* For example, {@code #include <stdio.h>} returns {@code true} and
* {@code #include "foobar.h"} returns {@code false}.
*/
boolean isStandard();
public boolean isStandard();
/**
* The inverse of {@link #isStandard()}
*/
public boolean isLocal();
public String getFullFileName();
public boolean isLocal();
/**
* @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;
public class Include extends SourceManipulation implements IInclude {
private String fullPath;
private final boolean standard;
private boolean fIsResolved= true;
@ -44,9 +43,6 @@ public class Include extends SourceManipulation implements IInclude {
return fullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.IInclude#isLocal()
*/
@Override
public boolean isLocal() {
return !isStandard();
@ -64,17 +60,11 @@ public class Include extends SourceManipulation implements IInclude {
fIsResolved= resolved;
}
/*
* @see org.eclipse.cdt.core.model.IInclude#isResolved()
*/
@Override
public boolean isResolved() {
return fIsResolved;
}
/*
* @see org.eclipse.cdt.internal.core.model.CElement#equals(java.lang.Object)
*/
@Override
public boolean equals(Object other) {
if (other instanceof IInclude && equals(this, (IInclude) other)) {

View file

@ -13,8 +13,10 @@ package org.eclipse.cdt.core.index;
import java.net.URI;
/**
* Files in the index are (conceptually) partitioned into workspace and non-workspace (external) files.
* Clients can obtain instances of IIndexFileLocation implementations from {@link IndexLocationFactory}
* Files in the index are (conceptually) partitioned into workspace and non-workspace (external)
* 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.
* @noimplement This interface is not intended to be implemented by clients.

View file

@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.index;
import org.eclipse.core.runtime.CoreException;
public interface IIndexFragmentFileSet {
/**
* Returns whether the file-set contains the file of the local binding.
* @throws CoreException
*/
boolean containsFileOfLocalBinding(IIndexFragmentBinding fb) throws CoreException;
boolean containsFileOfLocalBinding(IIndexFragmentBinding binding) throws CoreException;
/**
* Adds the fragment file to the file-set.

View file

@ -172,9 +172,6 @@ public class IndexFileSet implements IIndexFileSet {
return invert;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.index.IIndexFileSet#invert()
*/
@Override
public IIndexFileSet invert() {
if (fInverse == null) {

View file

@ -398,10 +398,17 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
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) {
boolean inhibitUseOfCurrentFileDirectory= false;
List<IncludeSearchPathElement> elements = new ArrayList<IncludeSearchPathElement>();
if (info != null) {
// Quote includes first
if (info instanceof IExtendedScannerInfo) {
final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info;
@ -427,6 +434,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
}
}
}
}
return new IncludeSearchPath(elements, inhibitUseOfCurrentFileDirectory);
}

View file

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

View file

@ -44,9 +44,6 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
fIgnoreExternal= ignoreWSExternal;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#fromInternalFormat(java.lang.String)
*/
@Override
public IIndexFileLocation fromInternalFormat(String raw) {
String fullPath = null;
@ -54,7 +51,7 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
if (raw.startsWith(EXTERNAL)) {
try {
uri = new URI(raw.substring(EXTERNAL.length()));
} catch(URISyntaxException use) {
} catch (URISyntaxException e) {
}
} else {
if (raw.startsWith(WS)) {
@ -71,9 +68,6 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
return uri == null ? null : new IndexFileLocation(uri, fullPath);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.dom.IIndexLocationConverter#toRaw(java.net.URI)
*/
@Override
public String toInternalFormat(IIndexFileLocation location) {
String fullPath= location.getFullPath();

View file

@ -195,7 +195,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
return tu;
}
private boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo,
private static boolean canResolveUnresolvedInclude(IIndexFile file, IScannerInfo scannerInfo,
ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) {
try {
String filePath = IndexLocationFactory.getAbsolutePath(file.getLocation()).toOSString();
@ -214,7 +214,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
return false;
}
private boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp,
private static boolean canResolveInclude(IIndexInclude include, String currentFile, long timestamp,
IncludeSearchPath includeSearchPath,
ProjectIndexerIncludeResolutionHeuristics includeResolutionHeuristics) throws CoreException {
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.
*/
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
// of File.lastModified() method and possible skew between clocks on a multi-CPU
// system. This may produce false positives, but they are pretty harmless.

View file

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

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.IContainerDMContext;
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.ISourceLookupDMContext;
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.MIRunControl.SuspendedEvent;
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.MIWatchpointScopeEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent;
@ -1340,21 +1342,34 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
// 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
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) {