1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

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

This commit is contained in:
Andrew Gvozdev 2012-04-20 07:18:20 -04:00
commit 89a9259918
12 changed files with 91 additions and 112 deletions

View file

@ -7,11 +7,13 @@
*
* Contributors:
* Red Hat Inc. - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.core;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.lang.reflect.Method;
import java.util.regex.Matcher;
@ -30,7 +32,6 @@ import org.eclipse.core.runtime.Path;
// us to pass an extended ProblemMarkerInfo, so we are forced to have our own mechanism
// which is similar to the CDT one.
public class ErrorParser extends MarkerGenerator implements IErrorParser {
public static final String ID = AutotoolsPlugin.PLUGIN_ID + ".errorParser"; //$NON-NLS-1$
private Pattern pkgconfigError =
Pattern.compile(".*?(configure:\\s+error:\\s+Package requirements\\s+\\((.*?)\\)\\s+were not met).*"); //$NON-NLS-1$
@ -54,6 +55,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser{
this.sourcePath = sourcePath;
}
@Override
public boolean processLine(String line,
org.eclipse.cdt.core.ErrorParserManager eoParser) {
@ -149,10 +151,9 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser{
if (!file.exists())
return null;
FileReader stream;
LineNumberReader reader = null;
try {
stream = new FileReader(file);
LineNumberReader reader = new LineNumberReader(stream);
reader = new LineNumberReader(new FileReader(file));
// look for something like:
// if test "${ac_cv_prog_WINDRES+set}" = set; then :
@ -179,10 +180,16 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser{
}
line = reader.readLine();
}
stream.close();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore.
}
}
}
return null;
@ -196,31 +203,34 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser{
* @return
*/
private int getErrorConfigLineNumber(String name) {
LineNumberReader reader = null;
try {
File file = new File(buildDir + "/config.log");
// If the log file is not present there is nothing we can do.
if (!file.exists())
return -1;
FileReader stream = new FileReader(file);
LineNumberReader reader = new LineNumberReader(stream);
reader = new LineNumberReader(new FileReader(file));
Pattern errorPattern = Pattern
.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
String line = reader.readLine();
while (line != null) {
Pattern errorPattern =
Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
String line;
while ((line = reader.readLine()) != null) {
Matcher m = errorPattern.matcher(line);
if (m.matches()) {
return Integer.parseInt(m.group(1));
}
line = reader.readLine();
}
stream.close();
} catch (Exception e) {
return -1;
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore.
}
}
}
return -1;
}

View file

@ -5800,4 +5800,19 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testSpecializationOfClassType_368610c() throws Exception {
parseAndCheckBindings();
}
//struct A {
// int m(int i) const;
// void m() const;
//};
//
//template<typename T> struct B {
// typedef int (T::*Method)(int) const;
// B(Method p) {}
//};
//
//B<const A> a(&A::m);
public void testConstInTypeParameter_377223() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -2352,9 +2352,9 @@ public class CPPSemantics {
}
public static IBinding resolveFunction(LookupData data, ICPPFunction[] fns, boolean allowUDC) throws DOMException {
fns= ArrayUtil.trim(ICPPFunction.class, fns);
if (fns == null || fns.length == 0)
if (fns == null || fns.length == 0 || fns[0] == null)
return null;
fns= ArrayUtil.trim(fns);
sortAstBeforeIndex(fns);

View file

@ -46,6 +46,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
@ -1190,6 +1191,9 @@ public class CPPTemplates {
ICPPPointerToMemberType ptm = (ICPPPointerToMemberType) typeContainer;
IType memberOfClass = ptm.getMemberOfClass();
IType newMemberOfClass = instantiateType(memberOfClass, tpMap, packOffset, within);
if (newMemberOfClass instanceof IQualifierType) {
newMemberOfClass = ((IQualifierType) newMemberOfClass).getType();
}
if (!(newMemberOfClass instanceof ICPPClassType || newMemberOfClass instanceof UniqueType
|| newMemberOfClass instanceof ICPPUnknownBinding)) {
return new ProblemType(ISemanticProblem.BINDING_INVALID_TYPE);

View file

@ -918,7 +918,7 @@ outer:
for (IErrorParser[] parsers : fErrorParsers.values()) {
for (IErrorParser parser : parsers) {
if (parser instanceof IErrorParser3) {
((IErrorParser3) parser).streamFinished();
((IErrorParser3) parser).shutdown();
}
}
}

View file

@ -24,8 +24,8 @@ public interface IConsoleParser {
public boolean processLine(String line);
/**
* Finalization of a console parser when the stream is closed.
* Called to let the parser know that the end of the error stream has been reached.
* Can be used by the parser to flush its internal buffers.
*/
public void shutdown();
}

View file

@ -15,7 +15,8 @@ package org.eclipse.cdt.core;
*/
public interface IErrorParser3 extends IErrorParser2 {
/**
* Notification that the stream of data to parse has ended.
* Called to let the parser know that the end of the error stream has been reached.
* Can be used by the parser to flush its internal buffers.
*/
void streamFinished();
void shutdown();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2011 Andrew Gvozdev (Quoin Inc.) and others.
* Copyright (c) 2009, 2012 Andrew Gvozdev (Quoin Inc.) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,8 +7,8 @@
*
* Contributors:
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
* Alex Ruiz (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
@ -25,8 +25,8 @@ import java.util.Set;
import java.util.TreeSet;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.ErrorParserContext;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IErrorParser;
import org.eclipse.cdt.core.IErrorParserNamed;
import org.eclipse.cdt.core.IMarkerGenerator;
@ -52,8 +52,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* ErrorParserExtensionManager manages error parser extensions, serialization and preferences
*
* ErrorParserExtensionManager manages error parser extensions, serialization and preferences.
*/
public class ErrorParserExtensionManager {
private static final String STORAGE_ERRORPARSER_EXTENSIONS = "model.extensions.xml"; //$NON-NLS-1$
@ -749,9 +748,9 @@ public class ErrorParserExtensionManager {
*/
public static String[] getDefaultErrorParserIds() {
if (fDefaultErrorParserIds == null) {
return fAvailableErrorParsers.keySet().toArray(new String[0]);
return getErrorParserIds(fAvailableErrorParsers, BUILD);
}
return fDefaultErrorParserIds.toArray(new String[0]);
return fDefaultErrorParserIds.toArray(new String[fDefaultErrorParserIds.size()]);
}
/**
@ -777,7 +776,7 @@ public class ErrorParserExtensionManager {
int context) {
Pair<IErrorParserNamed, Integer> pair =
isExtension ? fExtensionErrorParsers.get(id) : fAvailableErrorParsers.get(id);
if (!isInContext(pair, context)) {
if (pair == null || !isInContext(pair, context)) {
return null;
}
IErrorParserNamed errorParser = pair.first;

View file

@ -96,61 +96,43 @@ public class CReconciler extends MonoReconciler {
public boolean isConflicting(ISchedulingRule rule) {
return rule == this;
}
}
/**
* Internal part listener for activating the reconciler.
*/
private class PartListener implements IPartListener2 {
/*
* @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partActivated(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partClosed(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partDeactivated(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partHidden(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == fTextEditor) {
setEditorActive(false);
}
}
/*
* @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partOpened(IWorkbenchPartReference partRef) {
}
/*
* @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partVisible(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == fTextEditor) {
@ -164,7 +146,6 @@ public class CReconciler extends MonoReconciler {
* Internal Shell activation listener for activating the reconciler.
*/
private class ActivationListener extends ShellAdapter {
private Control fControl;
public ActivationListener(Control control) {
@ -172,9 +153,6 @@ public class CReconciler extends MonoReconciler {
fControl= control;
}
/*
* @see org.eclipse.swt.events.ShellListener#shellActivated(org.eclipse.swt.events.ShellEvent)
*/
@Override
public void shellActivated(ShellEvent e) {
if (!fControl.isDisposed() && fControl.isVisible()) {
@ -184,9 +162,6 @@ public class CReconciler extends MonoReconciler {
}
}
/*
* @see org.eclipse.swt.events.ShellListener#shellDeactivated(org.eclipse.swt.events.ShellEvent)
*/
@Override
public void shellDeactivated(ShellEvent e) {
if (!fControl.isDisposed() && fControl.getShell() == e.getSource()) {
@ -199,9 +174,6 @@ public class CReconciler extends MonoReconciler {
* Internal C element changed listener
*/
private class ElementChangedListener implements IElementChangedListener {
/*
* @see org.eclipse.cdt.core.model.IElementChangedListener#elementChanged(org.eclipse.cdt.core.model.ElementChangedEvent)
*/
@Override
public void elementChanged(ElementChangedEvent event) {
if (event.getType() == ElementChangedEvent.POST_CHANGE) {
@ -246,9 +218,6 @@ public class CReconciler extends MonoReconciler {
private class IndexerListener implements IIndexerStateListener, IIndexChangeListener {
private boolean fIndexChanged;
/*
* @see org.eclipse.cdt.core.index.IIndexerStateListener#indexChanged(org.eclipse.cdt.core.index.IIndexerStateEvent)
*/
@Override
public void indexChanged(IIndexerStateEvent event) {
if (event.indexerIsIdle()) {
@ -263,9 +232,6 @@ public class CReconciler extends MonoReconciler {
}
}
/*
* @see org.eclipse.cdt.core.index.IIndexChangeListener#indexChanged(org.eclipse.cdt.core.index.IIndexChangeEvent)
*/
@Override
public void indexChanged(IIndexChangeEvent event) {
if (!fIndexChanged && isRelevantProject(event.getAffectedProject())) {
@ -305,9 +271,6 @@ public class CReconciler extends MonoReconciler {
fTextEditor= editor;
}
/*
* @see org.eclipse.jface.text.reconciler.IReconciler#install(org.eclipse.jface.text.ITextViewer)
*/
@Override
public void install(ITextViewer textViewer) {
super.install(textViewer);
@ -335,9 +298,6 @@ public class CReconciler extends MonoReconciler {
}});
}
/*
* @see org.eclipse.jface.text.reconciler.IReconciler#uninstall()
*/
@Override
public void uninstall() {
fTriggerReconcilerJob.cancel();
@ -369,9 +329,6 @@ public class CReconciler extends MonoReconciler {
}
}
/*
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#forceReconciling()
*/
@Override
protected void forceReconciling() {
if (!fInitialProcessDone)
@ -379,18 +336,12 @@ public class CReconciler extends MonoReconciler {
super.forceReconciling();
}
/*
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#aboutToBeReconciled()
*/
@Override
protected void aboutToBeReconciled() {
CCompositeReconcilingStrategy strategy= (CCompositeReconcilingStrategy) getReconcilingStrategy(IDocument.DEFAULT_CONTENT_TYPE);
strategy.aboutToBeReconciled();
}
/*
* @see org.eclipse.jface.text.reconciler.MonoReconciler#initialProcess()
*/
@Override
protected void initialProcess() {
super.initialProcess();
@ -400,9 +351,6 @@ public class CReconciler extends MonoReconciler {
}
}
/*
* @see org.eclipse.jface.text.reconciler.MonoReconciler#process(org.eclipse.jface.text.reconciler.DirtyRegion)
*/
@Override
protected void process(DirtyRegion dirtyRegion) {
fIsReconciling= true;
@ -469,7 +417,6 @@ public class CReconciler extends MonoReconciler {
return false;
}
private boolean isRelevantProject(ICProject affectedProject) {
if (affectedProject == null) {
return false;
@ -499,5 +446,4 @@ public class CReconciler extends MonoReconciler {
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 Ericsson and others.
* Copyright (c) 2008, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Ericsson - initial API and implementation
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
* John Dallaway - GDB 7.x MI thread details field ignored (Bug 325556)
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@ -118,7 +119,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
*/
@Immutable
private static class MIExecutionDMC extends AbstractDMContext
implements IMIExecutionDMContext
implements IMIExecutionDMContext, IDisassemblyDMContext
{
/**
* String ID that is used to identify the thread in the GDB/MI protocol.

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
@ -76,7 +77,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
*/
@Immutable
private static class MIExecutionDMC extends AbstractDMContext
implements IMIExecutionDMContext
implements IMIExecutionDMContext, IDisassemblyDMContext
{
/**
* String ID that is used to identify the thread in the GDB/MI protocol.

View file

@ -10,6 +10,7 @@
* Ericsson AB - Modified for handling of multiple threads
* Vladimir Prus (Mentor Graphics) - Add proper stop reason for step return (Bug 362274)
* Indel AG - [369622] fixed moveToLine using MinGW
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
@ -37,6 +38,7 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDMEvent;
import org.eclipse.cdt.dsf.debug.service.ICachingService;
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl;
@ -93,7 +95,7 @@ import org.osgi.framework.BundleContext;
*/
public class MIRunControl extends AbstractDsfService implements IMIRunControl, ICachingService
{
private static class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext
private static class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext, IDisassemblyDMContext
{
/**
* Integer ID that is used to identify the thread in the GDB/MI protocol.