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:
commit
23b841b96c
302 changed files with 6978 additions and 3378 deletions
|
@ -128,12 +128,7 @@ public class MakeCorePlugin extends Plugin {
|
||||||
public static void log(Throwable e) {
|
public static void log(Throwable e) {
|
||||||
if (e instanceof InvocationTargetException)
|
if (e instanceof InvocationTargetException)
|
||||||
e = ((InvocationTargetException) e).getTargetException();
|
e = ((InvocationTargetException) e).getTargetException();
|
||||||
IStatus status = null;
|
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), new Exception()));
|
||||||
if (e instanceof CoreException)
|
|
||||||
status = ((CoreException) e).getStatus();
|
|
||||||
else
|
|
||||||
status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
|
|
||||||
log(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(IStatus status) {
|
public static void log(IStatus status) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
* Copyright (c) 2000, 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
|
||||||
|
@ -45,11 +45,9 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +63,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
/** presentation of the content, i.e. for MakeView tree of for BuildTargetDialog table */
|
/** presentation of the content, i.e. for MakeView tree of for BuildTargetDialog table */
|
||||||
protected boolean bFlatten;
|
protected boolean bFlatten;
|
||||||
|
|
||||||
protected StructuredViewer viewer;
|
protected TreeViewer viewer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
|
@ -84,9 +82,6 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
bFlatten = flat;
|
bFlatten = flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getChildren(Object obj) {
|
public Object[] getChildren(Object obj) {
|
||||||
if (obj instanceof IWorkspaceRoot) {
|
if (obj instanceof IWorkspaceRoot) {
|
||||||
|
@ -154,9 +149,6 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getParent(Object obj) {
|
public Object getParent(Object obj) {
|
||||||
if (obj instanceof IMakeTarget) {
|
if (obj instanceof IMakeTarget) {
|
||||||
|
@ -173,17 +165,11 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildren(Object obj) {
|
public boolean hasChildren(Object obj) {
|
||||||
return getChildren(obj).length > 0;
|
return getChildren(obj).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object obj) {
|
public Object[] getElements(Object obj) {
|
||||||
if (bFlatten) {
|
if (bFlatten) {
|
||||||
|
@ -198,9 +184,6 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
return getChildren(obj);
|
return getChildren(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (viewer != null) {
|
if (viewer != null) {
|
||||||
|
@ -208,15 +191,12 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
if (this.viewer == null) {
|
if (this.viewer == null) {
|
||||||
MakeCorePlugin.getDefault().getTargetManager().addListener(this);
|
MakeCorePlugin.getDefault().getTargetManager().addListener(this);
|
||||||
}
|
}
|
||||||
this.viewer = (StructuredViewer) viewer;
|
this.viewer = (TreeViewer) viewer;
|
||||||
IWorkspace oldWorkspace = null;
|
IWorkspace oldWorkspace = null;
|
||||||
IWorkspace newWorkspace = null;
|
IWorkspace newWorkspace = null;
|
||||||
if (oldInput instanceof IWorkspace) {
|
if (oldInput instanceof IWorkspace) {
|
||||||
|
@ -248,147 +228,123 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.eclipse.cdt.make.core.IMakeTargetListener#targetChanged(org.eclipse.cdt.make.core.MakeTargetEvent)
|
* Refresh the whole view.
|
||||||
*/
|
*/
|
||||||
@Override
|
private void refreshView() {
|
||||||
public void targetChanged(final MakeTargetEvent event) {
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
final Control ctrl = viewer.getControl();
|
@Override
|
||||||
if (ctrl != null && !ctrl.isDisposed()) {
|
public void run() {
|
||||||
switch (event.getType()) {
|
viewer.refresh();
|
||||||
case MakeTargetEvent.PROJECT_ADDED :
|
|
||||||
case MakeTargetEvent.PROJECT_REMOVED :
|
|
||||||
ctrl.getDisplay().asyncExec(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!ctrl.isDisposed()) {
|
|
||||||
viewer.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case MakeTargetEvent.TARGET_ADD :
|
|
||||||
case MakeTargetEvent.TARGET_CHANGED :
|
|
||||||
case MakeTargetEvent.TARGET_REMOVED :
|
|
||||||
ctrl.getDisplay().asyncExec(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!ctrl.isDisposed()) {
|
|
||||||
if (bFlatten) {
|
|
||||||
viewer.refresh();
|
|
||||||
} else {
|
|
||||||
//We can't just call refresh on the container target that
|
|
||||||
//has been created since it may be that the container has
|
|
||||||
//been filtered out and the filters in the viewer don't know
|
|
||||||
//any better how to call out to the filter selection again.
|
|
||||||
//Instead we walk to the root project container and refresh it.
|
|
||||||
Set<IContainer> containers = new HashSet<IContainer>();
|
|
||||||
IMakeTarget[] targets = event.getTargets();
|
|
||||||
for (IMakeTarget target : targets) {
|
|
||||||
IContainer container = target.getContainer();
|
|
||||||
while(!(container instanceof IProject) && container.getParent()!=null) {
|
|
||||||
container = container.getParent();
|
|
||||||
}
|
|
||||||
containers.add(container);
|
|
||||||
}
|
|
||||||
for (IContainer container : containers) {
|
|
||||||
viewer.refresh(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processDelta(IResourceDelta delta) {
|
/**
|
||||||
// Bail out if the widget was disposed.
|
* Refresh the project tree or the project subtree (in case of drill-down adapter) in the view.
|
||||||
Control ctrl = viewer.getControl();
|
*/
|
||||||
if (ctrl == null || ctrl.isDisposed() || delta == null) {
|
private void refreshProjectTree(final IProject project) {
|
||||||
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (viewer.getTree().getItemCount() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object firstItem = viewer.getTree().getItem(0).getData();
|
||||||
|
IContainer parentContainer = null;
|
||||||
|
|
||||||
|
boolean isDrilledDown = !(firstItem instanceof IProject);
|
||||||
|
if (!isDrilledDown) {
|
||||||
|
// view shows projects
|
||||||
|
viewer.refresh(project);
|
||||||
|
} else {
|
||||||
|
// drill-down adapter in the game
|
||||||
|
if (firstItem instanceof IResource) {
|
||||||
|
parentContainer = ((IResource) firstItem).getParent();
|
||||||
|
} else if (firstItem instanceof TargetSourceContainer) {
|
||||||
|
parentContainer = ((TargetSourceContainer) firstItem).getContainer().getParent();
|
||||||
|
} else if (firstItem instanceof IMakeTarget) {
|
||||||
|
parentContainer = ((IMakeTarget) firstItem).getContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentContainer != null && project.equals(parentContainer.getProject())) {
|
||||||
|
viewer.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void targetChanged(MakeTargetEvent event) {
|
||||||
|
// Additions/removal of projects. Only notifications for projects having applicable builder come here.
|
||||||
|
int type = event.getType();
|
||||||
|
if (type == MakeTargetEvent.PROJECT_ADDED || type == MakeTargetEvent.PROJECT_REMOVED) {
|
||||||
|
refreshView();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
|
IMakeTarget[] targets = event.getTargets();
|
||||||
|
if (targets == null) {
|
||||||
// Not interested in Content changes.
|
return;
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
|
||||||
if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle changed children recursively.
|
Set<IProject> affectedProjects = new HashSet<IProject>();
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
for (IMakeTarget target : event.getTargets()) {
|
||||||
processDelta(affectedChildren[i]);
|
IContainer container = target.getContainer();
|
||||||
|
affectedProjects.add(container.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the affected resource
|
// If the view is being filtered, adding/removing targets can
|
||||||
final IResource resource = delta.getResource();
|
// result in showing or hiding containers or the project itself
|
||||||
|
for (IProject project : affectedProjects) {
|
||||||
// Handle removed children. Issue one update for all removals.
|
refreshProjectTree(project);
|
||||||
affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
|
}
|
||||||
if (affectedChildren.length > 0) {
|
}
|
||||||
final ArrayList<IResource> affected = new ArrayList<IResource>(affectedChildren.length);
|
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
private void collectAffectedProjects(IResourceDelta delta, Set<IProject> affectedProjects) {
|
||||||
if (affectedChildren[i].getResource().getType() == IResource.FOLDER) {
|
if (affectedProjects.contains(delta.getResource().getProject())) {
|
||||||
affected.add(affectedChildren[i].getResource());
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!affected.isEmpty()) {
|
for (IResourceDelta d : delta.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED)) {
|
||||||
Display.getDefault().asyncExec(new Runnable() {
|
// handle folders only, additions/removal of projects are dealt with in #targetChanged(MakeTargetEvent)
|
||||||
@Override
|
IResource rc = d.getResource();
|
||||||
public void run() {
|
if (rc.getType() == IResource.FOLDER) {
|
||||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
IProject project = rc.getProject();
|
||||||
return;
|
if (MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(project)) {
|
||||||
if (viewer instanceof AbstractTreeViewer) {
|
affectedProjects.add(project);
|
||||||
((AbstractTreeViewer) viewer).remove(affected.toArray());
|
return;
|
||||||
} else {
|
}
|
||||||
viewer.refresh(resource);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
for (IResourceDelta d : delta.getAffectedChildren(IResourceDelta.CHANGED)) {
|
||||||
}
|
collectAffectedProjects(d, affectedProjects);
|
||||||
}
|
|
||||||
|
|
||||||
// Handle added children. Issue one update for all insertions.
|
|
||||||
affectedChildren = delta.getAffectedChildren(IResourceDelta.ADDED);
|
|
||||||
if (affectedChildren.length > 0) {
|
|
||||||
final ArrayList<IResource> affected = new ArrayList<IResource>(affectedChildren.length);
|
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
|
||||||
if (affectedChildren[i].getResource().getType() == IResource.FOLDER) {
|
|
||||||
affected.add(affectedChildren[i].getResource());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!affected.isEmpty()) {
|
|
||||||
Display.getDefault().asyncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
|
||||||
return;
|
|
||||||
if (viewer instanceof AbstractTreeViewer) {
|
|
||||||
((AbstractTreeViewer) viewer).add(resource, affected.toArray());
|
|
||||||
} else {
|
|
||||||
viewer.refresh(resource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void resourceChanged(IResourceChangeEvent event) {
|
public void resourceChanged(IResourceChangeEvent event) {
|
||||||
final IResourceDelta delta = event.getDelta();
|
IResourceDelta delta = event.getDelta();
|
||||||
Control ctrl = viewer.getControl();
|
if (delta == null) {
|
||||||
if (ctrl != null && !ctrl.isDisposed())
|
return;
|
||||||
processDelta(delta);
|
}
|
||||||
|
|
||||||
|
Set<IProject> affectedProjects = new HashSet<IProject>();
|
||||||
|
collectAffectedProjects(delta, affectedProjects);
|
||||||
|
|
||||||
|
// If the view is being filtered or source roots shown,
|
||||||
|
// adding/removing resources can structurally affect the tree
|
||||||
|
// starting with the project
|
||||||
|
for (IProject project : affectedProjects) {
|
||||||
|
refreshProjectTree(project);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -397,34 +353,29 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
* @since 7.1
|
* @since 7.1
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(final CProjectDescriptionEvent event) {
|
public void handleEvent(CProjectDescriptionEvent event) {
|
||||||
Display display = Display.getDefault();
|
ICDescriptionDelta delta = event.getDefaultSettingCfgDelta();
|
||||||
display.asyncExec(new Runnable() {
|
if (delta==null)
|
||||||
@Override
|
return;
|
||||||
public void run() {
|
|
||||||
ICDescriptionDelta delta = event.getDefaultSettingCfgDelta();
|
|
||||||
if (delta==null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int flags = delta.getChangeFlags();
|
int flags = delta.getChangeFlags();
|
||||||
if ( ((flags & ICDescriptionDelta.SOURCE_ADDED) != 0) ||
|
if ( ((flags & ICDescriptionDelta.SOURCE_ADDED) != 0) ||
|
||||||
((flags & ICDescriptionDelta.SOURCE_REMOVED) != 0) ) {
|
((flags & ICDescriptionDelta.SOURCE_REMOVED) != 0) ) {
|
||||||
|
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
ICSettingObject setting = delta.getOldSetting();
|
ICSettingObject setting = delta.getOldSetting();
|
||||||
if (setting==null)
|
if (setting == null) {
|
||||||
setting = delta.getNewSetting();
|
setting = delta.getNewSetting();
|
||||||
|
}
|
||||||
|
|
||||||
if (setting instanceof ICConfigurationDescription)
|
if (setting instanceof ICConfigurationDescription) {
|
||||||
project = ((ICConfigurationDescription) setting).getProjectDescription().getProject();
|
project = ((ICConfigurationDescription) setting).getProjectDescription().getProject();
|
||||||
|
if (project != null) {
|
||||||
if (project!=null)
|
// refresh source roots under the project
|
||||||
viewer.refresh(project);
|
refreshProjectTree(project);
|
||||||
else
|
|
||||||
viewer.refresh();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -435,12 +386,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
@Override
|
@Override
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
public void preferenceChange(PreferenceChangeEvent event) {
|
||||||
if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
|
if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
|
||||||
Display.getDefault().asyncExec(new Runnable() {
|
refreshView();
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
viewer.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceProxy;
|
import org.eclipse.core.resources.IResourceProxy;
|
||||||
import org.eclipse.core.resources.IResourceProxyVisitor;
|
import org.eclipse.core.resources.IResourceProxyVisitor;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
|
@ -57,54 +56,66 @@ public class FilterEmtpyFoldersAction extends Action {
|
||||||
setToolTipText(MakeUIPlugin.getResourceString("FilterEmptyFolderAction.tooltip")); //$NON-NLS-1$
|
setToolTipText(MakeUIPlugin.getResourceString("FilterEmptyFolderAction.tooltip")); //$NON-NLS-1$
|
||||||
setChecked(getSettings().getBoolean(FILTER_EMPTY_FOLDERS));
|
setChecked(getSettings().getBoolean(FILTER_EMPTY_FOLDERS));
|
||||||
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_FILTER); //$NON-NLS-1$
|
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_FILTER); //$NON-NLS-1$
|
||||||
fViewer.addFilter(new ViewerFilter() {
|
|
||||||
//Check the make targets of the specified container, and if they don't exist, run
|
|
||||||
//through the children looking for the first match that we can find that contains
|
|
||||||
//a make target.
|
|
||||||
private boolean hasMakeTargets(IContainer container) throws CoreException {
|
|
||||||
IMakeTarget [] targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(container);
|
|
||||||
if(targets != null && targets.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
fViewer.addFilter(new ViewerFilter() {
|
||||||
|
/**
|
||||||
|
* Run through the children looking for the first match that we can find that contains
|
||||||
|
* a make target.
|
||||||
|
*/
|
||||||
|
private boolean hasMakeTargets(final IContainer parentContainer) {
|
||||||
final boolean [] haveTargets = new boolean[1];
|
final boolean [] haveTargets = new boolean[1];
|
||||||
haveTargets[0] = false;
|
haveTargets[0] = false;
|
||||||
|
|
||||||
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
|
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
public boolean visit(IResourceProxy proxy) {
|
||||||
if(haveTargets[0]) {
|
if(haveTargets[0]) {
|
||||||
return false; //We found what we were looking for
|
return false; // We found what we were looking for
|
||||||
}
|
}
|
||||||
|
|
||||||
if(proxy.getType() != IResource.FOLDER) {
|
int rcType = proxy.getType();
|
||||||
return true; //We only look at folders for content
|
if(rcType != IResource.PROJECT && rcType != IResource.FOLDER) {
|
||||||
|
return false; // Ignore non-containers
|
||||||
}
|
}
|
||||||
|
|
||||||
IContainer folder = (IContainer) proxy.requestResource();
|
IContainer subFolder = (IContainer) proxy.requestResource();
|
||||||
IMakeTarget [] targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(folder);
|
|
||||||
if(targets != null && targets.length > 0) {
|
if (!(parentContainer instanceof IProject) && !subFolder.equals(parentContainer)
|
||||||
haveTargets[0] = true;
|
&& CCorePlugin.showSourceRootsAtTopOfProject() && MakeContentProvider.isSourceEntry(subFolder)) {
|
||||||
return false;
|
return false; // Skip source folders showing up second time as regular folders
|
||||||
}
|
}
|
||||||
return true; //Keep looking
|
|
||||||
|
try {
|
||||||
|
IMakeTarget [] targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(subFolder);
|
||||||
|
if(targets != null && targets.length > 0) {
|
||||||
|
haveTargets[0] = true;
|
||||||
|
return false; // Found a target
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// log any problem then ignore it
|
||||||
|
MakeUIPlugin.log(e);
|
||||||
|
}
|
||||||
|
return true; // Keep looking
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
container.accept(visitor, IResource.NONE);
|
|
||||||
|
try {
|
||||||
|
parentContainer.accept(visitor, IResource.NONE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// log any problem then ignore it
|
||||||
|
MakeUIPlugin.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
return haveTargets[0];
|
return haveTargets[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
if (isChecked()) {
|
if (isChecked()) {
|
||||||
IContainer container = null;
|
IContainer container = null;
|
||||||
if (element instanceof IContainer) {
|
if (element instanceof IContainer) {
|
||||||
container = (IContainer)element;
|
container = (IContainer) element;
|
||||||
if (!(container instanceof IProject)) {
|
if (parentElement instanceof IProject && !(container instanceof IProject)) {
|
||||||
// under subfolders do not show source roots second time (when filtered)
|
// under subfolders do not show source roots second time (when filtered)
|
||||||
if (CCorePlugin.showSourceRootsAtTopOfProject() && MakeContentProvider.isSourceEntry(container))
|
if (CCorePlugin.showSourceRootsAtTopOfProject() && MakeContentProvider.isSourceEntry(container))
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,12 +124,8 @@ public class FilterEmtpyFoldersAction extends Action {
|
||||||
container = ((TargetSourceContainer) element).getContainer();
|
container = ((TargetSourceContainer) element).getContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container!=null) {
|
if (container != null) {
|
||||||
try {
|
return hasMakeTargets(container);
|
||||||
return hasMakeTargets(container);
|
|
||||||
} catch(Exception ex) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -126,9 +133,6 @@ public class FilterEmtpyFoldersAction extends Action {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
fViewer.refresh();
|
fViewer.refresh();
|
||||||
|
|
|
@ -141,7 +141,9 @@ Option.Posix.Warn.Pedandic=Pedantic (-pedantic)
|
||||||
Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors)
|
Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors)
|
||||||
Option.Posix.Warn.nowarn=Inhibit all warnings (-w)
|
Option.Posix.Warn.nowarn=Inhibit all warnings (-w)
|
||||||
Option.Posix.Warn.allwarn=All warnings (-Wall)
|
Option.Posix.Warn.allwarn=All warnings (-Wall)
|
||||||
|
Option.Posix.Warn.extrawarn=Extra warnings (-Wextra)
|
||||||
Option.Posix.Warn.toerrs=Warnings as errors (-Werror)
|
Option.Posix.Warn.toerrs=Warnings as errors (-Werror)
|
||||||
|
Option.Posix.Warn.wconversion=Implicit conversion warnings (-Wconversion)
|
||||||
|
|
||||||
Option.Posix.Verbose=Verbose (-v)
|
Option.Posix.Verbose=Verbose (-v)
|
||||||
Option.OtherFlags=Other flags
|
Option.OtherFlags=Other flags
|
||||||
|
|
|
@ -1202,6 +1202,14 @@
|
||||||
id="gnu.c.compiler.option.warnings.allwarn"
|
id="gnu.c.compiler.option.warnings.allwarn"
|
||||||
valueType="boolean">
|
valueType="boolean">
|
||||||
</option>
|
</option>
|
||||||
|
<option
|
||||||
|
defaultValue="false"
|
||||||
|
name="%Option.Posix.Warn.extrawarn"
|
||||||
|
category="gnu.c.compiler.category.warnings"
|
||||||
|
command="-Wextra"
|
||||||
|
id="gnu.c.compiler.option.warnings.extrawarn"
|
||||||
|
valueType="boolean">
|
||||||
|
</option>
|
||||||
<option
|
<option
|
||||||
defaultValue="false"
|
defaultValue="false"
|
||||||
name="%Option.Posix.Warn.toerrs"
|
name="%Option.Posix.Warn.toerrs"
|
||||||
|
@ -1210,6 +1218,14 @@
|
||||||
id="gnu.c.compiler.option.warnings.toerrors"
|
id="gnu.c.compiler.option.warnings.toerrors"
|
||||||
valueType="boolean">
|
valueType="boolean">
|
||||||
</option>
|
</option>
|
||||||
|
<option
|
||||||
|
defaultValue="false"
|
||||||
|
name="%Option.Posix.Warn.wconversion"
|
||||||
|
category="gnu.c.compiler.category.warnings"
|
||||||
|
command="-Wconversion"
|
||||||
|
id="gnu.c.compiler.option.warnings.wconversion"
|
||||||
|
valueType="boolean">
|
||||||
|
</option>
|
||||||
<optionCategory
|
<optionCategory
|
||||||
owner="cdt.managedbuild.tool.gnu.c.compiler"
|
owner="cdt.managedbuild.tool.gnu.c.compiler"
|
||||||
name="%OptionCategory.Misc"
|
name="%OptionCategory.Misc"
|
||||||
|
@ -1515,6 +1531,14 @@
|
||||||
id="gnu.cpp.compiler.option.warnings.allwarn"
|
id="gnu.cpp.compiler.option.warnings.allwarn"
|
||||||
valueType="boolean">
|
valueType="boolean">
|
||||||
</option>
|
</option>
|
||||||
|
<option
|
||||||
|
defaultValue="false"
|
||||||
|
name="%Option.Posix.Warn.extrawarn"
|
||||||
|
category="gnu.cpp.compiler.category.warnings"
|
||||||
|
command="-Wextra"
|
||||||
|
id="gnu.cpp.compiler.option.warnings.extrawarn"
|
||||||
|
valueType="boolean">
|
||||||
|
</option>
|
||||||
<option
|
<option
|
||||||
defaultValue="false"
|
defaultValue="false"
|
||||||
name="%Option.Posix.Warn.toerrs"
|
name="%Option.Posix.Warn.toerrs"
|
||||||
|
@ -1523,6 +1547,14 @@
|
||||||
id="gnu.cpp.compiler.option.warnings.toerrors"
|
id="gnu.cpp.compiler.option.warnings.toerrors"
|
||||||
valueType="boolean">
|
valueType="boolean">
|
||||||
</option>
|
</option>
|
||||||
|
<option
|
||||||
|
defaultValue="false"
|
||||||
|
name="%Option.Posix.Warn.wconversion"
|
||||||
|
category="gnu.cpp.compiler.category.warnings"
|
||||||
|
command="-Wconversion"
|
||||||
|
id="gnu.cpp.compiler.option.warnings.wconversion"
|
||||||
|
valueType="boolean">
|
||||||
|
</option>
|
||||||
<optionCategory
|
<optionCategory
|
||||||
owner="cdt.managedbuild.tool.gnu.cpp.compiler"
|
owner="cdt.managedbuild.tool.gnu.cpp.compiler"
|
||||||
name="%OptionCategory.Misc"
|
name="%OptionCategory.Misc"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<classpathentry kind="src" path="parser"/>
|
<classpathentry kind="src" path="parser"/>
|
||||||
<classpathentry kind="src" path="suite"/>
|
<classpathentry kind="src" path="suite"/>
|
||||||
<classpathentry kind="src" path="regression"/>
|
<classpathentry kind="src" path="regression"/>
|
||||||
<classpathentry kind="src" path="templateengine"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
|
|
@ -32,7 +32,6 @@ Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
|
||||||
org.eclipse.cdt.core.testplugin,
|
org.eclipse.cdt.core.testplugin,
|
||||||
org.eclipse.cdt.core.testplugin.util,
|
org.eclipse.cdt.core.testplugin.util,
|
||||||
org.eclipse.cdt.core.tests,
|
org.eclipse.cdt.core.tests,
|
||||||
org.eclipse.cdt.core.tests.templateengine,
|
|
||||||
org.eclipse.cdt.core.winreg.tests,
|
org.eclipse.cdt.core.winreg.tests,
|
||||||
org.eclipse.cdt.internal.index.tests;x-internal:=true,
|
org.eclipse.cdt.internal.index.tests;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.pdom.tests;x-internal:=true,
|
org.eclipse.cdt.internal.pdom.tests;x-internal:=true,
|
||||||
|
|
|
@ -25,8 +25,7 @@ source.. = model/,\
|
||||||
parser/,\
|
parser/,\
|
||||||
suite/,\
|
suite/,\
|
||||||
misc/,\
|
misc/,\
|
||||||
regression/,\
|
regression/
|
||||||
templateengine/
|
|
||||||
|
|
||||||
jre.compilation.profile=JavaSE-1.6
|
jre.compilation.profile=JavaSE-1.6
|
||||||
javacSource=1.6
|
javacSource=1.6
|
||||||
|
|
|
@ -9367,6 +9367,33 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace std {
|
||||||
|
// template <class T1, class T2> struct pair {
|
||||||
|
// T1 first;
|
||||||
|
// T2 second;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T, typename U> T begin(const pair<T, U>& p) {
|
||||||
|
// return p.first;
|
||||||
|
// }
|
||||||
|
// template <typename T, typename U> U end(const pair<T, U>& p) {
|
||||||
|
// return p.second;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// struct S {
|
||||||
|
// int x;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// int main() {
|
||||||
|
// S arr[5];
|
||||||
|
// std::pair<S*, S*> p{arr, arr + 5};
|
||||||
|
// for (const auto& r : p)
|
||||||
|
// r.x;
|
||||||
|
// }
|
||||||
|
public void testAutoTypeInRangeBasedFor_332883c() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
// struct S {
|
// struct S {
|
||||||
// void f();
|
// void f();
|
||||||
// };
|
// };
|
||||||
|
|
|
@ -5638,4 +5638,55 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testTemplateAmbiguityInDeleteExpression_364225() throws Exception {
|
public void testTemplateAmbiguityInDeleteExpression_364225() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename T> void foo(T);
|
||||||
|
// template <typename T> void foo(T, typename T::type* = 0);
|
||||||
|
// int main() {
|
||||||
|
// foo(0);
|
||||||
|
// }
|
||||||
|
public void testSyntaxFailureInstantiatingFunctionTemplate_365981a() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename T> bool bar(T);
|
||||||
|
// template <typename T> bool bar(T, void(T::*)() = 0);
|
||||||
|
// void test() {
|
||||||
|
// bar(0);
|
||||||
|
// }
|
||||||
|
public void testSyntaxFailureInstantiatingFunctionTemplate_365981b() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template<typename _Tp> class vector {};
|
||||||
|
// template<typename T> struct bar {
|
||||||
|
// void foo() {
|
||||||
|
// vector<T> index;
|
||||||
|
// for (const auto& entry : index) {
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
public void testResolvingAutoTypeWithDependentExpression_367472() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// void foo(int, int);
|
||||||
|
// template <typename... Args> void bar(Args... args) {
|
||||||
|
// foo(1,2,args...);
|
||||||
|
// foo(args...);
|
||||||
|
// }
|
||||||
|
public void testPackExpansionsAsArguments_367560() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename> class A;
|
||||||
|
// template <typename T> class A<void (T::*)()> {};
|
||||||
|
// template <typename T> class A<void (T::*)() const> {};
|
||||||
|
//
|
||||||
|
// struct S {};
|
||||||
|
// int main() {
|
||||||
|
// A<void (S::*)()> m;
|
||||||
|
// }
|
||||||
|
public void testDeductionForConstFunctionType_367562() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTName findName(String section, int len) {
|
protected IASTName findName(String section, int len) {
|
||||||
|
if (len == 0)
|
||||||
|
len= section.length();
|
||||||
for (int i = 0; i < strategy.getAstCount(); i++) {
|
for (int i = 0; i < strategy.getAstCount(); i++) {
|
||||||
IASTTranslationUnit ast = strategy.getAst(i);
|
IASTTranslationUnit ast = strategy.getAst(i);
|
||||||
final IASTNodeSelector nodeSelector = ast.getNodeSelector(null);
|
final IASTNodeSelector nodeSelector = ast.getNodeSelector(null);
|
||||||
|
@ -260,30 +262,36 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
this.cpp = cpp;
|
this.cpp = cpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAstCount() {
|
public int getAstCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getAst(int index) {
|
public IASTTranslationUnit getAst(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder getAstSource(int index) {
|
public StringBuilder getAstSource(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return testData[1];
|
return testData[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||||
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
@ -308,6 +316,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
|
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
@ -317,10 +326,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IIndex getIndex() {
|
public IIndex getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCompositeIndex() {
|
public boolean isCompositeIndex() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -337,30 +348,36 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
this.cpp = cpp;
|
this.cpp = cpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAstCount() {
|
public int getAstCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getAst(int index) {
|
public IASTTranslationUnit getAst(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder getAstSource(int index) {
|
public StringBuilder getAstSource(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return testData[1];
|
return testData[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
cproject = cpp ? CProjectHelper.createCCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
cproject = cpp ? CProjectHelper.createCCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||||
: CProjectHelper.createCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
: CProjectHelper.createCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
@ -385,6 +402,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
|
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
@ -394,10 +412,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IIndex getIndex() {
|
public IIndex getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCompositeIndex() {
|
public boolean isCompositeIndex() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -425,26 +445,32 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
asts = new ArrayList<IASTTranslationUnit>();
|
asts = new ArrayList<IASTTranslationUnit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAstCount() {
|
public int getAstCount() {
|
||||||
return asts.size();
|
return asts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getAst(int index) {
|
public IASTTranslationUnit getAst(int index) {
|
||||||
return asts.get(index);
|
return asts.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder getAstSource(int index) {
|
public StringBuilder getAstSource(int index) {
|
||||||
return astSources.get(index);
|
return astSources.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||||
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
@ -487,6 +513,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
@ -496,10 +523,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IIndex getIndex() {
|
public IIndex getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCompositeIndex() {
|
public boolean isCompositeIndex() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -516,10 +545,12 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
this.cpp = cpp;
|
this.cpp = cpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
@ -532,6 +563,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
cproject= cpp ? CProjectHelper.createCCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
cproject= cpp ? CProjectHelper.createCCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||||
: CProjectHelper.createCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
: CProjectHelper.createCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
@ -580,30 +612,36 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
return referenced;
|
return referenced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getAstCount() {
|
public int getAstCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getAst(int index) {
|
public IASTTranslationUnit getAst(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder getAstSource(int index) {
|
public StringBuilder getAstSource(int index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return testData[1];
|
return testData[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IIndex getIndex() {
|
public IIndex getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public StringBuilder[] getTestData() {
|
public StringBuilder[] getTestData() {
|
||||||
return testData;
|
return testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCompositeIndex() {
|
public boolean isCompositeIndex() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2394,7 +2394,8 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
final Set<IFolder> folders = new HashSet<IFolder>();
|
final Set<IFolder> folders = new HashSet<IFolder>();
|
||||||
folders.add(root);
|
folders.add(root);
|
||||||
root.accept(new IResourceVisitor() {
|
root.accept(new IResourceVisitor() {
|
||||||
public boolean visit(final IResource resource) throws CoreException {
|
@Override
|
||||||
|
public boolean visit(final IResource resource) throws CoreException {
|
||||||
if (resource instanceof IFile) {
|
if (resource instanceof IFile) {
|
||||||
files.add((IFile) resource);
|
files.add((IFile) resource);
|
||||||
} else if (resource instanceof IFolder) {
|
} else if (resource instanceof IFolder) {
|
||||||
|
@ -2431,4 +2432,42 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // context.c
|
||||||
|
// #define A B
|
||||||
|
// #include "b.h" // file name is important to reproduce the issue
|
||||||
|
// #include "a.h" // file name is important to reproduce the issue
|
||||||
|
|
||||||
|
// // a.h and b.h
|
||||||
|
// int A;
|
||||||
|
public void testUpdatingHeaderInContext_367315() throws Exception {
|
||||||
|
String[] contents= getContentsForTest(2);
|
||||||
|
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||||
|
TestSourceReader.createFile(fCProject.getProject(), "context.c", contents[0]);
|
||||||
|
IFile ah= TestSourceReader.createFile(fCProject.getProject(), "a.h", contents[1]);
|
||||||
|
IFile bh= TestSourceReader.createFile(fCProject.getProject(), "b.h", contents[1]);
|
||||||
|
indexManager.reindex(fCProject);
|
||||||
|
waitForIndexer();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
IIndexBinding[] vars = fIndex.findBindings("B".toCharArray(), IndexFilter.ALL_DECLARED, new NullProgressMonitor());
|
||||||
|
assertEquals(1, vars.length);
|
||||||
|
assertEquals(2, fIndex.findDefinitions(vars[0]).length);
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
final CoreModel coreModel = CCorePlugin.getDefault().getCoreModel();
|
||||||
|
ICElement[] selection = new ICElement[] {coreModel.create(ah), coreModel.create(bh)};
|
||||||
|
indexManager.update(selection, IIndexManager.UPDATE_ALL);
|
||||||
|
waitForIndexer();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
IIndexBinding[] vars = fIndex.findBindings("B".toCharArray(), IndexFilter.ALL_DECLARED, new NullProgressMonitor());
|
||||||
|
assertEquals(1, vars.length);
|
||||||
|
assertEquals(2, fIndex.findDefinitions(vars[0]).length);
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,6 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
||||||
public static TestSuite suite() {return suite(ProjectWithDepProj.class);}
|
public static TestSuite suite() {return suite(ProjectWithDepProj.class);}
|
||||||
|
|
||||||
// template <typename T= int> class XT;
|
|
||||||
|
|
||||||
// #include "header.h"
|
|
||||||
// template <typename T> class XT {};
|
|
||||||
// void test() {
|
|
||||||
// XT<> x;
|
|
||||||
// };
|
|
||||||
@Override
|
@Override
|
||||||
public void testDefaultTemplateArgInHeader_264988() throws Exception {
|
public void testDefaultTemplateArgInHeader_264988() throws Exception {
|
||||||
// Not supported across projects (the composite index does not merge
|
// Not supported across projects (the composite index does not merge
|
||||||
|
@ -1908,4 +1901,33 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
public void testUsageOfClassTemplateOutsideOfClassBody_357320() throws Exception {
|
public void testUsageOfClassTemplateOutsideOfClassBody_357320() throws Exception {
|
||||||
getBindingFromASTName("m1", 0, ICPPMethod.class);
|
getBindingFromASTName("m1", 0, ICPPMethod.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename> struct foo;
|
||||||
|
// template <> struct foo<int> {
|
||||||
|
// typedef int type;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// #include "header.h"
|
||||||
|
// template <typename> struct foo {};
|
||||||
|
// int main() {
|
||||||
|
// typedef foo<int>::type type; // ERROR HERE: 'foo<int>::type' could not be
|
||||||
|
// }
|
||||||
|
public void testSpecializationInIndex_367563a() throws Exception {
|
||||||
|
getBindingFromASTName("type type", 4, ITypedef.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename> struct foo;
|
||||||
|
// template <typename T> struct foo<T*> {
|
||||||
|
// typedef int type;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// #include "header.h"
|
||||||
|
// template <typename> struct foo {};
|
||||||
|
// int main() {
|
||||||
|
// typedef foo<int*>::type type; // ERROR HERE: 'foo<int>::type' could not be
|
||||||
|
// }
|
||||||
|
public void testSpecializationInIndex_367563b() throws Exception {
|
||||||
|
getBindingFromASTName("type type", 4, ITypedef.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
|
@ -131,12 +133,55 @@ public class IndexMultiVariantHeaderTest extends IndexBindingResolutionTestBase
|
||||||
// y = 0;
|
// y = 0;
|
||||||
// z = 0;
|
// z = 0;
|
||||||
// }
|
// }
|
||||||
public void _testSignificantMacroDetection() throws Exception {
|
public void testSignificantMacroDetection() throws Exception {
|
||||||
// TODO(sprigogin): For this test to work REPORT_SIGNIFICANT_MACROS flag
|
|
||||||
// should be passed to CPreprocessor.expandMacro method. See
|
|
||||||
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=197989#c92 for details.
|
|
||||||
getBindingFromASTName("x = 0", 1, ICPPVariable.class);
|
getBindingFromASTName("x = 0", 1, ICPPVariable.class);
|
||||||
getBindingFromASTName("y = 0", 1, ICPPVariable.class);
|
getBindingFromASTName("y = 0", 1, ICPPVariable.class);
|
||||||
getBindingFromASTName("z = 0", 1, ICPPVariable.class);
|
getBindingFromASTName("z = 0", 1, ICPPVariable.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// b.h
|
||||||
|
// #ifndef _B
|
||||||
|
// #define _B
|
||||||
|
// #define SIG // This internal modification is not propagated
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// a.h
|
||||||
|
// #include "b.h"
|
||||||
|
// #ifdef SIG // Not significant, because it is defined in "b.h"
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// a.cpp *
|
||||||
|
// #include "a.h"
|
||||||
|
public void testSignificantMacroDetection_367753a() throws Exception {
|
||||||
|
IASTName includeName= findName("a.h", 0);
|
||||||
|
IASTPreprocessorIncludeStatement inc= (IASTPreprocessorIncludeStatement) includeName.getParent();
|
||||||
|
assertTrue(inc.isResolved());
|
||||||
|
assertEquals("{}", inc.getSignificantMacros().toString());
|
||||||
|
assertNotNull(inc.getImportedIndexFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
// c.h
|
||||||
|
// #define SIG // This internal modification is not propagated
|
||||||
|
|
||||||
|
// b.h
|
||||||
|
// #ifndef _B
|
||||||
|
// #define _B
|
||||||
|
// #include "c.h"
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// a.h
|
||||||
|
// #include "b.h"
|
||||||
|
// #ifdef SIG // Not significant, because it is defined in "c.h"
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// a.cpp *
|
||||||
|
// #include "a.h"
|
||||||
|
public void testSignificantMacroDetection_367753b() throws Exception {
|
||||||
|
IASTName includeName= findName("a.h", 0);
|
||||||
|
IASTPreprocessorIncludeStatement inc= (IASTPreprocessorIncludeStatement) includeName.getParent();
|
||||||
|
assertTrue(inc.isResolved());
|
||||||
|
assertEquals("{}", inc.getSignificantMacros().toString());
|
||||||
|
assertNotNull(inc.getImportedIndexFile());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,12 @@ public class DBTest extends BaseTestCase {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(long record) throws CoreException {
|
public int compare(long record) throws CoreException {
|
||||||
return db.getString(db.getRecPtr(record + 4)).compare(key, true);
|
return db.getString(db.getRecPtr(record + 4)).compare(key, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean visit(long record) throws CoreException {
|
public boolean visit(long record) throws CoreException {
|
||||||
this.record = record;
|
this.record = record;
|
||||||
return false;
|
return false;
|
||||||
|
@ -185,6 +187,7 @@ public class DBTest extends BaseTestCase {
|
||||||
};
|
};
|
||||||
|
|
||||||
IBTreeComparator comparator = new IBTreeComparator() {
|
IBTreeComparator comparator = new IBTreeComparator() {
|
||||||
|
@Override
|
||||||
public int compare(long record1, long record2) throws CoreException {
|
public int compare(long record1, long record2) throws CoreException {
|
||||||
IString string1 = db.getString(db.getRecPtr(record1 + 4));
|
IString string1 = db.getString(db.getRecPtr(record1 + 4));
|
||||||
IString string2 = db.getString(db.getRecPtr(record2 + 4));
|
IString string2 = db.getString(db.getRecPtr(record2 + 4));
|
||||||
|
@ -221,9 +224,10 @@ public class DBTest extends BaseTestCase {
|
||||||
assertCMP("", EQ, "", true);
|
assertCMP("", EQ, "", true);
|
||||||
assertCMP("", EQ, "", false);
|
assertCMP("", EQ, "", false);
|
||||||
|
|
||||||
doTrials(1000, 1, ShortString.MAX_LENGTH, r, true);
|
doTrials(1000, 1, ShortString.MAX_BYTE_LENGTH/2, r, true);
|
||||||
|
doTrials(1000, 1, ShortString.MAX_BYTE_LENGTH/2, r, false);
|
||||||
doTrials(1000, 1, ShortString.MAX_LENGTH, r, false);
|
doTrials(1000, 1, ShortString.MAX_BYTE_LENGTH, r, true);
|
||||||
|
doTrials(1000, 1, ShortString.MAX_BYTE_LENGTH, r, false);
|
||||||
|
|
||||||
assertCMP("a", LT, "b", true);
|
assertCMP("a", LT, "b", true);
|
||||||
assertCMP("aa", LT, "ab", true);
|
assertCMP("aa", LT, "ab", true);
|
||||||
|
@ -239,8 +243,8 @@ public class DBTest extends BaseTestCase {
|
||||||
|
|
||||||
public void testLongStringComparison() throws CoreException {
|
public void testLongStringComparison() throws CoreException {
|
||||||
Random r= new Random(314159265);
|
Random r= new Random(314159265);
|
||||||
doTrials(100, ShortString.MAX_LENGTH+1, ShortString.MAX_LENGTH*2, r, true);
|
doTrials(100, ShortString.MAX_BYTE_LENGTH+1, ShortString.MAX_BYTE_LENGTH*2, r, true);
|
||||||
doTrials(100, ShortString.MAX_LENGTH+1, ShortString.MAX_LENGTH*2, r, false);
|
doTrials(100, ShortString.MAX_BYTE_LENGTH+1, ShortString.MAX_BYTE_LENGTH*2, r, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doTrials(int n, int min, int max, Random r, boolean caseSensitive) throws CoreException {
|
private void doTrials(int n, int min, int max, Random r, boolean caseSensitive) throws CoreException {
|
||||||
|
|
|
@ -21,14 +21,11 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.osgi.framework.Bundle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior related to location representation in the PDOM
|
* Tests behavior related to location representation in the PDOM
|
||||||
|
@ -40,15 +37,13 @@ public class PDOMLocationTests extends BaseTestCase {
|
||||||
return suite(PDOMLocationTests.class);
|
return suite(PDOMLocationTests.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
|
||||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
|
||||||
CharSequence[] testData = TestSourceReader.getContentsForTest(b, "parser", getClass(), getName(), 3);
|
|
||||||
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
if (cproject != null) {
|
if (cproject != null) {
|
||||||
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
|
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Norbert Ploett (Siemens AG)
|
* Norbert Ploett (Siemens AG)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.suite;
|
package org.eclipse.cdt.core.suite;
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.core.model.tests.WorkingCopyTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
||||||
import org.eclipse.cdt.core.parser.tests.rewrite.RewriteTests;
|
import org.eclipse.cdt.core.parser.tests.rewrite.RewriteTests;
|
||||||
import org.eclipse.cdt.core.resources.tests.RefreshScopeTests;
|
import org.eclipse.cdt.core.resources.tests.RefreshScopeTests;
|
||||||
import org.eclipse.cdt.core.tests.templateengine.AllTemplateEngineTests;
|
|
||||||
import org.eclipse.cdt.internal.index.tests.IndexTests;
|
import org.eclipse.cdt.internal.index.tests.IndexTests;
|
||||||
import org.eclipse.cdt.internal.pdom.tests.PDOMTests;
|
import org.eclipse.cdt.internal.pdom.tests.PDOMTests;
|
||||||
import org.eclipse.cdt.utils.CdtVariableResolverTest;
|
import org.eclipse.cdt.utils.CdtVariableResolverTest;
|
||||||
|
@ -83,11 +82,8 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
suite.addTest(PDOMTests.suite());
|
suite.addTest(PDOMTests.suite());
|
||||||
suite.addTest(IndexTests.suite());
|
suite.addTest(IndexTests.suite());
|
||||||
|
|
||||||
suite.addTest(AllTemplateEngineTests.suite());
|
|
||||||
|
|
||||||
suite.addTest(RefreshScopeTests.suite());
|
suite.addTest(RefreshScopeTests.suite());
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,12 @@ public class TestSourceReader {
|
||||||
contents.remove(0);
|
contents.remove(0);
|
||||||
content = new StringBuilder();
|
content = new StringBuilder();
|
||||||
}
|
}
|
||||||
int idx= line.indexOf(testName);
|
if (line.length() > 0 && !contents.isEmpty()) {
|
||||||
if (idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx + testName.length()))) {
|
int idx= line.indexOf(testName);
|
||||||
return contents.toArray(new StringBuilder[contents.size()]);
|
if (idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx + testName.length()))) {
|
||||||
|
return contents.toArray(new StringBuilder[contents.size()]);
|
||||||
|
}
|
||||||
|
contents.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,6 +232,7 @@ public class TestSourceReader {
|
||||||
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||||
final IFile result[] = new IFile[1];
|
final IFile result[] = new IFile[1];
|
||||||
ws.run(new IWorkspaceRunnable() {
|
ws.run(new IWorkspaceRunnable() {
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
//Obtain file handle
|
//Obtain file handle
|
||||||
IFile file = container.getFile(filePath);
|
IFile file = container.getFile(filePath);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -870,7 +871,16 @@ public class CDataUtil {
|
||||||
} else {
|
} else {
|
||||||
resultList = makeRelative(project, resultList);
|
resultList = makeRelative(project, resultList);
|
||||||
}
|
}
|
||||||
return resultList.toArray(new ICSourceEntry[resultList.size()]);
|
|
||||||
|
ICSourceEntry[] resultArray = resultList.toArray(new ICSourceEntry[resultList.size()]);
|
||||||
|
Arrays.sort(resultArray, new Comparator<ICSourceEntry>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ICSourceEntry o1, ICSourceEntry o2) {
|
||||||
|
return o1.getFullPath().toString().compareTo(o2.getFullPath().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return resultArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ICSourceEntry> makeRelative(IProject project, List<ICSourceEntry> list){
|
private static List<ICSourceEntry> makeRelative(IProject project, List<ICSourceEntry> list){
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (IBM) - Initial API and implementation
|
* Doug Schaefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTBinaryExpression extends IASTExpression {
|
public interface IASTBinaryExpression extends IASTExpression {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node property that describes the relationship between an
|
* Node property that describes the relationship between an
|
||||||
* <code>IASTBinaryExpression</code> and an <code>IASTExpression</code>
|
* <code>IASTBinaryExpression</code> and an <code>IASTExpression</code>
|
||||||
|
@ -271,10 +270,12 @@ public interface IASTBinaryExpression extends IASTExpression {
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTBinaryExpression copy();
|
public IASTBinaryExpression copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTBinaryExpression copy(CopyStyle style);
|
public IASTBinaryExpression copy(CopyStyle style);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.IName;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTName extends IASTNode, IName {
|
public interface IASTName extends IASTNode, IName {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant sentinel.
|
* Constant sentinel.
|
||||||
*/
|
*/
|
||||||
|
@ -32,12 +31,14 @@ public interface IASTName extends IASTNode, IName {
|
||||||
/**
|
/**
|
||||||
* Returns the name including qualification and template arguments.
|
* Returns the name including qualification and template arguments.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public char[] toCharArray();
|
public char[] toCharArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link #toCharArray()}.
|
* Same as {@link #toCharArray()}.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString();
|
public String toString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,11 +102,13 @@ public interface IASTName extends IASTNode, IName {
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTName copy();
|
public IASTName copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTName copy(CopyStyle style);
|
public IASTName copy(CopyStyle style);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPClassTemplate extends ICPPTemplateDefinition, ICPPClassType {
|
public interface ICPPClassTemplate extends ICPPTemplateDefinition, ICPPClassType {
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException;
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a deferred instance that allows lookups within this class template.
|
* Returns a deferred instance that allows lookups within this class template.
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Mike Kucera (IBM)
|
* Mike Kucera (IBM)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser;
|
package org.eclipse.cdt.core.dom.parser;
|
||||||
|
|
||||||
|
@ -106,14 +106,15 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
protected abstract ParserLanguage getParserLanguage();
|
protected abstract ParserLanguage getParserLanguage();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
||||||
IParserLogService log) throws CoreException {
|
IParserLogService log) throws CoreException {
|
||||||
return getASTTranslationUnit(reader, scanInfo, fileCreator, index, 0, log);
|
return getASTTranslationUnit(reader, scanInfo, fileCreator, index, 0, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@Override
|
||||||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
||||||
IIndex index, int options, IParserLogService log) throws CoreException {
|
IIndex index, int options, IParserLogService log) throws CoreException {
|
||||||
|
@ -136,6 +137,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
if (log instanceof ICanceler) {
|
if (log instanceof ICanceler) {
|
||||||
canceler= (ICanceler) log;
|
canceler= (ICanceler) log;
|
||||||
canceler.setCancelable(new ICancelable() {
|
canceler.setCancelable(new ICancelable() {
|
||||||
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
scanner.cancel();
|
scanner.cancel();
|
||||||
parser.cancel();
|
parser.cancel();
|
||||||
|
@ -155,6 +157,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@Override
|
||||||
public IASTCompletionNode getCompletionNode(org.eclipse.cdt.core.parser.CodeReader reader,
|
public IASTCompletionNode getCompletionNode(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
||||||
IParserLogService log, int offset) throws CoreException {
|
IParserLogService log, int offset) throws CoreException {
|
||||||
|
@ -189,12 +192,13 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
*/
|
*/
|
||||||
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options) {
|
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options) {
|
||||||
ParserMode mode;
|
ParserMode mode;
|
||||||
if (forCompletion)
|
if (forCompletion) {
|
||||||
mode= ParserMode.COMPLETION_PARSE;
|
mode= ParserMode.COMPLETION_PARSE;
|
||||||
else if ((options & OPTION_SKIP_FUNCTION_BODIES) != 0)
|
} else if ((options & OPTION_SKIP_FUNCTION_BODIES) != 0) {
|
||||||
mode= ParserMode.STRUCTURAL_PARSE;
|
mode= ParserMode.STRUCTURAL_PARSE;
|
||||||
else
|
} else {
|
||||||
mode= ParserMode.COMPLETE_PARSE;
|
mode= ParserMode.COMPLETE_PARSE;
|
||||||
|
}
|
||||||
|
|
||||||
ISourceCodeParser parser= createParser(scanner, mode, log, index);
|
ISourceCodeParser parser= createParser(scanner, mode, log, index);
|
||||||
if ((options & OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS) != 0) {
|
if ((options & OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS) != 0) {
|
||||||
|
@ -224,6 +228,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
return new CPreprocessor(content, scanInfo, getParserLanguage(), log, getScannerExtensionConfiguration(scanInfo), fcp);
|
return new CPreprocessor(content, scanInfo, getParserLanguage(), log, getScannerExtensionConfiguration(scanInfo), fcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IASTName[] getSelectedNames(IASTTranslationUnit ast, int start, int length) {
|
public IASTName[] getSelectedNames(IASTTranslationUnit ast, int start, int length) {
|
||||||
IASTNode selectedNode= ast.getNodeSelector(null).findNode(start, length);
|
IASTNode selectedNode= ast.getNodeSelector(null).findNode(start, length);
|
||||||
|
@ -243,12 +248,13 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
return collector.getNames();
|
return collector.getNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
||||||
// use default model builder
|
// use default model builder
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICLanguageKeywords cLanguageKeywords = null;
|
private ICLanguageKeywords cLanguageKeywords;
|
||||||
|
|
||||||
private synchronized ICLanguageKeywords getCLanguageKeywords() {
|
private synchronized ICLanguageKeywords getCLanguageKeywords() {
|
||||||
if (cLanguageKeywords == null)
|
if (cLanguageKeywords == null)
|
||||||
|
@ -265,15 +271,18 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for backwards compatibility
|
// For backwards compatibility
|
||||||
|
@Override
|
||||||
public String[] getBuiltinTypes() {
|
public String[] getBuiltinTypes() {
|
||||||
return getCLanguageKeywords().getBuiltinTypes();
|
return getCLanguageKeywords().getBuiltinTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getKeywords() {
|
public String[] getKeywords() {
|
||||||
return getCLanguageKeywords().getKeywords();
|
return getCLanguageKeywords().getKeywords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getPreprocessorKeywords() {
|
public String[] getPreprocessorKeywords() {
|
||||||
return getCLanguageKeywords().getPreprocessorKeywords();
|
return getCLanguageKeywords().getPreprocessorKeywords();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class CharArrayObjectMap <T> extends CharTable {
|
public class CharArrayObjectMap <T> extends CharTable {
|
||||||
public static final CharArrayObjectMap<Object> EMPTY_MAP = new CharArrayObjectMap<Object>(0) {
|
public static final CharArrayObjectMap<?> EMPTY_MAP = new CharArrayObjectMap<Object>(0) {
|
||||||
@Override
|
@Override
|
||||||
public Object clone() { return this; }
|
public Object clone() { return this; }
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
@ -15,15 +15,14 @@ import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class Linkage implements ILinkage {
|
public class Linkage implements ILinkage {
|
||||||
|
|
||||||
public static final ILinkage NO_LINKAGE = new Linkage(NO_LINKAGE_ID, NO_LINKAGE_NAME);
|
public static final ILinkage NO_LINKAGE = new Linkage(NO_LINKAGE_ID, NO_LINKAGE_NAME);
|
||||||
public static final ILinkage C_LINKAGE = new Linkage(C_LINKAGE_ID, C_LINKAGE_NAME);
|
public static final ILinkage C_LINKAGE = new Linkage(C_LINKAGE_ID, C_LINKAGE_NAME);
|
||||||
public static final ILinkage CPP_LINKAGE = new Linkage(CPP_LINKAGE_ID, CPP_LINKAGE_NAME);
|
public static final ILinkage CPP_LINKAGE = new Linkage(CPP_LINKAGE_ID, CPP_LINKAGE_NAME);
|
||||||
public static final ILinkage FORTRAN_LINKAGE = new Linkage(FORTRAN_LINKAGE_ID, FORTRAN_LINKAGE_NAME);
|
public static final ILinkage FORTRAN_LINKAGE = new Linkage(FORTRAN_LINKAGE_ID, FORTRAN_LINKAGE_NAME);
|
||||||
public static final ILinkage OBJC_LINKAGE = new Linkage(OBJC_LINKAGE_ID, OBJC_LINKAGE_NAME);
|
public static final ILinkage OBJC_LINKAGE = new Linkage(OBJC_LINKAGE_ID, OBJC_LINKAGE_NAME);
|
||||||
|
|
||||||
private static final ILinkage[] LINKAGES= {C_LINKAGE, CPP_LINKAGE, FORTRAN_LINKAGE, OBJC_LINKAGE};
|
private static final ILinkage[] LINKAGES= { C_LINKAGE, CPP_LINKAGE, FORTRAN_LINKAGE, OBJC_LINKAGE };
|
||||||
private static final ILinkage[] INDEX_LINKAGES= {C_LINKAGE, CPP_LINKAGE, FORTRAN_LINKAGE};
|
private static final ILinkage[] INDEX_LINKAGES= { C_LINKAGE, CPP_LINKAGE, FORTRAN_LINKAGE };
|
||||||
|
|
||||||
public static final ILinkage[] getIndexerLinkages() {
|
public static final ILinkage[] getIndexerLinkages() {
|
||||||
return INDEX_LINKAGES;
|
return INDEX_LINKAGES;
|
||||||
|
@ -46,13 +45,18 @@ public class Linkage implements ILinkage {
|
||||||
|
|
||||||
private int fID;
|
private int fID;
|
||||||
private String fName;
|
private String fName;
|
||||||
|
|
||||||
private Linkage(int id, String name) {
|
private Linkage(int id, String name) {
|
||||||
fID= id;
|
fID= id;
|
||||||
fName= name;
|
fName= name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getLinkageID() {
|
public int getLinkageID() {
|
||||||
return fID;
|
return fID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLinkageName() {
|
public String getLinkageName() {
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -31,14 +31,12 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalNameOwner;
|
||||||
* Implementation for names in C translation units.
|
* Implementation for names in C translation units.
|
||||||
*/
|
*/
|
||||||
public class CASTName extends ASTNode implements IASTName, IASTCompletionContext {
|
public class CASTName extends ASTNode implements IASTName, IASTCompletionContext {
|
||||||
|
|
||||||
private final char[] name;
|
private final char[] name;
|
||||||
|
|
||||||
private static final char[] EMPTY_CHAR_ARRAY = {};
|
private static final char[] EMPTY_CHAR_ARRAY = {};
|
||||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private IBinding binding = null;
|
private IBinding binding;
|
||||||
|
|
||||||
|
|
||||||
public CASTName(char[] name) {
|
public CASTName(char[] name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -48,10 +46,12 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
name = EMPTY_CHAR_ARRAY;
|
name = EMPTY_CHAR_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CASTName copy() {
|
@Override
|
||||||
|
public CASTName copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CASTName copy(CopyStyle style) {
|
public CASTName copy(CopyStyle style) {
|
||||||
CASTName copy = new CASTName(name == null ? null : name.clone());
|
CASTName copy = new CASTName(name == null ? null : name.clone());
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
|
@ -61,7 +61,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding resolveBinding() {
|
@Override
|
||||||
|
public IBinding resolveBinding() {
|
||||||
if (binding == null) {
|
if (binding == null) {
|
||||||
CVisitor.createBinding(this);
|
CVisitor.createBinding(this);
|
||||||
}
|
}
|
||||||
|
@ -69,19 +70,23 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding resolvePreBinding() {
|
@Override
|
||||||
|
public IBinding resolvePreBinding() {
|
||||||
return resolveBinding();
|
return resolveBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding getBinding() {
|
@Override
|
||||||
|
public IBinding getBinding() {
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding getPreBinding() {
|
@Override
|
||||||
|
public IBinding getPreBinding() {
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTCompletionContext getCompletionContext() {
|
@Override
|
||||||
|
public IASTCompletionContext getCompletionContext() {
|
||||||
IASTNode node = getParent();
|
IASTNode node = getParent();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if (node instanceof IASTCompletionContext) {
|
if (node instanceof IASTCompletionContext) {
|
||||||
|
@ -95,7 +100,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBinding(IBinding binding) {
|
@Override
|
||||||
|
public void setBinding(IBinding binding) {
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,14 +113,17 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return new String(name);
|
return new String(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] toCharArray() {
|
@Override
|
||||||
|
public char[] toCharArray() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] getSimpleID() {
|
public char[] getSimpleID() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] getLookupKey() {
|
public char[] getLookupKey() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -146,6 +155,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRoleOfName(boolean allowResolution) {
|
public int getRoleOfName(boolean allowResolution) {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTInternalNameOwner) {
|
if (parent instanceof IASTInternalNameOwner) {
|
||||||
|
@ -157,7 +167,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return IASTNameOwner.r_unclear;
|
return IASTNameOwner.r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeclaration() {
|
@Override
|
||||||
|
public boolean isDeclaration() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -172,8 +183,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isReference() {
|
public boolean isReference() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -187,7 +198,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDefinition() {
|
@Override
|
||||||
|
public boolean isDefinition() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -201,10 +213,12 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.C_LINKAGE;
|
return Linkage.C_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTElaboratedTypeSpecifier) {
|
if (parent instanceof IASTElaboratedTypeSpecifier) {
|
||||||
|
@ -247,6 +261,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
||||||
return (IBinding[])ArrayUtil.removeNulls(IBinding.class, bindings);
|
return (IBinding[])ArrayUtil.removeNulls(IBinding.class, bindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTName getLastName() {
|
public IASTName getLastName() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
private IASTFunctionDeclarator declarator;
|
private IASTFunctionDeclarator declarator;
|
||||||
private IASTStatement bodyStatement;
|
private IASTStatement bodyStatement;
|
||||||
private ICPPASTConstructorChainInitializer[] memInits = null;
|
private ICPPASTConstructorChainInitializer[] memInits;
|
||||||
private int memInitPos= -1;
|
private int memInitPos= -1;
|
||||||
private boolean fDeleted= false;
|
private boolean fDeleted;
|
||||||
private boolean fDefaulted= false;
|
private boolean fDefaulted;
|
||||||
|
|
||||||
public CPPASTFunctionDefinition() {
|
public CPPASTFunctionDefinition() {
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,12 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
setBody(bodyStatement);
|
setBody(bodyStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTFunctionDefinition copy() {
|
public CPPASTFunctionDefinition copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTFunctionDefinition copy(CopyStyle style) {
|
public CPPASTFunctionDefinition copy(CopyStyle style) {
|
||||||
CPPASTFunctionDefinition copy = new CPPASTFunctionDefinition();
|
CPPASTFunctionDefinition copy = new CPPASTFunctionDefinition();
|
||||||
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
|
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
|
||||||
|
@ -61,8 +63,7 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
if (declarator != null) {
|
if (declarator != null) {
|
||||||
IASTDeclarator outer = ASTQueries.findOutermostDeclarator(declarator);
|
IASTDeclarator outer = ASTQueries.findOutermostDeclarator(declarator);
|
||||||
outer = outer.copy(style);
|
outer = outer.copy(style);
|
||||||
copy.setDeclarator((IASTFunctionDeclarator) ASTQueries
|
copy.setDeclarator((IASTFunctionDeclarator) ASTQueries.findTypeRelevantDeclarator(outer));
|
||||||
.findTypeRelevantDeclarator(outer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copy.setBody(bodyStatement == null ? null : bodyStatement.copy(style));
|
copy.setBody(bodyStatement == null ? null : bodyStatement.copy(style));
|
||||||
|
@ -79,11 +80,13 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTDeclSpecifier getDeclSpecifier() {
|
public IASTDeclSpecifier getDeclSpecifier() {
|
||||||
return declSpecifier;
|
return declSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
@Override
|
||||||
|
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
declSpecifier = declSpec;
|
declSpecifier = declSpec;
|
||||||
if (declSpec != null) {
|
if (declSpec != null) {
|
||||||
|
@ -92,11 +95,13 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTFunctionDeclarator getDeclarator() {
|
@Override
|
||||||
|
public IASTFunctionDeclarator getDeclarator() {
|
||||||
return declarator;
|
return declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeclarator(IASTFunctionDeclarator declarator) {
|
@Override
|
||||||
|
public void setDeclarator(IASTFunctionDeclarator declarator) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.declarator = declarator;
|
this.declarator = declarator;
|
||||||
if (declarator != null) {
|
if (declarator != null) {
|
||||||
|
@ -106,11 +111,13 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTStatement getBody() {
|
@Override
|
||||||
|
public IASTStatement getBody() {
|
||||||
return bodyStatement;
|
return bodyStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBody(IASTStatement statement) {
|
@Override
|
||||||
|
public void setBody(IASTStatement statement) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
bodyStatement = statement;
|
bodyStatement = statement;
|
||||||
if (statement != null) {
|
if (statement != null) {
|
||||||
|
@ -119,6 +126,7 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addMemberInitializer(ICPPASTConstructorChainInitializer initializer) {
|
public void addMemberInitializer(ICPPASTConstructorChainInitializer initializer) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
|
@ -128,6 +136,7 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPASTConstructorChainInitializer[] getMemberInitializers() {
|
public ICPPASTConstructorChainInitializer[] getMemberInitializers() {
|
||||||
if (memInits == null)
|
if (memInits == null)
|
||||||
return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
||||||
|
@ -136,23 +145,28 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
ICPPASTConstructorChainInitializer.class, memInits, memInitPos);
|
ICPPASTConstructorChainInitializer.class, memInits, memInitPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return ((ICPPASTFunctionDeclarator) declarator).getFunctionScope();
|
return ((ICPPASTFunctionDeclarator) declarator).getFunctionScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDefaulted() {
|
public boolean isDefaulted() {
|
||||||
return fDefaulted;
|
return fDefaulted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDeleted() {
|
public boolean isDeleted() {
|
||||||
return fDeleted;
|
return fDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIsDefaulted(boolean isDefaulted) {
|
public void setIsDefaulted(boolean isDefaulted) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
fDefaulted= isDefaulted;
|
fDefaulted= isDefaulted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIsDeleted(boolean isDeleted) {
|
public void setIsDeleted(boolean isDeleted) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
fDeleted= isDeleted;
|
fDeleted= isDeleted;
|
||||||
|
@ -203,6 +217,7 @@ public class CPPASTFunctionDefinition extends ASTNode
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if (bodyStatement == child) {
|
if (bodyStatement == child) {
|
||||||
other.setPropertyInParent(bodyStatement.getPropertyInParent());
|
other.setPropertyInParent(bodyStatement.getPropertyInParent());
|
||||||
|
|
|
@ -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.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBinding fBinding = null;
|
private IBinding fBinding;
|
||||||
private byte fResolutionDepth = 0;
|
private byte fResolutionDepth;
|
||||||
private boolean fIsFinal= false;
|
private boolean fIsFinal;
|
||||||
|
|
||||||
public final void incResolutionDepth() {
|
public final void incResolutionDepth() {
|
||||||
if (fBinding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
if (fBinding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||||
|
@ -66,6 +66,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
* Resolves the name at least up to the intermediate binding and returns it.
|
* Resolves the name at least up to the intermediate binding and returns it.
|
||||||
* @see ICPPTwoPhaseBinding
|
* @see ICPPTwoPhaseBinding
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBinding resolvePreBinding() {
|
public IBinding resolvePreBinding() {
|
||||||
if (fBinding == null) {
|
if (fBinding == null) {
|
||||||
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||||
|
@ -77,7 +78,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding resolveBinding() {
|
@Override
|
||||||
|
public IBinding resolveBinding() {
|
||||||
if (fBinding == null) {
|
if (fBinding == null) {
|
||||||
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||||
setBinding(new RecursionResolvingBinding(this));
|
setBinding(new RecursionResolvingBinding(this));
|
||||||
|
@ -105,7 +107,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
* Otherwise the intermediate or final binding for this name is returned.
|
* Otherwise the intermediate or final binding for this name is returned.
|
||||||
* @see ICPPTwoPhaseBinding
|
* @see ICPPTwoPhaseBinding
|
||||||
*/
|
*/
|
||||||
public IBinding getPreBinding() {
|
@Override
|
||||||
|
public IBinding getPreBinding() {
|
||||||
return fBinding;
|
return fBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +117,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
* Otherwise the final binding for this name is returned.
|
* Otherwise the final binding for this name is returned.
|
||||||
* @see ICPPTwoPhaseBinding
|
* @see ICPPTwoPhaseBinding
|
||||||
*/
|
*/
|
||||||
public IBinding getBinding() {
|
@Override
|
||||||
|
public IBinding getBinding() {
|
||||||
final IBinding cand= fBinding;
|
final IBinding cand= fBinding;
|
||||||
if (cand == null)
|
if (cand == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -137,11 +141,13 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
fIsFinal= true;
|
fIsFinal= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBinding(IBinding binding) {
|
public void setBinding(IBinding binding) {
|
||||||
fBinding= binding;
|
fBinding= binding;
|
||||||
fResolutionDepth= 0;
|
fResolutionDepth= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTName getLastName() {
|
public IASTName getLastName() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +157,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return new String(toCharArray());
|
return new String(toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTCompletionContext getCompletionContext() {
|
public IASTCompletionContext getCompletionContext() {
|
||||||
IASTNode node = getParent();
|
IASTNode node = getParent();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
|
@ -163,6 +170,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRoleOfName(boolean allowResolution) {
|
public int getRoleOfName(boolean allowResolution) {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTInternalNameOwner) {
|
if (parent instanceof IASTInternalNameOwner) {
|
||||||
|
@ -174,7 +182,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return IASTNameOwner.r_unclear;
|
return IASTNameOwner.r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeclaration() {
|
@Override
|
||||||
|
public boolean isDeclaration() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -189,7 +198,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReference() {
|
@Override
|
||||||
|
public boolean isReference() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -198,7 +208,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDefinition() {
|
@Override
|
||||||
|
public boolean isDefinition() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
@ -207,9 +218,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTName#getLinkage()
|
|
||||||
*/
|
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.CPP_LINKAGE;
|
return Linkage.CPP_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -24,15 +24,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
/**
|
/**
|
||||||
* Represents a template declaration.
|
* Represents a template declaration.
|
||||||
*/
|
*/
|
||||||
public class CPPASTTemplateDeclaration extends ASTNode implements
|
public class CPPASTTemplateDeclaration extends ASTNode
|
||||||
ICPPASTInternalTemplateDeclaration, IASTAmbiguityParent {
|
implements ICPPASTInternalTemplateDeclaration, IASTAmbiguityParent {
|
||||||
|
|
||||||
private boolean exported;
|
private boolean exported;
|
||||||
private byte isAssociatedWithLastName= -1;
|
private byte isAssociatedWithLastName= -1;
|
||||||
private short nestingLevel= -1;
|
private short nestingLevel= -1;
|
||||||
private IASTDeclaration declaration;
|
private IASTDeclaration declaration;
|
||||||
private ICPPTemplateScope templateScope;
|
private ICPPTemplateScope templateScope;
|
||||||
private ICPPASTTemplateParameter[] parameters = null;
|
private ICPPASTTemplateParameter[] parameters;
|
||||||
private int parametersPos= -1;
|
private int parametersPos= -1;
|
||||||
|
|
||||||
public CPPASTTemplateDeclaration() {
|
public CPPASTTemplateDeclaration() {
|
||||||
|
@ -42,10 +41,12 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
setDeclaration(declaration);
|
setDeclaration(declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTTemplateDeclaration copy() {
|
public CPPASTTemplateDeclaration copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTTemplateDeclaration copy(CopyStyle style) {
|
public CPPASTTemplateDeclaration copy(CopyStyle style) {
|
||||||
CPPASTTemplateDeclaration copy = new CPPASTTemplateDeclaration();
|
CPPASTTemplateDeclaration copy = new CPPASTTemplateDeclaration();
|
||||||
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
|
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
|
||||||
|
@ -59,20 +60,24 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isExported() {
|
public boolean isExported() {
|
||||||
return exported;
|
return exported;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExported(boolean value) {
|
@Override
|
||||||
|
public void setExported(boolean value) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
exported = value;
|
exported = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTDeclaration getDeclaration() {
|
@Override
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeclaration(IASTDeclaration declaration) {
|
@Override
|
||||||
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
|
@ -81,13 +86,15 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPASTTemplateParameter[] getTemplateParameters() {
|
@Override
|
||||||
|
public ICPPASTTemplateParameter[] getTemplateParameters() {
|
||||||
if (parameters == null) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
if (parameters == null) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
||||||
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.removeNullsAfter(ICPPASTTemplateParameter.class, parameters, parametersPos);
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.removeNullsAfter(ICPPASTTemplateParameter.class, parameters, parametersPos);
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTemplateParameter(ICPPASTTemplateParameter parm) {
|
@Override
|
||||||
|
public void addTemplateParameter(ICPPASTTemplateParameter parm) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (parm != null) {
|
if (parm != null) {
|
||||||
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm);
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm);
|
||||||
|
@ -97,6 +104,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@Override
|
||||||
public void addTemplateParamter(ICPPASTTemplateParameter param) {
|
public void addTemplateParamter(ICPPASTTemplateParameter param) {
|
||||||
addTemplateParameter(param);
|
addTemplateParameter(param);
|
||||||
}
|
}
|
||||||
|
@ -128,13 +136,15 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateScope getScope() {
|
public ICPPTemplateScope getScope() {
|
||||||
if (templateScope == null)
|
if (templateScope == null)
|
||||||
templateScope = new CPPTemplateScope(this);
|
templateScope = new CPPTemplateScope(this);
|
||||||
return templateScope;
|
return templateScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
@Override
|
||||||
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if (declaration == child) {
|
if (declaration == child) {
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
|
@ -142,6 +152,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public short getNestingLevel() {
|
public short getNestingLevel() {
|
||||||
if (nestingLevel == -1) {
|
if (nestingLevel == -1) {
|
||||||
CPPTemplates.associateTemplateDeclarations(this);
|
CPPTemplates.associateTemplateDeclarations(this);
|
||||||
|
@ -150,6 +161,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
return nestingLevel;
|
return nestingLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAssociatedWithLastName() {
|
public boolean isAssociatedWithLastName() {
|
||||||
if (isAssociatedWithLastName == -1)
|
if (isAssociatedWithLastName == -1)
|
||||||
CPPTemplates.associateTemplateDeclarations(this);
|
CPPTemplates.associateTemplateDeclarations(this);
|
||||||
|
@ -158,10 +170,12 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
|
||||||
return isAssociatedWithLastName != 0;
|
return isAssociatedWithLastName != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAssociatedWithLastName(boolean value) {
|
public void setAssociatedWithLastName(boolean value) {
|
||||||
isAssociatedWithLastName= value ? (byte) 1 : (byte) 0;
|
isAssociatedWithLastName= value ? (byte) 1 : (byte) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNestingLevel(short level) {
|
public void setNestingLevel(short level) {
|
||||||
assert level >= 0;
|
assert level >= 0;
|
||||||
nestingLevel= level;
|
nestingLevel= level;
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
super(physicalNode);
|
super(physicalNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EScopeKind getKind() {
|
public EScopeKind getKind() {
|
||||||
return EScopeKind.eClassType;
|
return EScopeKind.eClassType;
|
||||||
}
|
}
|
||||||
|
@ -270,6 +271,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPConstructor[] getConstructors() {
|
public ICPPConstructor[] getConstructors() {
|
||||||
return getConstructors(null, true);
|
return getConstructors(null, true);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +279,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
private ICPPConstructor[] getConstructors(IASTName forName, boolean forceResolve) {
|
private ICPPConstructor[] getConstructors(IASTName forName, boolean forceResolve) {
|
||||||
populateCache();
|
populateCache();
|
||||||
|
|
||||||
final CharArrayObjectMap nameMap = bindings;
|
final CharArrayObjectMap<Object> nameMap = bindings;
|
||||||
if (nameMap == null)
|
if (nameMap == null)
|
||||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
|
|
||||||
|
@ -365,6 +367,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ICPPClassType getClassType() {
|
public ICPPClassType getClassType() {
|
||||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||||
final IASTName name = compSpec.getName();
|
final IASTName name = compSpec.getName();
|
||||||
|
@ -378,6 +381,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getImplicitMethods() {
|
public ICPPMethod[] getImplicitMethods() {
|
||||||
if (implicits == null)
|
if (implicits == null)
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -36,8 +35,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
|
|
||||||
|
@ -47,26 +46,26 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClassTemplate,
|
public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClassTemplate,
|
||||||
ICPPInternalClassTemplate, ICPPInternalClassTypeMixinHost {
|
ICPPInternalClassTemplate, ICPPInternalClassTypeMixinHost {
|
||||||
|
|
||||||
private ICPPClassTemplate fIndexBinding= null;
|
|
||||||
private boolean checkedIndex= false;
|
|
||||||
|
|
||||||
|
|
||||||
private ICPPClassTemplatePartialSpecialization[] partialSpecializations = null;
|
private ICPPClassTemplatePartialSpecialization[] partialSpecializations = null;
|
||||||
private ICPPDeferredClassInstance fDeferredInstance;
|
private ICPPDeferredClassInstance fDeferredInstance;
|
||||||
|
private boolean addedPartialSpecializationsOfIndex;
|
||||||
|
|
||||||
public CPPClassTemplate(IASTName name) {
|
public CPPClassTemplate(IASTName name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void checkForDefinition() {
|
public void checkForDefinition() {
|
||||||
// Ambiguity resolution ensures that definitions are resolved.
|
// Ambiguity resolution ensures that definitions are resolved.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
||||||
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.append(
|
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.append(
|
||||||
ICPPClassTemplatePartialSpecialization.class, partialSpecializations, spec);
|
ICPPClassTemplatePartialSpecialization.class, partialSpecializations, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPASTCompositeTypeSpecifier getCompositeTypeSpecifier() {
|
public ICPPASTCompositeTypeSpecifier getCompositeTypeSpecifier() {
|
||||||
if (definition != null) {
|
if (definition != null) {
|
||||||
IASTNode node = definition.getParent();
|
IASTNode node = definition.getParent();
|
||||||
|
@ -78,6 +77,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassScope getCompositeScope() {
|
public ICPPClassScope getCompositeScope() {
|
||||||
if (definition == null) {
|
if (definition == null) {
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
|
@ -93,15 +93,16 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward declarations must be backed up from the index.
|
// Forward declarations must be backed up from the index.
|
||||||
checkForIndexBinding();
|
ICPPClassTemplate ib = getIndexBinding();
|
||||||
if (fIndexBinding != null) {
|
if (ib != null) {
|
||||||
IScope scope = fIndexBinding.getCompositeScope();
|
IScope scope = ib.getCompositeScope();
|
||||||
if (scope instanceof ICPPClassScope)
|
if (scope instanceof ICPPClassScope)
|
||||||
return (ICPPClassScope) scope;
|
return (ICPPClassScope) scope;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getKey() {
|
public int getKey() {
|
||||||
if (definition != null) {
|
if (definition != null) {
|
||||||
ICPPASTCompositeTypeSpecifier cts= getCompositeTypeSpecifier();
|
ICPPASTCompositeTypeSpecifier cts= getCompositeTypeSpecifier();
|
||||||
|
@ -124,11 +125,25 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
return ICPPASTElaboratedTypeSpecifier.k_class;
|
return ICPPASTElaboratedTypeSpecifier.k_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
|
if (!addedPartialSpecializationsOfIndex) {
|
||||||
|
addedPartialSpecializationsOfIndex= true;
|
||||||
|
ICPPClassTemplate ib = getIndexBinding();
|
||||||
|
if (ib != null) {
|
||||||
|
IIndexFileSet fs = getTemplateName().getTranslationUnit().getIndexFileSet();
|
||||||
|
for (ICPPClassTemplatePartialSpecialization spec : ib.getPartialSpecializations()) {
|
||||||
|
if (spec instanceof IIndexBinding && fs.containsDeclaration((IIndexBinding) spec)) {
|
||||||
|
addPartialSpecialization(spec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.trim(ICPPClassTemplatePartialSpecialization.class, partialSpecializations);
|
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.trim(ICPPClassTemplatePartialSpecialization.class, partialSpecializations);
|
||||||
return partialSpecializations;
|
return partialSpecializations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if (type == this)
|
if (type == this)
|
||||||
return true;
|
return true;
|
||||||
|
@ -137,42 +152,52 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPBase[] getBases() {
|
public ICPPBase[] getBases() {
|
||||||
return ClassTypeHelper.getBases(this);
|
return ClassTypeHelper.getBases(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IField[] getFields() {
|
public IField[] getFields() {
|
||||||
return ClassTypeHelper.getFields(this);
|
return ClassTypeHelper.getFields(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPField[] getDeclaredFields() {
|
public ICPPField[] getDeclaredFields() {
|
||||||
return ClassTypeHelper.getDeclaredFields(this);
|
return ClassTypeHelper.getDeclaredFields(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getMethods() {
|
public ICPPMethod[] getMethods() {
|
||||||
return ClassTypeHelper.getMethods(this);
|
return ClassTypeHelper.getMethods(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getAllDeclaredMethods() {
|
public ICPPMethod[] getAllDeclaredMethods() {
|
||||||
return ClassTypeHelper.getAllDeclaredMethods(this);
|
return ClassTypeHelper.getAllDeclaredMethods(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getDeclaredMethods() {
|
public ICPPMethod[] getDeclaredMethods() {
|
||||||
return ClassTypeHelper.getDeclaredMethods(this);
|
return ClassTypeHelper.getDeclaredMethods(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPConstructor[] getConstructors() {
|
public ICPPConstructor[] getConstructors() {
|
||||||
return ClassTypeHelper.getConstructors(this);
|
return ClassTypeHelper.getConstructors(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding[] getFriends() {
|
public IBinding[] getFriends() {
|
||||||
return ClassTypeHelper.getFriends(this);
|
return ClassTypeHelper.getFriends(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassType[] getNestedClasses() {
|
public ICPPClassType[] getNestedClasses() {
|
||||||
return ClassTypeHelper.getNestedClasses(this);
|
return ClassTypeHelper.getNestedClasses(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IField findField(String name) {
|
public IField findField(String name) {
|
||||||
return ClassTypeHelper.findField(this, name);
|
return ClassTypeHelper.findField(this, name);
|
||||||
}
|
}
|
||||||
|
@ -194,10 +219,12 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
return ASTTypeUtil.getType(this);
|
return ASTTypeUtil.getType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAnonymous() {
|
public boolean isAnonymous() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public final ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
if (fDeferredInstance == null) {
|
if (fDeferredInstance == null) {
|
||||||
fDeferredInstance= createDeferredInstance();
|
fDeferredInstance= createDeferredInstance();
|
||||||
|
@ -210,10 +237,11 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
return new CPPDeferredClassInstance(this, args, getCompositeScope());
|
return new CPPDeferredClassInstance(this, args, getCompositeScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
||||||
checkForIndexBinding();
|
ICPPClassTemplate ib = getIndexBinding();
|
||||||
if (fIndexBinding != null) {
|
if (ib != null) {
|
||||||
ICPPTemplateParameter[] params = fIndexBinding.getTemplateParameters();
|
ICPPTemplateParameter[] params = ib.getTemplateParameters();
|
||||||
if (paramPos < params.length) {
|
if (paramPos < params.length) {
|
||||||
ICPPTemplateParameter param = params[paramPos];
|
ICPPTemplateParameter param = params[paramPos];
|
||||||
return param.getDefaultValue();
|
return param.getDefaultValue();
|
||||||
|
@ -221,21 +249,4 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForIndexBinding() {
|
|
||||||
if (checkedIndex)
|
|
||||||
return;
|
|
||||||
|
|
||||||
checkedIndex= true;
|
|
||||||
IASTTranslationUnit tu;
|
|
||||||
if (definition != null) {
|
|
||||||
tu= definition.getTranslationUnit();
|
|
||||||
} else {
|
|
||||||
tu= declarations[0].getTranslationUnit();
|
|
||||||
}
|
|
||||||
IIndex index= tu.getIndex();
|
|
||||||
if (index != null) {
|
|
||||||
fIndexBinding= (ICPPClassTemplate) index.adaptBinding(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,13 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
fClassTemplate= template;
|
fClassTemplate= template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
ICPPClassTemplatePartialSpecialization template = (ICPPClassTemplatePartialSpecialization) getSpecializedBinding();
|
ICPPClassTemplatePartialSpecialization template = (ICPPClassTemplatePartialSpecialization) getSpecializedBinding();
|
||||||
return template.getTemplateParameters();
|
return template.getTemplateParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public synchronized final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
if (instances == null)
|
if (instances == null)
|
||||||
instances = new ObjectMap(2);
|
instances = new ObjectMap(2);
|
||||||
|
@ -52,6 +54,7 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
instances.put(key, instance);
|
instances.put(key, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public synchronized final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
||||||
|
@ -60,6 +63,7 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized ICPPTemplateInstance[] getAllInstances() {
|
public synchronized ICPPTemplateInstance[] getAllInstances() {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
||||||
|
@ -71,10 +75,12 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
|
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
if (fDeferredInstance == null) {
|
if (fDeferredInstance == null) {
|
||||||
ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
|
ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
|
||||||
|
@ -83,10 +89,12 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
return fDeferredInstance;
|
return fDeferredInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassTemplate getPrimaryClassTemplate() {
|
public ICPPClassTemplate getPrimaryClassTemplate() {
|
||||||
return fClassTemplate;
|
return fClassTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument[] getTemplateArguments() throws DOMException {
|
public ICPPTemplateArgument[] getTemplateArguments() throws DOMException {
|
||||||
ICPPTemplateArgument[] args = ((ICPPClassTemplatePartialSpecialization) getSpecializedBinding()).getTemplateArguments();
|
ICPPTemplateArgument[] args = ((ICPPClassTemplatePartialSpecialization) getSpecializedBinding()).getTemplateArguments();
|
||||||
final IBinding owner = getOwner();
|
final IBinding owner = getOwner();
|
||||||
|
@ -96,10 +104,12 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1, null);
|
return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,11 +128,13 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
|
||||||
return CPPTemplates.getArgumentMap(getPrimaryClassTemplate(), getTemplateParameterMap());
|
return CPPTemplates.getArgumentMap(getPrimaryClassTemplate(), getTemplateParameterMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IType[] getArguments() throws DOMException {
|
public IType[] getArguments() throws DOMException {
|
||||||
return CPPTemplates.getArguments(getTemplateArguments());
|
return CPPTemplates.getArguments(getTemplateArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
||||||
// no default arguments for partial specializations
|
// no default arguments for partial specializations
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
super(orig, owner, argumentMap);
|
super(orig, owner, argumentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
if (fPartialSpecs == null) {
|
if (fPartialSpecs == null) {
|
||||||
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
||||||
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
||||||
|
@ -52,6 +53,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return fPartialSpecs;
|
return fPartialSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
// mstodo if we specialize the template parameters (because of its default values), it will
|
// mstodo if we specialize the template parameters (because of its default values), it will
|
||||||
// be less error prone to use the defaults.
|
// be less error prone to use the defaults.
|
||||||
|
@ -59,6 +61,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return template.getTemplateParameters();
|
return template.getTemplateParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public synchronized final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
if (instances == null)
|
if (instances == null)
|
||||||
instances = new ObjectMap(2);
|
instances = new ObjectMap(2);
|
||||||
|
@ -66,6 +69,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
instances.put(key, instance);
|
instances.put(key, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public synchronized final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
||||||
|
@ -74,6 +78,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized ICPPTemplateInstance[] getAllInstances() {
|
public synchronized ICPPTemplateInstance[] getAllInstances() {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
||||||
|
@ -85,6 +90,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +99,12 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
|
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
if (fDeferredInstance == null) {
|
if (fDeferredInstance == null) {
|
||||||
ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
|
ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
|
||||||
|
@ -105,6 +113,7 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
return fDeferredInstance;
|
return fDeferredInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
*/
|
*/
|
||||||
public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
|
|
||||||
private CharArrayObjectMap labels = CharArrayObjectMap.EMPTY_MAP;
|
private CharArrayObjectMap<IBinding> labels = CharArrayObjectMap.emptyMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param physicalNode
|
* @param physicalNode
|
||||||
|
@ -47,6 +47,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
super(physicalNode);
|
super(physicalNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EScopeKind getKind() {
|
public EScopeKind getKind() {
|
||||||
return EScopeKind.eLocal;
|
return EScopeKind.eLocal;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (labels == CharArrayObjectMap.EMPTY_MAP)
|
if (labels == CharArrayObjectMap.EMPTY_MAP)
|
||||||
labels = new CharArrayObjectMap(2);
|
labels = new CharArrayObjectMap<IBinding>(2);
|
||||||
|
|
||||||
labels.put(binding.getNameCharArray(), binding);
|
labels.put(binding.getNameCharArray(), binding);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +71,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
|
||||||
*/
|
*/
|
||||||
public IBinding getBinding(IASTName name) {
|
public IBinding getBinding(IASTName name) {
|
||||||
return (IBinding) labels.get(name.getLookupKey());
|
return labels.get(name.getLookupKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -84,7 +85,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
for (int i = 0; i < labels.size(); i++) {
|
for (int i = 0; i < labels.size(); i++) {
|
||||||
char[] key = labels.keyAt(i);
|
char[] key = labels.keyAt(i);
|
||||||
if (CharArrayUtils.equals(key, n)) {
|
if (CharArrayUtils.equals(key, n)) {
|
||||||
bindings.add((IBinding) labels.get(key));
|
bindings.add(labels.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +109,8 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope()
|
||||||
*/
|
*/
|
||||||
public IScope getBodyScope() {
|
@Override
|
||||||
|
public IScope getBodyScope() {
|
||||||
IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode();
|
IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode();
|
||||||
IASTNode parent = fnDtor.getParent();
|
IASTNode parent = fnDtor.getParent();
|
||||||
if (parent instanceof IASTFunctionDefinition) {
|
if (parent instanceof IASTFunctionDefinition) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
|
@ -28,11 +29,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
|
@ -48,6 +52,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
public CPPTemplateProblem(IASTNode node, int id, char[] arg) {
|
public CPPTemplateProblem(IASTNode node, int id, char[] arg) {
|
||||||
super(node, id, arg);
|
super(node, id, arg);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
return ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
|
return ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +67,10 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
private ICPPTemplateParameter[] templateParameters;
|
private ICPPTemplateParameter[] templateParameters;
|
||||||
private ObjectMap instances;
|
private ObjectMap instances;
|
||||||
|
|
||||||
|
private ICPPClassTemplate indexBinding= null;
|
||||||
|
private boolean checkedIndex= false;
|
||||||
|
|
||||||
|
|
||||||
public CPPTemplateDefinition(IASTName name) {
|
public CPPTemplateDefinition(IASTName name) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
ASTNodeProperty prop = name.getPropertyInParent();
|
ASTNodeProperty prop = name.getPropertyInParent();
|
||||||
|
@ -85,6 +94,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
if (instances == null)
|
if (instances == null)
|
||||||
instances = new ObjectMap(2);
|
instances = new ObjectMap(2);
|
||||||
|
@ -92,14 +102,46 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
instances.put(key, instance);
|
instances.put(key, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
||||||
return (ICPPTemplateInstance) instances.get(key);
|
ICPPTemplateInstance cand = (ICPPTemplateInstance) instances.get(key);
|
||||||
|
if (cand != null)
|
||||||
|
return cand;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ICPPClassTemplate ib = getIndexBinding();
|
||||||
|
if (ib instanceof ICPPInstanceCache) {
|
||||||
|
ICPPTemplateInstance cand= ((ICPPInstanceCache) ib).getInstance(arguments);
|
||||||
|
if (cand instanceof IIndexBinding &&
|
||||||
|
getTemplateName().getTranslationUnit().getIndexFileSet().containsDeclaration((IIndexBinding) cand)) {
|
||||||
|
return cand;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ICPPClassTemplate getIndexBinding() {
|
||||||
|
if (!checkedIndex) {
|
||||||
|
checkedIndex= true;
|
||||||
|
IASTName name= getTemplateName();
|
||||||
|
if (name != null) {
|
||||||
|
IASTTranslationUnit tu = name.getTranslationUnit();
|
||||||
|
if (tu != null) {
|
||||||
|
IIndex index= tu.getIndex();
|
||||||
|
if (index != null) {
|
||||||
|
IIndexBinding ib = index.adaptBinding(this);
|
||||||
|
if (ib instanceof ICPPClassTemplate)
|
||||||
|
indexBinding= (ICPPClassTemplate) ib;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
||||||
|
@ -122,6 +164,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return new String(getNameCharArray());
|
return new String(getNameCharArray());
|
||||||
}
|
}
|
||||||
|
@ -129,6 +172,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
return getTemplateName().getSimpleID();
|
return getTemplateName().getSimpleID();
|
||||||
}
|
}
|
||||||
|
@ -136,6 +180,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return CPPVisitor.getContainingScope(getTemplateName());
|
return CPPVisitor.getContainingScope(getTemplateName());
|
||||||
}
|
}
|
||||||
|
@ -143,6 +188,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
return CPPVisitor.getQualifiedName(this);
|
return CPPVisitor.getQualifiedName(this);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +196,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public char[][] getQualifiedNameCharArray() {
|
public char[][] getQualifiedNameCharArray() {
|
||||||
return CPPVisitor.getQualifiedNameCharArray(this);
|
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +204,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isGloballyQualified() {
|
public boolean isGloballyQualified() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -164,6 +212,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition#getParameters()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition#getParameters()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
if (templateParameters == null) {
|
if (templateParameters == null) {
|
||||||
ICPPASTTemplateDeclaration template = CPPTemplates.getTemplateDeclaration(getTemplateName());
|
ICPPASTTemplateDeclaration template = CPPTemplates.getTemplateDeclaration(getTemplateName());
|
||||||
|
@ -186,6 +235,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addDefinition(IASTNode node) {
|
public void addDefinition(IASTNode node) {
|
||||||
if (node instanceof ICPPASTCompositeTypeSpecifier) {
|
if (node instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
node = ((ICPPASTCompositeTypeSpecifier)node).getName();
|
node = ((ICPPASTCompositeTypeSpecifier)node).getName();
|
||||||
|
@ -203,6 +253,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addDeclaration(IASTNode node) {
|
public void addDeclaration(IASTNode node) {
|
||||||
if (node instanceof ICPPASTElaboratedTypeSpecifier) {
|
if (node instanceof ICPPASTElaboratedTypeSpecifier) {
|
||||||
node = ((ICPPASTElaboratedTypeSpecifier)node).getName();
|
node = ((ICPPASTElaboratedTypeSpecifier)node).getName();
|
||||||
|
@ -227,6 +278,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
||||||
int pos= templateParameter.getParameterPosition();
|
int pos= templateParameter.getParameterPosition();
|
||||||
|
|
||||||
|
@ -286,6 +338,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDeclarations()
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDeclarations()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTNode[] getDeclarations() {
|
public IASTNode[] getDeclarations() {
|
||||||
return declarations;
|
return declarations;
|
||||||
}
|
}
|
||||||
|
@ -293,14 +346,17 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDefinition()
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDefinition()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTNode getDefinition() {
|
public IASTNode getDefinition() {
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.CPP_LINKAGE;
|
return Linkage.CPP_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final IBinding getOwner() {
|
public final IBinding getOwner() {
|
||||||
IASTName templateName= getTemplateName();
|
IASTName templateName= getTemplateName();
|
||||||
if (templateName == null)
|
if (templateName == null)
|
||||||
|
|
|
@ -57,10 +57,12 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
fIsParameterPack= isPack;
|
fIsParameterPack= isPack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final boolean isParameterPack() {
|
public final boolean isParameterPack() {
|
||||||
return fIsParameterPack;
|
return fIsParameterPack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPScope asScope() {
|
public ICPPScope asScope() {
|
||||||
if (unknownScope == null) {
|
if (unknownScope == null) {
|
||||||
IASTName n = null;
|
IASTName n = null;
|
||||||
|
@ -72,6 +74,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return unknownScope;
|
return unknownScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
if (templateParameters == null) {
|
if (templateParameters == null) {
|
||||||
ICPPASTTemplatedTypeTemplateParameter template = (ICPPASTTemplatedTypeTemplateParameter) getPrimaryDeclaration().getParent();
|
ICPPASTTemplatedTypeTemplateParameter template = (ICPPASTTemplatedTypeTemplateParameter) getPrimaryDeclaration().getParent();
|
||||||
|
@ -88,6 +91,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return templateParameters;
|
return templateParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
||||||
return templateParameter;
|
return templateParameter;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +100,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IType getDefault() {
|
public IType getDefault() {
|
||||||
IASTName[] nds = getDeclarations();
|
IASTName[] nds = getDeclarations();
|
||||||
if (nds == null || nds.length == 0)
|
if (nds == null || nds.length == 0)
|
||||||
|
@ -120,6 +125,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument getDefaultValue() {
|
public ICPPTemplateArgument getDefaultValue() {
|
||||||
IType d= getDefault();
|
IType d= getDefault();
|
||||||
if (d == null)
|
if (d == null)
|
||||||
|
@ -128,46 +134,59 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return new CPPTemplateArgument(d);
|
return new CPPTemplateArgument(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPBase[] getBases() {
|
public ICPPBase[] getBases() {
|
||||||
return ICPPBase.EMPTY_BASE_ARRAY;
|
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public IField[] getFields() {
|
public IField[] getFields() {
|
||||||
return IField.EMPTY_FIELD_ARRAY;
|
return IField.EMPTY_FIELD_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public IField findField(String name) {
|
public IField findField(String name) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPField[] getDeclaredFields() {
|
public ICPPField[] getDeclaredFields() {
|
||||||
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getMethods() {
|
public ICPPMethod[] getMethods() {
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getAllDeclaredMethods() {
|
public ICPPMethod[] getAllDeclaredMethods() {
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPMethod[] getDeclaredMethods() {
|
public ICPPMethod[] getDeclaredMethods() {
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPConstructor[] getConstructors() {
|
public ICPPConstructor[] getConstructors() {
|
||||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public IBinding[] getFriends() {
|
public IBinding[] getFriends() {
|
||||||
return IBinding.EMPTY_BINDING_ARRAY;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public ICPPClassType[] getNestedClasses() {
|
public ICPPClassType[] getNestedClasses() {
|
||||||
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getKey() {
|
public int getKey() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IScope getCompositeScope() {
|
public IScope getCompositeScope() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSameType(IType type) {
|
@Override
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
if (type == this)
|
if (type == this)
|
||||||
return true;
|
return true;
|
||||||
if (type instanceof ITypedef)
|
if (type instanceof ITypedef)
|
||||||
|
@ -178,10 +197,12 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public final void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
if (instances == null)
|
if (instances == null)
|
||||||
instances = new ObjectMap(2);
|
instances = new ObjectMap(2);
|
||||||
|
@ -189,6 +210,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
instances.put(key, instance);
|
instances.put(key, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public final ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
String key= ASTTypeUtil.getArgumentListString(arguments, true);
|
||||||
|
@ -197,6 +219,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
if (instances != null) {
|
if (instances != null) {
|
||||||
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
ICPPTemplateInstance[] result= new ICPPTemplateInstance[instances.size()];
|
||||||
|
@ -208,14 +231,17 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
return ICPPTemplateInstance.EMPTY_TEMPLATE_INSTANCE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTName getUnknownName() {
|
public IASTName getUnknownName() {
|
||||||
return new CPPASTName(getNameCharArray());
|
return new CPPASTName(getNameCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAnonymous() {
|
public boolean isAnonymous() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() {
|
public ICPPDeferredClassInstance asDeferredInstance() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
|
||||||
* This field needs to be protected when used in PDOMCPPUnknownScope,
|
* This field needs to be protected when used in PDOMCPPUnknownScope,
|
||||||
* don't use it outside of {@link #getOrCreateBinding(IASTName, int)}
|
* don't use it outside of {@link #getOrCreateBinding(IASTName, int)}
|
||||||
*/
|
*/
|
||||||
private CharArrayObjectMap map;
|
private CharArrayObjectMap<IBinding[]> map;
|
||||||
|
|
||||||
public CPPUnknownScope(ICPPUnknownBinding binding, IASTName name) {
|
public CPPUnknownScope(ICPPUnknownBinding binding, IASTName name) {
|
||||||
super();
|
super();
|
||||||
|
@ -57,41 +57,26 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
|
||||||
return EScopeKind.eClassType;
|
return EScopeKind.eClassType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
return scopeName;
|
return scopeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getParent()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() throws DOMException {
|
||||||
return binding.getScope();
|
return binding.getScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] find(String name) {
|
public IBinding[] find(String name) {
|
||||||
return null;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getPhysicalNode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return scopeName;
|
return scopeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addName(IASTName name) {
|
public void addName(IASTName name) {
|
||||||
}
|
}
|
||||||
|
@ -101,9 +86,6 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
|
||||||
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getBinding(final IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
public IBinding getBinding(final IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||||
boolean type= false;
|
boolean type= false;
|
||||||
|
@ -152,10 +134,10 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
|
||||||
|
|
||||||
protected IBinding getOrCreateBinding(final IASTName name, int idx) {
|
protected IBinding getOrCreateBinding(final IASTName name, int idx) {
|
||||||
if (map == null)
|
if (map == null)
|
||||||
map = new CharArrayObjectMap(2);
|
map = new CharArrayObjectMap<IBinding[]>(2);
|
||||||
|
|
||||||
final char[] c = name.getLookupKey();
|
final char[] c = name.getLookupKey();
|
||||||
IBinding[] o = (IBinding[]) map.get(c);
|
IBinding[] o = map.get(c);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
o = new IBinding[3];
|
o = new IBinding[3];
|
||||||
map.put(c, o);
|
map.put(c, o);
|
||||||
|
@ -210,9 +192,6 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
|
||||||
// do nothing, this is part of template magic and not a normal scope
|
// do nothing, this is part of template magic and not a normal scope
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope#getUnknownBinding()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPBinding getScopeBinding() {
|
public ICPPBinding getScopeBinding() {
|
||||||
return binding;
|
return binding;
|
||||||
|
|
|
@ -320,7 +320,9 @@ class BaseClassLookup {
|
||||||
return;
|
return;
|
||||||
fCollected= true;
|
fCollected= true;
|
||||||
|
|
||||||
data.foundItems = CPPSemantics.mergePrefixResults((CharArrayObjectMap) data.foundItems, fBindings, true);
|
@SuppressWarnings("unchecked")
|
||||||
|
final CharArrayObjectMap<Object> resultMap = (CharArrayObjectMap<Object>) data.foundItems;
|
||||||
|
data.foundItems = CPPSemantics.mergePrefixResults(resultMap, fBindings, true);
|
||||||
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);
|
||||||
child.collectResultForContentAssist(data);
|
child.collectResultForContentAssist(data);
|
||||||
|
|
|
@ -2276,7 +2276,8 @@ public class CPPSemantics {
|
||||||
private static ICPPFunction[] selectByArgumentCount(LookupData data, ICPPFunction[] functions) throws DOMException {
|
private static ICPPFunction[] selectByArgumentCount(LookupData data, ICPPFunction[] functions) throws DOMException {
|
||||||
assert data.forDeclaration() == null;
|
assert data.forDeclaration() == null;
|
||||||
|
|
||||||
int argumentCount = data.getFunctionArgumentCount();
|
final int argumentCount = data.getFunctionArgumentCount();
|
||||||
|
final int packExpansionCount= data.getFunctionArgumentPackExpansionCount();
|
||||||
|
|
||||||
// Trim the list down to the set of viable functions
|
// Trim the list down to the set of viable functions
|
||||||
ICPPFunction[] result= new ICPPFunction[functions.length];
|
ICPPFunction[] result= new ICPPFunction[functions.length];
|
||||||
|
@ -2300,11 +2301,11 @@ public class CPPSemantics {
|
||||||
numArgs--;
|
numArgs--;
|
||||||
|
|
||||||
boolean ok;
|
boolean ok;
|
||||||
if (numArgs > numPars) {
|
if (numArgs-packExpansionCount > numPars) {
|
||||||
// more arguments than parameters --> need ellipsis or parameter pack
|
// More arguments than parameters --> need ellipsis or parameter pack
|
||||||
ok= fn.takesVarArgs() || fn.hasParameterPack();
|
ok= fn.takesVarArgs() || fn.hasParameterPack();
|
||||||
} else {
|
} else {
|
||||||
ok = numArgs >= fn.getRequiredArgumentCount();
|
ok = numArgs >= fn.getRequiredArgumentCount() || packExpansionCount > 0;
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (fn instanceof IIndexBinding) {
|
if (fn instanceof IIndexBinding) {
|
||||||
|
|
|
@ -98,6 +98,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType;
|
||||||
|
@ -1143,7 +1144,7 @@ public class CPPTemplates {
|
||||||
IType newMemberOfClass = instantiateType(memberOfClass, tpMap, packOffset, within);
|
IType newMemberOfClass = instantiateType(memberOfClass, tpMap, packOffset, within);
|
||||||
if (!(newMemberOfClass instanceof ICPPClassType || newMemberOfClass instanceof UniqueType
|
if (!(newMemberOfClass instanceof ICPPClassType || newMemberOfClass instanceof UniqueType
|
||||||
|| newMemberOfClass instanceof ICPPUnknownBinding)) {
|
|| newMemberOfClass instanceof ICPPUnknownBinding)) {
|
||||||
newMemberOfClass = memberOfClass;
|
return new ProblemType(ISemanticProblem.BINDING_INVALID_TYPE);
|
||||||
}
|
}
|
||||||
if (newNestedType != nestedType || newMemberOfClass != memberOfClass) {
|
if (newNestedType != nestedType || newMemberOfClass != memberOfClass) {
|
||||||
return new CPPPointerToMemberType(newNestedType, newMemberOfClass,
|
return new CPPPointerToMemberType(newNestedType, newMemberOfClass,
|
||||||
|
@ -2342,6 +2343,8 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (t != owner) {
|
||||||
|
return new ProblemBinding(unknown.getUnknownName(), IProblemBinding.SEMANTIC_BAD_SCOPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1927,7 +1927,7 @@ public class CPPVisitor extends ASTQueries {
|
||||||
beginExpr= expr.copy();
|
beginExpr= expr.copy();
|
||||||
} else if (type instanceof ICPPClassType) {
|
} else if (type instanceof ICPPClassType) {
|
||||||
ICPPClassType ct= (ICPPClassType) type;
|
ICPPClassType ct= (ICPPClassType) type;
|
||||||
if (ct.getCompositeScope().find(BEGIN_STR).length > 0) {
|
if (CPPSemantics.findBindings(ct.getCompositeScope(), BEGIN_STR, true).length > 0) {
|
||||||
final CPPASTName name = new CPPASTName(BEGIN);
|
final CPPASTName name = new CPPASTName(BEGIN);
|
||||||
name.setOffset(((ASTNode) forInit).getOffset());
|
name.setOffset(((ASTNode) forInit).getOffset());
|
||||||
beginExpr= new CPPASTFunctionCallExpression(
|
beginExpr= new CPPASTFunctionCallExpression(
|
||||||
|
|
|
@ -52,6 +52,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerList;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerList;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPackExpansionExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||||
|
@ -341,7 +342,7 @@ public class LookupData {
|
||||||
if (foundItems instanceof Object[])
|
if (foundItems instanceof Object[])
|
||||||
return ((Object[]) foundItems).length != 0;
|
return ((Object[]) foundItems).length != 0;
|
||||||
if (foundItems instanceof CharArrayObjectMap)
|
if (foundItems instanceof CharArrayObjectMap)
|
||||||
return ((CharArrayObjectMap) foundItems).size() != 0;
|
return ((CharArrayObjectMap<?>) foundItems).size() != 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +534,17 @@ public class LookupData {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getFunctionArgumentPackExpansionCount() {
|
||||||
|
int count= 0;
|
||||||
|
if (functionArgs != null) {
|
||||||
|
for (IASTInitializerClause arg : functionArgs) {
|
||||||
|
if (arg instanceof ICPPASTPackExpansionExpression)
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasFunctionArguments() {
|
public boolean hasFunctionArguments() {
|
||||||
return functionArgs != null;
|
return functionArgs != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ public class TemplateArgumentDeduction {
|
||||||
p= getArgumentTypeForDeduction(p, a instanceof ICPPReferenceType);
|
p= getArgumentTypeForDeduction(p, a instanceof ICPPReferenceType);
|
||||||
a= SemanticUtil.getNestedType(a, SemanticUtil.REF | SemanticUtil.TDEF);
|
a= SemanticUtil.getNestedType(a, SemanticUtil.REF | SemanticUtil.TDEF);
|
||||||
TemplateArgumentDeduction deduct= new TemplateArgumentDeduction(tmplParams, null, map, 0);
|
TemplateArgumentDeduction deduct= new TemplateArgumentDeduction(tmplParams, null, map, 0);
|
||||||
if (!deduct.fromType(p, a, false)) {
|
if (!deduct.fromType(p, a, true)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,18 +664,24 @@ public class TemplateArgumentDeduction {
|
||||||
} else if (p instanceof ICPPPointerToMemberType) {
|
} else if (p instanceof ICPPPointerToMemberType) {
|
||||||
if (!(a instanceof ICPPPointerToMemberType))
|
if (!(a instanceof ICPPPointerToMemberType))
|
||||||
return false;
|
return false;
|
||||||
if (!fromType(((ICPPPointerToMemberType) p).getMemberOfClass(),
|
final ICPPPointerToMemberType ptrP = (ICPPPointerToMemberType) p;
|
||||||
((ICPPPointerToMemberType) a).getMemberOfClass(), false)) {
|
final ICPPPointerToMemberType ptrA = (ICPPPointerToMemberType) a;
|
||||||
|
if (!allowCVQConversion && (ptrP.isConst() != ptrA.isConst() || ptrP.isVolatile() != ptrA.isVolatile()))
|
||||||
|
return false;
|
||||||
|
if (!fromType(ptrP.getMemberOfClass(), ptrA.getMemberOfClass(), false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p = ((ICPPPointerToMemberType) p).getType();
|
p = ptrP.getType();
|
||||||
a = ((ICPPPointerToMemberType) a).getType();
|
a = ptrA.getType();
|
||||||
} else if (p instanceof IPointerType) {
|
} else if (p instanceof IPointerType) {
|
||||||
if (!(a instanceof IPointerType)) {
|
if (!(a instanceof IPointerType))
|
||||||
return false;
|
return false;
|
||||||
}
|
final IPointerType ptrP = (IPointerType) p;
|
||||||
p = ((IPointerType) p).getType();
|
final IPointerType ptrA = (IPointerType) a;
|
||||||
a = ((IPointerType) a).getType();
|
if (!allowCVQConversion && (ptrP.isConst() != ptrA.isConst() || ptrP.isVolatile() != ptrA.isVolatile()))
|
||||||
|
return false;
|
||||||
|
p = ptrP.getType();
|
||||||
|
a = ptrA.getType();
|
||||||
} else if (p instanceof ICPPReferenceType) {
|
} else if (p instanceof ICPPReferenceType) {
|
||||||
if (!(a instanceof ICPPReferenceType)) {
|
if (!(a instanceof ICPPReferenceType)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -730,10 +736,10 @@ public class TemplateArgumentDeduction {
|
||||||
if (remaining != CVQualifier.NONE) {
|
if (remaining != CVQualifier.NONE) {
|
||||||
a= SemanticUtil.addQualifiers(a, remaining.isConst(), remaining.isVolatile(), remaining.isRestrict());
|
a= SemanticUtil.addQualifiers(a, remaining.isConst(), remaining.isVolatile(), remaining.isRestrict());
|
||||||
}
|
}
|
||||||
} else if (p instanceof IFunctionType) {
|
} else if (p instanceof ICPPFunctionType) {
|
||||||
if (!(a instanceof IFunctionType))
|
if (!(a instanceof ICPPFunctionType))
|
||||||
return false;
|
return false;
|
||||||
return fromFunctionType((IFunctionType) p, (IFunctionType) a);
|
return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a);
|
||||||
} else if (p instanceof ICPPTemplateParameter) {
|
} else if (p instanceof ICPPTemplateParameter) {
|
||||||
ICPPTemplateArgument current= fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);
|
ICPPTemplateArgument current= fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
|
@ -820,7 +826,10 @@ public class TemplateArgumentDeduction {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fromFunctionType(IFunctionType ftp, IFunctionType fta) throws DOMException {
|
private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta) throws DOMException {
|
||||||
|
if (ftp.isConst() != fta.isConst() || ftp.isVolatile() != fta.isVolatile())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!fromType(ftp.getReturnType(), fta.getReturnType(), false))
|
if (!fromType(ftp.getReturnType(), fta.getReturnType(), false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
|
@ -144,6 +146,24 @@ public class ASTWriter {
|
||||||
* @return <code>true</code> if the blank line between the nodes is needed.
|
* @return <code>true</code> if the blank line between the nodes is needed.
|
||||||
*/
|
*/
|
||||||
public static boolean requireBlankLineInBetween(IASTNode node1, IASTNode node2) {
|
public static boolean requireBlankLineInBetween(IASTNode node1, IASTNode node2) {
|
||||||
|
if (node1 instanceof ContainerNode) {
|
||||||
|
List<IASTNode> nodes = ((ContainerNode) node1).getNodes();
|
||||||
|
if (!nodes.isEmpty()) {
|
||||||
|
node1 = nodes.get(nodes.size() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node2 instanceof ContainerNode) {
|
||||||
|
List<IASTNode> nodes = ((ContainerNode) node2).getNodes();
|
||||||
|
if (!nodes.isEmpty()) {
|
||||||
|
node2 = nodes.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (node1 instanceof ICPPASTTemplateDeclaration) {
|
||||||
|
node1 = ((ICPPASTTemplateDeclaration) node1).getDeclaration();
|
||||||
|
}
|
||||||
|
while (node2 instanceof ICPPASTTemplateDeclaration) {
|
||||||
|
node2 = ((ICPPASTTemplateDeclaration) node2).getDeclaration();
|
||||||
|
}
|
||||||
if (node1 instanceof ICPPASTVisibilityLabel && node2 instanceof ICPPASTVisibilityLabel) {
|
if (node1 instanceof ICPPASTVisibilityLabel && node2 instanceof ICPPASTVisibilityLabel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class ASTWriterVisitor extends ASTVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visit(ASTLiteralNode lit) {
|
public void visit(ASTLiteralNode lit) {
|
||||||
|
insertBlankLineIfNeeded(lit);
|
||||||
scribe.print(lit.getRawSignature());
|
scribe.print(lit.getRawSignature());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,16 +58,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ContainerNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException;
|
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
||||||
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
|
||||||
import org.eclipse.cdt.internal.formatter.CCodeFormatter;
|
import org.eclipse.cdt.internal.formatter.CCodeFormatter;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.Document;
|
import org.eclipse.jface.text.Document;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
@ -77,7 +75,6 @@ import org.eclipse.jface.text.TextUtilities;
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
||||||
import org.eclipse.ltk.core.refactoring.TextFileChange;
|
import org.eclipse.ltk.core.refactoring.TextFileChange;
|
||||||
import org.eclipse.text.edits.InsertEdit;
|
|
||||||
import org.eclipse.text.edits.MalformedTreeException;
|
import org.eclipse.text.edits.MalformedTreeException;
|
||||||
import org.eclipse.text.edits.MultiTextEdit;
|
import org.eclipse.text.edits.MultiTextEdit;
|
||||||
import org.eclipse.text.edits.ReplaceEdit;
|
import org.eclipse.text.edits.ReplaceEdit;
|
||||||
|
@ -557,36 +554,51 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleAppends(IASTTranslationUnit tu) {
|
private void handleAppends(IASTTranslationUnit tu) {
|
||||||
ASTWriter synthWriter = new ASTWriter();
|
List<ASTModification> modifications = getModifications(tu, ModificationKind.APPEND_CHILD);
|
||||||
synthWriter.setModificationStore(modificationStore);
|
if (modifications.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
for (ASTModification modification : getModifications(tu, ModificationKind.APPEND_CHILD)) {
|
IASTNode prevNode = null;
|
||||||
IASTNode targetNode = modification.getTargetNode();
|
IASTDeclaration[] declarations = tu.getDeclarations();
|
||||||
IASTFileLocation targetLocation = targetNode.getFileLocation();
|
if (declarations.length != 0) {
|
||||||
String currentFile = targetLocation.getFileName();
|
prevNode = declarations[declarations.length - 1];
|
||||||
IPath implPath = new Path(currentFile);
|
} else {
|
||||||
IFile relevantFile= ResourceLookup.selectFileForLocation(implPath, null);
|
IASTPreprocessorStatement[] preprocessorStatements = tu.getAllPreprocessorStatements();
|
||||||
if (relevantFile == null || !relevantFile.exists()) { // If not in workspace or local file system
|
if (preprocessorStatements.length != 0) {
|
||||||
throw new UnhandledASTModificationException(modification);
|
prevNode = preprocessorStatements[preprocessorStatements.length - 1];
|
||||||
}
|
}
|
||||||
MultiTextEdit edit;
|
|
||||||
if (changes.containsKey(relevantFile)) {
|
|
||||||
edit = changes.get(relevantFile);
|
|
||||||
} else {
|
|
||||||
edit = new MultiTextEdit();
|
|
||||||
changes.put(relevantFile, edit);
|
|
||||||
}
|
|
||||||
String code = synthWriter.write(modification.getNewNode(), commentMap);
|
|
||||||
|
|
||||||
if (targetNode instanceof IASTTranslationUnit &&
|
|
||||||
((IASTTranslationUnit) targetNode).getDeclarations().length > 0) {
|
|
||||||
IASTTranslationUnit targetTu = (IASTTranslationUnit) targetNode;
|
|
||||||
IASTDeclaration lastDecl = targetTu.getDeclarations()[targetTu.getDeclarations().length - 1];
|
|
||||||
targetLocation = lastDecl.getFileLocation();
|
|
||||||
}
|
|
||||||
String lineDelimiter = FileHelper.determineLineDelimiter(tu.getRawSignature());
|
|
||||||
edit.addChild(new InsertEdit(endOffset(targetLocation), lineDelimiter + lineDelimiter + code));
|
|
||||||
}
|
}
|
||||||
|
int offset = prevNode != null ? getEndOffsetIncludingComments(prevNode) : 0;
|
||||||
|
String source = tu.getRawSignature();
|
||||||
|
int endOffset = skipTrailingBlankLines(source, offset);
|
||||||
|
|
||||||
|
ChangeGeneratorWriterVisitor writer =
|
||||||
|
new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
|
||||||
|
IASTNode newNode = null;
|
||||||
|
for (ASTModification modification : modifications) {
|
||||||
|
boolean first = newNode == null;
|
||||||
|
newNode = modification.getNewNode();
|
||||||
|
if (first) {
|
||||||
|
if (prevNode != null) {
|
||||||
|
writer.newLine();
|
||||||
|
if (ASTWriter.requireBlankLineInBetween(prevNode, newNode)) {
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newNode.accept(writer);
|
||||||
|
}
|
||||||
|
if (prevNode != null) {
|
||||||
|
IASTNode nextNode = getNextSiblingOrPreprocessorNode(prevNode);
|
||||||
|
if (nextNode != null && ASTWriter.requireBlankLineInBetween(newNode, nextNode)) {
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String code = writer.toString();
|
||||||
|
IFile file = FileHelper.getFileFromNode(tu);
|
||||||
|
MultiTextEdit parentEdit = getEdit(tu, file);
|
||||||
|
parentEdit.addChild(new ReplaceEdit(offset, endOffset - offset, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1016,6 +1028,13 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
if (modification.getKind() != ModificationKind.APPEND_CHILD)
|
if (modification.getKind() != ModificationKind.APPEND_CHILD)
|
||||||
return false;
|
return false;
|
||||||
IASTNode node = modification.getNewNode();
|
IASTNode node = modification.getNewNode();
|
||||||
|
if (node instanceof ContainerNode) {
|
||||||
|
for (IASTNode containedNode : ((ContainerNode) node).getNodes()) {
|
||||||
|
if (!(containedNode instanceof IASTDeclaration || containedNode instanceof IASTStatement))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return node instanceof IASTDeclaration || node instanceof IASTStatement;
|
return node instanceof IASTDeclaration || node instanceof IASTStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,13 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||||
|
|
||||||
public class UnhandledASTModificationException extends RuntimeException {
|
public class UnhandledASTModificationException extends RuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private final ASTModification illegalModification;
|
private final ASTModification illegalModification;
|
||||||
|
|
||||||
public UnhandledASTModificationException(ASTModification illegalModification) {
|
public UnhandledASTModificationException(ASTModification illegalModification) {
|
||||||
|
|
|
@ -47,7 +47,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Code reader factory, that fakes code readers for header files already stored in the index.
|
* Code reader factory, that fakes code readers for header files already stored in the index.
|
||||||
*/
|
*/
|
||||||
public final class IndexBasedFileContentProvider extends InternalFileContentProvider {
|
public final class IndexBasedFileContentProvider extends InternalFileContentProvider {
|
||||||
private static final class NeedToParseException extends Exception {}
|
|
||||||
private static final String GAP = "__gap__"; //$NON-NLS-1$
|
private static final String GAP = "__gap__"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final IIndex fIndex;
|
private final IIndex fIndex;
|
||||||
|
@ -135,7 +134,7 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
// Report pragma once inclusions, only if no exception was thrown.
|
// Report pragma once inclusions, only if no exception was thrown.
|
||||||
fPragmaOnce.putAll(newPragmaOnce);
|
fPragmaOnce.putAll(newPragmaOnce);
|
||||||
return new InternalFileContent(path, macros, directives, files, toList(preLoaded));
|
return new InternalFileContent(path, macros, directives, files, toList(preLoaded));
|
||||||
} catch (NeedToParseException e) {
|
} catch (DependsOnOutdatedFileException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -188,7 +187,7 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
Map<IIndexFileLocation, IFileNomination> newPragmaOnce,
|
Map<IIndexFileLocation, IFileNomination> newPragmaOnce,
|
||||||
LinkedHashSet<IIndexFile> preLoaded, List<IIndexFile> files,
|
LinkedHashSet<IIndexFile> preLoaded, List<IIndexFile> files,
|
||||||
List<IIndexMacro> macros, List<ICPPUsingDirective> usingDirectives,
|
List<IIndexMacro> macros, List<ICPPUsingDirective> usingDirectives,
|
||||||
Set<IIndexFile> preventRecursion) throws CoreException, NeedToParseException {
|
Set<IIndexFile> preventRecursion) throws CoreException, DependsOnOutdatedFileException {
|
||||||
if (file.equals(stopAt))
|
if (file.equals(stopAt))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -211,8 +210,6 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
final Object[] pds;
|
final Object[] pds;
|
||||||
if (fRelatedIndexerTask != null) {
|
if (fRelatedIndexerTask != null) {
|
||||||
IndexFileContent content= fRelatedIndexerTask.getFileContent(fLinkage, ifl, file);
|
IndexFileContent content= fRelatedIndexerTask.getFileContent(fLinkage, ifl, file);
|
||||||
if (content == null)
|
|
||||||
throw new NeedToParseException();
|
|
||||||
uds= content.getUsingDirectives();
|
uds= content.getUsingDirectives();
|
||||||
pds= content.getPreprocessingDirectives();
|
pds= content.getPreprocessingDirectives();
|
||||||
} else {
|
} else {
|
||||||
|
@ -252,7 +249,7 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalFileContent getContentForContextToHeaderGap(String path,
|
public InternalFileContent getContentForContextToHeaderGap(String path,
|
||||||
IMacroDictionary macroDictionary) {
|
IMacroDictionary macroDictionary) throws DependsOnOutdatedFileException {
|
||||||
if (fContextToHeaderGap == null) {
|
if (fContextToHeaderGap == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -268,12 +265,8 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
ArrayList<IIndexMacro> macros= new ArrayList<IIndexMacro>();
|
ArrayList<IIndexMacro> macros= new ArrayList<IIndexMacro>();
|
||||||
ArrayList<ICPPUsingDirective> directives= new ArrayList<ICPPUsingDirective>();
|
ArrayList<ICPPUsingDirective> directives= new ArrayList<ICPPUsingDirective>();
|
||||||
LinkedHashSet<IIndexFile> preLoaded= new LinkedHashSet<IIndexFile>();
|
LinkedHashSet<IIndexFile> preLoaded= new LinkedHashSet<IIndexFile>();
|
||||||
try {
|
if (!collectFileContent(contextFile, targetFile, newPragmaOnce, preLoaded,
|
||||||
if (!collectFileContent(contextFile, targetFile, newPragmaOnce, preLoaded,
|
filesIncluded, macros, directives, new HashSet<IIndexFile>())) {
|
||||||
filesIncluded, macros, directives, new HashSet<IIndexFile>())) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (NeedToParseException e) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,4 +295,14 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
|
||||||
}
|
}
|
||||||
return IIndexFile.EMPTY_FILE_ARRAY;
|
return IIndexFile.EMPTY_FILE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContextPath() {
|
||||||
|
if (fContextToHeaderGap != null)
|
||||||
|
try {
|
||||||
|
return fPathResolver.getASTPath(fContextToHeaderGap[0].getLocation());
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ public class CompositeCPPClassTemplate extends CompositeCPPClassType
|
||||||
super(cf, ct);
|
super(cf, ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
try {
|
try {
|
||||||
final CIndex cIndex = (CIndex) ((CPPCompositesFactory) cf).getContext();
|
final CIndex cIndex = (CIndex) ((CPPCompositesFactory) cf).getContext();
|
||||||
IIndexFragmentBinding[] bindings = cIndex.findEquivalentBindings(rbinding);
|
IIndexFragmentBinding[] bindings = cIndex.findEquivalentBindings(rbinding);
|
||||||
|
@ -59,22 +60,27 @@ public class CompositeCPPClassTemplate extends CompositeCPPClassType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
return CompositeInstanceCache.getCache(cf, rbinding).getInstance(arguments);
|
return CompositeInstanceCache.getCache(cf, rbinding).getInstance(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
CompositeInstanceCache.getCache(cf, rbinding).addInstance(arguments, instance);
|
CompositeInstanceCache.getCache(cf, rbinding).addInstance(arguments, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
return CompositeInstanceCache.getCache(cf, rbinding).getAllInstances();
|
return CompositeInstanceCache.getCache(cf, rbinding).getAllInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
|
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
|
||||||
synchronized (cache) {
|
synchronized (cache) {
|
||||||
|
|
|
@ -32,8 +32,8 @@ CompositeCPPClassSpecialization implements ICPPClassTemplate, ICPPInstanceCache{
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations()
|
@Override
|
||||||
throws DOMException {
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
ICPPClassTemplatePartialSpecialization[] result= ((ICPPClassTemplate) rbinding).getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] result= ((ICPPClassTemplate) rbinding).getPartialSpecializations();
|
||||||
for (int i= 0; i < result.length; i++) {
|
for (int i= 0; i < result.length; i++) {
|
||||||
result[i]= (ICPPClassTemplatePartialSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)result[i]);
|
result[i]= (ICPPClassTemplatePartialSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)result[i]);
|
||||||
|
@ -41,23 +41,28 @@ CompositeCPPClassSpecialization implements ICPPClassTemplate, ICPPInstanceCache{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
return CompositeInstanceCache.getCache(cf, rbinding).getInstance(arguments);
|
return CompositeInstanceCache.getCache(cf, rbinding).getInstance(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
CompositeInstanceCache.getCache(cf, rbinding).addInstance(arguments, instance);
|
CompositeInstanceCache.getCache(cf, rbinding).addInstance(arguments, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
return CompositeInstanceCache.getCache(cf, rbinding).getAllInstances();
|
return CompositeInstanceCache.getCache(cf, rbinding).getAllInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
|
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
|
||||||
synchronized (cache) {
|
synchronized (cache) {
|
||||||
|
|
|
@ -57,6 +57,7 @@ import org.eclipse.cdt.internal.core.parser.IMacroDictionary;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator.EvalException;
|
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator.EvalException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.FileVersion;
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.FileVersion;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.InclusionKind;
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.InclusionKind;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider.DependsOnOutdatedFileException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.Lexer.LexerOptions;
|
import org.eclipse.cdt.internal.core.parser.scanner.Lexer.LexerOptions;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.MacroDefinitionParser.InvalidMacroDefinitionException;
|
import org.eclipse.cdt.internal.core.parser.scanner.MacroDefinitionParser.InvalidMacroDefinitionException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.BranchKind;
|
import org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.BranchKind;
|
||||||
|
@ -133,7 +134,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
@Override
|
@Override
|
||||||
public boolean visitValue(char[] macro, char[] value) {
|
public boolean visitValue(char[] macro, char[] value) {
|
||||||
PreprocessorMacro m = fMacroDictionary.get(macro);
|
PreprocessorMacro m = fMacroDictionary.get(macro);
|
||||||
return m != null && CharArrayUtils.equals(m.getExpansion(), value);
|
return m != null && CharArrayUtils.equals(SignificantMacros.shortenValue(m.getExpansion()), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDefined(char[] macro) {
|
private boolean isDefined(char[] macro) {
|
||||||
|
@ -246,7 +247,6 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
private final LocationMap fLocationMap;
|
private final LocationMap fLocationMap;
|
||||||
private CharArraySet fPreventInclusion= new CharArraySet(0);
|
private CharArraySet fPreventInclusion= new CharArraySet(0);
|
||||||
|
|
||||||
private final Lexer fRootLexer;
|
|
||||||
private final ScannerContext fRootContext;
|
private final ScannerContext fRootContext;
|
||||||
protected ScannerContext fCurrentContext;
|
protected ScannerContext fCurrentContext;
|
||||||
|
|
||||||
|
@ -297,13 +297,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fMacroExpander= new MacroExpander(this, fMacroDictionary, fLocationMap, fLexOptions);
|
fMacroExpander= new MacroExpander(this, fMacroDictionary, fLocationMap, fLexOptions);
|
||||||
fIncludeFileResolutionHeuristics= fFileContentProvider.getIncludeHeuristics();
|
fIncludeFileResolutionHeuristics= fFileContentProvider.getIncludeHeuristics();
|
||||||
|
|
||||||
final String filePath= fRootContent.getFileLocation();
|
String contextPath= fFileContentProvider.getContextPath();
|
||||||
configureIncludeSearchPath(new File(filePath).getParentFile(), info);
|
if (contextPath == null) {
|
||||||
|
contextPath= fRootContent.getFileLocation();
|
||||||
|
}
|
||||||
|
configureIncludeSearchPath(new File(contextPath).getParentFile(), info);
|
||||||
setupMacroDictionary(configuration, info, language);
|
setupMacroDictionary(configuration, info, language);
|
||||||
|
|
||||||
ILocationCtx ctx= fLocationMap.pushTranslationUnit(filePath, fRootContent.getSource());
|
ILocationCtx ctx= fLocationMap.pushTranslationUnit(fRootContent.getFileLocation(), fRootContent.getSource());
|
||||||
fRootLexer= new Lexer(fRootContent.getSource(), fLexOptions, this, this);
|
Lexer lexer = new Lexer(fRootContent.getSource(), fLexOptions, this, this);
|
||||||
fRootContext= fCurrentContext= new ScannerContext(ctx, null, fRootLexer);
|
fRootContext= fCurrentContext= new ScannerContext(ctx, null, lexer);
|
||||||
if (info instanceof IExtendedScannerInfo) {
|
if (info instanceof IExtendedScannerInfo) {
|
||||||
final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info;
|
final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info;
|
||||||
fPreIncludedFiles= new String[][] { einfo.getMacroFiles(), einfo.getIncludeFiles() };
|
fPreIncludedFiles= new String[][] { einfo.getMacroFiles(), einfo.getIncludeFiles() };
|
||||||
|
@ -346,11 +349,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
@Override
|
@Override
|
||||||
public void setContentAssistMode(int offset) {
|
public void setContentAssistMode(int offset) {
|
||||||
fContentAssistLimit= offset;
|
fContentAssistLimit= offset;
|
||||||
fRootLexer.setContentAssistMode(offset);
|
fRootContext.getLexer().setContentAssistMode(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isContentAssistMode() {
|
public boolean isContentAssistMode() {
|
||||||
return fRootLexer.isContentAssistMode();
|
return fRootContext.getLexer().isContentAssistMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -466,10 +469,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
fPreIncludedFiles= null;
|
fPreIncludedFiles= null;
|
||||||
}
|
}
|
||||||
final String location = fLocationMap.getTranslationUnitPath();
|
final String location = fLocationMap.getTranslationUnitPath();
|
||||||
InternalFileContent content= fFileContentProvider.getContentForContextToHeaderGap(location,
|
InternalFileContent content;
|
||||||
fMacroDictionaryFacade);
|
try {
|
||||||
|
content = fFileContentProvider.getContentForContextToHeaderGap(location,
|
||||||
|
fMacroDictionaryFacade);
|
||||||
|
} catch (DependsOnOutdatedFileException e) {
|
||||||
|
// Abort the parser, handled by the abstract indexer task.
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
if (content != null && content.getKind() == InclusionKind.FOUND_IN_INDEX) {
|
if (content != null && content.getKind() == InclusionKind.FOUND_IN_INDEX) {
|
||||||
processInclusionFromIndex(0, location, content, false);
|
processInclusionFromIndex(0, content, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
detectIncludeGuard(location, fRootContent.getSource(), fRootContext);
|
detectIncludeGuard(location, fRootContent.getSource(), fRootContext);
|
||||||
|
@ -577,7 +586,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
t= internalFetchToken(fRootContext, CHECK_NUMBERS, false);
|
t= internalFetchToken(fRootContext, CHECK_NUMBERS | REPORT_SIGNIFICANT_MACROS | IGNORE_UNDEFINED_SIGNIFICANT_MACROS, false);
|
||||||
} catch (OffsetLimitReachedException e) {
|
} catch (OffsetLimitReachedException e) {
|
||||||
fHandledCompletion= true;
|
fHandledCompletion= true;
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1463,7 +1472,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
processInclusionFromIndex(poundOffset, path, fi, true);
|
processInclusionFromIndex(poundOffset, fi, true);
|
||||||
break;
|
break;
|
||||||
case USE_SOURCE:
|
case USE_SOURCE:
|
||||||
// Will be parsed
|
// Will be parsed
|
||||||
|
@ -1502,7 +1511,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processInclusionFromIndex(int offset, String path, InternalFileContent fi, boolean updateContext) {
|
private void processInclusionFromIndex(int offset, InternalFileContent fi, boolean updateContext) {
|
||||||
List<IIndexMacro> mdefs= fi.getMacroDefinitions();
|
List<IIndexMacro> mdefs= fi.getMacroDefinitions();
|
||||||
for (IIndexMacro macro : mdefs) {
|
for (IIndexMacro macro : mdefs) {
|
||||||
addMacroDefinition(macro);
|
addMacroDefinition(macro);
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.parser.ISignificantMacros;
|
import org.eclipse.cdt.core.parser.ISignificantMacros;
|
||||||
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
|
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
|
||||||
import org.eclipse.cdt.internal.core.dom.IIncludeFileResolutionHeuristics;
|
import org.eclipse.cdt.internal.core.dom.IIncludeFileResolutionHeuristics;
|
||||||
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
|
||||||
import org.eclipse.cdt.internal.core.parser.IMacroDictionary;
|
import org.eclipse.cdt.internal.core.parser.IMacroDictionary;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.InclusionKind;
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.InclusionKind;
|
||||||
|
|
||||||
|
@ -32,6 +33,15 @@ import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent.Inclusio
|
||||||
* Internal implementation of the file content providers
|
* Internal implementation of the file content providers
|
||||||
*/
|
*/
|
||||||
public abstract class InternalFileContentProvider extends IncludeFileContentProvider {
|
public abstract class InternalFileContentProvider extends IncludeFileContentProvider {
|
||||||
|
public static final class DependsOnOutdatedFileException extends Exception {
|
||||||
|
public final Object fTu;
|
||||||
|
public final IIndexFragmentFile fIndexFile;
|
||||||
|
public DependsOnOutdatedFileException(Object tu, IIndexFragmentFile file) {
|
||||||
|
fTu= tu;
|
||||||
|
fIndexFile= file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IIncludeFileResolutionHeuristics fIncludeResolutionHeuristics;
|
private IIncludeFileResolutionHeuristics fIncludeResolutionHeuristics;
|
||||||
private final Map<String, IFileNomination> fPragmaOnce= new HashMap<String, IFileNomination>();
|
private final Map<String, IFileNomination> fPragmaOnce= new HashMap<String, IFileNomination>();
|
||||||
private final Map<String, List<ISignificantMacros>> fLoadedVersions= new HashMap<String, List<ISignificantMacros>>();
|
private final Map<String, List<ISignificantMacros>> fLoadedVersions= new HashMap<String, List<ISignificantMacros>>();
|
||||||
|
@ -64,9 +74,10 @@ public abstract class InternalFileContentProvider extends IncludeFileContentProv
|
||||||
* or <code>null</code> if this cannot be done.
|
* or <code>null</code> if this cannot be done.
|
||||||
* @param filePath the absolute location of the file.
|
* @param filePath the absolute location of the file.
|
||||||
* @param macroDictionary macros defined at the inclusion point.
|
* @param macroDictionary macros defined at the inclusion point.
|
||||||
|
* @throws DependsOnOutdatedFileException
|
||||||
*/
|
*/
|
||||||
public InternalFileContent getContentForContextToHeaderGap(String filePath,
|
public InternalFileContent getContentForContextToHeaderGap(String filePath,
|
||||||
IMacroDictionary macroDictionary) {
|
IMacroDictionary macroDictionary) throws DependsOnOutdatedFileException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,4 +135,11 @@ public abstract class InternalFileContentProvider extends IncludeFileContentProv
|
||||||
list.add(sig);
|
list.add(sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the path of the context of <code>null</code>, if there is no context.
|
||||||
|
*/
|
||||||
|
public String getContextPath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,14 +330,29 @@ final class ScannerContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void internalModification(char[] macroName) {
|
public void internalModification(char[] macroName) {
|
||||||
if (fInternalModifications != null)
|
final CharArraySet collector = findModificationCollector();
|
||||||
fInternalModifications.put(macroName);
|
if (collector != null)
|
||||||
|
collector.put(macroName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CharArraySet findModificationCollector() {
|
||||||
|
ScannerContext ctx= this;
|
||||||
|
do {
|
||||||
|
final CharArraySet collector = ctx.fInternalModifications;
|
||||||
|
if (collector != null)
|
||||||
|
return collector;
|
||||||
|
ctx= ctx.getParent();
|
||||||
|
} while (ctx != null);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void significantMacro(IMacroBinding macro) {
|
public void significantMacro(IMacroBinding macro) {
|
||||||
final char[] macroName= macro.getNameCharArray();
|
final char[] macroName= macro.getNameCharArray();
|
||||||
if (fInternalModifications != null && !fInternalModifications.containsKey(macroName)) {
|
if (fInternalModifications != null && !fInternalModifications.containsKey(macroName)) {
|
||||||
fSignificantMacros.put(macroName, macro.getExpansion());
|
final char[] expansion = macro.getExpansion();
|
||||||
|
if (expansion != null)
|
||||||
|
fSignificantMacros.put(macroName, SignificantMacros.shortenValue(expansion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,23 +385,28 @@ final class ScannerContext {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fParent != null) {
|
if (fParent != null) {
|
||||||
final CharArraySet local = fParent.fInternalModifications;
|
CharArraySet collector = fParent.findModificationCollector();
|
||||||
if (local != null) {
|
if (collector != null) {
|
||||||
final CharArrayObjectMap<char[]> significant = fParent.fSignificantMacros;
|
// Propagate internal modifications to first interested parent.
|
||||||
for (int i=0; i<fSignificantMacros.size(); i++) {
|
collector.addAll(fInternalModifications);
|
||||||
final char[] name = fSignificantMacros.keyAt(i);
|
|
||||||
if (!local.containsKey(name)) {
|
// Propagate significant macros to direct parent, if it is interested.
|
||||||
final char[] value= fSignificantMacros.getAt(i);
|
if (collector == fParent.fInternalModifications) {
|
||||||
if (value == SignificantMacros.DEFINED) {
|
final CharArrayObjectMap<char[]> significant = fParent.fSignificantMacros;
|
||||||
if (!local.containsKey(name)) {
|
for (int i=0; i<fSignificantMacros.size(); i++) {
|
||||||
fParent.addSignificantMacroDefined(name);
|
final char[] name = fSignificantMacros.keyAt(i);
|
||||||
|
if (!collector.containsKey(name)) {
|
||||||
|
final char[] value= fSignificantMacros.getAt(i);
|
||||||
|
if (value == SignificantMacros.DEFINED) {
|
||||||
|
if (!collector.containsKey(name)) {
|
||||||
|
fParent.addSignificantMacroDefined(name);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
significant.put(name, value);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
significant.put(name, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local.addAll(fInternalModifications);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fInternalModifications= null;
|
fInternalModifications= null;
|
||||||
|
@ -398,18 +418,21 @@ final class ScannerContext {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sm.accept(new ISignificantMacros.IVisitor() {
|
sm.accept(new ISignificantMacros.IVisitor() {
|
||||||
|
@Override
|
||||||
public boolean visitValue(char[] macro, char[] value) {
|
public boolean visitValue(char[] macro, char[] value) {
|
||||||
if (!fInternalModifications.containsKey(macro)) {
|
if (!fInternalModifications.containsKey(macro)) {
|
||||||
fSignificantMacros.put(macro, value);
|
fSignificantMacros.put(macro, value);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean visitUndefined(char[] macro) {
|
public boolean visitUndefined(char[] macro) {
|
||||||
if (!fInternalModifications.containsKey(macro)) {
|
if (!fInternalModifications.containsKey(macro)) {
|
||||||
fSignificantMacros.put(macro, SignificantMacros.UNDEFINED);
|
fSignificantMacros.put(macro, SignificantMacros.UNDEFINED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean visitDefined(char[] macro) {
|
public boolean visitDefined(char[] macro) {
|
||||||
if (!fInternalModifications.containsKey(macro)) {
|
if (!fInternalModifications.containsKey(macro)) {
|
||||||
fSignificantMacros.put(macro, SignificantMacros.DEFINED);
|
fSignificantMacros.put(macro, SignificantMacros.DEFINED);
|
||||||
|
|
|
@ -28,11 +28,10 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
* A <code>null</code> string is encoded as a single comma.
|
* A <code>null</code> string is encoded as a single comma.
|
||||||
*/
|
*/
|
||||||
public class SignificantMacros implements ISignificantMacros {
|
public class SignificantMacros implements ISignificantMacros {
|
||||||
public static final char[] UNDEFINED = {};
|
public static final char[] DEFINED = {0};
|
||||||
public static final char[] DEFINED = {};
|
public static final char[] UNDEFINED = {1};
|
||||||
private static final int ENCODED_UNDEFINED = Character.MAX_VALUE;
|
|
||||||
private static final int ENCODED_DEFINED = Character.MAX_VALUE-1;
|
|
||||||
private static final Comparator<Object> SORTER = new Comparator<Object>() {
|
private static final Comparator<Object> SORTER = new Comparator<Object>() {
|
||||||
|
@Override
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
return CharArrayUtils.compare((char[])o1, (char[])o2);
|
return CharArrayUtils.compare((char[])o1, (char[])o2);
|
||||||
}
|
}
|
||||||
|
@ -58,13 +57,7 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
char[] name= (char[]) key;
|
char[] name= (char[]) key;
|
||||||
char[] value= sigMacros.get(name);
|
char[] value= sigMacros.get(name);
|
||||||
buffer.append((char) name.length).append(name);
|
buffer.append((char) name.length).append(name);
|
||||||
if (value == DEFINED) {
|
buffer.append((char) value.length).append(value);
|
||||||
buffer.append((char) ENCODED_DEFINED);
|
|
||||||
} else if (value == UNDEFINED) {
|
|
||||||
buffer.append((char) ENCODED_UNDEFINED);
|
|
||||||
} else {
|
|
||||||
buffer.append((char) value.length).append(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int len= buffer.length();
|
int len= buffer.length();
|
||||||
char[] result= new char[len];
|
char[] result= new char[len];
|
||||||
|
@ -93,6 +86,7 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
&& CharArrayUtils.equals(fEncoded, ((SignificantMacros) obj).fEncoded);
|
&& CharArrayUtils.equals(fEncoded, ((SignificantMacros) obj).fEncoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean accept(IVisitor visitor) {
|
public boolean accept(IVisitor visitor) {
|
||||||
final char[] encoded = fEncoded;
|
final char[] encoded = fEncoded;
|
||||||
final int len = encoded.length;
|
final int len = encoded.length;
|
||||||
|
@ -102,28 +96,27 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
int v= i + len1;
|
int v= i + len1;
|
||||||
if (v >= len)
|
if (v >= len)
|
||||||
break;
|
break;
|
||||||
|
final int len2 = encoded[v++];
|
||||||
|
if (v+len2 > len)
|
||||||
|
break;
|
||||||
|
|
||||||
char[] macro= extract(encoded, i, len1);
|
char[] macro= extract(encoded, i, len1);
|
||||||
final int len2 = encoded[v++];
|
i= v+len2;
|
||||||
switch(len2) {
|
if (len2 == 1) {
|
||||||
case ENCODED_UNDEFINED:
|
if (encoded[v] == UNDEFINED[0]) {
|
||||||
i= v;
|
if (!visitor.visitUndefined(macro))
|
||||||
if (!visitor.visitUndefined(macro))
|
return false;
|
||||||
return false;
|
continue;
|
||||||
break;
|
}
|
||||||
case ENCODED_DEFINED:
|
if (encoded[v] == DEFINED[0]) {
|
||||||
i= v;
|
if (!visitor.visitDefined(macro))
|
||||||
if (!visitor.visitDefined(macro))
|
return false;
|
||||||
return false;
|
continue;
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
i= v+len2;
|
|
||||||
if (i > len)
|
|
||||||
break;
|
|
||||||
if (!visitor.visitValue(macro, extract(encoded, v, len2)))
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
final char[] value = extract(encoded, v, len2);
|
||||||
|
if (!visitor.visitValue(macro, value))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -134,6 +127,7 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] encode() {
|
public char[] encode() {
|
||||||
return fEncoded;
|
return fEncoded;
|
||||||
}
|
}
|
||||||
|
@ -147,14 +141,17 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
final StringBuilder buf= new StringBuilder();
|
final StringBuilder buf= new StringBuilder();
|
||||||
buf.append('{');
|
buf.append('{');
|
||||||
accept(new IVisitor() {
|
accept(new IVisitor() {
|
||||||
|
@Override
|
||||||
public boolean visitValue(char[] macro, char[] value) {
|
public boolean visitValue(char[] macro, char[] value) {
|
||||||
buf.append(macro).append('=').append(value).append(',');
|
buf.append(macro).append('=').append(value).append(',');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean visitUndefined(char[] macro) {
|
public boolean visitUndefined(char[] macro) {
|
||||||
buf.append(macro).append('=').append("null,");
|
buf.append(macro).append('=').append("null,");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean visitDefined(char[] macro) {
|
public boolean visitDefined(char[] macro) {
|
||||||
buf.append(macro).append('=').append("*,");
|
buf.append(macro).append('=').append("*,");
|
||||||
return true;
|
return true;
|
||||||
|
@ -166,4 +163,19 @@ public class SignificantMacros implements ISignificantMacros {
|
||||||
buf.append('}');
|
buf.append('}');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static char[] shortenValue(char[] expansion) {
|
||||||
|
if (expansion.length <= 16)
|
||||||
|
return expansion;
|
||||||
|
char[] result= new char[16];
|
||||||
|
System.arraycopy(expansion, 0, result, 0, 8);
|
||||||
|
StreamHasher hasher= new StreamHasher();
|
||||||
|
hasher.addChunk(expansion);
|
||||||
|
long hash= hasher.computeHash();
|
||||||
|
for(int i= 0; i<8; i++) {
|
||||||
|
result[8+i]= (char) (hash & 0xff);
|
||||||
|
hash= hash >> 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
||||||
|
@ -54,6 +55,7 @@ import org.eclipse.cdt.internal.core.index.IWritableIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.IndexBasedFileContentProvider;
|
import org.eclipse.cdt.internal.core.index.IndexBasedFileContentProvider;
|
||||||
import org.eclipse.cdt.internal.core.parser.IMacroDictionary;
|
import org.eclipse.cdt.internal.core.parser.IMacroDictionary;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider;
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider.DependsOnOutdatedFileException;
|
||||||
import org.eclipse.cdt.internal.core.parser.util.LRUCache;
|
import org.eclipse.cdt.internal.core.parser.util.LRUCache;
|
||||||
import org.eclipse.cdt.utils.EFSExtensionManager;
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -783,7 +785,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
return;
|
return;
|
||||||
final Object tu = locTask.fTu;
|
final Object tu = locTask.fTu;
|
||||||
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu);
|
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu);
|
||||||
parseFile(tu, linkageID, ifl, scannerInfo, null, monitor);
|
parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +819,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
return;
|
return;
|
||||||
final Object tu = locTask.fTu;
|
final Object tu = locTask.fTu;
|
||||||
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu);
|
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu);
|
||||||
parseFile(tu, linkageID, ifl, scannerInfo, null, monitor);
|
parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor);
|
||||||
if (locTask.isCompleted())
|
if (locTask.isCompleted())
|
||||||
it.remove();
|
it.remove();
|
||||||
|
|
||||||
|
@ -870,8 +872,24 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu);
|
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu);
|
||||||
FileContext ctx= new FileContext(ctxFile, headerFile);
|
final AbstractLanguage language = getLanguage(contextTu, linkageID);
|
||||||
parseFile(tu, linkageID, ifl, scannerInfo, ctx, monitor);
|
final FileContext ctx= new FileContext(ctxFile, headerFile);
|
||||||
|
Set<IIndexFile> dependencies= null;
|
||||||
|
boolean done= false;
|
||||||
|
while (!done) {
|
||||||
|
done= true;
|
||||||
|
DependsOnOutdatedFileException d= parseFile(tu, language, ifl, scannerInfo, ctx, monitor);
|
||||||
|
if (d != null) {
|
||||||
|
// File was not parsed, because there is a dependency that needs to be
|
||||||
|
// handled before
|
||||||
|
if (dependencies == null)
|
||||||
|
dependencies= new HashSet<IIndexFile>();
|
||||||
|
if (dependencies.add(d.fIndexFile)) {
|
||||||
|
if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null)
|
||||||
|
done= false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!ctx.fLostPragmaOnceSemantics)
|
if (!ctx.fLostPragmaOnceSemantics)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -929,21 +947,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void parseFile(Object tu, int linkageID, IIndexFileLocation ifl, IScannerInfo scanInfo,
|
private DependsOnOutdatedFileException parseFile(Object tu, AbstractLanguage lang, IIndexFileLocation ifl, IScannerInfo scanInfo,
|
||||||
FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException {
|
FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||||
IPath path= getLabel(ifl);
|
IPath path= getLabel(ifl);
|
||||||
AbstractLanguage[] langs= fResolver.getLanguages(tu, true);
|
|
||||||
AbstractLanguage lang= null;
|
|
||||||
for (AbstractLanguage lang2 : langs) {
|
|
||||||
if (lang2.getLinkageID() == linkageID) {
|
|
||||||
lang= lang2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lang == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Throwable th= null;
|
Throwable th= null;
|
||||||
try {
|
try {
|
||||||
if (fShowActivity) {
|
if (fShowActivity) {
|
||||||
|
@ -951,18 +957,21 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
}
|
}
|
||||||
pm.subTask(getMessage(MessageKind.parsingFileTask,
|
pm.subTask(getMessage(MessageKind.parsingFileTask,
|
||||||
path.lastSegment(), path.removeLastSegments(1).toString()));
|
path.lastSegment(), path.removeLastSegments(1).toString()));
|
||||||
long start= System.currentTimeMillis();
|
|
||||||
FileContent codeReader= fResolver.getCodeReader(tu);
|
FileContent codeReader= fResolver.getCodeReader(tu);
|
||||||
IIndexFile[] ctxFiles = ctx == null ? null : new IIndexFile[] {ctx.fContext, ctx.fOldFile};
|
final boolean isSource = fResolver.isSourceUnit(tu);
|
||||||
|
|
||||||
IASTTranslationUnit ast= createAST(tu, lang, codeReader, scanInfo, fASTOptions, ctxFiles, pm);
|
long start= System.currentTimeMillis();
|
||||||
|
IASTTranslationUnit ast= createAST(lang, codeReader, scanInfo, isSource, fASTOptions, ctx, pm);
|
||||||
fStatistics.fParsingTime += System.currentTimeMillis() - start;
|
fStatistics.fParsingTime += System.currentTimeMillis() - start;
|
||||||
if (ast != null) {
|
if (ast != null) {
|
||||||
writeToIndex(linkageID, ast, codeReader.getContentsHash(), ctx, pm);
|
writeToIndex(lang.getLinkageID(), ast, codeReader.getContentsHash(), ctx, pm);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
final Throwable cause = e.getCause();
|
||||||
|
if (cause instanceof DependsOnOutdatedFileException)
|
||||||
|
return (DependsOnOutdatedFileException) cause;
|
||||||
th= e;
|
th= e;
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
th= e;
|
th= e;
|
||||||
|
@ -976,6 +985,16 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
if (th != null) {
|
if (th != null) {
|
||||||
swallowError(path, th);
|
swallowError(path, th);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AbstractLanguage getLanguage(Object tu, int linkageID) {
|
||||||
|
for (AbstractLanguage language : fResolver.getLanguages(tu, true)) {
|
||||||
|
if (language.getLinkageID() == linkageID) {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath getLabel(IIndexFileLocation ifl) {
|
private IPath getLabel(IIndexFileLocation ifl) {
|
||||||
|
@ -1033,13 +1052,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IASTTranslationUnit createAST(Object tu, AbstractLanguage language,
|
private final IASTTranslationUnit createAST(AbstractLanguage language, FileContent codeReader,
|
||||||
FileContent codeReader, IScannerInfo scanInfo, int options,
|
IScannerInfo scanInfo, boolean isSource, int options,
|
||||||
IIndexFile[] ctx2header, IProgressMonitor pm) throws CoreException {
|
FileContext ctx, IProgressMonitor pm) throws CoreException {
|
||||||
if (codeReader == null) {
|
if (codeReader == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (fResolver.isSourceUnit(tu)) {
|
if (isSource) {
|
||||||
options |= ILanguage.OPTION_IS_SOURCE_UNIT;
|
options |= ILanguage.OPTION_IS_SOURCE_UNIT;
|
||||||
}
|
}
|
||||||
if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) {
|
if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) {
|
||||||
|
@ -1048,6 +1067,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
final IIndexFile[] ctx2header = ctx == null ? null : new IIndexFile[] {ctx.fContext, ctx.fOldFile};
|
||||||
if (fCodeReaderFactory == null) {
|
if (fCodeReaderFactory == null) {
|
||||||
InternalFileContentProvider fileContentProvider = createInternalFileContentProvider();
|
InternalFileContentProvider fileContentProvider = createInternalFileContentProvider();
|
||||||
if (fIsFastIndexer) {
|
if (fIsFastIndexer) {
|
||||||
|
@ -1163,14 +1183,14 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final IndexFileContent getFileContent(int linkageID, IIndexFileLocation ifl,
|
public final IndexFileContent getFileContent(int linkageID, IIndexFileLocation ifl,
|
||||||
IIndexFile file) throws CoreException {
|
IIndexFile file) throws CoreException, DependsOnOutdatedFileException {
|
||||||
LinkageTask map = findRequestMap(linkageID);
|
LinkageTask map = findRequestMap(linkageID);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
LocationTask request= map.find(ifl);
|
LocationTask request= map.find(ifl);
|
||||||
if (request != null) {
|
if (request != null) {
|
||||||
FileVersionTask task= request.findVersion(file);
|
FileVersionTask task= request.findVersion(file);
|
||||||
if (task != null && task.fOutdated)
|
if (task != null && task.fOutdated)
|
||||||
return null;
|
throw new DependsOnOutdatedFileException(request.fTu, task.fIndexFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IndexFileContent fc= fIndexContentCache.get(file);
|
IndexFileContent fc= fIndexContentCache.get(file);
|
||||||
|
|
|
@ -212,10 +212,11 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
* 120.0 - Enumerators in global index, bug 356235
|
* 120.0 - Enumerators in global index, bug 356235
|
||||||
* 120.1 - Specializations of using declarations, bug 357293.
|
* 120.1 - Specializations of using declarations, bug 357293.
|
||||||
* 121.0 - Multiple variants of included header file, bug 197989.
|
* 121.0 - Multiple variants of included header file, bug 197989.
|
||||||
|
* 122.0 - Compacting strings
|
||||||
*/
|
*/
|
||||||
private static final int MIN_SUPPORTED_VERSION= version(121, 0);
|
private static final int MIN_SUPPORTED_VERSION= version(122, 0);
|
||||||
private static final int MAX_SUPPORTED_VERSION= version(121, Short.MAX_VALUE);
|
private static final int MAX_SUPPORTED_VERSION= version(122, Short.MAX_VALUE);
|
||||||
private static final int DEFAULT_VERSION = version(121, 0);
|
private static final int DEFAULT_VERSION = version(122, 0);
|
||||||
|
|
||||||
private static int version(int major, int minor) {
|
private static int version(int major, int minor) {
|
||||||
return (major << 16) + minor;
|
return (major << 16) + minor;
|
||||||
|
|
|
@ -252,15 +252,45 @@ final class Chunk {
|
||||||
fBuffer[++idx]= (byte)(value);
|
fBuffer[++idx]= (byte)(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void putChars(final long offset, char[] chars, int start, int len) {
|
||||||
|
assert fLocked;
|
||||||
|
fDirty= true;
|
||||||
|
int idx= recPtrToIndex(offset)-1;
|
||||||
|
final int end= start+len;
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
char value= chars[i];
|
||||||
|
fBuffer[++idx]= (byte)(value >> 8);
|
||||||
|
fBuffer[++idx]= (byte)(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putCharsAsBytes(final long offset, char[] chars, int start, int len) {
|
||||||
|
assert fLocked;
|
||||||
|
fDirty= true;
|
||||||
|
int idx= recPtrToIndex(offset)-1;
|
||||||
|
final int end= start+len;
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
char value= chars[i];
|
||||||
|
fBuffer[++idx]= (byte)(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public char getChar(final long offset) {
|
public char getChar(final long offset) {
|
||||||
int idx= recPtrToIndex( offset );
|
int idx= recPtrToIndex( offset );
|
||||||
return (char) (((fBuffer[idx] << 8) | (fBuffer[++idx] & 0xff)));
|
return (char) (((fBuffer[idx] << 8) | (fBuffer[++idx] & 0xff)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCharArray(final long offset, final char[] result) {
|
public void getChars(final long offset, final char[] result, int start, int len) {
|
||||||
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
||||||
buf.position(recPtrToIndex( offset ));
|
buf.position(recPtrToIndex( offset ));
|
||||||
buf.asCharBuffer().get(result);
|
buf.asCharBuffer().get(result, start, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCharsFromBytes(final long offset, final char[] result, int start, int len) {
|
||||||
|
final int pos = recPtrToIndex(offset);
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
result[start+i] = (char) (fBuffer[pos+i] & 0xff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear(final long offset, final int length) {
|
void clear(final long offset, final int length) {
|
||||||
|
|
|
@ -530,25 +530,42 @@ public class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IString newString(String string) throws CoreException {
|
public IString newString(String string) throws CoreException {
|
||||||
if (string.length() > ShortString.MAX_LENGTH)
|
return newString(string.toCharArray());
|
||||||
return new LongString(this, string);
|
|
||||||
else
|
|
||||||
return new ShortString(this, string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IString newString(char[] chars) throws CoreException {
|
public IString newString(char[] chars) throws CoreException {
|
||||||
if (chars.length > ShortString.MAX_LENGTH)
|
int len= chars.length;
|
||||||
return new LongString(this, chars);
|
int bytelen;
|
||||||
|
final boolean useBytes = useBytes(chars);
|
||||||
|
if (useBytes) {
|
||||||
|
bytelen= len;
|
||||||
|
} else {
|
||||||
|
bytelen= 2*len;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytelen > ShortString.MAX_BYTE_LENGTH)
|
||||||
|
return new LongString(this, chars, useBytes);
|
||||||
else
|
else
|
||||||
return new ShortString(this, chars);
|
return new ShortString(this, chars, useBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean useBytes(char[] chars) {
|
||||||
|
for (char c : chars) {
|
||||||
|
if ((c & 0xff00) != 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IString getString(long offset) throws CoreException {
|
public IString getString(long offset) throws CoreException {
|
||||||
int length = getInt(offset);
|
final int l = getInt(offset);
|
||||||
if (length > ShortString.MAX_LENGTH)
|
int bytelen= l<0 ? -l : 2*l;
|
||||||
|
if (bytelen > ShortString.MAX_BYTE_LENGTH) {
|
||||||
return new LongString(this, offset);
|
return new LongString(this, offset);
|
||||||
else
|
}
|
||||||
return new ShortString(this, offset);
|
return new ShortString(this, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -48,73 +46,117 @@ public class LongString implements IString {
|
||||||
this.record = record;
|
this.record = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface IWriter {
|
public LongString(Database db, final char[] chars, boolean useBytes) throws CoreException {
|
||||||
public void writeChars(int start, int length, long p) throws CoreException;
|
final int numChars1 = useBytes ? NUM_CHARS1*2 : NUM_CHARS1;
|
||||||
}
|
final int numCharsn = useBytes ? NUM_CHARSN*2 : NUM_CHARSN;
|
||||||
|
|
||||||
private long createString(int length, IWriter writer) throws CoreException {
|
this.db = db;
|
||||||
// write the first record
|
this.record = db.malloc(Database.MAX_MALLOC_SIZE);
|
||||||
long firstRecord = db.malloc(Database.MAX_MALLOC_SIZE);
|
|
||||||
int start = 0;
|
// Write the first record
|
||||||
db.putInt(firstRecord, length);
|
final int length = chars.length;
|
||||||
writer.writeChars(start, NUM_CHARS1, firstRecord + CHARS1);
|
db.putInt(this.record, useBytes ? -length : length);
|
||||||
|
Chunk chunk= db.getChunk(this.record);
|
||||||
|
|
||||||
|
if (useBytes) {
|
||||||
|
chunk.putCharsAsBytes(this.record + CHARS1, chars, 0, numChars1);
|
||||||
|
} else {
|
||||||
|
chunk.putChars(this.record + CHARS1, chars, 0, numChars1);
|
||||||
|
}
|
||||||
|
|
||||||
// write the subsequent records
|
// write the subsequent records
|
||||||
long lastNext = firstRecord + NEXT1;
|
long lastNext = this.record + NEXT1;
|
||||||
start += NUM_CHARS1;
|
int start = numChars1;
|
||||||
while (length - start > NUM_CHARSN) {
|
while (length-start > numCharsn) {
|
||||||
long nextRecord = db.malloc(Database.MAX_MALLOC_SIZE);
|
long nextRecord = db.malloc(Database.MAX_MALLOC_SIZE);
|
||||||
db.putRecPtr(lastNext, nextRecord);
|
db.putRecPtr(lastNext, nextRecord);
|
||||||
writer.writeChars(start, NUM_CHARSN, nextRecord + CHARSN);
|
chunk= db.getChunk(nextRecord);
|
||||||
start += NUM_CHARSN;
|
if (useBytes) {
|
||||||
|
chunk.putCharsAsBytes(nextRecord + CHARSN, chars, start, numCharsn);
|
||||||
|
} else {
|
||||||
|
chunk.putChars(nextRecord + CHARSN, chars, start, numCharsn);
|
||||||
|
}
|
||||||
|
start += numCharsn;
|
||||||
lastNext = nextRecord + NEXTN;
|
lastNext = nextRecord + NEXTN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the final record
|
// Write last record
|
||||||
length -= start;
|
int remaining= length - start;
|
||||||
long finalRecord = db.malloc(CHARSN + (length) * 2);
|
long nextRecord = db.malloc(CHARSN + (useBytes ? remaining : remaining*2));
|
||||||
db.putRecPtr(lastNext, finalRecord);
|
db.putRecPtr(lastNext, nextRecord);
|
||||||
writer.writeChars(start, length, finalRecord + CHARSN);
|
chunk= db.getChunk(nextRecord);
|
||||||
|
if (useBytes) {
|
||||||
return firstRecord;
|
chunk.putCharsAsBytes(nextRecord + CHARSN, chars, start, remaining);
|
||||||
}
|
} else {
|
||||||
|
chunk.putChars(nextRecord + CHARSN, chars, start, remaining);
|
||||||
public LongString(Database db, final String string) throws CoreException {
|
}
|
||||||
this.db = db;
|
|
||||||
this.record = createString(string.length(), new IWriter() {
|
|
||||||
public void writeChars(int start, int length, long p) throws CoreException {
|
|
||||||
for (int i = start; i < start + length; ++i) {
|
|
||||||
LongString.this.db.putChar(p, string.charAt(i));
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongString(Database db, final char[] chars) throws CoreException {
|
|
||||||
this.db = db;
|
|
||||||
this.record = createString(chars.length, new IWriter() {
|
|
||||||
public void writeChars(int start, int length, long p) throws CoreException {
|
|
||||||
for (int i = start; i < start + length; ++i) {
|
|
||||||
LongString.this.db.putChar(p, chars[i]);
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getRecord() {
|
public long getRecord() {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char[] getChars() throws CoreException {
|
||||||
|
int length = db.getInt(record + LENGTH);
|
||||||
|
final boolean useBytes = length < 0;
|
||||||
|
int numChars1 = NUM_CHARS1;
|
||||||
|
int numCharsn = NUM_CHARSN;
|
||||||
|
if (useBytes) {
|
||||||
|
length= -length;
|
||||||
|
numChars1 *= 2;
|
||||||
|
numCharsn *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
final char[] chars = new char[length];
|
||||||
|
|
||||||
|
// First record
|
||||||
|
long p = record;
|
||||||
|
Chunk chunk= db.getChunk(p);
|
||||||
|
if (useBytes) {
|
||||||
|
chunk.getCharsFromBytes(p+CHARS1, chars, 0, numChars1);
|
||||||
|
} else {
|
||||||
|
chunk.getChars(p+CHARS1, chars, 0, numChars1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int start= numChars1;
|
||||||
|
p= record + NEXT1;
|
||||||
|
|
||||||
|
// Other records
|
||||||
|
while (start < length) {
|
||||||
|
p = db.getRecPtr(p);
|
||||||
|
int partLen= Math.min(length-start, numCharsn);
|
||||||
|
chunk= db.getChunk(p);
|
||||||
|
if (useBytes) {
|
||||||
|
chunk.getCharsFromBytes(p+CHARSN, chars, start, partLen);
|
||||||
|
} else {
|
||||||
|
chunk.getChars(p+CHARSN, chars, start, partLen);
|
||||||
|
}
|
||||||
|
start+= partLen;
|
||||||
|
p=p+NEXTN;
|
||||||
|
}
|
||||||
|
return chars;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void delete() throws CoreException {
|
public void delete() throws CoreException {
|
||||||
int length = db.getInt(record + LENGTH) - NUM_CHARS1;
|
int length = db.getInt(record + LENGTH);
|
||||||
|
final boolean useBytes = length < 0;
|
||||||
|
int numChars1 = NUM_CHARS1;
|
||||||
|
int numCharsn = NUM_CHARSN;
|
||||||
|
if (useBytes) {
|
||||||
|
length= -length;
|
||||||
|
numChars1 *= 2;
|
||||||
|
numCharsn *= 2;
|
||||||
|
}
|
||||||
long nextRecord = db.getRecPtr(record + NEXT1);
|
long nextRecord = db.getRecPtr(record + NEXT1);
|
||||||
db.free(record);
|
db.free(record);
|
||||||
|
length-= numChars1;
|
||||||
|
|
||||||
// Middle records
|
// Middle records
|
||||||
while (length > NUM_CHARSN) {
|
while (length > numCharsn) {
|
||||||
length -= NUM_CHARSN;
|
length -= numCharsn;
|
||||||
long nextnext = db.getRecPtr(nextRecord + NEXTN);
|
long nextnext = db.getRecPtr(nextRecord + NEXTN);
|
||||||
db.free(nextRecord);
|
db.free(nextRecord);
|
||||||
nextRecord = nextnext;
|
nextRecord = nextnext;
|
||||||
|
@ -147,19 +189,6 @@ public class LongString implements IString {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class HashCodeComputer implements IReader {
|
|
||||||
private int fHashcode= 0;
|
|
||||||
|
|
||||||
public int getHashcode() {
|
|
||||||
return fHashcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void appendChar(char c) {
|
|
||||||
fHashcode = 31*fHashcode + c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compatible with {@link String#hashCode()}
|
* Compatible with {@link String#hashCode()}
|
||||||
*/
|
*/
|
||||||
|
@ -167,224 +196,53 @@ public class LongString implements IString {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int h = hash;
|
int h = hash;
|
||||||
if (h == 0) {
|
if (h == 0) {
|
||||||
HashCodeComputer hcc;
|
char chars[];
|
||||||
try {
|
try {
|
||||||
int length = db.getInt(record + LENGTH);
|
chars = getChars();
|
||||||
hcc = new HashCodeComputer();
|
final int len = chars.length;
|
||||||
readChars(length, hcc);
|
for (int i = 0; i < len; i++) {
|
||||||
h= hcc.getHashcode();
|
h = 31*h + chars[i];
|
||||||
hash = h;
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
hash = h;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(IString string, boolean caseSensitive) throws CoreException {
|
public int compare(IString string, boolean caseSensitive) throws CoreException {
|
||||||
if (string instanceof LongString)
|
return ShortString.compare(getChars(), string.getChars(), caseSensitive);
|
||||||
return compare((LongString)string, caseSensitive);
|
|
||||||
else if (string instanceof ShortString)
|
|
||||||
return compare((ShortString)string, caseSensitive);
|
|
||||||
else
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compare(char[] other, boolean caseSensitive) throws CoreException {
|
|
||||||
CharIterator i1 = new CharIterator();
|
|
||||||
int i2 = 0;
|
|
||||||
int n2 = other.length;
|
|
||||||
|
|
||||||
while (i1.hasNext() && i2 < n2) {
|
|
||||||
int cmp= ShortString.compareChars(i1.next(), other[i2], caseSensitive);
|
|
||||||
if(cmp!=0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
++i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i1.hasNext() && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1.hasNext())
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compare(ShortString other, boolean caseSensitive) throws CoreException {
|
|
||||||
CharIterator i1 = new CharIterator();
|
|
||||||
int index2 = 0;
|
|
||||||
int length2 = other.getLength();
|
|
||||||
|
|
||||||
while (i1.hasNext() && index2<length2) {
|
|
||||||
int cmp= ShortString.compareChars(i1.next(), other.charAt(index2), caseSensitive);
|
|
||||||
if(cmp!=0)
|
|
||||||
return cmp;
|
|
||||||
index2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i1.hasNext() && index2 != length2)
|
|
||||||
return -1;
|
|
||||||
else if (index2 == length2 && i1.hasNext())
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compare(LongString other, boolean caseSensitive) throws CoreException {
|
|
||||||
CharIterator i1 = new CharIterator();
|
|
||||||
CharIterator i2 = other.new CharIterator();
|
|
||||||
|
|
||||||
while (i1.hasNext() && i2.hasNext()) {
|
|
||||||
int cmp= ShortString.compareChars(i1.next(), i2.next(), caseSensitive);
|
|
||||||
if(cmp!=0)
|
|
||||||
return cmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i1.hasNext() && i2.hasNext())
|
|
||||||
return -1;
|
|
||||||
else if (!i2.hasNext() && i1.hasNext())
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(String other, boolean caseSensitive) throws CoreException {
|
public int compare(String other, boolean caseSensitive) throws CoreException {
|
||||||
CharIterator i1 = new CharIterator();
|
return ShortString.compare(getChars(), other.toCharArray(), caseSensitive);
|
||||||
int i2 = 0;
|
|
||||||
int n2 = other.length();
|
|
||||||
|
|
||||||
while (i1.hasNext() && i2 < n2) {
|
|
||||||
int cmp= ShortString.compareChars(i1.next(), other.charAt(i2), caseSensitive);
|
|
||||||
if(cmp!=0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
++i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i1.hasNext() && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1.hasNext())
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int comparePrefix(char[] other, boolean caseSensitive) throws CoreException {
|
@Override
|
||||||
CharIterator i1 = new CharIterator();
|
public int compare(char[] other, boolean caseSensitive) throws CoreException {
|
||||||
int i2 = 0;
|
return ShortString.compare(getChars(), other, caseSensitive);
|
||||||
int n2 = other.length;
|
|
||||||
|
|
||||||
while (i1.hasNext() && i2 < n2) {
|
|
||||||
int cmp= ShortString.compareChars(i1.next(), other[i2], caseSensitive);
|
|
||||||
if(cmp!=0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
++i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!i1.hasNext() && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface IReader {
|
|
||||||
public void appendChar(char c);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readChars(int length, IReader reader) throws CoreException {
|
|
||||||
// First record
|
|
||||||
long p = record + CHARS1;
|
|
||||||
for (int i = 0; i < NUM_CHARS1; ++i) {
|
|
||||||
reader.appendChar(db.getChar(p));
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
length -= NUM_CHARS1;
|
|
||||||
long nextRecord = db.getRecPtr(record + NEXT1);
|
|
||||||
|
|
||||||
// Middle records
|
|
||||||
while (length > NUM_CHARSN) {
|
|
||||||
p = nextRecord + CHARSN;
|
|
||||||
for (int i = 0; i < NUM_CHARSN; ++i) {
|
|
||||||
reader.appendChar(db.getChar(p));
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
length -= NUM_CHARSN;
|
|
||||||
nextRecord = db.getRecPtr(nextRecord + NEXTN);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Last record
|
|
||||||
p = nextRecord + CHARSN;
|
|
||||||
for (int i = 0; i < length; ++i) {
|
|
||||||
reader.appendChar(db.getChar(p));
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience class for sequential access to LongString characters
|
|
||||||
*/
|
|
||||||
private class CharIterator {
|
|
||||||
long p;
|
|
||||||
int count;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
public CharIterator() throws CoreException {
|
|
||||||
p = record + CHARS1;
|
|
||||||
length = db.getInt(record + LENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public char next() throws CoreException {
|
|
||||||
char result = db.getChar(p);
|
|
||||||
p += 2;
|
|
||||||
count++;
|
|
||||||
if(count>length) {
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
}
|
|
||||||
if(count == NUM_CHARS1) {
|
|
||||||
p = db.getRecPtr(record + NEXT1) + CHARSN;
|
|
||||||
}
|
|
||||||
if(count > NUM_CHARS1 && ((count-NUM_CHARS1) % NUM_CHARSN)==0) {
|
|
||||||
p = db.getRecPtr(p-(NUM_CHARSN*2)-4) + CHARSN;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasNext() {
|
|
||||||
return count<length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] getChars() throws CoreException {
|
|
||||||
int length = db.getInt(record + LENGTH);
|
|
||||||
final char[] chars = new char[length];
|
|
||||||
readChars(length, new IReader() {
|
|
||||||
int cp = 0;
|
|
||||||
public void appendChar(char c) {
|
|
||||||
chars[cp++] = c;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getString() throws CoreException {
|
|
||||||
int length = db.getInt(record + LENGTH);
|
|
||||||
final StringBuilder buffer = new StringBuilder(length);
|
|
||||||
readChars(length, new IReader() {
|
|
||||||
public void appendChar(char c) {
|
|
||||||
buffer.append(c);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return buffer.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
||||||
int cmp= compare(string, false);
|
return ShortString.compareCompatibleWithIgnoreCase(getChars(), string.getChars());
|
||||||
return cmp==0 ? compare(string, true) : cmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareCompatibleWithIgnoreCase(char[] chars) throws CoreException {
|
@Override
|
||||||
int cmp= compare(chars, false);
|
public int comparePrefix(char[] other, boolean caseSensitive) throws CoreException {
|
||||||
return cmp==0 ? compare(chars, true) : cmp;
|
return ShortString.comparePrefix(getChars(), other, caseSensitive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getString() throws CoreException {
|
||||||
|
return new String(getChars());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareCompatibleWithIgnoreCase(char[] other) throws CoreException {
|
||||||
|
return ShortString.compareCompatibleWithIgnoreCase(getChars(), other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2009 QNX Software Systems and others.
|
* Copyright (c) 2006, 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
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,57 +29,53 @@ public class ShortString implements IString {
|
||||||
private static final int LENGTH = 0;
|
private static final int LENGTH = 0;
|
||||||
private static final int CHARS = 4;
|
private static final int CHARS = 4;
|
||||||
|
|
||||||
public static final int MAX_LENGTH = (Database.MAX_MALLOC_SIZE - CHARS) / 2;
|
public static final int MAX_BYTE_LENGTH = Database.MAX_MALLOC_SIZE - CHARS;
|
||||||
|
|
||||||
public ShortString(Database db, long offset) {
|
public ShortString(Database db, long offset) {
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.record = offset;
|
this.record = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShortString(Database db, char[] chars) throws CoreException {
|
public ShortString(Database db, char[] chars, boolean useBytes) throws CoreException {
|
||||||
|
final int n = chars.length;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.record = db.malloc(CHARS + chars.length * 2);
|
|
||||||
|
|
||||||
|
this.record = db.malloc(CHARS + (useBytes ? n : 2*n));
|
||||||
Chunk chunk = db.getChunk(record);
|
Chunk chunk = db.getChunk(record);
|
||||||
chunk.putInt(record + LENGTH, (char)chars.length);
|
chunk.putInt(record + LENGTH, useBytes ? -n : n);
|
||||||
int n = chars.length;
|
|
||||||
long p = record + CHARS;
|
long p = record + CHARS;
|
||||||
for (int i = 0; i < n; ++i) {
|
if (useBytes) {
|
||||||
chunk.putChar(p, chars[i]);
|
chunk.putCharsAsBytes(p, chars, 0, n);
|
||||||
p += 2;
|
} else {
|
||||||
}
|
chunk.putChars(p, chars, 0, n);
|
||||||
}
|
|
||||||
|
|
||||||
public ShortString(Database db, String string) throws CoreException {
|
|
||||||
this.db = db;
|
|
||||||
this.record = db.malloc(CHARS + string.length() * 2);
|
|
||||||
|
|
||||||
Chunk chunk = db.getChunk(record);
|
|
||||||
chunk.putInt(record + LENGTH, string.length());
|
|
||||||
int n = string.length();
|
|
||||||
long p = record + CHARS;
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
chunk.putChar(p, string.charAt(i));
|
|
||||||
p += 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getRecord() {
|
public long getRecord() {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void delete() throws CoreException {
|
public void delete() throws CoreException {
|
||||||
db.free(record);
|
db.free(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] getChars() throws CoreException {
|
public char[] getChars() throws CoreException {
|
||||||
Chunk chunk = db.getChunk(record);
|
final Chunk chunk = db.getChunk(record);
|
||||||
int length = chunk.getInt(record + LENGTH);
|
final int l = chunk.getInt(record + LENGTH);
|
||||||
char[] chars = new char[length];
|
final int length = Math.abs(l);
|
||||||
chunk.getCharArray(record + CHARS, chars);
|
final char[] chars = new char[length];
|
||||||
|
if (l < 0) {
|
||||||
|
chunk.getCharsFromBytes(record + CHARS, chars, 0, length);
|
||||||
|
} else {
|
||||||
|
chunk.getChars(record + CHARS, chars, 0, length);
|
||||||
|
}
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getString() throws CoreException {
|
public String getString() throws CoreException {
|
||||||
return new String(getChars());
|
return new String(getChars());
|
||||||
}
|
}
|
||||||
|
@ -102,49 +99,22 @@ public class ShortString implements IString {
|
||||||
if (n1 != n2)
|
if (n1 != n2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
long p1 = record + CHARS;
|
return CharArrayUtils.equals(getChars(), string.getChars());
|
||||||
long p2 = string.record + CHARS;
|
}
|
||||||
for (int i = 0; i < n1; ++i) {
|
if (obj instanceof char[]) {
|
||||||
if (chunk1.getChar(p1) != chunk2.getChar(p2))
|
|
||||||
return false;
|
|
||||||
p1 += 2;
|
|
||||||
p2 += 2;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (obj instanceof char[]) {
|
|
||||||
char[] chars = (char[])obj;
|
char[] chars = (char[])obj;
|
||||||
Chunk chunk = db.getChunk(record);
|
|
||||||
|
|
||||||
// Make sure size is the same
|
// Make sure size is the same
|
||||||
int n = chunk.getInt(record);
|
if (getLength() != chars.length)
|
||||||
if (n != chars.length)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check each character
|
return CharArrayUtils.equals(getChars(), chars);
|
||||||
long p = record + CHARS;
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
if (chunk.getChar(p) != chars[i])
|
|
||||||
return false;
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (obj instanceof String) {
|
} else if (obj instanceof String) {
|
||||||
String string = (String)obj;
|
String string = (String)obj;
|
||||||
Chunk chunk = db.getChunk(record);
|
if (getLength() != string.length())
|
||||||
|
|
||||||
// Make sure size is the same
|
|
||||||
int n = chunk.getInt(record);
|
|
||||||
if (n != string.length())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check each character
|
return CharArrayUtils.equals(getChars(), string.toCharArray());
|
||||||
long p = record + CHARS;
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
if (chunk.getChar(p) != string.charAt(i))
|
|
||||||
return false;
|
|
||||||
p += 2;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
@ -173,112 +143,48 @@ public class ShortString implements IString {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int compare(final char[] chars, char[] other, boolean caseSensitive) {
|
||||||
|
final int n = Math.min(chars.length, other.length);
|
||||||
|
for (int i=0; i<n; i++) {
|
||||||
|
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
||||||
|
if (cmp != 0)
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
return chars.length - other.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(char[] other, boolean caseSensitive) throws CoreException {
|
public int compare(char[] other, boolean caseSensitive) throws CoreException {
|
||||||
Chunk chunk = db.getChunk(record);
|
return compare(getChars(), other, caseSensitive);
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
|
||||||
int i2 = 0;
|
|
||||||
long n1 = i1 + chunk.getInt(record + LENGTH) * 2;
|
|
||||||
int n2 = other.length;
|
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
|
||||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
|
||||||
if (cmp != 0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
++i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i1 == n1 && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1 != n1)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(IString string, boolean caseSensitive) throws CoreException {
|
public int compare(IString string, boolean caseSensitive) throws CoreException {
|
||||||
if (string instanceof ShortString)
|
return compare(getChars(), string.getChars(), caseSensitive);
|
||||||
return compare((ShortString)string, caseSensitive);
|
|
||||||
else if (string instanceof LongString)
|
|
||||||
return - ((LongString)string).compare(this, caseSensitive);
|
|
||||||
else
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compare(ShortString other, boolean caseSensitive) throws CoreException {
|
|
||||||
Chunk chunk1 = db.getChunk(record);
|
|
||||||
Chunk chunk2 = other.db.getChunk(other.record);
|
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
|
||||||
long i2 = other.record + CHARS;
|
|
||||||
long n1 = i1 + chunk1.getInt(record + LENGTH) * 2;
|
|
||||||
long n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2;
|
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
|
||||||
int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive);
|
|
||||||
if (cmp != 0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
i2 += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i1 == n1 && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1 != n1)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(String other, boolean caseSensitive) throws CoreException {
|
public int compare(String other, boolean caseSensitive) throws CoreException {
|
||||||
Chunk chunk = db.getChunk(record);
|
return compare(getChars(), other.toCharArray(), caseSensitive);
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
|
||||||
int i2 = 0;
|
|
||||||
long n1 = i1 + chunk.getInt(record + LENGTH) * 2;
|
|
||||||
int n2 = other.length();
|
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
|
||||||
int cmp= compareChars(chunk.getChar(i1), other.charAt(i2), caseSensitive);
|
|
||||||
if (cmp != 0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
++i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i1 == n1 && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1 != n1)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
public int compareCompatibleWithIgnoreCase(IString string) throws CoreException {
|
||||||
if (string instanceof ShortString)
|
return compareCompatibleWithIgnoreCase(string.getChars());
|
||||||
return compareCompatibleWithIgnoreCase((ShortString)string);
|
|
||||||
else if (string instanceof LongString)
|
|
||||||
return - ((LongString)string).compareCompatibleWithIgnoreCase(this);
|
|
||||||
else
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareCompatibleWithIgnoreCase(ShortString other) throws CoreException {
|
@Override
|
||||||
Chunk chunk1 = db.getChunk(record);
|
public int compareCompatibleWithIgnoreCase(char[] other) throws CoreException {
|
||||||
Chunk chunk2 = other.db.getChunk(other.record);
|
return compareCompatibleWithIgnoreCase(getChars(), other);
|
||||||
|
}
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
public static int compareCompatibleWithIgnoreCase(final char[] chars, char[] other) {
|
||||||
long i2 = other.record + CHARS;
|
final int n = Math.min(chars.length, other.length);
|
||||||
long n1 = i1 + chunk1.getInt(record + LENGTH) * 2;
|
|
||||||
long n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2;
|
|
||||||
int sensitiveCmp= 0;
|
int sensitiveCmp= 0;
|
||||||
while (i1 < n1 && i2 < n2) {
|
|
||||||
final char c1= chunk1.getChar(i1);
|
for (int i=0; i<n; i++) {
|
||||||
final char c2= chunk2.getChar(i2);
|
final char c1= chars[i];
|
||||||
|
final char c2= other[i];
|
||||||
if (c1 != c2) {
|
if (c1 != c2) {
|
||||||
int cmp= compareChars(c1, c2, false); // insensitive
|
int cmp= compareChars(c1, c2, false); // insensitive
|
||||||
if (cmp != 0)
|
if (cmp != 0)
|
||||||
|
@ -287,93 +193,40 @@ public class ShortString implements IString {
|
||||||
if (sensitiveCmp == 0) {
|
if (sensitiveCmp == 0) {
|
||||||
if (c1 < c2) {
|
if (c1 < c2) {
|
||||||
sensitiveCmp= -1;
|
sensitiveCmp= -1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sensitiveCmp= 1;
|
sensitiveCmp= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
i2 += 2;
|
|
||||||
}
|
}
|
||||||
|
int cmp= chars.length - other.length;
|
||||||
if (i1 == n1 && i2 != n2)
|
if (cmp != 0)
|
||||||
return -1;
|
return cmp;
|
||||||
else if (i2 == n2 && i1 != n1)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return sensitiveCmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compareCompatibleWithIgnoreCase(char[] chars) throws CoreException {
|
|
||||||
Chunk chunk1 = db.getChunk(record);
|
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
|
||||||
int i2 = 0;
|
|
||||||
long n1 = i1 + chunk1.getInt(record + LENGTH) * 2;
|
|
||||||
int n2 = chars.length;
|
|
||||||
int sensitiveCmp= 0;
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
|
||||||
final char c1= chunk1.getChar(i1);
|
|
||||||
final char c2= chars[i2];
|
|
||||||
if (c1 != c2) {
|
|
||||||
int cmp= compareChars(c1, c2, false); // insensitive
|
|
||||||
if (cmp != 0)
|
|
||||||
return cmp;
|
|
||||||
|
|
||||||
if (sensitiveCmp == 0) {
|
|
||||||
if (c1 < c2) {
|
|
||||||
sensitiveCmp= -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sensitiveCmp= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
i2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i1 == n1 && i2 != n2)
|
|
||||||
return -1;
|
|
||||||
else if (i2 == n2 && i1 != n1)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return sensitiveCmp;
|
return sensitiveCmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int comparePrefix(char[] other, boolean caseSensitive) throws CoreException {
|
public int comparePrefix(char[] other, boolean caseSensitive) throws CoreException {
|
||||||
Chunk chunk = db.getChunk(record);
|
return comparePrefix(getChars(), other, caseSensitive);
|
||||||
|
}
|
||||||
|
|
||||||
long i1 = record + CHARS;
|
public static int comparePrefix(final char[] chars, char[] other, boolean caseSensitive) {
|
||||||
int i2 = 0;
|
final int n = Math.min(chars.length, other.length);
|
||||||
long n1 = i1 + chunk.getInt(record + LENGTH) * 2;
|
|
||||||
int n2 = other.length;
|
|
||||||
|
|
||||||
while (i1 < n1 && i2 < n2) {
|
for (int i=0; i<n; i++) {
|
||||||
int cmp= compareChars(chunk.getChar(i1), other[i2], caseSensitive);
|
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
||||||
if (cmp != 0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
i1 += 2;
|
|
||||||
++i2;
|
|
||||||
}
|
}
|
||||||
|
if (chars.length < other.length)
|
||||||
if (i1 == n1 && i2 != n2)
|
|
||||||
return -1;
|
return -1;
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char charAt(int i) throws CoreException {
|
public final int getLength() throws CoreException {
|
||||||
long ptr = record + CHARS + (i * 2);
|
return Math.abs(db.getInt(record + LENGTH));
|
||||||
return db.getChar(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLength() throws CoreException {
|
|
||||||
return db.getInt(record + LENGTH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE;
|
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
try {
|
try {
|
||||||
|
@ -209,7 +210,8 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
getDB().putRecPtr(record + FIRST_PARTIAL, partial.getRecord());
|
getDB().putRecPtr(record + FIRST_PARTIAL, partial.getRecord());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
try {
|
try {
|
||||||
ArrayList<PDOMCPPClassTemplatePartialSpecialization> partials =
|
ArrayList<PDOMCPPClassTemplatePartialSpecialization> partials =
|
||||||
new ArrayList<PDOMCPPClassTemplatePartialSpecialization>();
|
new ArrayList<PDOMCPPClassTemplatePartialSpecialization>();
|
||||||
|
@ -262,18 +264,22 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner());
|
return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
return PDOMInstanceCache.getCache(this).getInstance(arguments);
|
return PDOMInstanceCache.getCache(this).getInstance(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
PDOMInstanceCache.getCache(this).addInstance(arguments, instance);
|
PDOMInstanceCache.getCache(this).addInstance(arguments, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
return PDOMInstanceCache.getCache(this).getAllInstances();
|
return PDOMInstanceCache.getCache(this).getAllInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
// Template parameters are identified by their position in the parameter list.
|
// Template parameters are identified by their position in the parameter list.
|
||||||
int pos = param.getParameterPosition();
|
int pos = param.getParameterPosition();
|
||||||
|
@ -296,6 +302,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
|
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
|
||||||
synchronized (cache) {
|
synchronized (cache) {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
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.DOMException;
|
|
||||||
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.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
|
@ -67,7 +66,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +101,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, rhs);
|
return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassTemplate getPrimaryClassTemplate() {
|
public ICPPClassTemplate getPrimaryClassTemplate() {
|
||||||
if (fPrimaryTemplate == null) {
|
if (fPrimaryTemplate == null) {
|
||||||
try {
|
try {
|
||||||
|
@ -114,6 +114,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
return fPrimaryTemplate;
|
return fPrimaryTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException {
|
public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException {
|
||||||
final Database db = getPDOM().getDB();
|
final Database db = getPDOM().getDB();
|
||||||
long oldRec = db.getRecPtr(record+ARGUMENTS);
|
long oldRec = db.getRecPtr(record+ARGUMENTS);
|
||||||
|
@ -124,6 +125,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateArgument[] getTemplateArguments() {
|
public ICPPTemplateArgument[] getTemplateArguments() {
|
||||||
try {
|
try {
|
||||||
final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS);
|
final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS);
|
||||||
|
@ -134,6 +136,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IType[] getArguments() {
|
public IType[] getArguments() {
|
||||||
return CPPTemplates.getArguments(getTemplateArguments());
|
return CPPTemplates.getArguments(getTemplateArguments());
|
||||||
|
|
|
@ -64,19 +64,23 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
|
||||||
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE_SPECIALIZATION;
|
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE_SPECIALIZATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
ICPPClassTemplate template = (ICPPClassTemplate) getSpecializedBinding();
|
ICPPClassTemplate template = (ICPPClassTemplate) getSpecializedBinding();
|
||||||
return template.getTemplateParameters();
|
return template.getTemplateParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
return PDOMInstanceCache.getCache(this).getInstance(arguments);
|
return PDOMInstanceCache.getCache(this).getInstance(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
|
||||||
PDOMInstanceCache.getCache(this).addInstance(arguments, instance);
|
PDOMInstanceCache.getCache(this).addInstance(arguments, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPTemplateInstance[] getAllInstances() {
|
public ICPPTemplateInstance[] getAllInstances() {
|
||||||
return PDOMInstanceCache.getCache(this).getAllInstances();
|
return PDOMInstanceCache.getCache(this).getAllInstances();
|
||||||
}
|
}
|
||||||
|
@ -153,7 +157,8 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
|
||||||
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
|
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
@Override
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
||||||
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
||||||
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
||||||
|
@ -163,6 +168,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
|
||||||
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
|
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
|
||||||
synchronized (cache) {
|
synchronized (cache) {
|
||||||
|
|
|
@ -2623,61 +2623,91 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
return formatOverloadedLeftShiftChain(node);
|
return formatOverloadedLeftShiftChain(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To improve speed of the algorithm we flatten homogeneous nested binary expressions
|
||||||
|
// to reduce overall depth of the expression tree.
|
||||||
|
List<IASTExpression> operands = getOperandsOfMultiExpression(node);
|
||||||
|
|
||||||
Runnable tailFormatter = endsWithMacroExpansion(node) ? null : scribe.takeTailFormatter();
|
Runnable tailFormatter = endsWithMacroExpansion(node) ? null : scribe.takeTailFormatter();
|
||||||
|
|
||||||
Alignment expressionAlignment= scribe.createAlignment(
|
Alignment alignment= scribe.createAlignment(
|
||||||
Alignment.BINARY_EXPRESSION,
|
Alignment.BINARY_EXPRESSION,
|
||||||
preferences.alignment_for_binary_expression,
|
preferences.alignment_for_binary_expression,
|
||||||
Alignment.R_OUTERMOST,
|
Alignment.R_OUTERMOST,
|
||||||
2,
|
operands.size(),
|
||||||
scribe.scanner.getCurrentPosition());
|
scribe.scanner.getCurrentPosition());
|
||||||
|
|
||||||
scribe.enterAlignment(expressionAlignment);
|
scribe.enterAlignment(alignment);
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
final IASTExpression op1= node.getOperand1();
|
for (int i = 0; i < operands.size(); i++) {
|
||||||
// Left operand
|
final IASTExpression operand = operands.get(i);
|
||||||
op1.accept(this);
|
// In case of macros we may have already passed the operator position.
|
||||||
scribe.printTrailingComment();
|
if (i > 0 && scribe.scanner.getCurrentPosition() < operand.getFileLocation().getNodeOffset()) {
|
||||||
|
scribe.alignFragment(alignment, i);
|
||||||
|
|
||||||
// In case of macros we may have already passed the operator position.
|
// Operator
|
||||||
if (scribe.scanner.getCurrentPosition() < node.getOperand2().getFileLocation().getNodeOffset()) {
|
final int nextToken= peekNextToken();
|
||||||
scribe.alignFragment(expressionAlignment, 1);
|
// In case of C++ alternative operators, like 'and', 'or', etc. a space
|
||||||
|
boolean forceSpace= Character.isJavaIdentifierStart(peekNextChar());
|
||||||
|
|
||||||
// Operator
|
switch (node.getOperator()) {
|
||||||
final int nextToken= peekNextToken();
|
case IASTBinaryExpression.op_pmdot:
|
||||||
// In case of C++ alternative operators, like 'and', 'not', etc. a space
|
case IASTBinaryExpression.op_pmarrow:
|
||||||
boolean forceSpace= Character.isJavaIdentifierStart(peekNextChar());
|
scribe.printNextToken(nextToken, false);
|
||||||
|
break;
|
||||||
|
|
||||||
switch (node.getOperator()) {
|
default:
|
||||||
case IASTBinaryExpression.op_pmdot:
|
scribe.printNextToken(nextToken, forceSpace || preferences.insert_space_before_binary_operator);
|
||||||
case IASTBinaryExpression.op_pmarrow:
|
if (forceSpace || preferences.insert_space_after_binary_operator) {
|
||||||
scribe.printNextToken(nextToken, false);
|
scribe.space();
|
||||||
break;
|
}
|
||||||
default:
|
}
|
||||||
scribe.printNextToken(nextToken, forceSpace || preferences.insert_space_before_binary_operator);
|
scribe.printTrailingComment();
|
||||||
if (forceSpace || preferences.insert_space_after_binary_operator) {
|
}
|
||||||
scribe.space();
|
if (i == alignment.fragmentCount - 1) {
|
||||||
}
|
scribe.setTailFormatter(tailFormatter);
|
||||||
}
|
}
|
||||||
}
|
operand.accept(this);
|
||||||
|
scribe.restartAtOffset(getNodeEndLocation(operand));
|
||||||
|
scribe.printTrailingComment();
|
||||||
|
}
|
||||||
|
|
||||||
// Right operand
|
scribe.runTailFormatter();
|
||||||
final IASTExpression op2= node.getOperand2();
|
|
||||||
op2.accept(this);
|
|
||||||
|
|
||||||
if (tailFormatter != null)
|
|
||||||
tailFormatter.run();
|
|
||||||
ok = true;
|
ok = true;
|
||||||
} catch (AlignmentException e) {
|
} catch (AlignmentException e) {
|
||||||
scribe.redoAlignment(e);
|
scribe.redoAlignment(e);
|
||||||
}
|
}
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
scribe.exitAlignment(expressionAlignment, true);
|
scribe.exitAlignment(alignment, true);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traverses a chain of nested homogeneous left-to-right-associative binary expressions and
|
||||||
|
* returns a list of their operands in left-to-right order. For example, for the expression
|
||||||
|
* a + b * c + d, it will return a list containing expressions: a, b * c, and d.
|
||||||
|
*
|
||||||
|
* @param binaryExpression the top-level binary expression
|
||||||
|
* @return a list of expression operands from left to right
|
||||||
|
*/
|
||||||
|
private List<IASTExpression> getOperandsOfMultiExpression(IASTBinaryExpression binaryExpression) {
|
||||||
|
int operator = binaryExpression.getOperator();
|
||||||
|
List<IASTExpression> operands = new ArrayList<IASTExpression>(2);
|
||||||
|
IASTExpression node;
|
||||||
|
do {
|
||||||
|
operands.add(binaryExpression.getOperand2());
|
||||||
|
node = binaryExpression.getOperand1();
|
||||||
|
if (!(node instanceof IASTBinaryExpression)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
binaryExpression = (IASTBinaryExpression) node;
|
||||||
|
} while (binaryExpression.getOperator() == operator);
|
||||||
|
operands.add(node);
|
||||||
|
Collections.reverse(operands);
|
||||||
|
return operands;
|
||||||
|
}
|
||||||
|
|
||||||
private int formatAssignment(IASTBinaryExpression node) {
|
private int formatAssignment(IASTBinaryExpression node) {
|
||||||
Runnable tailFormatter = scribe.takeTailFormatter();
|
Runnable tailFormatter = scribe.takeTailFormatter();
|
||||||
final IASTExpression op1= node.getOperand1();
|
final IASTExpression op1= node.getOperand1();
|
||||||
|
|
|
@ -311,7 +311,7 @@ public class Alignment {
|
||||||
this.fragmentIndentations[i] = this.breakIndentationLevel;
|
this.fragmentIndentations[i] = this.breakIndentationLevel;
|
||||||
return wasSplit = true;
|
return wasSplit = true;
|
||||||
}
|
}
|
||||||
} while (--i >= 0);
|
} while ((this.fragmentBreaks[i] != BREAK || (this.mode & M_INDENT_ON_COLUMN) != 0) && --i >= 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* # aligned fragment
|
/* # aligned fragment
|
||||||
|
|
|
@ -29,4 +29,4 @@ ProcessRunner.argumentsMismatch=Argument type mismatch:
|
||||||
ProcessRunner.error=-->Error:
|
ProcessRunner.error=-->Error:
|
||||||
ProcessRunner.success=-->Success:
|
ProcessRunner.success=-->Success:
|
||||||
ProcessRunner.info=-->Info:
|
ProcessRunner.info=-->Info:
|
||||||
ProcessHelper.fileNotFound=File not found:
|
ProcessHelper.fileNotFound=File not found: ''{0}''
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
* Mark Espiritu (VastSystems) - bug 215283
|
* Mark Espiritu (VastSystems) - bug 215283
|
||||||
|
* Raphael Zulliger (Indel AG) - [367482] fixed resource leak
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.templateengine.process;
|
package org.eclipse.cdt.core.templateengine.process;
|
||||||
|
|
||||||
|
@ -20,7 +21,6 @@ import java.io.InputStreamReader;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -29,9 +29,10 @@ import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as Helper class for process the processes i.e., copy, replace and append
|
* Acts as helper class for process the processes i.e., copy, replace and append files.
|
||||||
* files.
|
|
||||||
*/
|
*/
|
||||||
public class ProcessHelper {
|
public class ProcessHelper {
|
||||||
public static final String CONDITION = "condition"; //$NON-NLS-1$
|
public static final String CONDITION = "condition"; //$NON-NLS-1$
|
||||||
|
@ -45,15 +46,15 @@ public class ProcessHelper {
|
||||||
*
|
*
|
||||||
* @param fileContents contents which are appended to the file.
|
* @param fileContents contents which are appended to the file.
|
||||||
* @param toFile a file to append contents.
|
* @param toFile a file to append contents.
|
||||||
* @throws IOException,
|
* @throws IOException exception while writing contents into a file
|
||||||
* exception while writing contents into a file
|
|
||||||
*
|
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static void appendFile(String fileContents, File toFile) throws IOException {
|
public static void appendFile(String fileContents, File toFile) throws IOException {
|
||||||
RandomAccessFile raf = null;
|
RandomAccessFile raf = null;
|
||||||
if (!toFile.exists()) {
|
if (!toFile.exists()) {
|
||||||
throw new FileNotFoundException(" The specified destination file does not exists "); //$NON-NLS-1$
|
throw new FileNotFoundException(MessageFormat.format(
|
||||||
|
TemplateEngineMessages.getString("ProcessHelper.fileNotFound"), //$NON-NLS-1$
|
||||||
|
toFile.getPath()));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
raf = new RandomAccessFile(toFile, "rw"); //$NON-NLS-1$
|
raf = new RandomAccessFile(toFile, "rw"); //$NON-NLS-1$
|
||||||
|
@ -69,7 +70,7 @@ public class ProcessHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns a vector of all replace marker strings. (e.g.,
|
* This method returns a vector of all replace marker strings. (e.g.,
|
||||||
* $(item), vector contains 'item' as one item. , ) is the end pattern.
|
* $(item), vector contains 'item' as one item) is the end pattern.
|
||||||
*
|
*
|
||||||
* @param str A given string possibly containing markers.
|
* @param str A given string possibly containing markers.
|
||||||
* @return the set of names occurring within markers
|
* @return the set of names occurring within markers
|
||||||
|
@ -77,14 +78,16 @@ public class ProcessHelper {
|
||||||
*/
|
*/
|
||||||
public static Set<String> getReplaceKeys(String str) {
|
public static Set<String> getReplaceKeys(String str) {
|
||||||
Set<String> replaceStrings = new HashSet<String>();
|
Set<String> replaceStrings = new HashSet<String>();
|
||||||
int start= 0, end= 0;
|
int start= 0;
|
||||||
|
int end= 0;
|
||||||
while ((start = str.indexOf(START_PATTERN, start)) >= 0) {
|
while ((start = str.indexOf(START_PATTERN, start)) >= 0) {
|
||||||
end = str.indexOf(END_PATTERN, start);
|
end = str.indexOf(END_PATTERN, start);
|
||||||
if (end != -1) {
|
if (end != -1) {
|
||||||
replaceStrings.add(str.substring(start + START_PATTERN.length(), end));
|
replaceStrings.add(str.substring(start + START_PATTERN.length(), end));
|
||||||
start = end + END_PATTERN.length();
|
start = end + END_PATTERN.length();
|
||||||
} else
|
} else {
|
||||||
start++;
|
start++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return replaceStrings;
|
return replaceStrings;
|
||||||
}
|
}
|
||||||
|
@ -93,19 +96,18 @@ public class ProcessHelper {
|
||||||
* This method takes a URL as parameter to read the contents, and to add
|
* This method takes a URL as parameter to read the contents, and to add
|
||||||
* into a string buffer.
|
* into a string buffer.
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source URL to read the contents.
|
||||||
* URL to read the contents.
|
* @return string contents of a file specified in the URL source path.
|
||||||
* @return string, contents of a file specified in the URL source path.
|
|
||||||
* @throws IOException
|
|
||||||
*
|
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static String readFromFile(URL source) throws IOException {
|
public static String readFromFile(URL source) throws IOException {
|
||||||
char[] chars = new char[4092];
|
char[] chars = new char[4092];
|
||||||
InputStreamReader contentsReader = null;
|
InputStreamReader contentsReader = null;
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuilder buffer = new StringBuilder();
|
||||||
if (!new java.io.File(source.getFile()).exists()) {
|
if (!new java.io.File(source.getFile()).exists()) {
|
||||||
throw new FileNotFoundException(TemplateEngineMessages.getString("ProcessHelper.fileNotFound") + source.getFile()); //$NON-NLS-1$
|
throw new FileNotFoundException(MessageFormat.format(
|
||||||
|
TemplateEngineMessages.getString("ProcessHelper.fileNotFound"), //$NON-NLS-1$
|
||||||
|
source.getFile()));
|
||||||
} else {
|
} else {
|
||||||
contentsReader = new InputStreamReader(source.openStream());
|
contentsReader = new InputStreamReader(source.openStream());
|
||||||
int c;
|
int c;
|
||||||
|
@ -124,12 +126,8 @@ public class ProcessHelper {
|
||||||
* This method reads contents from source, and writes the contents into
|
* This method reads contents from source, and writes the contents into
|
||||||
* destination file.
|
* destination file.
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source URL to read the contents.
|
||||||
* URL to read the contents.
|
* @param dest destination file to write the contents.
|
||||||
* @param dest
|
|
||||||
* destination file to write the contents.
|
|
||||||
* @throws IOException
|
|
||||||
*
|
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static void copyBinaryFile(URL source, File dest) throws IOException {
|
public static void copyBinaryFile(URL source, File dest) throws IOException {
|
||||||
|
@ -137,22 +135,30 @@ public class ProcessHelper {
|
||||||
if (source != null && dest != null) {
|
if (source != null && dest != null) {
|
||||||
File file = new File(source.getFile());
|
File file = new File(source.getFile());
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream in = null;
|
||||||
FileOutputStream fos = new FileOutputStream(dest);
|
FileOutputStream out = null;
|
||||||
int ch;
|
try {
|
||||||
while (true) {
|
in = new FileInputStream(file);
|
||||||
ch = fis.read(bytes);
|
out = new FileOutputStream(dest);
|
||||||
if (ch == -1) {
|
int len;
|
||||||
break;
|
while ((len = in.read(bytes)) != -1) {
|
||||||
|
out.write(bytes, 0, len);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (in != null)
|
||||||
|
in.close();
|
||||||
|
} finally {
|
||||||
|
if (out != null)
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
fos.write(bytes, 0, ch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method Creates the Directories in the parent Folder.
|
* This method creates the directories in the parent folder.
|
||||||
* @param projectHandle
|
* @param projectHandle
|
||||||
* @param parentFolder
|
* @param parentFolder
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -169,18 +175,17 @@ public class ProcessHelper {
|
||||||
parentFolder.create(true, true, null);
|
parentFolder.create(true, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
* @param macros
|
* @param macros
|
||||||
* @param valueStore
|
* @param valueStore
|
||||||
* @return the Macro Value after expanding the Macros.
|
* @return the macro value after expanding the macros.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static String getValueAfterExpandingMacros(String string, Set<String> macros, Map<String, String> valueStore) {
|
public static String getValueAfterExpandingMacros(String string, Set<String> macros,
|
||||||
for (Iterator<String> i = macros.iterator(); i.hasNext();) {
|
Map<String, String> valueStore) {
|
||||||
String key = i.next();
|
for (String key : macros) {
|
||||||
String value = valueStore.get(key);
|
String value = valueStore.get(key);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
string = string.replace(START_PATTERN + key + END_PATTERN, value);
|
string = string.replace(START_PATTERN + key + END_PATTERN, value);
|
||||||
|
|
|
@ -467,14 +467,14 @@ public:
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSystemId() const {
|
|
||||||
return systemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setName(char* name) {
|
void setName(char* name) {
|
||||||
this->name = name;
|
this->name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getSystemId() const {
|
||||||
|
return systemId;
|
||||||
|
}
|
||||||
|
|
||||||
void setSystemId(int systemId) {
|
void setSystemId(int systemId) {
|
||||||
this->systemId = systemId;
|
this->systemId = systemId;
|
||||||
}
|
}
|
||||||
|
@ -542,14 +542,14 @@ public:
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isOk() const {
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setI(int i) {
|
void setI(int i) {
|
||||||
this->i = i;
|
this->i = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isOk() const {
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
void setOk(bool ok) {
|
void setOk(bool ok) {
|
||||||
this->ok = ok;
|
this->ok = ok;
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1173,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* A_H_ */
|
#endif /* A_H_ */
|
||||||
|
|
||||||
//=
|
//=
|
||||||
#ifndef A_H_
|
#ifndef A_H_
|
||||||
#define A_H_
|
#define A_H_
|
||||||
|
@ -1195,9 +1194,7 @@ inline void Person::setId(int id) {
|
||||||
this->id = id;
|
this->id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* A_H_ */
|
#endif /* A_H_ */
|
||||||
|
|
||||||
//!No Methods Separate Definition
|
//!No Methods Separate Definition
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -1248,7 +1245,6 @@ inline void test::setI(int i) {
|
||||||
this->i = i;
|
this->i = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* TEST_H_ */
|
#endif /* TEST_H_ */
|
||||||
//!Bug 323780 "Generate Getters and Setters..." crashes
|
//!Bug 323780 "Generate Getters and Setters..." crashes
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
||||||
|
@ -1349,7 +1345,6 @@ public:
|
||||||
//@Test.cxx
|
//@Test.cxx
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
int Test::getTestField() const {
|
int Test::getTestField() const {
|
||||||
return testField;
|
return testField;
|
||||||
}
|
}
|
||||||
|
@ -1390,7 +1385,6 @@ public:
|
||||||
//@component_b/implementation/Test.cpp
|
//@component_b/implementation/Test.cpp
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
int Test::getTestField() const {
|
int Test::getTestField() const {
|
||||||
return testField;
|
return testField;
|
||||||
}
|
}
|
||||||
|
@ -1451,7 +1445,7 @@ public:
|
||||||
int test;
|
int test;
|
||||||
};
|
};
|
||||||
#endif /* A_H_ */
|
#endif /* A_H_ */
|
||||||
//!Bug ??? - Getter for an array field
|
//!Bug 319278 - Getter for an array field
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -1479,3 +1473,36 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif /* A_H_ */
|
#endif /* A_H_ */
|
||||||
|
//!Bug 352258 - Avoiding reserved names
|
||||||
|
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
|
||||||
|
//@.config
|
||||||
|
filename=A.h
|
||||||
|
getters=mClass
|
||||||
|
setters=mClass
|
||||||
|
//@A.h
|
||||||
|
#ifndef A_H_
|
||||||
|
#define A_H_
|
||||||
|
|
||||||
|
class getClass {
|
||||||
|
private:
|
||||||
|
int /*$*/mClass/*$$*/;
|
||||||
|
};
|
||||||
|
#endif /* A_H_ */
|
||||||
|
//=
|
||||||
|
#ifndef A_H_
|
||||||
|
#define A_H_
|
||||||
|
|
||||||
|
class getClass {
|
||||||
|
private:
|
||||||
|
int mClass;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int getClass1() const {
|
||||||
|
return mClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setClass(int _class) {
|
||||||
|
mClass = _class;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif /* A_H_ */
|
||||||
|
|
|
@ -17,8 +17,6 @@ public:
|
||||||
|
|
||||||
inline bool X::a(int int1) const {
|
inline bool X::a(int int1) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Param const and reference and pointer two params
|
//!Param const and reference and pointer two params
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -38,8 +36,6 @@ public:
|
||||||
|
|
||||||
inline bool X::xy(int int1, int i) const {
|
inline bool X::xy(int int1, int i) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Test if TemplateMethod stays in header
|
//!Test if TemplateMethod stays in header
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -62,15 +58,13 @@ public:
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void A<T>::test() {
|
inline void A<T>::test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//@A.cpp
|
//@A.cpp
|
||||||
#include "A.h"
|
#include "A.h"
|
||||||
|
|
||||||
//=
|
//=
|
||||||
#include "A.h"
|
#include "A.h"
|
||||||
|
|
||||||
//!class template member functions
|
//!Class template member functions
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -102,9 +96,7 @@ A<T>::A() {
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void A<T>::test() {
|
inline void A<T>::test() {
|
||||||
}
|
}
|
||||||
|
//!Member class
|
||||||
|
|
||||||
//!member class
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -144,8 +136,6 @@ public:
|
||||||
|
|
||||||
inline void A::test() {
|
inline void A::test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Method declared in otherwise empty class
|
//!Method declared in otherwise empty class
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -165,7 +155,6 @@ public:
|
||||||
//@A.cpp
|
//@A.cpp
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
void A::test() {
|
void A::test() {
|
||||||
}
|
}
|
||||||
//!Implement in existing namespace
|
//!Implement in existing namespace
|
||||||
|
@ -205,7 +194,7 @@ void ClassInNamespace::test2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//!virtual method in the middle of con/destructor, without parameters and void return value
|
//!Virtual method in the middle of con/destructor, without parameters and void return value
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -287,8 +276,6 @@ A::A() {
|
||||||
|
|
||||||
void A::foo() {
|
void A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Method at beginning, without parameters, void return value and const
|
//!Method at beginning, without parameters, void return value and const
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -348,8 +335,6 @@ A::A() {
|
||||||
|
|
||||||
int A::foo() {
|
int A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Method with two int parameters
|
//!Method with two int parameters
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -379,8 +364,6 @@ A::A() {
|
||||||
|
|
||||||
int A::foo(int param1, int param2) {
|
int A::foo(int param1, int param2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Method defined in header
|
//!Method defined in header
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -408,8 +391,6 @@ A::A() {
|
||||||
|
|
||||||
inline void A::test() {
|
inline void A::test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Implement a function at end of source file
|
//!Implement a function at end of source file
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -426,7 +407,6 @@ void function_with_impl() {
|
||||||
|
|
||||||
void function() {
|
void function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Implement with namespace
|
//!Implement with namespace
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -453,7 +433,6 @@ void Namespace::ClassInNamespace::other_test() {
|
||||||
|
|
||||||
void Namespace::ClassInNamespace::test() {
|
void Namespace::ClassInNamespace::test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Implement function within namespace
|
//!Implement function within namespace
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -524,7 +503,7 @@ int test2() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//!class template member functions with multiple templates
|
//!Class template member functions with multiple templates
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -538,7 +517,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
A<T,U>::A() {
|
A<T, U>::A() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
@ -550,15 +529,13 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
A<T,U>::A() {
|
A<T, U>::A() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
inline void A<T, U>::test() {
|
inline void A<T, U>::test() {
|
||||||
}
|
}
|
||||||
|
//!With default parameters
|
||||||
|
|
||||||
//!with default parameters
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -578,7 +555,7 @@ public:
|
||||||
|
|
||||||
void Class::test(int param1, int param2, int param3) {
|
void Class::test(int param1, int param2, int param3) {
|
||||||
}
|
}
|
||||||
//!static method
|
//!Static method
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -672,7 +649,6 @@ class TestClass {
|
||||||
inline void nspace::TestClass::testMethod() {
|
inline void nspace::TestClass::testMethod() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* TESTCLASS_H_ */
|
#endif /* TESTCLASS_H_ */
|
||||||
|
|
||||||
//!Bug 290110 Source-> Implement Method
|
//!Bug 290110 Source-> Implement Method
|
||||||
|
@ -736,8 +712,6 @@ A::~A() {
|
||||||
|
|
||||||
void n1::n2::A::B::testmethod2() {
|
void n1::n2::A::B::testmethod2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
|
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -753,7 +727,6 @@ public:
|
||||||
//@A.cxx
|
//@A.cxx
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
void TestClass::foo() {
|
void TestClass::foo() {
|
||||||
}
|
}
|
||||||
//!Bug 355006 - NPE implementing template function
|
//!Bug 355006 - NPE implementing template function
|
||||||
|
@ -773,7 +746,6 @@ void func(T&);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void func(T&) {
|
inline void func(T&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Bug 363111 - Remove explicit in constructor definition
|
//!Bug 363111 - Remove explicit in constructor definition
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -789,6 +761,5 @@ public:
|
||||||
//@A.cpp
|
//@A.cpp
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
TestClass::TestClass() {
|
TestClass::TestClass() {
|
||||||
}
|
}
|
|
@ -18,7 +18,6 @@ inline void A::member() {
|
||||||
// return comment
|
// return comment
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!ClassToHeaderTopCommentOrder
|
//!ClassToHeaderTopCommentOrder
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -41,7 +40,6 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!ClassToHeaderCatchComment
|
//!ClassToHeaderCatchComment
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -68,7 +66,6 @@ try {
|
||||||
catch (int i) {
|
catch (int i) {
|
||||||
// catch comment
|
// catch comment
|
||||||
}
|
}
|
||||||
|
|
||||||
//!ClassToHeaderTopComment
|
//!ClassToHeaderTopComment
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -89,7 +86,6 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!ClassToHeaderTemplateTopComment
|
//!ClassToHeaderTemplateTopComment
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -114,7 +110,6 @@ template<typename T>
|
||||||
inline T A::member() {
|
inline T A::member() {
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
//!ClassToHeaderTrailingComment
|
//!ClassToHeaderTrailingComment
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -133,7 +128,6 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
} // Trailing comment
|
} // Trailing comment
|
||||||
|
|
||||||
//!ClassToHeaderTrailingCommentWithTryBlock
|
//!ClassToHeaderTrailingCommentWithTryBlock
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -93,7 +93,6 @@ void /*$*/member/*$$*/() {
|
||||||
//@A.h
|
//@A.h
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
void member() {
|
void member() {
|
||||||
// body comment
|
// body comment
|
||||||
return;
|
return;
|
||||||
|
@ -115,7 +114,6 @@ void /*$*/member/*$$*/() {
|
||||||
//@A.h
|
//@A.h
|
||||||
|
|
||||||
//=
|
//=
|
||||||
|
|
||||||
// Top comment
|
// Top comment
|
||||||
void member() {
|
void member() {
|
||||||
// body comment
|
// body comment
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
inline A::A(int x, int y) :
|
inline A::A(int x, int y) :
|
||||||
a(x), b(y) {
|
a(x), b(y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestConstructorToggleInHeaderToImplementation
|
//!TestConstructorToggleInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -85,7 +84,6 @@ int main() {
|
||||||
A::A(int x, int y) :
|
A::A(int x, int y) :
|
||||||
a(x), b(y) {
|
a(x), b(y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestConstructorToggleInImplementationToClass
|
//!TestConstructorToggleInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -154,7 +152,6 @@ public:
|
||||||
|
|
||||||
inline A::~A() {
|
inline A::~A() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestDestructorToggleInHeaderToImplementation
|
//!TestDestructorToggleInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -199,7 +196,6 @@ int main() {
|
||||||
|
|
||||||
A::~A() {
|
A::~A() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestDestructorToggleInImplementationToClass
|
//!TestDestructorToggleInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -20,7 +20,6 @@ class A {
|
||||||
inline void A::member(int a, int b) {
|
inline void A::member(int a, int b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestDefaultParameterInitializerInHeaderToImplementation
|
//!TestDefaultParameterInitializerInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -57,7 +56,6 @@ int main() {
|
||||||
void A::member(int a, int b) {
|
void A::member(int a, int b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestDefaultParameterInitializerInImplementationToClass
|
//!TestDefaultParameterInitializerInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -54,7 +54,6 @@ int main() {
|
||||||
int freeFunction(int* a, int& b) {
|
int freeFunction(int* a, int& b) {
|
||||||
return 42;
|
return 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestFreeFunctionToggleFromImplementationToHeaderWithDeclaration
|
//!TestFreeFunctionToggleFromImplementationToHeaderWithDeclaration
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -172,7 +171,6 @@ try {
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestFreeFunction
|
//!TestFreeFunction
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -260,4 +258,3 @@ void freefunction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//!TestSimpleNamespaceInClassToInHeader
|
//!Test simple namespace in class to in header
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -30,7 +30,7 @@ inline void A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//!TestSimpleNamespaceInHeaderToImplementationWithinNSDefinition
|
//!Test simple namespace in header to implementation within namespace definition
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -80,8 +80,7 @@ void A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//!Test simple namespace in header to implementation with namespace definition in implementation
|
||||||
//!TestSimpleNamespaceInHeaderToImplementationWithNSDefinitionInImpl
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -134,7 +133,7 @@ void A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//!TestSimpleNamespaceInHeaderToImplementationWithNamespaceQualifiedName
|
//!Test simple namespace in header to implementation with namespace qualified name
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -184,7 +183,6 @@ void A::foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestSimpleNamespaceFromImplementationToInHeader
|
//!TestSimpleNamespaceFromImplementationToInHeader
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -24,7 +24,6 @@ class A {
|
||||||
inline void A::B::member(int a, int b) {
|
inline void A::B::member(int a, int b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestNestedClassInHeaderToImplementation
|
//!TestNestedClassInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -65,7 +64,6 @@ int main() {
|
||||||
void A::B::member(int a, int b) {
|
void A::B::member(int a, int b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestNestedClassInImplementationToClass
|
//!TestNestedClassInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//!TestZeroLengthSelection
|
//!Test zero length selection
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -16,8 +16,7 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test substring selection
|
||||||
//!TestSubstringSelection
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -35,8 +34,7 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test body selection
|
||||||
//!TestBodySelection
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -54,8 +52,7 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test body selection with confusing name
|
||||||
//!TestBodySelectionWithConfusingName
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -75,8 +72,7 @@ inline void A::member() {
|
||||||
int abcd = 42;
|
int abcd = 42;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test left border selection
|
||||||
//!TestLeftBorderSelection
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -94,8 +90,7 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test right border selection
|
||||||
//!TestRightBorderSelection
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -113,8 +108,7 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test overlapping selection
|
||||||
//!TestOverlappingSelection
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -132,4 +126,3 @@ class A {
|
||||||
inline void A::member() {
|
inline void A::member() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//!TestSimpleFunctionInClassToInHeader
|
//!Test simple function in class to in header
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -28,8 +28,7 @@ private:
|
||||||
inline int A::function() {
|
inline int A::function() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//!Test simple function in header to implementation
|
||||||
//!TestSimpleFunctionInHeaderToImplementation
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -73,7 +72,6 @@ int main() {
|
||||||
int A::function() {
|
int A::function() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestSimpleFunctionInImplementationToInClass
|
//!TestSimpleFunctionInImplementationToInClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//!TestTemplateFunctionInClassToInHeader
|
//!Test template function in class to in header
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -27,8 +27,7 @@ template<typename T, typename U>
|
||||||
inline T A<T, U>::B::member() {
|
inline T A<T, U>::B::member() {
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
//!Test template function in header to in class
|
||||||
//!TestTemplateFunctionInHeaderToInClass
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -57,7 +56,7 @@ class A {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
//!TestTemplateFunctionInHeaderToInClassWithTemplateSelected
|
//!Test template function in header to in class with template selected
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -78,8 +77,7 @@ template<typename T>
|
||||||
inline T A::foo() {
|
inline T A::foo() {
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
//!Test complex template function from in class to in header
|
||||||
//!TestComplexTemplateFunctionFromInClassToInheader
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
@ -105,8 +103,7 @@ template<typename U, typename V>
|
||||||
inline void A<T, S>::foo(const U& u, const V& v) {
|
inline void A<T, S>::foo(const U& u, const V& v) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//!Test complex template function from in header to in class
|
||||||
//!TestComplexTemplateFunctionFromInHeaderToInClass
|
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
filename=A.h
|
filename=A.h
|
||||||
|
|
|
@ -30,7 +30,6 @@ try {
|
||||||
catch (std::exception& e1) {
|
catch (std::exception& e1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestTryCatchFromInHeaderToImplementation
|
//!TestTryCatchFromInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -77,7 +76,6 @@ try {
|
||||||
catch (std::exception& e1) {
|
catch (std::exception& e1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestTryCatchFromInImplementationToClass
|
//!TestTryCatchFromInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -160,7 +158,6 @@ catch (std::exception& e1) {
|
||||||
catch (std::exception& e2) {
|
catch (std::exception& e2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestMultipleTryCatchFromInHeaderToImplementation
|
//!TestMultipleTryCatchFromInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
@ -213,7 +210,6 @@ catch (std::exception& e1) {
|
||||||
catch (std::exception& e2) {
|
catch (std::exception& e2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestMultipleTryCatchFromInImplementationToClass
|
//!TestMultipleTryCatchFromInImplementationToClass
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -18,7 +18,6 @@ class A {
|
||||||
inline int A::foo() {
|
inline int A::foo() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestVirtualSpecifierFromInHeaderToImplementation
|
//!TestVirtualSpecifierFromInHeaderToImplementation
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//%CPP
|
//%CPP
|
||||||
|
@ -52,7 +51,6 @@ int main() {
|
||||||
int A::foo() {
|
int A::foo() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!TestVirtualSpecifierFromImplementationToHeader
|
//!TestVirtualSpecifierFromImplementationToHeader
|
||||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||||
//@.config
|
//@.config
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AllTemplateEngineTests extends TestSuite {
|
public class AllTemplateEngineTests extends TestSuite {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -31,7 +30,7 @@ public class AllTemplateEngineTests extends TestSuite {
|
||||||
* Since the TemplateEngine consists of UI(Wizard).
|
* Since the TemplateEngine consists of UI(Wizard).
|
||||||
* A TestWizard is created to which the dynamically generated
|
* A TestWizard is created to which the dynamically generated
|
||||||
* UIPages are added. The Wizard is launched from here.
|
* UIPages are added. The Wizard is launched from here.
|
||||||
* The TestCases created to test the TemplateEngine is initialised here.
|
* The TestCases created to test the TemplateEngine is initialized here.
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -34,26 +34,22 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NamedNodeMap;
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* All supporting functions which are not part of Testing class.
|
* All supporting functions which are not part of Testing class.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TemplateEngineTestsHelper {
|
public class TemplateEngineTestsHelper {
|
||||||
|
public static final String LOGGER_FILE_NAME = "TemplateEngineTests"; //$NON-NLS-1$
|
||||||
public static final String LOGGER_FILE_NAME="TemplateEngineTests"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the url of a xml template, by passing the xml file name.
|
* Returns the url of a xml template, by passing the xml file name.
|
||||||
* @param templateName
|
* @param templateName
|
||||||
* @return URL
|
* @return URL
|
||||||
*/
|
*/
|
||||||
public static URL getTemplateURL(String templateName){
|
public static URL getTemplateURL(String templateName){
|
||||||
Bundle bundle = Platform.getBundle(CTestPlugin.PLUGIN_ID);
|
Bundle bundle = Platform.getBundle(CTestPlugin.PLUGIN_ID);
|
||||||
URL url = FileLocator.find(bundle, new Path("resources/templateengine/"+templateName), null); //$NON-NLS-1$
|
URL url = FileLocator.find(bundle, new Path("resources/templateengine/" + templateName), null); //$NON-NLS-1$
|
||||||
if ( url != null )
|
if (url != null) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
url = FileLocator.toFileURL(url);
|
url = FileLocator.toFileURL(url);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -65,19 +61,19 @@ public class TemplateEngineTestsHelper {
|
||||||
|
|
||||||
public static TemplateCore[] getTestTemplates() {
|
public static TemplateCore[] getTestTemplates() {
|
||||||
TemplateCore[] templates = TemplateEngine.getDefault().getTemplates();
|
TemplateCore[] templates = TemplateEngine.getDefault().getTemplates();
|
||||||
List testTemplates = new ArrayList();
|
List<TemplateCore> testTemplates = new ArrayList<TemplateCore>();
|
||||||
for (int i =0; i < templates.length; i++) {
|
for (int i = 0; i < templates.length; i++) {
|
||||||
if (templates[i].getTemplateType().equals("TestTemplate")) {
|
if (templates[i].getTemplateType().equals("TestTemplate")) {
|
||||||
testTemplates.add(templates[i]);
|
testTemplates.add(templates[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (TemplateCore[]) testTemplates.toArray(new TemplateCore[testTemplates.size()]);
|
return testTemplates.toArray(new TemplateCore[testTemplates.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getChildCount(TemplateDescriptor templateDescriptor, String propertyGroupID){
|
public static int getChildCount(TemplateDescriptor templateDescriptor, String propertyGroupID){
|
||||||
List list = templateDescriptor.getPropertyGroupList();
|
List<Element> list = templateDescriptor.getPropertyGroupList();
|
||||||
for (int i = 0, l = list.size(); i < l; i++) {
|
for (int i = 0, l = list.size(); i < l; i++) {
|
||||||
Element element = (Element) list.get(i);
|
Element element = list.get(i);
|
||||||
NamedNodeMap attributes = element.getAttributes();
|
NamedNodeMap attributes = element.getAttributes();
|
||||||
for (int j = 0, l1 = attributes.getLength(); j < l1; j++) {
|
for (int j = 0, l1 = attributes.getLength(); j < l1; j++) {
|
||||||
String value = attributes.item(j).getNodeValue();
|
String value = attributes.item(j).getNodeValue();
|
||||||
|
@ -90,7 +86,7 @@ public class TemplateEngineTestsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean failIfErrorStatus(IStatus[] statuses) {
|
public static boolean failIfErrorStatus(IStatus[] statuses) {
|
||||||
for(int i=0; i<statuses.length; i++) {
|
for(int i = 0; i < statuses.length; i++) {
|
||||||
IStatus status = statuses[i];
|
IStatus status = statuses[i];
|
||||||
if (status.getCode() == IStatus.ERROR) {
|
if (status.getCode() == IStatus.ERROR) {
|
||||||
Assert.fail(status.getMessage());
|
Assert.fail(status.getMessage());
|
||||||
|
@ -112,5 +108,4 @@ public class TemplateEngineTestsHelper {
|
||||||
workspaceDesc.setAutoBuilding(false);
|
workspaceDesc.setAutoBuilding(false);
|
||||||
workspace.setDescription(workspaceDesc);
|
workspace.setDescription(workspaceDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
* 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.ui.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
@ -49,7 +49,7 @@ public class TestExtraPagesProvider implements IPagesAfterTemplateSelectionProvi
|
||||||
* An example implementation of {@link IWizardDataPage} for test purposes.
|
* An example implementation of {@link IWizardDataPage} for test purposes.
|
||||||
*/
|
*/
|
||||||
static class MyPage extends AbstractWizardDataPage implements IWizardDataPage {
|
static class MyPage extends AbstractWizardDataPage implements IWizardDataPage {
|
||||||
String labelText , dataKey, dataValue;
|
String labelText, dataKey, dataValue;
|
||||||
|
|
||||||
public MyPage(String labelText, String dataKey, String dataValue) {
|
public MyPage(String labelText, String dataKey, String dataValue) {
|
||||||
super("CustomTestPageName", "Title", null);
|
super("CustomTestPageName", "Title", null);
|
||||||
|
@ -59,7 +59,7 @@ public class TestExtraPagesProvider implements IPagesAfterTemplateSelectionProvi
|
||||||
this.dataValue= dataValue;
|
this.dataValue= dataValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getPageData() {
|
public Map<String, String> getPageData() {
|
||||||
return Collections.singletonMap(dataKey, dataValue);
|
return Collections.singletonMap(dataKey, dataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -28,7 +28,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
public class TestProcesses extends BaseTestCase {
|
public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
private static final String workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toOSString();
|
private static final String workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toOSString();
|
||||||
private static final String PROJECT_NAME = "TemplateEngineTestsProject"; //$NON-NLS-1$
|
private static final String PROJECT_NAME = "TemplateEngineTestsProject"; //$NON-NLS-1$
|
||||||
private static final String SOURCE_FOLDER = "Source"; //$NON-NLS-1$
|
private static final String SOURCE_FOLDER = "Source"; //$NON-NLS-1$
|
||||||
|
@ -63,7 +62,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testAddFile() {
|
public void testAddFile() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddFile"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddFile"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -84,7 +83,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testAddFiles() {
|
public void testAddFiles() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddFiles"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddFiles"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -105,7 +104,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testAddLink() {
|
public void testAddLink() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddLink"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AddLink"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -131,7 +130,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testAppend() {
|
public void testAppend() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*Append"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*Append"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -160,7 +159,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testAppendCreate() {
|
public void testAppendCreate() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AppendCreate"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*AppendCreate"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -184,7 +183,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testCopy() {
|
public void testCopy() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*Copy"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*Copy"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -213,7 +212,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testCreateResourceIdentifier() {
|
public void testCreateResourceIdentifier() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*CreateResourceIdentifier"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*CreateResourceIdentifier"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -237,7 +236,7 @@ public class TestProcesses extends BaseTestCase {
|
||||||
|
|
||||||
public void testCreateSourceFolder() {
|
public void testCreateSourceFolder() {
|
||||||
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*CreateSourceFolder"); //$NON-NLS-1$
|
TemplateCore template = TemplateEngine.getDefault().getFirstTemplate(PROJECT_TYPE, null, ".*CreateSourceFolder"); //$NON-NLS-1$
|
||||||
Map valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
valueStore.put("projectName", PROJECT_NAME); //$NON-NLS-1$
|
||||||
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
valueStore.put("projectType", PROJECT_TYPE); //$NON-NLS-1$
|
||||||
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
valueStore.put("location", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
|
@ -6,10 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -18,7 +17,6 @@ import java.util.Set;
|
||||||
import org.eclipse.cdt.core.templateengine.SharedDefaults;
|
import org.eclipse.cdt.core.templateengine.SharedDefaults;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes all the test cases of SharedDefaults backend functionality
|
* Executes all the test cases of SharedDefaults backend functionality
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +34,6 @@ public class TestSharedDefaults extends BaseTestCase {
|
||||||
/*
|
/*
|
||||||
* @see TestCase#tearDown()
|
* @see TestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected void tearDown(){
|
protected void tearDown(){
|
||||||
sharedDefaults = null;
|
sharedDefaults = null;
|
||||||
}
|
}
|
||||||
|
@ -45,47 +42,39 @@ public class TestSharedDefaults extends BaseTestCase {
|
||||||
* This test checks if data gets added to the back end
|
* This test checks if data gets added to the back end
|
||||||
* New data gets persisted in SharedDefault XML file
|
* New data gets persisted in SharedDefault XML file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testAddToBackEndStorage() {
|
public void testAddToBackEndStorage() {
|
||||||
Map actualSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> actualSharedDefaults= sharedDefaults.getSharedDefaultsMap();
|
||||||
|
|
||||||
actualSharedDefaults.put("provider.name","eclipse"); //$NON-NLS-1$ //$NON-NLS-2$
|
actualSharedDefaults.put("provider.name","eclipse"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
actualSharedDefaults.put("copyright","Symbian Software Ltd."); //$NON-NLS-1$ //$NON-NLS-2$
|
actualSharedDefaults.put("copyright","Symbian Software Ltd."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
actualSharedDefaults.put("author","Bala Torati"); //$NON-NLS-1$ //$NON-NLS-2$
|
actualSharedDefaults.put("author","Bala Torati"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
Map expectedSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> expectedSharedDefaults= sharedDefaults.getSharedDefaultsMap();
|
||||||
|
|
||||||
assertEquals("Contents are different :", //$NON-NLS-1$
|
assertEquals("Contents are different :", //$NON-NLS-1$
|
||||||
expectedSharedDefaults,
|
expectedSharedDefaults,
|
||||||
actualSharedDefaults);
|
actualSharedDefaults);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tests the updateToBackEndStorage of SharedDefaults
|
* This tests the updateToBackEndStorage of SharedDefaults
|
||||||
* to verify whether the key-value pair gets updated with new value
|
* to verify whether the key-value pair gets updated with new value
|
||||||
* New data gets persisted in SharedDefault XML file
|
* New data gets persisted in SharedDefault XML file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testUpdateToBackEndStorage() {
|
public void testUpdateToBackEndStorage() {
|
||||||
Map actualSharedDefaults = sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> actualSharedDefaults = sharedDefaults.getSharedDefaultsMap();
|
||||||
Set keySet = actualSharedDefaults.keySet();
|
|
||||||
Iterator iterator = keySet.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
for (Map.Entry<String, String> entry : actualSharedDefaults.entrySet()) {
|
||||||
Object key = iterator.next();
|
String key = entry.getKey();
|
||||||
Object value = actualSharedDefaults.get(key);
|
String value = entry.getValue();
|
||||||
String keyName = (String)key;
|
if (key.equals("org.eclipse.cdt.templateengine.project.HelloWorld.basename")) { //$NON-NLS-1$
|
||||||
String valueName = (String)value;
|
entry.setValue("Astala Vista"); //$NON-NLS-1$
|
||||||
if (keyName.equals("org.eclipse.cdt.templateengine.project.HelloWorld.basename")){ //$NON-NLS-1$
|
sharedDefaults.updateToBackEndStorage("org.eclipse.cdt.templateengine.project.HelloWorld.basename", value); //$NON-NLS-1$
|
||||||
valueName = "Astala Vista"; //$NON-NLS-1$
|
break;
|
||||||
actualSharedDefaults.put(keyName, valueName);
|
|
||||||
sharedDefaults.updateToBackEndStorage("org.eclipse.cdt.templateengine.project.HelloWorld.basename", valueName); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map expectedSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> expectedSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
||||||
|
|
||||||
assertEquals("Contents are different :", //$NON-NLS-1$
|
assertEquals("Contents are different :", //$NON-NLS-1$
|
||||||
expectedSharedDefaults,
|
expectedSharedDefaults,
|
||||||
|
@ -96,25 +85,23 @@ public class TestSharedDefaults extends BaseTestCase {
|
||||||
* This tests the deleteBackEndStorage of SharedDefaults
|
* This tests the deleteBackEndStorage of SharedDefaults
|
||||||
* to verify whether the key-value pair gets deleted at the backend
|
* to verify whether the key-value pair gets deleted at the backend
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testDeleteBackEndStorage() {
|
public void testDeleteBackEndStorage() {
|
||||||
Map actualSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> actualSharedDefaults= sharedDefaults.getSharedDefaultsMap();
|
||||||
Set keySet = actualSharedDefaults.keySet();
|
Set<String> keySet = actualSharedDefaults.keySet();
|
||||||
Iterator iterator = keySet.iterator();
|
Iterator<String> iterator = keySet.iterator();
|
||||||
String keyName = null;
|
String keyName = null;
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
String key = iterator.next();
|
||||||
Object key = iterator.next();
|
keyName = key;
|
||||||
keyName = (String)key;
|
|
||||||
if (keyName.equals("org.eclipse.cdt.templateengine.project.HelloWorld.basename")) { //$NON-NLS-1$
|
if (keyName.equals("org.eclipse.cdt.templateengine.project.HelloWorld.basename")) { //$NON-NLS-1$
|
||||||
actualSharedDefaults.remove(keyName);
|
actualSharedDefaults.remove(keyName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedDefaults.deleteBackEndStorage(new String[]{keyName});
|
sharedDefaults.deleteBackEndStorage(new String[] { keyName });
|
||||||
Map expectedSharedDefaults=sharedDefaults.getSharedDefaultsMap();
|
Map<String, String> expectedSharedDefaults= sharedDefaults.getSharedDefaultsMap();
|
||||||
|
|
||||||
assertEquals("Contents are different :", //$NON-NLS-1$
|
assertEquals("Contents are different :", //$NON-NLS-1$
|
||||||
expectedSharedDefaults,
|
expectedSharedDefaults,
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
@ -17,8 +17,6 @@ import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
* Test the functionality of TemplateEngine.
|
* Test the functionality of TemplateEngine.
|
||||||
*/
|
*/
|
||||||
public class TestTemplateEngine extends BaseTestCase {
|
public class TestTemplateEngine extends BaseTestCase {
|
||||||
|
|
||||||
|
|
||||||
TemplateEngine templateEngine = null;
|
TemplateEngine templateEngine = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -26,7 +24,6 @@ public class TestTemplateEngine extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
templateEngine = TemplateEngine.getDefault();
|
templateEngine = TemplateEngine.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,5 +56,4 @@ public class TestTemplateEngine extends BaseTestCase {
|
||||||
public void testSingleton() {
|
public void testSingleton() {
|
||||||
assertSame(templateEngine, TemplateEngine.getDefault());
|
assertSame(templateEngine, TemplateEngine.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial Implementation
|
* Andrew Ferguson (Symbian) - Initial Implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bala Torati (Symbian) - Initial API and implementation
|
* Bala Torati (Symbian) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.tests.templateengine;
|
package org.eclipse.cdt.ui.tests.templateengine;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -17,13 +17,10 @@ import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the functionality of the ValueStore class.
|
* Test the functionality of the ValueStore class.
|
||||||
*/
|
*/
|
||||||
public class TestValueStore extends BaseTestCase {
|
public class TestValueStore extends BaseTestCase {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp is called before execution of test method.
|
* setUp is called before execution of test method.
|
||||||
*/
|
*/
|
||||||
|
@ -44,12 +41,11 @@ public class TestValueStore extends BaseTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test ValueStore for Not Null condition.
|
* Test ValueStore for Not Null condition.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void testValueStoreNotNull(){
|
public void testValueStoreNotNull(){
|
||||||
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
||||||
for (int i=0; i <templates.length; i++) {
|
for (int i = 0; i < templates.length; i++) {
|
||||||
Map valueStore = templates[i].getValueStore();
|
Map<String, String> valueStore = templates[i].getValueStore();
|
||||||
assertNotNull(valueStore);
|
assertNotNull(valueStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,18 +56,16 @@ public class TestValueStore extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
public void testCompareValueStoreWithTemplateDefaluts(){
|
public void testCompareValueStoreWithTemplateDefaluts(){
|
||||||
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
||||||
for (int i=0; i <templates.length; i++) {
|
for (int i = 0; i < templates.length; i++) {
|
||||||
Map valueStore = templates[i].getValueStore();
|
Map<String, String> valueStore = templates[i].getValueStore();
|
||||||
TemplateDescriptor templateDescriptor = templates[i].getTemplateDescriptor();
|
TemplateDescriptor templateDescriptor = templates[i].getTemplateDescriptor();
|
||||||
Map templateDefaults = templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement());
|
Map<String, String> templateDefaults = templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement());
|
||||||
|
|
||||||
Iterator defaultsIterator = templateDefaults.keySet().iterator();
|
Iterator<String> defaultsIterator = templateDefaults.keySet().iterator();
|
||||||
while(defaultsIterator.hasNext()){
|
while (defaultsIterator.hasNext()){
|
||||||
String key = (String)defaultsIterator.next();
|
String key = defaultsIterator.next();
|
||||||
assertNotNull(valueStore.get(key));
|
assertNotNull(valueStore.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.ui.tests.outline.OutlineTestSuite;
|
||||||
import org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest;
|
import org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest;
|
||||||
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite;
|
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite;
|
||||||
import org.eclipse.cdt.ui.tests.search.SearchTestSuite;
|
import org.eclipse.cdt.ui.tests.search.SearchTestSuite;
|
||||||
|
import org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests;
|
||||||
import org.eclipse.cdt.ui.tests.text.TextTestSuite;
|
import org.eclipse.cdt.ui.tests.text.TextTestSuite;
|
||||||
import org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite;
|
import org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite;
|
||||||
import org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite;
|
import org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite;
|
||||||
|
@ -101,5 +102,7 @@ public class AutomatedSuite extends TestSuite {
|
||||||
|
|
||||||
// tests from package org.eclipse.cdt.ui.tests.misc
|
// tests from package org.eclipse.cdt.ui.tests.misc
|
||||||
addTest(MiscTestSuite.suite());
|
addTest(MiscTestSuite.suite());
|
||||||
|
|
||||||
|
addTest(AllTemplateEngineTests.suite());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.gettersandsetters;
|
package org.eclipse.cdt.ui.tests.refactoring.gettersandsetters;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -23,12 +21,12 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
|
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
|
||||||
import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
|
import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.AccessorDescriptor.AccessorKind;
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GenerateGettersAndSettersRefactoring;
|
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GenerateGettersAndSettersRefactoring;
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterContext;
|
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterContext;
|
||||||
|
|
||||||
|
@ -38,11 +36,11 @@ import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterCon
|
||||||
public class GenerateGettersAndSettersTest extends RefactoringTest {
|
public class GenerateGettersAndSettersTest extends RefactoringTest {
|
||||||
protected boolean fatalError;
|
protected boolean fatalError;
|
||||||
private int warnings;
|
private int warnings;
|
||||||
private List<String> selectedGetters;
|
private int infos;
|
||||||
private List<String> selectedSetters;
|
private String[] selectedGetters;
|
||||||
|
private String[] selectedSetters;
|
||||||
private GenerateGettersAndSettersRefactoring refactoring;
|
private GenerateGettersAndSettersRefactoring refactoring;
|
||||||
private boolean definitionSeparate;
|
private boolean definitionSeparate;
|
||||||
private int infos;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -88,17 +86,11 @@ public class GenerateGettersAndSettersTest extends RefactoringTest {
|
||||||
private void selectFields() {
|
private void selectFields() {
|
||||||
GetterSetterContext context = refactoring.getContext();
|
GetterSetterContext context = refactoring.getContext();
|
||||||
|
|
||||||
for (IASTSimpleDeclaration currentDecl : context.existingFields) {
|
for (String name : selectedGetters) {
|
||||||
String name = currentDecl.getDeclarators()[0].getName().getRawSignature();
|
context.selectAccessorForField(name, AccessorKind.GETTER);
|
||||||
if (selectedGetters.contains(name)) {
|
}
|
||||||
selectedGetters.remove(name);
|
for (String name : selectedSetters) {
|
||||||
context.selectedFunctions.add(context.createGetterInserter(currentDecl));
|
context.selectAccessorForField(name, AccessorKind.SETTER);
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedSetters.contains(name)) {
|
|
||||||
selectedSetters.remove(name);
|
|
||||||
context.selectedFunctions.add(context.createSetterInserter(currentDecl));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,13 +103,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTest {
|
||||||
String setters = refactoringProperties.getProperty("setters", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
String setters = refactoringProperties.getProperty("setters", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
definitionSeparate = Boolean.valueOf(refactoringProperties.getProperty("definitionSeparate", "false"));
|
definitionSeparate = Boolean.valueOf(refactoringProperties.getProperty("definitionSeparate", "false"));
|
||||||
|
|
||||||
selectedGetters = new ArrayList<String>();
|
selectedGetters = getters.split(",");
|
||||||
for (String getterName : getters.split(",")) { //$NON-NLS-1$
|
selectedSetters = setters.split(",");
|
||||||
selectedGetters.add(getterName);
|
|
||||||
}
|
|
||||||
selectedSetters = new ArrayList<String>();
|
|
||||||
for (String setterName : setters.split(",")) { //$NON-NLS-1$
|
|
||||||
selectedSetters.add(setterName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2011 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
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.ui.tests.text;
|
package org.eclipse.cdt.ui.tests.text;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
@ -110,8 +111,8 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CEditor fEditor;
|
private CEditor fEditor;
|
||||||
private static SourceViewer fSourceViewer;
|
private SourceViewer fSourceViewer;
|
||||||
private ICProject fCProject;
|
private ICProject fCProject;
|
||||||
private IProject fNonCProject;
|
private IProject fNonCProject;
|
||||||
private StyledText fTextWidget;
|
private StyledText fTextWidget;
|
||||||
|
@ -443,6 +444,24 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertTrue(part instanceof CEditor);
|
assertTrue(part instanceof CEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLeakingInstanceAfterClose() throws Exception {
|
||||||
|
final String file= "/ceditor/src/main.cpp";
|
||||||
|
fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false);
|
||||||
|
setUpEditor(file);
|
||||||
|
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
|
||||||
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
|
WeakReference<CEditor> ref = new WeakReference<CEditor>(fEditor);
|
||||||
|
EditorTestHelper.closeEditor(fEditor);
|
||||||
|
fEditor = null;
|
||||||
|
fSourceViewer = null;
|
||||||
|
int ngc = 10;
|
||||||
|
while (ref.get() != null && ngc-- > 0) {
|
||||||
|
System.gc();
|
||||||
|
Thread.sleep(200);
|
||||||
|
}
|
||||||
|
assertNull("CEditor instance seems to be leaking after close", ref.get());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type characters into the styled text.
|
* Type characters into the styled text.
|
||||||
*
|
*
|
||||||
|
|
|
@ -328,15 +328,22 @@ HideCFiles.description= Hides all C files
|
||||||
HideHeaderFiles.label= Header files
|
HideHeaderFiles.label= Header files
|
||||||
HideHeaderFiles.description= Hides all Header files
|
HideHeaderFiles.description= Hides all Header files
|
||||||
|
|
||||||
HideUsingDirective.label= Using directive
|
HideAnonymousStruct.label= Anonymous structs and enums
|
||||||
HideUsingDirective.description= Hides using directives
|
HideAnonymousStruct.navigator.label= C/C++ anonymous structs and enums
|
||||||
|
HideAnonymousStruct.description= Hides all anonymous structs and enums
|
||||||
HideMacroDirective.label= Macro directive
|
|
||||||
HideMacroDirective.description= Hides Macro directives
|
|
||||||
|
|
||||||
ForwardDeclarationFilter.label= Forward declaration
|
ForwardDeclarationFilter.label= Forward declaration
|
||||||
|
ForwardDeclarationFilter.navigator.label= C/C++ forward declaration
|
||||||
ForwardDeclarationFilter.description= Hides forward declarations, unless found in a header file.
|
ForwardDeclarationFilter.description= Hides forward declarations, unless found in a header file.
|
||||||
|
|
||||||
|
HideMacroDirective.label= Macro directive
|
||||||
|
HideMacroDirective.navigator.label= C/C++ macro directive
|
||||||
|
HideMacroDirective.description= Hides Macro directives
|
||||||
|
|
||||||
|
HideUsingDirective.label= Using directive
|
||||||
|
HideUsingDirective.navigator.label= C/C++ using directive
|
||||||
|
HideUsingDirective.description= Hides using directives
|
||||||
|
|
||||||
#
|
#
|
||||||
WorkInProgress.name=Work In Progress
|
WorkInProgress.name=Work In Progress
|
||||||
|
|
||||||
|
|
|
@ -136,14 +136,54 @@
|
||||||
class="org.eclipse.cdt.internal.ui.filters.NonCElementFilter"
|
class="org.eclipse.cdt.internal.ui.filters.NonCElementFilter"
|
||||||
id="org.eclipse.cdt.internal.ui.CView.NonCElementFilter">
|
id="org.eclipse.cdt.internal.ui.CView.NonCElementFilter">
|
||||||
</filter>
|
</filter>
|
||||||
<!-- C/C++ Outline Page -->
|
|
||||||
<filter
|
<filter
|
||||||
targetId="org.eclipse.cdt.ui.COutlinePage"
|
targetId="org.eclipse.cdt.ui.CView"
|
||||||
|
name="%HideAnonymousStruct.label"
|
||||||
|
enabled="true"
|
||||||
|
description="%HideAnonymousStruct.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.AnonymousStructFilter"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CView.AnonymousStructFilter">
|
||||||
|
</filter>
|
||||||
|
<filter
|
||||||
|
targetId="org.eclipse.cdt.ui.CView"
|
||||||
|
name="%ForwardDeclarationFilter.label"
|
||||||
|
enabled="true"
|
||||||
|
description="%ForwardDeclarationFilter.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.ForwardDeclarationFilter"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CView.ForwardDeclarationFilter">
|
||||||
|
</filter>
|
||||||
|
<filter
|
||||||
|
targetId="org.eclipse.cdt.ui.CView"
|
||||||
|
name="%HideMacroDirective.label"
|
||||||
|
enabled="false"
|
||||||
|
description="%HideMacroDirective.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.MacroDirectiveFilter"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CView.MacroDirectiveFilter">
|
||||||
|
</filter>
|
||||||
|
<filter
|
||||||
|
targetId="org.eclipse.cdt.ui.CView"
|
||||||
name="%HideUsingDirective.label"
|
name="%HideUsingDirective.label"
|
||||||
enabled="false"
|
enabled="false"
|
||||||
description="%HideUsingDirective.description"
|
description="%HideUsingDirective.description"
|
||||||
class="org.eclipse.cdt.internal.ui.filters.UsingDirectiveFilter"
|
class="org.eclipse.cdt.internal.ui.filters.UsingDirectiveFilter"
|
||||||
id="org.eclipse.cdt.ui.COutlinePage.UsingDeclarationFilter">
|
id="org.eclipse.cdt.internal.ui.CView.UsingDeclarationFilter">
|
||||||
|
</filter>
|
||||||
|
<!-- C/C++ Outline Page -->
|
||||||
|
<filter
|
||||||
|
targetId="org.eclipse.cdt.ui.COutlinePage"
|
||||||
|
name="%HideAnonymousStruct.label"
|
||||||
|
enabled="false"
|
||||||
|
description="%HideAnonymousStruct.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.AnonymousStructFilter"
|
||||||
|
id="org.eclipse.cdt.ui.COutlinePage.AnonymousStructFilter">
|
||||||
|
</filter>
|
||||||
|
<filter
|
||||||
|
targetId="org.eclipse.cdt.ui.COutlinePage"
|
||||||
|
name="%ForwardDeclarationFilter.label"
|
||||||
|
enabled="false"
|
||||||
|
description="%ForwardDeclarationFilter.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.ForwardDeclarationFilter"
|
||||||
|
id="org.eclipse.cdt.ui.COutlinePage.ForwardDeclarationFilter">
|
||||||
</filter>
|
</filter>
|
||||||
<filter
|
<filter
|
||||||
targetId="org.eclipse.cdt.ui.COutlinePage"
|
targetId="org.eclipse.cdt.ui.COutlinePage"
|
||||||
|
@ -155,11 +195,11 @@
|
||||||
</filter>
|
</filter>
|
||||||
<filter
|
<filter
|
||||||
targetId="org.eclipse.cdt.ui.COutlinePage"
|
targetId="org.eclipse.cdt.ui.COutlinePage"
|
||||||
name="%ForwardDeclarationFilter.label"
|
name="%HideUsingDirective.label"
|
||||||
enabled="false"
|
enabled="false"
|
||||||
description="%ForwardDeclarationFilter.description"
|
description="%HideUsingDirective.description"
|
||||||
class="org.eclipse.cdt.internal.ui.filters.ForwardDeclarationFilter"
|
class="org.eclipse.cdt.internal.ui.filters.UsingDirectiveFilter"
|
||||||
id="org.eclipse.cdt.ui.COutlinePage.ForwardDeclarationFilter">
|
id="org.eclipse.cdt.ui.COutlinePage.UsingDeclarationFilter">
|
||||||
</filter>
|
</filter>
|
||||||
<!-- Asm Outline Page -->
|
<!-- Asm Outline Page -->
|
||||||
<filter
|
<filter
|
||||||
|
@ -578,6 +618,258 @@
|
||||||
label="%Dummy.label"
|
label="%Dummy.label"
|
||||||
value="240, 216, 168">
|
value="240, 216, 168">
|
||||||
</colorDefinition>
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_multi_line_comment"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="63, 127, 95">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_single_line_comment"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="63, 127, 95">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_keyword"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_type"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_string"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="42, 0, 255">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_operators"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_braces"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_numbers"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_default"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.pp_directive"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.pp_directive"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.pp_default"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.pp_header"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="42, 0, 255">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.asm_directive"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.asm_label"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 0, 85">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.c_comment_task_tag"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 159, 191">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="63, 95, 191">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="63, 95, 191">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="127, 159, 191">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.staticFieldHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 192">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.fieldHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 192">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.methodDeclarationHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.staticMethodHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.functionDeclarationHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.functionHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.localVariableDeclarationHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="128, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.localVariableHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.globalVariableHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.parameterVariableHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.templateParameterHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="100, 70, 50">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.methodHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.classHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 80, 50">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.enumHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="100, 70, 50">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.macroSubstitutionHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.macroDefinitionHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.typedefHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 80, 50">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.namespaceHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.labelHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.enumeratorHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="0, 0, 192">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.problemHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="224, 0, 0">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.externalSDKHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="100, 40, 128">
|
||||||
|
</colorDefinition>
|
||||||
|
<colorDefinition
|
||||||
|
id="org.eclipse.cdt.ui.overloadedOperatorHighlighting"
|
||||||
|
isEditable="false"
|
||||||
|
label="%Dummy.label"
|
||||||
|
value="200, 100, 0">
|
||||||
|
</colorDefinition>
|
||||||
<theme
|
<theme
|
||||||
id="org.eclipse.ui.ide.systemDefault">
|
id="org.eclipse.ui.ide.systemDefault">
|
||||||
<colorOverride
|
<colorOverride
|
||||||
|
@ -596,6 +888,170 @@
|
||||||
id="org.eclipse.cdt.ui.content_assist_parameters_foreground"
|
id="org.eclipse.cdt.ui.content_assist_parameters_foreground"
|
||||||
value="COLOR_LIST_FOREGROUND">
|
value="COLOR_LIST_FOREGROUND">
|
||||||
</colorOverride>
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_multi_line_comment"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_single_line_comment"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_keyword"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_type"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_string"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_operators"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_braces"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_numbers"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_default"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.pp_directive"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.pp_default"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.pp_header"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.asm_directive"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.asm_label"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.c_comment_task_tag"
|
||||||
|
value="COLOR_WIDGET_NORMAL_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"
|
||||||
|
value="COLOR_WIDGET_NORMAL_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.staticFieldHighlighting"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.fieldHighlighting"
|
||||||
|
value="COLOR_LIST_SELECTION">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.methodDeclarationHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.staticMethodHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.functionDeclarationHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.functionHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.localVariableDeclarationHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.localVariableHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.globalVariableHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.parameterVariableHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.templateParameterHighlighting"
|
||||||
|
value="COLOR_WIDGET_DARK_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.methodHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.classHighlighting"
|
||||||
|
value="COLOR_WIDGET_DARK_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.enumHighlighting"
|
||||||
|
value="COLOR_WIDGET_DARK_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.macroSubstitutionHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.macroDefinitionHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.typedefHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.namespaceHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.labelHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.enumeratorHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.problemHighlighting"
|
||||||
|
value="COLOR_WIDGET_DARK_SHADOW">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.externalSDKHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
|
<colorOverride
|
||||||
|
id="org.eclipse.cdt.ui.overloadedOperatorHighlighting"
|
||||||
|
value="COLOR_LIST_FOREGROUND">
|
||||||
|
</colorOverride>
|
||||||
</theme>
|
</theme>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
@ -2958,10 +3414,6 @@
|
||||||
point="org.eclipse.core.runtime.preferences">
|
point="org.eclipse.core.runtime.preferences">
|
||||||
<initializer class="org.eclipse.cdt.ui.CUIPreferenceInitializer"/>
|
<initializer class="org.eclipse.cdt.ui.CUIPreferenceInitializer"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.core.runtime.preferences">
|
|
||||||
<initializer class="org.eclipse.cdt.ui.text.doctools.doxygen.DoxygenHelper"/>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
<!-- Default folding -->
|
<!-- Default folding -->
|
||||||
<extension
|
<extension
|
||||||
|
@ -3405,6 +3857,28 @@
|
||||||
description="%HideNonCElements.description"
|
description="%HideNonCElements.description"
|
||||||
id="org.eclipse.cdt.ui.navigator.filters.NonCElementFilter"
|
id="org.eclipse.cdt.ui.navigator.filters.NonCElementFilter"
|
||||||
name="%HideNonCElements.label"/>
|
name="%HideNonCElements.label"/>
|
||||||
|
<commonFilter
|
||||||
|
activeByDefault="true"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.AnonymousStructFilter"
|
||||||
|
description="%HideAnonymousStruct.description"
|
||||||
|
id="org.eclipse.cdt.ui.navigator.filters.AnonymousStructFilter"
|
||||||
|
name="%HideAnonymousStruct.navigator.label"/>
|
||||||
|
<commonFilter
|
||||||
|
activeByDefault="true"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.ForwardDeclarationFilter"
|
||||||
|
description="%ForwardDeclarationFilter.description"
|
||||||
|
id="org.eclipse.cdt.ui.navigator.filters.ForwardDeclarationFilter"
|
||||||
|
name="%ForwardDeclarationFilter.navigator.label"/>
|
||||||
|
<commonFilter
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.MacroDirectiveFilter"
|
||||||
|
description="%HideMacroDirective.description"
|
||||||
|
id="org.eclipse.cdt.ui.navigator.filters.MacroDirectiveFilter"
|
||||||
|
name="%HideMacroDirective.navigator.label"/>
|
||||||
|
<commonFilter
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.UsingDirectiveFilter"
|
||||||
|
description="%HideUsingDirective.description"
|
||||||
|
id="org.eclipse.cdt.ui.navigator.filters.UsingDirectiveFilter"
|
||||||
|
name="%HideUsingDirective.navigator.label"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.navigator.linkHelper">
|
point="org.eclipse.ui.navigator.linkHelper">
|
||||||
|
|
|
@ -188,18 +188,21 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
/* (non-Cdoc)
|
/* (non-Cdoc)
|
||||||
* Method declared on IContentProvider.
|
* Method declared on IContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Cdoc)
|
/* (non-Cdoc)
|
||||||
* Method declared on IContentProvider.
|
* Method declared on IContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Cdoc)
|
/* (non-Cdoc)
|
||||||
* Method declared on IStructuredContentProvider.
|
* Method declared on IStructuredContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object parent) {
|
public Object[] getElements(Object parent) {
|
||||||
return getChildren(parent);
|
return getChildren(parent);
|
||||||
}
|
}
|
||||||
|
@ -207,6 +210,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
/* (non-Cdoc)
|
/* (non-Cdoc)
|
||||||
* Method declared on ITreeContentProvider.
|
* Method declared on ITreeContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object[] getChildren(Object element) {
|
public Object[] getChildren(Object element) {
|
||||||
if (!exists(element))
|
if (!exists(element))
|
||||||
return NO_CHILDREN;
|
return NO_CHILDREN;
|
||||||
|
@ -263,6 +267,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
*
|
*
|
||||||
* @see ITreeContentProvider
|
* @see ITreeContentProvider
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (fProvideMembers) {
|
if (fProvideMembers) {
|
||||||
// assume TUs and binary files are never empty
|
// assume TUs and binary files are never empty
|
||||||
|
@ -315,6 +320,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
/* (non-Cdoc)
|
/* (non-Cdoc)
|
||||||
* Method declared on ITreeContentProvider.
|
* Method declared on ITreeContentProvider.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getParent(Object element) {
|
public Object getParent(Object element) {
|
||||||
if (!exists(element)) {
|
if (!exists(element)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class CActionFilter implements IActionFilter {
|
||||||
public CActionFilter() {
|
public CActionFilter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean testAttribute(Object target, String name, String value) {
|
public boolean testAttribute(Object target, String name, String value) {
|
||||||
ICElement element = (ICElement) target;
|
ICElement element = (ICElement) target;
|
||||||
IResource resource = element.getResource();
|
IResource resource = element.getResource();
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
||||||
/**
|
/**
|
||||||
* @see CElementAdapterFactory#getAdapterList
|
* @see CElementAdapterFactory#getAdapterList
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Class<?>[] getAdapterList() {
|
public Class<?>[] getAdapterList() {
|
||||||
return PROPERTIES;
|
return PROPERTIES;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +55,7 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
||||||
/**
|
/**
|
||||||
* @see CElementAdapterFactory#getAdapter
|
* @see CElementAdapterFactory#getAdapter
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public Object getAdapter(Object element, Class key) {
|
public Object getAdapter(Object element, Class key) {
|
||||||
ICElement celem = (ICElement) element;
|
ICElement celem = (ICElement) element;
|
||||||
|
|
|
@ -11,13 +11,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui;
|
package org.eclipse.cdt.internal.ui;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||||
import org.eclipse.ui.views.properties.IPropertySource;
|
import org.eclipse.ui.views.properties.IPropertySource;
|
||||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
public class CElementPropertySource implements IPropertySource {
|
public class CElementPropertySource implements IPropertySource {
|
||||||
|
|
||||||
private final static String LABEL= "CElementProperties.name"; //$NON-NLS-1$
|
private final static String LABEL= "CElementProperties.name"; //$NON-NLS-1$
|
||||||
|
@ -43,6 +44,7 @@ public class CElementPropertySource implements IPropertySource {
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#getPropertyDescriptors
|
* @see IPropertySource#getPropertyDescriptors
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||||
return fgPropertyDescriptors;
|
return fgPropertyDescriptors;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,7 @@ public class CElementPropertySource implements IPropertySource {
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#getPropertyValue
|
* @see IPropertySource#getPropertyValue
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getPropertyValue(Object name) {
|
public Object getPropertyValue(Object name) {
|
||||||
if (name.equals(IBasicPropertyConstants.P_TEXT)) {
|
if (name.equals(IBasicPropertyConstants.P_TEXT)) {
|
||||||
return fCElement.getElementName();
|
return fCElement.getElementName();
|
||||||
|
@ -60,12 +63,14 @@ public class CElementPropertySource implements IPropertySource {
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#setPropertyValue
|
* @see IPropertySource#setPropertyValue
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setPropertyValue(Object name, Object value) {
|
public void setPropertyValue(Object name, Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#getEditableValue
|
* @see IPropertySource#getEditableValue
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getEditableValue() {
|
public Object getEditableValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +78,7 @@ public class CElementPropertySource implements IPropertySource {
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#isPropertySet
|
* @see IPropertySource#isPropertySet
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isPropertySet(Object property) {
|
public boolean isPropertySet(Object property) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +86,7 @@ public class CElementPropertySource implements IPropertySource {
|
||||||
/**
|
/**
|
||||||
* @see IPropertySource#resetPropertyValue
|
* @see IPropertySource#resetPropertyValue
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void resetPropertyValue(Object property) {
|
public void resetPropertyValue(Object property) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui;
|
package org.eclipse.cdt.internal.ui;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.search.ui.NewSearchUI;
|
import org.eclipse.search.ui.NewSearchUI;
|
||||||
import org.eclipse.ui.IFolderLayout;
|
import org.eclipse.ui.IFolderLayout;
|
||||||
import org.eclipse.ui.IPageLayout;
|
import org.eclipse.ui.IPageLayout;
|
||||||
|
@ -21,6 +19,10 @@ import org.eclipse.ui.IPerspectiveFactory;
|
||||||
import org.eclipse.ui.console.IConsoleConstants;
|
import org.eclipse.ui.console.IConsoleConstants;
|
||||||
import org.eclipse.ui.navigator.resources.ProjectExplorer;
|
import org.eclipse.ui.navigator.resources.ProjectExplorer;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
|
||||||
|
|
||||||
public class CPerspectiveFactory implements IPerspectiveFactory {
|
public class CPerspectiveFactory implements IPerspectiveFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +35,7 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
|
||||||
/**
|
/**
|
||||||
* @see IPerspectiveFactory#createInitialLayout
|
* @see IPerspectiveFactory#createInitialLayout
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void createInitialLayout(IPageLayout layout) {
|
public void createInitialLayout(IPageLayout layout) {
|
||||||
String editorArea = layout.getEditorArea();
|
String editorArea = layout.getEditorArea();
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue