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

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

This commit is contained in:
Andrew Gvozdev 2012-11-23 09:10:13 -05:00
commit cdbd91fd64
133 changed files with 9243 additions and 1641 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
/*/*/index
/*/*/target
.DS_Store
.nfs*

View file

@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.internal.ui.editor.IMakefileDocumentProvider;
import org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentProvider;
import org.eclipse.cdt.make.internal.ui.editor.WorkingCopyManager;
@ -26,6 +27,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
@ -36,6 +38,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.osgi.framework.BundleContext;
@ -50,6 +53,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
private IWorkingCopyManager fWorkingCopyManager;
private IMakefileDocumentProvider fMakefileDocumentProvider;
private ScopedPreferenceStore fCorePreferenceStore;
/**
* The constructor.
@ -269,6 +273,16 @@ public class MakeUIPlugin extends AbstractUIPlugin {
return chainedStore;
}
/**
* Returns a preference store for org.eclipse.cdt.make.core preferences
* @return the preference store
*/
public IPreferenceStore getCorePreferenceStore() {
if (fCorePreferenceStore == null) {
fCorePreferenceStore= new ScopedPreferenceStore(InstanceScope.INSTANCE, MakeCorePlugin.PLUGIN_ID);
}
return fCorePreferenceStore;
}
@Override
public void start(BundleContext context) throws Exception {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2010 QNX Software Systems and others.
* Copyright (c) 2002, 2012 QNX Software Systems 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
@ -13,8 +13,8 @@
package org.eclipse.cdt.make.internal.ui.preferences;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PathEditor;
@ -23,7 +23,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
* MakePreferencePage
@ -37,7 +36,7 @@ public class MakefileSettingsPreferencePage extends FieldEditorPreferencePage im
public MakefileSettingsPreferencePage() {
super(GRID);
IPreferenceStore store = new ScopedPreferenceStore(new InstanceScope(), MakeCorePlugin.PLUGIN_ID);
IPreferenceStore store = MakeUIPlugin.getDefault().getCorePreferenceStore();
setPreferenceStore(store);
}

View file

@ -632,26 +632,27 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
private int decodeParallelizationNumber(String value) {
int parallelNumber = -1;
if (VALUE_OPTIMAL.equals(value)) {
if (value == null || VALUE_OPTIMAL.equals(value)) {
parallelNumber = -getOptimalParallelJobNum();
} else if (VALUE_UNLIMITED.equals(value)) {
parallelNumber = UNLIMITED_JOBS;
} else {
try {
parallelNumber = Integer.decode(value);
if (parallelNumber <= 0) {
// compatibility with legacy representation - it was that inconsistent
if (isInternalBuilder()) {
// "optimal" for Internal Builder
parallelNumber = -getOptimalParallelJobNum();
} else {
// unlimited for External Builder
parallelNumber = UNLIMITED_JOBS;
}
}
} catch (NumberFormatException e) {
ManagedBuilderCorePlugin.log(e);
parallelNumber = getOptimalParallelJobNum();
}
if (parallelNumber <= 0) {
// compatibility with legacy representation - it was that inconsistent
if (isInternalBuilder()) {
// "optimal" for Internal Builder
parallelNumber = -getOptimalParallelJobNum();
} else {
// unlimited for External Builder
parallelNumber = UNLIMITED_JOBS;
}
// default to "optimal" if not recognized
parallelNumber = -getOptimalParallelJobNum();
}
}
return parallelNumber;

View file

@ -167,6 +167,11 @@
wizardId="org.eclipse.cdt.ui.wizards.ConvertToMakeWizard">
<enablement>
<and>
<with variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<adapt type="org.eclipse.core.resources.IProject" />
<not>
<adapt type="org.eclipse.core.resources.IProject" >

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2011 Alena Laskavaia
* Copyright (c) 2009, 2012 Alena Laskavaia
* 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:
* Alena Laskavaia - initial API and implementation
* Tomasz Wesolowski - Bug 348387
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
@ -47,6 +48,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -205,8 +207,9 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
*/
private boolean isCompoundStatement(IASTStatement last) {
return last instanceof IASTIfStatement || last instanceof IASTWhileStatement ||
last instanceof IASTDoStatement || last instanceof IASTForStatement ||
last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
last instanceof IASTDoStatement || last instanceof IASTForStatement ||
last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement ||
last instanceof ICPPASTTryBlockStatement;
}
protected boolean isFuncExitStatement(IASTStatement statement) {

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2012 Alena Laskavaia 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
* Tomasz Wesolowski - Bug 348387
*******************************************************************************/
package org.eclipse.cdt.codan.core.cxx.internal.model.cfg;
@ -32,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
@ -231,14 +233,20 @@ public class ControlFlowGraphBuilder {
addOutgoing(prev, ifNode);
IConnectorNode mergeNode = factory.createConnectorNode();
ifNode.setMergeNode(mergeNode);
IBranchNode thenNode = factory.createBranchNode(IBranchNode.THEN);
addOutgoing(ifNode, thenNode);
IBasicBlock then = createSubGraph(thenNode, body.getTryBody());
addJump(then, mergeNode);
IBranchNode tryBodyNode = factory.createBranchNode(IBranchNode.TRY_BODY);
addOutgoing(ifNode, tryBodyNode);
IBasicBlock tryBody = createSubGraph(tryBodyNode, body.getTryBody());
addJump(tryBody, mergeNode);
ICPPASTCatchHandler[] catchHandlers = body.getCatchHandlers();
for (int i = 0; i < catchHandlers.length; i++) {
ICPPASTCatchHandler handler = catchHandlers[i];
IBranchNode handlerNode = factory.createBranchNode(handler.getDeclaration());
IBranchNode handlerNode;
IASTDeclaration declaration = handler.getDeclaration();
if (declaration != null) {
handlerNode = factory.createBranchNode(declaration);
} else {
handlerNode = factory.createBranchNode(IBranchNode.CATCH_ANY);
}
addOutgoing(ifNode, handlerNode);
IBasicBlock els = createSubGraph(handlerNode, handler.getCatchBody());
addJump(els, mergeNode);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2012 Alena Laskavaia
* 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
@ -363,7 +363,7 @@ public class ControlFlowGraphTest extends CodanFastCxxAstTestCase {
IPlainNode decl = (IPlainNode) startNode.getOutgoing();
IDecisionNode des = (IDecisionNode) decl.getOutgoing();
//assertEquals("", data(des));
IPlainNode bThen = (IPlainNode) branchEnd(des, IBranchNode.THEN);
IPlainNode bThen = (IPlainNode) branchEnd(des, IBranchNode.TRY_BODY);
assertEquals("*p = 1;", data(bThen));
IBasicBlock bElse = null;
IBasicBlock[] outgoingNodes = des.getOutgoingNodes();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2011 Alena Laskavaia
* Copyright (c) 2009, 2012 Alena Laskavaia
* 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
@ -8,6 +8,7 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
* Felipe Martinez - ReturnCheckerTest implementation
* Tomasz Wesolowski - Bug 348387
*******************************************************************************/
package org.eclipse.cdt.codan.core.internal.checkers;
@ -310,4 +311,39 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// int try1() {
// try {
// return 5;
// } catch (...) {
// return 5;
// }
// }
public void testTryBlock1() throws Exception {
// bug 348387
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
// int try2() {
// try {
// return 5;
// } catch (int) {
// }
// }
public void testTryBlock2() throws Exception {
loadCodeAndRunCpp(getAboveComment());
checkErrorLine(1);
}
// int try3() {
// try {
// } catch (int a) {
// return 5;
// }
// }
public void testTryBlock3() throws Exception {
loadCodeAndRunCpp(getAboveComment());
checkErrorLine(1);
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2012 Alena Laskavaia 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
* Tomasz Wesolowski - Bug 348387
*******************************************************************************/
package org.eclipse.cdt.codan.core.model.cfg;
@ -29,6 +30,14 @@ public interface IBranchNode extends IBasicBlock, ISingleIncoming, ISingleOutgoi
* Default branch of "switch" statement
*/
public static String DEFAULT = "default"; //$NON-NLS-1$
/**
* Try branch of "try" block statement
*/
public static String TRY_BODY = "try"; //$NON-NLS-1$
/**
* Catch "..." branch of "try" block statement
*/
public static String CATCH_ANY = "..."; //$NON-NLS-1$
/**
* @return label of a branch

View file

@ -168,6 +168,9 @@ public class CodanRunner {
private static void removeMarkersForDisabledProblems(CheckersRegistry chegistry,
Set<String> markerTypes, IResource resource, IProgressMonitor monitor) throws CoreException {
if (!resource.isAccessible()) {
return;
}
IResource[] children = null;
if (resource instanceof IContainer) {
children = ((IContainer) resource).members();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Alena Laskavaia
* Copyright (c) 2010, 2012 Alena Laskavaia 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
@ -19,6 +19,10 @@ import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
@ -71,6 +75,26 @@ public class CodanUIActivator extends AbstractUIPlugin {
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
/**
*
* @param key - key is usually plug-in relative path to image like icons/xxx.gif
* @return Image loaded from key location or from registry cache, it will be stored in plug-in registry and disposed when plug-in unloads
*/
public Image getImage(String key) {
ImageRegistry registry = getImageRegistry();
Image image = registry.get(key);
if (image == null) {
ImageDescriptor descriptor = imageDescriptorFromPlugin(PLUGIN_ID, key);
if (descriptor==null) {
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
return sharedImages.getImage(key);
}
registry.put(key, descriptor);
image = registry.get(key);
}
return image;
}
/**
* Logs the specified status with this plug-in's log.

View file

@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright (c) 2012 Marc-Andre Laperle
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc-Andre Laperle - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui;
public interface ImageConstants {
String ICON_WARNING = "icons/yellow_bug.gif"; //$NON-NLS-1$
String ICON_ERROR = "icons/red_bug.gif"; //$NON-NLS-1$
String ICON_INFO = "icons/blue_bug.gif"; //$NON-NLS-1$
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2011 Alena Laskavaia and others.
* Copyright (c) 2009, 2012 Alena Laskavaia 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
@ -8,9 +8,12 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
* IBM Corporation
* Marc-Andre Laperle
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
import java.text.MessageFormat;
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.core.PreferenceConstants;
import org.eclipse.cdt.codan.core.model.CodanSeverity;
@ -23,7 +26,9 @@ import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.core.param.LaunchModeProblemPreference;
import org.eclipse.cdt.codan.core.param.RootProblemPreference;
import org.eclipse.cdt.codan.internal.core.CodanPreferencesLoader;
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.cdt.codan.internal.ui.ImageConstants;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@ -40,10 +45,6 @@ import org.eclipse.jface.window.ToolTip;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import java.text.MessageFormat;
public class ProblemsTreeEditor extends CheckedTreeEditor {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
@ -261,16 +262,15 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
column2.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
final ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
if (element instanceof IProblem) {
IProblem p = (IProblem) element;
switch (p.getSeverity().intValue()) {
case IMarker.SEVERITY_INFO:
return images.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
return CodanUIActivator.getDefault().getImage(ImageConstants.ICON_INFO);
case IMarker.SEVERITY_WARNING:
return images.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
return CodanUIActivator.getDefault().getImage(ImageConstants.ICON_WARNING);
case IMarker.SEVERITY_ERROR:
return images.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
return CodanUIActivator.getDefault().getImage(ImageConstants.ICON_ERROR);
}
}
return null;

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004, 2009 QNX Software Systems Ltd and others.
* Copyright (c) 2004, 2012 QNX Software Systems Ltd 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
@ -47,12 +47,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
/**
* @author David
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class CDescriptorTests extends BaseTestCase {
static String projectId = CTestPlugin.PLUGIN_ID + ".TestProject";
@ -176,8 +170,9 @@ public class CDescriptorTests extends BaseTestCase {
Assert.assertEquals("C/C++ Test Project", owner.getName());
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=185930
public void testConcurrentDescriptorCreation() throws Exception {
// Disabled this test because it fails every now and then and it tests deprecated API
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340123
public void _testConcurrentDescriptorCreation() throws Exception {
for (int i = 0; i < 100 ; i++) {
fProject.close(null);
fProject.open(null);

View file

@ -153,18 +153,20 @@ public class AST2BaseTest extends BaseTestCase {
AbstractGNUSourceCodeParser parser = null;
if (lang == ParserLanguage.CPP) {
ICPPParserExtensionConfiguration config = null;
if (useGNUExtensions)
if (useGNUExtensions) {
config = new GPPParserExtensionConfiguration();
else
} else {
config = new ANSICPPParserExtensionConfiguration();
}
parser = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG,config, null);
} else {
ICParserExtensionConfiguration config = null;
if (useGNUExtensions)
if (useGNUExtensions) {
config = new GCCParserExtensionConfiguration();
else
} else {
config = new ANSICParserExtensionConfiguration();
}
parser = new GNUCSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, config, null);
}
@ -204,10 +206,11 @@ public class AST2BaseTest extends BaseTestCase {
public static IScanner createScanner(FileContent codeReader, ParserLanguage lang, ParserMode mode,
IScannerInfo scannerInfo) {
IScannerExtensionConfiguration configuration = null;
if (lang == ParserLanguage.C)
configuration= GCCScannerExtensionConfiguration.getInstance();
else
if (lang == ParserLanguage.C) {
configuration= GCCScannerExtensionConfiguration.getInstance(scannerInfo);
} else {
configuration= GPPScannerExtensionConfiguration.getInstance(scannerInfo);
}
IScanner scanner;
scanner= new CPreprocessor(codeReader, scannerInfo, lang, NULL_LOG, configuration,
IncludeFileContentProvider.getSavedFilesProvider());

View file

@ -91,7 +91,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
@ -1535,6 +1534,43 @@ public class AST2CPPTests extends AST2BaseTest {
}
}
// struct A {
// A(int x);
// A(char x);
// };
//
// A a = A(1);
public void testConstructorCall() throws Exception {
BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP);
ICPPConstructor ctor = bh.assertNonProblem("A(int x)", "A", ICPPConstructor.class);
ICPPClassType classType = bh.assertNonProblem("A(1)", "A", ICPPClassType.class);
assertSame(ctor.getOwner(), classType);
IASTName name = bh.findName("A(1)", "A");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
IBinding ctor2 = implicitNames[0].getBinding();
assertSame(ctor, ctor2);
}
// struct A {
// A(int x);
// };
// struct B {
// operator A();
// };
//
// void test() {
// B b;
// A a = A(b);
// }
public void _testConversionOperator() throws Exception {
BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP);
ICPPMethod oper = bh.assertNonProblem("operator A", "operator A", ICPPMethod.class);
ICPPMethod conv = bh.assertNonProblem("A(b)", "A", ICPPMethod.class);
// This assertion fails because conv is the copy ctor A(const A&), not the conversion operator B::operator A()
assertSame(oper, conv);
}
// namespace A { int x; }
// namespace B = A;
// int f(){ B::x; }
@ -2581,25 +2617,25 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(d.getNestedDeclarator().getPointerOperators()[0] instanceof ICPPASTPointerToMember);
}
// struct T1 {
// T1 operator() (int x) {
// return T1(x);
// struct A {
// A operator()(int x) {
// return A(x);
// }
// T1(int) {}
// A(int) {}
// };
public void testBug86336() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPConstructor T1_ctor = (ICPPConstructor) col.getName(6).resolveBinding();
ICPPClassType T1 = (ICPPClassType) col.getName(0).resolveBinding();
assertInstances(col, T1_ctor, 1);
assertInstances(col, T1, 3);
ICPPASTFunctionCallExpression fc= (ICPPASTFunctionCallExpression) col.getName(4).getParent().getParent();
IBinding ctor2 = fc.getImplicitNames()[0].resolveBinding();
assertSame(T1_ctor, ctor2);
BindingAssertionHelper bh = getAssertionHelper();
ICPPClassType clazz = bh.assertNonProblem("A {", "A", ICPPClassType.class);
ICPPConstructor ctor = bh.assertNonProblem("A(int)", "A", ICPPConstructor.class);
ICPPClassType clazz2 = bh.assertNonProblem("A(x)", "A", ICPPClassType.class);
assertSame(clazz, clazz2);
clazz2 = bh.assertNonProblem("A operator", "A", ICPPClassType.class);
assertSame(clazz, clazz2);
IASTName name = bh.findName("A(x)", "A");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
IBinding ctor2 = implicitNames[0].getBinding();
assertSame(ctor, ctor2);
}
// struct S { int i; };
@ -3783,6 +3819,24 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(((ITypedef) binding).getType() instanceof IFunctionType);
}
// struct A {
// A(int x);
// };
// typedef A B;
//
// B a = B(1);
public void testTypedefConstructorCall() throws Exception {
BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP);
ICPPConstructor ctor = bh.assertNonProblem("A(int x)", "A", ICPPConstructor.class);
ITypedef typedef = bh.assertNonProblem("B(1)", "B", ITypedef.class);
assertSame(ctor.getOwner(), typedef.getType());
IASTName name = bh.findName("B(1)", "B");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
IBinding ctor2 = implicitNames[0].getBinding();
assertSame(ctor, ctor2);
}
// void f(int);
// void foo(){
// f((1, 2));
@ -4709,97 +4763,6 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(i, col.getName(7).resolveBinding());
}
// template<typename T>
// struct basic_string {
// basic_string& operator+=(const T* s);
// basic_string& append(const T* s);
// };
//
// template<typename T>
// basic_string<T> operator+(const T* cs, const basic_string<T>& s);
//
// template<typename T>
// basic_string<T> operator+(const basic_string<T>& s, const T* cs);
//
// typedef basic_string<char> string;
//
// void test(const string& s) {
// auto s1 = "" + s + "";
// auto s2 = s1 += "";
// auto s3 = s2.append("foo");
// }
public void testTypedefPreservation_380498_1() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class);
assertTrue(s1.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s1.getType()).getName());
ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class);
assertTrue(s2.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s2.getType()).getName());
ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class);
assertTrue(s3.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s3.getType()).getName());
}
// template <typename T>
// struct vector {
// typedef T* const_iterator;
// const_iterator begin() const;
// };
//
// typedef int Element;
//
// void test(const vector<Element>& v) {
// auto it = v.begin();
// }
public void testTypedefPreservation_380498_2() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class);
assertTrue(it.getType() instanceof ITypedef);
assertEquals("vector<Element>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
}
// template <typename T> class char_traits {};
// template <typename C, typename T = char_traits<C>> class basic_string {};
//
// template<typename _Iterator>
// struct iterator_traits {
// typedef typename _Iterator::reference reference;
// };
//
// template<typename _Tp>
// struct iterator_traits<_Tp*> {
// typedef _Tp& reference;
// };
//
// template<typename _Iterator, typename _Container>
// struct normal_iterator {
// typedef iterator_traits<_Iterator> traits_type;
// typedef typename traits_type::reference reference;
// reference operator*() const;
// };
//
// template <typename T> struct vector {
// typedef T* pointer;
// typedef normal_iterator<pointer, vector> iterator;
// iterator begin();
// iterator end();
// };
//
// typedef basic_string<char> string;
//
// void test() {
// vector<string> v;
// for (auto s : v) {
// }
// }
public void testTypedefPreservation_380498_3() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class);
assertTrue(s.getType() instanceof ITypedef);
assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
}
// int f() {
// return 5;
// }
@ -9971,4 +9934,16 @@ public class AST2CPPTests extends AST2BaseTest {
public void testFinalParameter() throws Exception {
parseAndCheckBindings();
}
// struct S1 {};
// S1 s1;
// const int i= 1;
// template<int I> struct CT {};
// typedef int TD;
// bool operator==(S1 a, int r );
// static const int x = sizeof(CT<i>((TD * (CT<sizeof(s1 == 1)>::*)) 0 ));
// template<int I> bool operator==(S1 a, const CT<I>& r );
public void testOrderInAmbiguityResolution_390759() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -18,6 +18,9 @@ import static org.eclipse.cdt.core.parser.ParserLanguage.CPP;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateType;
import java.io.IOException;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.IName;
@ -29,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
@ -50,7 +54,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
@ -89,6 +92,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.parser.ParserException;
public class AST2TemplateTests extends AST2BaseTest {
@ -111,6 +115,11 @@ public class AST2TemplateTests extends AST2BaseTest {
return parseAndCheckBindings(code, CPP);
}
protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException {
String code= getAboveComment();
return new BindingAssertionHelper(code, true);
}
public void testBasicClassTemplate() throws Exception {
IASTTranslationUnit tu = parse("template <class T> class A{ T t; };", CPP); //$NON-NLS-1$
CPPNameCollector col = new CPPNameCollector();
@ -1719,23 +1728,19 @@ public class AST2TemplateTests extends AST2BaseTest {
// void m(){
// f(A<int>(1));
// }
public void testBug99254() throws Exception{
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPConstructor ctor = (ICPPConstructor) col.getName(2).resolveBinding();
ICPPFunction f = (ICPPFunction) col.getName(5).resolveBinding();
final IASTName typeConversion = col.getName(11);
ICPPSpecialization spec = (ICPPSpecialization) typeConversion.resolveBinding();
public void testBug99254_1() throws Exception {
BindingAssertionHelper bh= getAssertionHelper();
ICPPConstructor ctor = bh.assertNonProblem("A(T t)", "A", ICPPConstructor.class);
ICPPSpecialization spec = bh.assertNonProblem("A<int>(1)", "A<int>", ICPPSpecialization.class);
assertSame(ctor.getOwner(), spec.getSpecializedBinding());
final ICPPASTFunctionCallExpression fcall = (ICPPASTFunctionCallExpression) typeConversion.getParent().getParent();
final IBinding ctorSpec = fcall.getImplicitNames()[0].resolveBinding();
assertSame(ctor, (((ICPPSpecialization) ctorSpec).getSpecializedBinding()));
assertSame(f, col.getName(10).resolveBinding());
IASTName name = bh.findName("A<int>(1)", "A<int>");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
ICPPSpecialization ctor2 = (ICPPSpecialization) implicitNames[0].getBinding();
assertSame(ctor, ctor2.getSpecializedBinding());
ICPPFunction f = bh.assertNonProblem("f(A<int> a)", "f", ICPPFunction.class);
ICPPFunction f2 = bh.assertNonProblem("f(A<int>(1))", "f", ICPPFunction.class);
assertSame(f, f2);
}
// namespace core {
@ -1744,67 +1749,59 @@ public class AST2TemplateTests extends AST2BaseTest {
// };
// }
// class B {
// int add(const core::A<int> &rect);
// int add(const core::A<int>& rect);
// };
// void f(B* b){
// b->add(core::A<int>(10, 2));
// }
public void testBug99254_2() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPConstructor ctor = (ICPPConstructor) col.getName(3).resolveBinding();
ICPPMethod add = (ICPPMethod) col.getName(9).resolveBinding();
final IASTName typeConversion = col.getName(20);
ICPPSpecialization spec = (ICPPSpecialization) typeConversion.resolveBinding();
BindingAssertionHelper bh= getAssertionHelper();
ICPPConstructor ctor = bh.assertNonProblem("A(T x, T y)", "A", ICPPConstructor.class);
ICPPSpecialization spec = bh.assertNonProblem("A<int>(10, 2)", "A<int>", ICPPSpecialization.class);
assertSame(ctor.getOwner(), spec.getSpecializedBinding());
final ICPPASTFunctionCallExpression fcall = (ICPPASTFunctionCallExpression) typeConversion.getParent().getParent();
final IBinding ctorSpec = fcall.getImplicitNames()[0].resolveBinding();
assertSame(ctor, (((ICPPSpecialization) ctorSpec).getSpecializedBinding()));
assertSame(add, col.getName(19).resolveBinding());
IASTName name = bh.findName("A<int>(10, 2)", "A<int>");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
ICPPSpecialization ctor2 = (ICPPSpecialization) implicitNames[0].getBinding();
assertSame(ctor, ctor2.getSpecializedBinding());
ICPPMethod add = bh.assertNonProblem("add(const core::A<int>& rect)", "add", ICPPMethod.class);
ICPPMethod add2 = bh.assertNonProblem("b->add(core::A<int>(10, 2))", "add", ICPPMethod.class);
assertSame(add, add2);
}
// template <class T> class A { A(T); };
// typedef signed int s32;
// class B {
// int add(const A<s32> &rect);
// int add(const A<s32>& rect);
// };
// void f(B* b){
// b->add(A<int>(10));
// }
public void testBug99254_3() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPConstructor ctor = (ICPPConstructor) col.getName(2).resolveBinding();
ICPPMethod add = (ICPPMethod) col.getName(7).resolveBinding();
final IASTName typeConversion = col.getName(17);
ICPPSpecialization spec = (ICPPSpecialization) typeConversion.resolveBinding();
BindingAssertionHelper bh= getAssertionHelper();
ICPPConstructor ctor = bh.assertNonProblem("A(T)", "A", ICPPConstructor.class);
ICPPSpecialization spec = bh.assertNonProblem("A<int>(10)", "A<int>", ICPPSpecialization.class);
assertSame(ctor.getOwner(), spec.getSpecializedBinding());
final ICPPASTFunctionCallExpression fcall = (ICPPASTFunctionCallExpression) typeConversion.getParent().getParent();
final IBinding ctorSpec = fcall.getImplicitNames()[0].resolveBinding();
assertSame(ctor, (((ICPPSpecialization) ctorSpec).getSpecializedBinding()));
assertSame(add, col.getName(16).resolveBinding());
IASTName name = bh.findName("A<int>(10)", "A<int>");
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) name.getParent().getParent()).getImplicitNames();
assertEquals(1, implicitNames.length);
ICPPSpecialization ctor2 = (ICPPSpecialization) implicitNames[0].getBinding();
assertSame(ctor, ctor2.getSpecializedBinding());
ICPPMethod add = bh.assertNonProblem("add(const A<s32>& rect)", "add", ICPPMethod.class);
ICPPMethod add2 = bh.assertNonProblem("b->add(A<int>(10))", "add", ICPPMethod.class);
assertSame(add, add2);
}
public void testBug98666() throws Exception {
CPPASTNameBase.sAllowNameComputation= true;
IASTTranslationUnit tu = parse("A::template B<T> b;", CPP); //$NON-NLS-1$
IASTTranslationUnit tu = parse("A::template B<T> b;", CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPASTQualifiedName qn = (ICPPASTQualifiedName) col.getName(0);
IASTName[] ns = qn.getNames();
assertTrue(ns[1] instanceof ICPPASTTemplateId);
assertEquals(ns[1].toString(), "B<T>"); //$NON-NLS-1$
assertEquals(ns[1].toString(), "B<T>");
}
// template <class T> struct A{
@ -2278,8 +2275,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(p);
// }
public void testFunctionTemplate_272848_1() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename S>
@ -2295,8 +2291,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(p);
// }
public void testFunctionTemplate_272848_2() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T, typename U>
@ -2309,8 +2304,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f<int>(x);
// }
public void testFunctionTemplate_309564() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<class U> void f1(void(*f)(const U&)) {}
@ -2319,8 +2313,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f1(&f2); // problem on f1
// }
public void testSimplifiedFunctionTemplateWithFunctionPointer_281783() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <class T>
@ -2638,8 +2631,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// AI<char> y;
// AT<char> z;
public void testDefaultTemplateParameter_281781() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// class A {};
@ -3254,7 +3246,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// };
// }
public void testBug238180_ArrayOutOfBounds() throws Exception {
// the code above used to trigger an ArrayOutOfBoundsException
// The code above used to trigger an ArrayOutOfBoundsException
parse(getAboveComment(), CPP);
}
@ -3557,8 +3549,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// xt.partial;
// }
public void testDefaultArgsWithPartialSpecialization() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class XT {
@ -3707,6 +3698,116 @@ public class AST2TemplateTests extends AST2BaseTest {
bh.assertNonProblem("func(p)", 4, ICPPFunction.class);
}
// template <class T>
// struct C {
// typedef void (T::*PMF)();
// C(PMF member);
// };
//
// struct A {
// void m();
// };
//
// typedef A B;
//
// void test() {
// new C<B>(&B::m);
// }
public void testTypedef() throws Exception {
parseAndCheckBindings();
}
// template<typename T>
// struct basic_string {
// basic_string& operator+=(const T* s);
// basic_string& append(const T* s);
// };
//
// template<typename T>
// basic_string<T> operator+(const T* cs, const basic_string<T>& s);
//
// template<typename T>
// basic_string<T> operator+(const basic_string<T>& s, const T* cs);
//
// typedef basic_string<char> string;
//
// void test(const string& s) {
// auto s1 = "" + s + "";
// auto s2 = s1 += "";
// auto s3 = s2.append("foo");
// }
public void testTypedefPreservation_380498_1() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class);
assertTrue(s1.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s1.getType()).getName());
ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class);
assertTrue(s2.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s2.getType()).getName());
ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class);
assertTrue(s3.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s3.getType()).getName());
}
// template <typename T>
// struct vector {
// typedef T* const_iterator;
// const_iterator begin() const;
// };
//
// typedef int Element;
//
// void test(const vector<Element>& v) {
// auto it = v.begin();
// }
public void testTypedefPreservation_380498_2() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class);
assertTrue(it.getType() instanceof ITypedef);
assertEquals("vector<Element>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
}
// template <typename T> class char_traits {};
// template <typename C, typename T = char_traits<C>> class basic_string {};
//
// template<typename _Iterator>
// struct iterator_traits {
// typedef typename _Iterator::reference reference;
// };
//
// template<typename _Tp>
// struct iterator_traits<_Tp*> {
// typedef _Tp& reference;
// };
//
// template<typename _Iterator, typename _Container>
// struct normal_iterator {
// typedef iterator_traits<_Iterator> traits_type;
// typedef typename traits_type::reference reference;
// reference operator*() const;
// };
//
// template <typename T> struct vector {
// typedef T* pointer;
// typedef normal_iterator<pointer, vector> iterator;
// iterator begin();
// iterator end();
// };
//
// typedef basic_string<char> string;
//
// void test() {
// vector<string> v;
// for (auto s : v) {
// }
// }
public void testTypedefPreservation_380498_3() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class);
assertTrue(s.getType() instanceof ITypedef);
assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
}
// template <typename CL, typename T>
// struct A {
// template<typename U> struct C {
@ -3853,8 +3954,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// }
// };
public void testResolutionOfUnknownFunctions() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// class C {};
@ -3866,8 +3966,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// }
// };
public void testResolutionOfUnknownArrayAccess() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class CT {
@ -3880,7 +3979,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// x.append(3, 'c');
// }
public void testConflictInTemplateArgumentDeduction() throws Exception {
String code= getAboveComment();
final String code= getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
ICPPMethod m= bh.assertNonProblem("append(3", 6);
@ -3921,10 +4020,9 @@ public class AST2TemplateTests extends AST2BaseTest {
// return A<C>(p);
// }
public void testForwardDeclarations_264109() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
bh.assertNonProblem("A<C> make_A(C* p) {", 4, ICPPTemplateInstance.class);
parseAndCheckBindings(code);
parseAndCheckBindings(getAboveComment());
}
// template <typename T> class CT {
@ -3937,8 +4035,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// any(CT<int>(iptr));
// }
public void testConstructorTemplateInClassTemplate_264314() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class XT {};
@ -3955,8 +4052,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// func(y, xy, xint);
// }
public void testDistinctDeferredInstances_264367() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class XT {
@ -3965,8 +4061,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// }
// };
public void testUnknownParameter_264988() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<int V>
@ -3977,8 +4072,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// int x = A<0>::e;
// A<0>::E y;
public void testEnumeratorInTemplateInstance_265070() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> class CT {};
@ -3989,10 +4083,9 @@ public class AST2TemplateTests extends AST2BaseTest {
// getline2(i);
// }
public void testAmbiguousDeclaratorInFunctionTemplate_265342() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
bh.assertNonProblem("getline2(i)", 8, ICPPTemplateInstance.class);
parseAndCheckBindings(code);
parseAndCheckBindings(getAboveComment());
}
// class C {
@ -4008,8 +4101,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// };
// };
public void testOwnerOfFriendTemplate_265671() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
IFunction f= bh.assertNonProblem("f1(", 2, IFunction.class);
IBinding owner= f.getOwner();
assertNull(owner);
@ -4026,7 +4118,7 @@ public class AST2TemplateTests extends AST2BaseTest {
tpar= bh.assertNonProblem("T3", 2, ICPPTemplateParameter.class);
assertEquals(2, tpar.getTemplateNestingLevel());
parseAndCheckBindings(code);
parseAndCheckBindings(getAboveComment());
}
// template <typename T> void f(T t) {
@ -4034,13 +4126,12 @@ public class AST2TemplateTests extends AST2BaseTest {
// }
// template <typename T> void g(T t) {}
public void testDependentNameReferencingLaterDeclaration_265926a() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
IFunction gref= bh.assertNonProblem("g(t)", 1);
assertInstance(gref, ICPPUnknownBinding.class);
IFunction gdecl= bh.assertNonProblem("g(T t)", 1);
parseAndCheckBindings(code);
parseAndCheckBindings(getAboveComment());
}
// class C;
@ -4060,8 +4151,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// void a() {};
// };
public void testDependentNameReferencingLaterDeclaration_265926b() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> class XT {
@ -4072,22 +4162,20 @@ public class AST2TemplateTests extends AST2BaseTest {
// }
// };
public void testDeferredConversionOperator() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class X {};
// template <typename T> class X1 {
// friend class X<T>;
// };
// template <typename T> class Y : X1<int> {
// template <typename T> class Y : X1<int> {
// void test() {
// X<int> x; // problem binding on X<int>
// }
// };
public void testFriendClassTemplate_266992() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <int N>
@ -4098,8 +4186,19 @@ public class AST2TemplateTests extends AST2BaseTest {
// S(a);
// }
public void testFunctionTemplateWithArrayReferenceParameter_269926() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// typedef unsigned int uint;
// template <uint N>
// void S(int (&array)[N]);
//
// int a[1];
// void test() {
// S(a);
// }
public void testFunctionTemplateWithArrayReferenceParameter_394024() throws Exception {
parseAndCheckBindings();
}
// template <typename T>
@ -4116,8 +4215,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(p);
// }
public void testTemplateConversionOperator_271948_1() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T>
@ -4136,16 +4234,14 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(x);
// }
public void testTemplateConversionOperator_271948_2() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<unsigned int> struct ST{};
// template<template<unsigned int> class T> class CT {};
// typedef CT<ST> TDef;
public void testUsingTemplateTemplateParameter_279619() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <int N> void T(int (&array)[N]) {};
@ -4154,8 +4250,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// T<2>(a);
// }
public void testInstantiationOfArraySize_269926() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> class CT {
@ -4164,8 +4259,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// void CT<int>::init(void) {
// }
public void testMethodSpecialization_322988() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code, CPP);
parseAndCheckBindings();
}
@ -4179,8 +4273,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(x);
// }
public void testInlineFriendFunction_284690_1() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T>
@ -4218,8 +4311,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// typedef NullType Type;
// };
public void testDefaultArgument_289132() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> class XT {
@ -4278,8 +4370,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(ch, cint);
// }
public void testFunctionTemplateOrdering_293468() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> void func(T* t) {};
@ -4296,8 +4387,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// func1 (a);
// }
public void testFunctionTemplateOrdering_294539() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> class CT {};
@ -4310,8 +4400,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// return a;
// }
public void testClosingAngleBrackets1_261268() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> class CT {};
@ -4340,8 +4429,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// a < a >> (1+2); // binary expression via ambiguity
// }
public void testClosingAngleBracketsAmbiguity_261268() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// #define OPASSIGN(x) x##=
@ -4350,8 +4438,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// a OPASSIGN(>>) 1;
// }
public void testTokenPasteShiftROperator_261268() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <class T> class X {
@ -4485,16 +4572,14 @@ public class AST2TemplateTests extends AST2BaseTest {
// CTx<1,2> c;
// }
public void testNonTypeTemplateParameterPack_280909() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename... Types>
// struct count { static const int value = sizeof...(Types);
// };
public void testVariadicTemplateExamples_280909a() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename... T> void f(T (* ...t)(int, int));
@ -4504,8 +4589,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(add, subtract);
// }
public void testVariadicTemplateExamples_280909b() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename... Mixins>
@ -4514,15 +4598,13 @@ public class AST2TemplateTests extends AST2BaseTest {
// X(const Mixins&... mixins) : Mixins(mixins)... { }
// };
public void testVariadicTemplateExamples_280909c() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<class... Types> class Tuple; // Types is a template type parameter pack
// template<class T, int... Dims> struct multi array; // Dims is a non-type template parameter pack
public void testVariadicTemplateExamples_280909d() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<class T = char> class String;
@ -4631,8 +4713,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f<int*, float*>(0, 0, 0); // Types is the sequence int*, float*, int
// }
public void testVariadicTemplateExamples_280909j() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<class... Types> void f(Types&...);
@ -4643,8 +4724,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// g(x, y, z); // T1 is deduced to int, Types is deduced to float, int
// }
public void testVariadicTemplateExamples_280909k() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<class> struct X { };
@ -4661,8 +4741,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// Y<int, float, double> y3; // uses primary template, Types contains int, float, double
// int fv = f(g); // okay, Types contains int, float
public void testVariadicTemplateExamples_280909n() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename... Types> struct Tuple { };
@ -4688,8 +4767,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(2, 1.0); // okay: args contains two arguments, an int and a double
// }
public void testVariadicTemplateExamples_280909q() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename... Types> void f(Types... rest);
@ -4697,8 +4775,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(&rest...); // '&rest...' is a pack expansion, '&rest' is its pattern
// }
public void testVariadicTemplateExamples_280909r() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename...> struct Tuple {};
@ -4748,8 +4825,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// bind(&Test::Update);
// }
public void testFunctionOrdering_299608() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <class T, class U = double> void f(T t = 0, U u = 0);
@ -4858,8 +4934,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// CT<int>::CT() : value_(0) {
// }
public void testConstructorOfExplicitSpecialization() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <typename T> struct CT;
@ -4907,8 +4982,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// CT<const int>::T2 b;
// }
public void testBug306213c() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T1, typename T2> class CT {};
@ -4985,7 +5059,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// template void N::f<int>(int&);
// template<> void N::f<long>(long&) {}
public void testInlineNamespaces_305980() throws Exception {
final String code= getAboveComment();
final String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
ICPPFunctionTemplate ft= bh.assertNonProblem("f(T&)", 1);
@ -5021,8 +5095,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// g(x);
// }
public void testUnnamedTypesAsTemplateArgument_316317a() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template <class T> class X { };
@ -5041,8 +5114,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(b); // OK
// }
public void testUnnamedTypesAsTemplateArgument_316317b() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// struct S {
@ -5058,8 +5130,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// (x + 1)->s;
// }
public void testOverloadResolutionBetweenMethodTemplateAndFunction() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename ...T> void f(T..., T...);
@ -5067,8 +5138,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// f(1,1);
// }
public void testFunctionParameterPacksInNonFinalPosition_324096() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename _CharT> struct OutStream {
@ -5576,8 +5646,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// typedef r::s t;
// t::u x;
public void testBoolExpressionAsTemplateArgument_361604() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
parseAndCheckBindings();
}
// template<typename T> struct B {
@ -6074,4 +6143,14 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testAddressAsTemplateArgument_391190() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true);
}
// template <typename T> struct CT {
// const static int const_min= 1;
// };
// void test(int off) {
// off < CT<int>::const_min || off > CT<int>::const_min;
// }
public void testTemplateIDAmbiguity_393959() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true);
}
}

View file

@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM Rational Software) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Copyright (c) 2004, 2011 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM Rational Software) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
@ -41,211 +41,200 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
}
private IASTTranslationUnit parseGCC(String code) throws ParserException {
IASTTranslationUnit tu = parse(code, ParserLanguage.C, true, true);
IASTTranslationUnit tu = parse(code, ParserLanguage.C, true, true);
CNameResolver resolver = new CNameResolver();
tu.accept(resolver);
if (resolver.numProblemBindings > 0)
throw new ParserException(" there are " + resolver.numProblemBindings + " ProblemBindings on the tu"); //$NON-NLS-1$ //$NON-NLS-2$
throw new ParserException(" there are " + resolver.numProblemBindings + " ProblemBindings on the tu"); //$NON-NLS-2$
if (resolver.numNullBindings > 0)
throw new ParserException("Expected no null bindings, encountered " + resolver.numNullBindings); //$NON-NLS-1$
throw new ParserException("Expected no null bindings, encountered " + resolver.numNullBindings);
return tu;
}
private IASTTranslationUnit parseGPP(String code) throws ParserException {
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP, true, true);
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP, true, true);
CPPNameResolver resolver = new CPPNameResolver();
tu.accept(resolver);
if (resolver.numProblemBindings > 0)
throw new ParserException(" there are " + resolver.numProblemBindings + " ProblemBindings on the tu"); //$NON-NLS-1$ //$NON-NLS-2$
throw new ParserException(" there are " + resolver.numProblemBindings + " ProblemBindings on the tu"); //$NON-NLS-2$
if (resolver.numNullBindings > 0)
throw new ParserException("Expected no null bindings, encountered " + resolver.numNullBindings); //$NON-NLS-1$
throw new ParserException("Expected no null bindings, encountered " + resolver.numNullBindings);
return tu;
}
public void testBug39695() throws Exception
{
parseGCC("int a = __alignof__ (int);").getDeclarations(); //$NON-NLS-1$
public void testBug39695() throws Exception {
parseGCC("int a = __alignof__ (int);").getDeclarations();
}
public void testBug39684() throws Exception
{
IASTDeclaration bar = parseGCC("typeof(foo(1)) bar () { return foo(1); }").getDeclarations()[0]; //$NON-NLS-1$
public void testBug39684() throws Exception {
IASTDeclaration bar = parseGCC("typeof(foo(1)) bar () { return foo(1); }").getDeclarations()[0];
assertTrue(bar instanceof CASTFunctionDefinition);
CFunction barFunc = (CFunction)((CASTFunctionDefinition)bar).getDeclarator().getName().resolveBinding();
IFunctionType type = barFunc.getType();
// TODO Devin typeof declSpec has 0 length, also doesn't seem to have a type for typeof... raise a bug
// IASTSimpleTypeSpecifier simpleTypeSpec = ((IASTSimpleTypeSpecifier)bar.getReturnType().getTypeSpecifier());
// assertEquals( simpleTypeSpec.getType(), IASTGCCSimpleTypeSpecifier.Type.TYPEOF );
// assertEquals(simpleTypeSpec.getType(), IASTGCCSimpleTypeSpecifier.Type.TYPEOF);
}
public void testBug39698A() throws Exception
{
IASTDeclaration[] decls = parseGPP("int a=0; \n int b=1; \n int c = a <? b;").getDeclarations(); //$NON-NLS-1$
assertEquals( ASTStringUtil.getExpressionString( (IASTExpression) ((IASTEqualsInitializer)((IASTSimpleDeclaration)decls[2]).getDeclarators()[0].getInitializer()).getInitializerClause() ), "a <? b" ); //$NON-NLS-1$
public void testBug39698A() throws Exception {
IASTDeclaration[] decls = parseGPP("int a=0; \n int b=1; \n int c = a <? b;").getDeclarations();
assertEquals(ASTStringUtil.getExpressionString((IASTExpression) ((IASTEqualsInitializer)((IASTSimpleDeclaration)decls[2]).getDeclarators()[0].getInitializer()).getInitializerClause()), "a <? b");
}
public void testBug39698B() throws Exception
{
IASTDeclaration[] decls = parseGPP("int a=0; \n int b=1; \n int c = a >? b;").getDeclarations(); //$NON-NLS-1$
assertEquals( ASTStringUtil.getExpressionString( (IASTExpression) ((IASTEqualsInitializer)((IASTSimpleDeclaration)decls[2]).getDeclarators()[0].getInitializer()).getInitializerClause() ), "a >? b" ); //$NON-NLS-1$
public void testBug39698B() throws Exception {
IASTDeclaration[] decls = parseGPP("int a=0; \n int b=1; \n int c = a >? b;").getDeclarations();
assertEquals(ASTStringUtil.getExpressionString((IASTExpression) ((IASTEqualsInitializer)((IASTSimpleDeclaration)decls[2]).getDeclarators()[0].getInitializer()).getInitializerClause()), "a >? b");
}
public void testPredefinedSymbol_bug69791() throws Exception {
parseGPP("typedef __builtin_va_list __gnuc_va_list; \n").getDeclarations();//$NON-NLS-1$
parseGCC("typedef __builtin_va_list __gnuc_va_list; \n").getDeclarations();//$NON-NLS-1$
parseGPP("typedef __builtin_va_list __gnuc_va_list; \n").getDeclarations();
parseGCC("typedef __builtin_va_list __gnuc_va_list; \n").getDeclarations();
}
public void testBug39697() throws Exception
{
public void testBug39697() throws Exception {
Writer writer = new StringWriter();
writer.write( "__asm__( \"CODE\" );\n" ); //$NON-NLS-1$
writer.write( "__inline__ int foo() { return 4; }\n"); //$NON-NLS-1$
writer.write( "__const__ int constInt;\n"); //$NON-NLS-1$
writer.write( "__volatile__ int volInt;\n"); //$NON-NLS-1$
writer.write( "__signed__ int signedInt;\n"); //$NON-NLS-1$
IASTDeclaration[] decls = parseGCC( writer.toString() ).getDeclarations();
assertEquals(((IASTASMDeclaration)decls[0]).getAssembly(), "\"CODE\""); //$NON-NLS-1$
assertTrue( ((IASTFunctionDefinition)decls[1]).getDeclSpecifier().isInline() );
assertTrue( ((IASTSimpleDeclaration)decls[2]).getDeclSpecifier().isConst() );
assertTrue( ((IASTSimpleDeclaration)decls[3]).getDeclSpecifier().isVolatile() );
assertTrue( ((ICASTSimpleDeclSpecifier)((IASTSimpleDeclaration)decls[4]).getDeclSpecifier()).isSigned() );
writer.write("__asm__( \"CODE\" );\n");
writer.write("__inline__ int foo() { return 4; }\n");
writer.write("__const__ int constInt;\n");
writer.write("__volatile__ int volInt;\n");
writer.write("__signed__ int signedInt;\n");
IASTDeclaration[] decls = parseGCC(writer.toString()).getDeclarations();
assertEquals(((IASTASMDeclaration)decls[0]).getAssembly(), "\"CODE\"");
assertTrue(((IASTFunctionDefinition)decls[1]).getDeclSpecifier().isInline());
assertTrue(((IASTSimpleDeclaration)decls[2]).getDeclSpecifier().isConst());
assertTrue(((IASTSimpleDeclaration)decls[3]).getDeclSpecifier().isVolatile());
assertTrue(((ICASTSimpleDeclSpecifier)((IASTSimpleDeclaration)decls[4]).getDeclSpecifier()).isSigned());
writer = new StringWriter();
writer.write( "int * __restrict__ resPointer1;\n"); //$NON-NLS-1$
writer.write( "int * __restrict resPointer2;\n"); //$NON-NLS-1$
decls = parseGCC( writer.toString() ).getDeclarations();
assertTrue( ((ICASTPointer)((IASTSimpleDeclaration)decls[0]).getDeclarators()[0].getPointerOperators()[0]).isRestrict() );
assertTrue( ((ICASTPointer)((IASTSimpleDeclaration)decls[1]).getDeclarators()[0].getPointerOperators()[0]).isRestrict() );
writer.write("int * __restrict__ resPointer1;\n");
writer.write("int * __restrict resPointer2;\n");
decls = parseGCC(writer.toString()).getDeclarations();
assertTrue(((ICASTPointer)((IASTSimpleDeclaration)decls[0]).getDeclarators()[0].getPointerOperators()[0]).isRestrict());
assertTrue(((ICASTPointer)((IASTSimpleDeclaration)decls[1]).getDeclarators()[0].getPointerOperators()[0]).isRestrict());
writer = new StringWriter();
writer.write( "int * __restrict__ resPointer1;\n"); //$NON-NLS-1$
writer.write( "int * __restrict resPointer2;\n"); //$NON-NLS-1$
decls = parseGPP( writer.toString() ).getDeclarations();
assertTrue( ((IASTPointer)((IASTSimpleDeclaration)decls[0]).getDeclarators()[0].getPointerOperators()[0]).isRestrict() );
assertTrue( ((IASTPointer)((IASTSimpleDeclaration)decls[1]).getDeclarators()[0].getPointerOperators()[0]).isRestrict() );
writer.write("int * __restrict__ resPointer1;\n");
writer.write("int * __restrict resPointer2;\n");
decls = parseGPP(writer.toString()).getDeclarations();
assertTrue(((IASTPointer)((IASTSimpleDeclaration)decls[0]).getDeclarators()[0].getPointerOperators()[0]).isRestrict());
assertTrue(((IASTPointer)((IASTSimpleDeclaration)decls[1]).getDeclarators()[0].getPointerOperators()[0]).isRestrict());
}
public void testBug73954A() throws Exception{
public void testBug73954A() throws Exception {
StringWriter writer = new StringWriter();
writer.write("void f(){ \n");//$NON-NLS-1$
writer.write(" __builtin_expect( 23, 2); \n");//$NON-NLS-1$
writer.write(" __builtin_prefetch( (const void *)0, 1, 2); \n");//$NON-NLS-1$
writer.write(" __builtin_huge_val(); \n");//$NON-NLS-1$
writer.write(" __builtin_huge_valf(); \n");//$NON-NLS-1$
writer.write(" __builtin_huge_vall(); \n");//$NON-NLS-1$
writer.write(" __builtin_inf(); \n");//$NON-NLS-1$
writer.write(" __builtin_inff(); \n");//$NON-NLS-1$
writer.write(" __builtin_infl(); \n");//$NON-NLS-1$
writer.write(" __builtin_nan(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_nanf(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_nanl(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_nans(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_nansf(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_nansl(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_ffs (0); \n");//$NON-NLS-1$
writer.write(" __builtin_clz (0); \n");//$NON-NLS-1$
writer.write(" __builtin_ctz (0); \n");//$NON-NLS-1$
writer.write(" __builtin_popcount (0); \n");//$NON-NLS-1$
writer.write(" __builtin_parity (0); \n");//$NON-NLS-1$
writer.write(" __builtin_ffsl (0); \n");//$NON-NLS-1$
writer.write(" __builtin_clzl (0); \n");//$NON-NLS-1$
writer.write(" __builtin_ctzl (0); \n");//$NON-NLS-1$
writer.write(" __builtin_popcountl (0); \n");//$NON-NLS-1$
writer.write(" __builtin_parityl (0); \n");//$NON-NLS-1$
writer.write(" __builtin_ffsll (0); \n");//$NON-NLS-1$
writer.write(" __builtin_clzll (0); \n");//$NON-NLS-1$
writer.write(" __builtin_ctzll (0); \n");//$NON-NLS-1$
writer.write(" __builtin_popcountll (0); \n");//$NON-NLS-1$
writer.write(" __builtin_parityll (0); \n");//$NON-NLS-1$
writer.write(" __builtin_powi (0, 0); \n");//$NON-NLS-1$
writer.write(" __builtin_powif (0, 0); \n");//$NON-NLS-1$
writer.write(" __builtin_powil (0, 0); \n");//$NON-NLS-1$
writer.write("} \n"); //$NON-NLS-1$
parseGCC( writer.toString() );
writer.write("void f(){ \n");
writer.write(" __builtin_expect( 23, 2); \n");
writer.write(" __builtin_prefetch( (const void *)0, 1, 2); \n");
writer.write(" __builtin_huge_val(); \n");
writer.write(" __builtin_huge_valf(); \n");
writer.write(" __builtin_huge_vall(); \n");
writer.write(" __builtin_inf(); \n");
writer.write(" __builtin_inff(); \n");
writer.write(" __builtin_infl(); \n");
writer.write(" __builtin_nan(\"\"); \n");
writer.write(" __builtin_nanf(\"\"); \n");
writer.write(" __builtin_nanl(\"\"); \n");
writer.write(" __builtin_nans(\"\"); \n");
writer.write(" __builtin_nansf(\"\"); \n");
writer.write(" __builtin_nansl(\"\"); \n");
writer.write(" __builtin_ffs (0); \n");
writer.write(" __builtin_clz (0); \n");
writer.write(" __builtin_ctz (0); \n");
writer.write(" __builtin_popcount (0); \n");
writer.write(" __builtin_parity (0); \n");
writer.write(" __builtin_ffsl (0); \n");
writer.write(" __builtin_clzl (0); \n");
writer.write(" __builtin_ctzl (0); \n");
writer.write(" __builtin_popcountl (0); \n");
writer.write(" __builtin_parityl (0); \n");
writer.write(" __builtin_ffsll (0); \n");
writer.write(" __builtin_clzll (0); \n");
writer.write(" __builtin_ctzll (0); \n");
writer.write(" __builtin_popcountll (0); \n");
writer.write(" __builtin_parityll (0); \n");
writer.write(" __builtin_powi (0, 0); \n");
writer.write(" __builtin_powif (0, 0); \n");
writer.write(" __builtin_powil (0, 0); \n");
writer.write("} \n");
parseGCC(writer.toString());
}
public void testBug39686() throws Exception
{
public void testBug39686() throws Exception {
Writer code = new StringWriter();
code.write("__complex__ double x; // complex double\n"); //$NON-NLS-1$
code.write("__complex__ short int a; // complex short int\n"); //$NON-NLS-1$
code.write("__complex__ float y = 2.5fi; // 2.5 imaginary float literal\n"); //$NON-NLS-1$
code.write("__complex__ int z = 3i; // imaginary intege r literal\n"); //$NON-NLS-1$
code.write("double v = __real__ x; // real part of expression\n"); //$NON-NLS-1$
code.write("double w = __imag__ x; // imaginary part of expression\n"); //$NON-NLS-1$
code.write("__complex__ double x; // complex double\n");
code.write("__complex__ short int a; // complex short int\n");
code.write("__complex__ float y = 2.5fi; // 2.5 imaginary float literal\n");
code.write("__complex__ int z = 3i; // imaginary intege r literal\n");
code.write("double v = __real__ x; // real part of expression\n");
code.write("double w = __imag__ x; // imaginary part of expression\n");
parseGCC(code.toString());
}
public void testBug39551B() throws Exception
{
public void testBug39551B() throws Exception {
//this used to be 99.99 * __I__, but I don't know where the __I__ came from, its not in C99, nor in GCC
IASTDeclaration decl = parseGCC("_Imaginary double id = 99.99 * 1i;").getDeclarations()[0]; //$NON-NLS-1$
IASTDeclaration decl = parseGCC("_Imaginary double id = 99.99 * 1i;").getDeclarations()[0];
// TODO Devin does ICPPASTSimpleDeclSpecifier need something for isImaginary ?
// assertEquals( variable.getName(), "id"); //$NON-NLS-1$
// assertTrue( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).isImaginary() );
// assertEquals(variable.getName(), "id");
// assertTrue(((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).isImaginary());
}
public void testBug39681() throws Exception
{
public void testBug39681() throws Exception {
Writer code = new StringWriter();
code.write("double\n"); //$NON-NLS-1$
code.write("foo (double a, double b)\n"); //$NON-NLS-1$
code.write("{\n"); //$NON-NLS-1$
code.write(" double square (double z) { return z * z; }\n"); //$NON-NLS-1$
code.write(" return square (a) + square (b);\n"); //$NON-NLS-1$
code.write("}\n"); //$NON-NLS-1$
code.write("double\n");
code.write("foo (double a, double b)\n");
code.write("{\n");
code.write(" double square (double z) { return z * z; }\n");
code.write(" return square (a) + square (b);\n");
code.write("}\n");
parseGCC(code.toString());
}
public void testBug39677() throws Exception
{
parseGPP("class B { public: B(); int a;}; B::B() : a(({ 1; })) {}"); //$NON-NLS-1$
public void testBug39677() throws Exception {
parseGPP("class B { public: B(); int a;}; B::B() : a(({ 1; })) {}");
Writer writer = new StringWriter();
writer.write( "int foo(); class B { public: B(); int a;};");
writer.write( "B::B() : a(( { int y = foo (); int z;\n" ); //$NON-NLS-1$
writer.write( "if (y > 0) z = y;\n" ); //$NON-NLS-1$
writer.write( "else z = - y;\n" );//$NON-NLS-1$
writer.write( "z; })) {}\n" );//$NON-NLS-1$
parseGPP( writer.toString() );
writer.write("int foo(); class B { public: B(); int a;};");
writer.write("B::B() : a(( { int y = foo (); int z;\n");
writer.write("if (y > 0) z = y;\n");
writer.write("else z = - y;\n");
writer.write("z; })) {}\n");
parseGPP(writer.toString());
writer = new StringWriter();
writer.write( "int x = ({ int foo(); int y = foo (); int z;\n" ); //$NON-NLS-1$
writer.write( "if (y > 0) z = y;\n" ); //$NON-NLS-1$
writer.write( "else z = - y;\n" );//$NON-NLS-1$
writer.write( "z; });\n" );//$NON-NLS-1$
parseGPP( writer.toString() );
writer.write("int x = ({ int foo(); int y = foo (); int z;\n");
writer.write("if (y > 0) z = y;\n");
writer.write("else z = - y;\n");
writer.write("z; });\n");
parseGPP(writer.toString());
writer = new StringWriter();
writer.write( "int foo(); \n" ); //$NON-NLS-1$
writer.write( "typeof({ int y = foo (); \n" ); //$NON-NLS-1$
writer.write( " int z; \n" ); //$NON-NLS-1$
writer.write( " if (y > 0) z = y; \n" ); //$NON-NLS-1$
writer.write( " else z = - y; \n" ); //$NON-NLS-1$
writer.write( " z; \n" ); //$NON-NLS-1$
writer.write( " }) zoot; \n" ); //$NON-NLS-1$
parseGPP( writer.toString() ); // TODO Devin raised bug 93980
writer.write("int foo(); \n");
writer.write("typeof({ int y = foo (); \n");
writer.write(" int z; \n");
writer.write(" if (y > 0) z = y; \n");
writer.write(" else z = - y; \n");
writer.write(" z; \n");
writer.write(" }) zoot; \n");
parseGPP(writer.toString()); // TODO Devin raised bug 93980
}
public void testBug75401() throws Exception {
Writer writer = new StringWriter();
writer.write( "#define va_list __builtin_va_list \n"); //$NON-NLS-1$
writer.write( "#define va_arg(v,l) __builtin_va_arg(v,l) \n"); //$NON-NLS-1$
writer.write( "#define va_start(v,l) __builtin_va_start(v,l) \n"); //$NON-NLS-1$
writer.write( "#define va_end(v) __builtin_va_end(v) \n"); //$NON-NLS-1$
writer.write( "void variadic(int first, ...) { \n"); //$NON-NLS-1$
writer.write( " va_list v; \n"); //$NON-NLS-1$
writer.write( " va_start(v, first); \n"); //$NON-NLS-1$
writer.write( " long l = va_arg(v, long); \n"); //$NON-NLS-1$
writer.write( " va_end(v); \n"); //$NON-NLS-1$
writer.write( "} \n"); //$NON-NLS-1$
writer.write("#define va_list __builtin_va_list \n");
writer.write("#define va_arg(v,l) __builtin_va_arg(v,l) \n");
writer.write("#define va_start(v,l) __builtin_va_start(v,l) \n");
writer.write("#define va_end(v) __builtin_va_end(v) \n");
writer.write("void variadic(int first, ...) { \n");
writer.write(" va_list v; \n");
writer.write(" va_start(v, first); \n");
writer.write(" long l = va_arg(v, long); \n");
writer.write(" va_end(v); \n");
writer.write("} \n");
parseGCC(writer.toString());
parseGPP(writer.toString());
@ -253,136 +242,136 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
public void testBug73954B() throws Exception {
Writer writer = new StringWriter();
writer.write( "#define foo(x) \\\n"); //$NON-NLS-1$
writer.write( " __builtin_choose_expr( 1, foo_d(x), (void)0 ) \n"); //$NON-NLS-1$
writer.write( "int foo_d( int x ); \n"); //$NON-NLS-1$
writer.write( "int main() { \n"); //$NON-NLS-1$
writer.write( " if( __builtin_constant_p(1) && \n"); //$NON-NLS-1$
writer.write( " __builtin_types_compatible_p( 1, 'c') ) \n"); //$NON-NLS-1$
writer.write( " foo(1); \n"); //$NON-NLS-1$
writer.write( "} \n"); //$NON-NLS-1$
parseGCC( writer.toString());
writer.write("#define foo(x) \\\n");
writer.write(" __builtin_choose_expr( 1, foo_d(x), (void)0 ) \n");
writer.write("int foo_d( int x ); \n");
writer.write("int main() { \n");
writer.write(" if( __builtin_constant_p(1) && \n");
writer.write(" __builtin_types_compatible_p( 1, 'c') ) \n");
writer.write(" foo(1); \n");
writer.write("} \n");
parseGCC(writer.toString());
}
public void testGNUExternalTemplate_bug71603() throws Exception {
parseGPP("template <typename T> \n class A {}; \n extern template class A<int>; \n").getDeclarations(); //$NON-NLS-1$
parseGPP("template <typename T> \n class A {}; \n extern template class A<int>; \n").getDeclarations();
}
public void testBug74190_g_assert_1() throws Exception {
Writer writer = new StringWriter();
writer.write( "void log( int ); \n"); //$NON-NLS-1$
writer.write( "void f() { \n"); //$NON-NLS-1$
writer.write( " int a = 1; \n"); //$NON-NLS-1$
writer.write( " (void)({ if( a ){ } \n"); //$NON-NLS-1$
writer.write( " else{ log( a ); } \n"); //$NON-NLS-1$
writer.write( " }); \n"); //$NON-NLS-1$
writer.write( "} \n"); //$NON-NLS-1$
parseGCC( writer.toString() );
parseGPP( writer.toString() );
writer.write("void log( int ); \n");
writer.write("void f() { \n");
writer.write(" int a = 1; \n");
writer.write(" (void)({ if( a ){ } \n");
writer.write(" else{ log( a ); } \n");
writer.write(" }); \n");
writer.write("} \n");
parseGCC(writer.toString());
parseGPP(writer.toString());
}
public void testBug74190_g_return_if_fail() throws Exception {
Writer writer = new StringWriter();
writer.write( "void f() { \n"); //$NON-NLS-1$
writer.write( " (void)({ if( ( ({ 0; }) ) ) \n"); //$NON-NLS-1$
writer.write( " { } \n"); //$NON-NLS-1$
writer.write( " }); \n"); //$NON-NLS-1$
writer.write( "} \n"); //$NON-NLS-1$
parseGCC( writer.toString() );
parseGPP( writer.toString() );
writer.write("void f() { \n");
writer.write(" (void)({ if( ( ({ 0; }) ) ) \n");
writer.write(" { } \n");
writer.write(" }); \n");
writer.write("} \n");
parseGCC(writer.toString());
parseGPP(writer.toString());
}
public void testBug95635() throws Exception{
StringWriter writer = new StringWriter();
writer.write("void f(){ \n");//$NON-NLS-1$
writer.write(" char a[10]; \n"); //$NON-NLS-1$
writer.write(" __builtin_va_list b; \n"); //$NON-NLS-1$
writer.write(" __builtin_abort(); \n");//$NON-NLS-1$
writer.write(" __builtin_exit(1); \n");//$NON-NLS-1$
writer.write(" __builtin__Exit(1); \n");//$NON-NLS-1$
writer.write(" __builtin__exit(1); \n");//$NON-NLS-1$
writer.write(" __builtin_conj(1); \n");//$NON-NLS-1$
writer.write(" __builtin_conjf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_conjl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_creal(1); \n");//$NON-NLS-1$
writer.write(" __builtin_crealf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_creall(1); \n");//$NON-NLS-1$
writer.write(" __builtin_cimag(1); \n");//$NON-NLS-1$
writer.write(" __builtin_cimagf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_cimagl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_imaxabs(1); \n");//$NON-NLS-1$
writer.write(" __builtin_llabs(1); \n");//$NON-NLS-1$
writer.write(" __builtin_vscanf(\"\",b);\n");//$NON-NLS-1$
writer.write(" __builtin_vsnprintf(a, 1, \"\", b); \n");//$NON-NLS-1$
writer.write(" __builtin_vsscanf(\"\", \"\", b);\n");//$NON-NLS-1$
writer.write(" __builtin_cosf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_cosl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_expf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_expl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_fabsf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_fabsl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_logf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_logl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_sinf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_sinl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_sqrtf(1); \n");//$NON-NLS-1$
writer.write(" __builtin_sqrtl(1); \n");//$NON-NLS-1$
writer.write(" __builtin_abs(1); \n");//$NON-NLS-1$
writer.write(" __builtin_cos(1); \n");//$NON-NLS-1$
writer.write(" __builtin_exp(1); \n");//$NON-NLS-1$
writer.write(" __builtin_fabs(1); \n");//$NON-NLS-1$
writer.write(" __builtin_fprintf((void*)0, \"\");\n");//$NON-NLS-1$
writer.write(" __builtin_fputs(\"\", (void*)0);\n");//$NON-NLS-1$
writer.write(" __builtin_labs(1); \n");//$NON-NLS-1$
writer.write(" __builtin_log(1); \n");//$NON-NLS-1$
writer.write(" __builtin_memcmp((void*)0, (void*)0, 1);\n");//$NON-NLS-1$
writer.write(" __builtin_memcpy((void*)0,(void*)0, 1);\n");//$NON-NLS-1$
writer.write(" __builtin_memset((void*)0, 1, 1);\n");//$NON-NLS-1$
writer.write(" __builtin_printf(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_putchar(1); \n");//$NON-NLS-1$
writer.write(" __builtin_puts(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_scanf(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_sin(1); \n");//$NON-NLS-1$
writer.write(" __builtin_snprintf(a, 1, \"\");\n");//$NON-NLS-1$
writer.write(" __builtin_sprintf(a, \"\");\n");//$NON-NLS-1$
writer.write(" __builtin_sqrt(1); \n");//$NON-NLS-1$
writer.write(" __builtin_sscanf(\"\", \"\"); \n");//$NON-NLS-1$1
writer.write(" __builtin_strcat(a, \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strchr(\"\", 1); \n");//$NON-NLS-1$
writer.write(" __builtin_strcmp(\"\", \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strcpy(a, \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strcspn(\"\", \"\");\n");//$NON-NLS-1$
writer.write(" __builtin_strlen(\"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strncat(a, \"\", 1);\n");//$NON-NLS-1$
writer.write(" __builtin_strncmp(\"\", \"\", 1);\n");//$NON-NLS-1$
writer.write(" __builtin_strncpy(a, \"\", 1);\n");//$NON-NLS-1$
writer.write(" __builtin_strpbrk(\"\", \"\");\n");//$NON-NLS-1$
writer.write(" __builtin_strrchr(\"\", 1); \n");//$NON-NLS-1$
writer.write(" __builtin_strspn(\"\", \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strstr(\"\", \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_strstr(\"\", \"\"); \n");//$NON-NLS-1$
writer.write(" __builtin_vprintf(a, b);\n");//$NON-NLS-1$
writer.write(" __builtin_vsprintf(a, \"\", b); \n");//$NON-NLS-1$
writer.write(" __builtin_isgreater(1.0,1.0); \n");//$NON-NLS-1$
writer.write(" __builtin_isgreaterequal(1.0,1.0);\n");//$NON-NLS-1$
writer.write(" __builtin_isless(1.0,1.0); \n");//$NON-NLS-1$
writer.write(" __builtin_islessequal(1.0,1.0); \n");//$NON-NLS-1$
writer.write(" __builtin_islessgreater(1.0,1.0); \n");//$NON-NLS-1$
writer.write(" __builtin_isunordered(1.0,1.0); \n");//$NON-NLS-1$
writer.write("} \n"); //$NON-NLS-1$
writer.write("void f(){ \n");
writer.write(" char a[10]; \n");
writer.write(" __builtin_va_list b; \n");
writer.write(" __builtin_abort(); \n");
writer.write(" __builtin_exit(1); \n");
writer.write(" __builtin__Exit(1); \n");
writer.write(" __builtin__exit(1); \n");
writer.write(" __builtin_conj(1); \n");
writer.write(" __builtin_conjf(1); \n");
writer.write(" __builtin_conjl(1); \n");
writer.write(" __builtin_creal(1); \n");
writer.write(" __builtin_crealf(1); \n");
writer.write(" __builtin_creall(1); \n");
writer.write(" __builtin_cimag(1); \n");
writer.write(" __builtin_cimagf(1); \n");
writer.write(" __builtin_cimagl(1); \n");
writer.write(" __builtin_imaxabs(1); \n");
writer.write(" __builtin_llabs(1); \n");
writer.write(" __builtin_vscanf(\"\",b);\n");
writer.write(" __builtin_vsnprintf(a, 1, \"\", b); \n");
writer.write(" __builtin_vsscanf(\"\", \"\", b);\n");
writer.write(" __builtin_cosf(1); \n");
writer.write(" __builtin_cosl(1); \n");
writer.write(" __builtin_expf(1); \n");
writer.write(" __builtin_expl(1); \n");
writer.write(" __builtin_fabsf(1); \n");
writer.write(" __builtin_fabsl(1); \n");
writer.write(" __builtin_logf(1); \n");
writer.write(" __builtin_logl(1); \n");
writer.write(" __builtin_sinf(1); \n");
writer.write(" __builtin_sinl(1); \n");
writer.write(" __builtin_sqrtf(1); \n");
writer.write(" __builtin_sqrtl(1); \n");
writer.write(" __builtin_abs(1); \n");
writer.write(" __builtin_cos(1); \n");
writer.write(" __builtin_exp(1); \n");
writer.write(" __builtin_fabs(1); \n");
writer.write(" __builtin_fprintf((void*)0, \"\");\n");
writer.write(" __builtin_fputs(\"\", (void*)0);\n");
writer.write(" __builtin_labs(1); \n");
writer.write(" __builtin_log(1); \n");
writer.write(" __builtin_memcmp((void*)0, (void*)0, 1);\n");
writer.write(" __builtin_memcpy((void*)0,(void*)0, 1);\n");
writer.write(" __builtin_memset((void*)0, 1, 1);\n");
writer.write(" __builtin_printf(\"\"); \n");
writer.write(" __builtin_putchar(1); \n");
writer.write(" __builtin_puts(\"\"); \n");
writer.write(" __builtin_scanf(\"\"); \n");
writer.write(" __builtin_sin(1); \n");
writer.write(" __builtin_snprintf(a, 1, \"\");\n");
writer.write(" __builtin_sprintf(a, \"\");\n");
writer.write(" __builtin_sqrt(1); \n");
writer.write(" __builtin_sscanf(\"\", \"\"); \n");
writer.write(" __builtin_strcat(a, \"\"); \n");
writer.write(" __builtin_strchr(\"\", 1); \n");
writer.write(" __builtin_strcmp(\"\", \"\"); \n");
writer.write(" __builtin_strcpy(a, \"\"); \n");
writer.write(" __builtin_strcspn(\"\", \"\");\n");
writer.write(" __builtin_strlen(\"\"); \n");
writer.write(" __builtin_strncat(a, \"\", 1);\n");
writer.write(" __builtin_strncmp(\"\", \"\", 1);\n");
writer.write(" __builtin_strncpy(a, \"\", 1);\n");
writer.write(" __builtin_strpbrk(\"\", \"\");\n");
writer.write(" __builtin_strrchr(\"\", 1); \n");
writer.write(" __builtin_strspn(\"\", \"\"); \n");
writer.write(" __builtin_strstr(\"\", \"\"); \n");
writer.write(" __builtin_strstr(\"\", \"\"); \n");
writer.write(" __builtin_vprintf(a, b);\n");
writer.write(" __builtin_vsprintf(a, \"\", b); \n");
writer.write(" __builtin_isgreater(1.0,1.0); \n");
writer.write(" __builtin_isgreaterequal(1.0,1.0);\n");
writer.write(" __builtin_isless(1.0,1.0); \n");
writer.write(" __builtin_islessequal(1.0,1.0); \n");
writer.write(" __builtin_islessgreater(1.0,1.0); \n");
writer.write(" __builtin_isunordered(1.0,1.0); \n");
writer.write("} \n");
final String code = writer.toString();
parseGCC( code );
parseGPP( code );
parseGCC(code);
parseGPP(code);
}
// typedef int size_t; // will be defined in <stddef.h>
// struct S {int m;};
// void test() {
// int a= __builtin_offsetof(struct S, m);
// int a= __builtin_offsetof(struct S, m);
// };
public void test__builtinOffsetof_Bug265001() throws Exception {
// gcc with __GNUC__ >= 4 defines:
@ -395,7 +384,7 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
// typedef struct S {int m;} T;
// void test() {
// int a= __offsetof__(1);
// int a= __offsetof__(1);
// };
public void test__offsetof__Bug265001() throws Exception {
// gcc with __GNUC__ < 4 defines:
@ -403,10 +392,9 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
// (__offsetof__ (reinterpret_cast <__size_t> \
// (& reinterpret_cast <const volatile char &> \
// (static_cast<type *> (0)->field))))
String code= getAboveComment();
parseGPP(code);
parseGPP(getAboveComment());
}
// void test(){
// bool b;
// b= __has_nothrow_assign (int);
@ -429,4 +417,12 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
public void testTypeTraits_Bug342683() throws Exception {
parseGPP(getAboveComment());
}
// __int128 a;
// unsigned __int128 b;
public void test__int128() throws Exception {
String code= getAboveComment();
parseGCC(code);
parseGPP(code);
}
}

View file

@ -159,6 +159,32 @@ public class VariableReadWriteFlagsTest extends AST2BaseTest {
a.assertReadWriteFlags("g(&a, b, c)", "c", READ);
}
// struct A {
// A(int* x, int& y);
// A(const int* x, const int& y, int z);
// };
//
// void test(int a, int b, int c) {
// A(&a, b);
// A x(&a, b);
// A(&a, b, c);
// A y(&a, b, c);
// };
public void testConstructorCall_393068() throws Exception {
AssertionHelper a = getCPPAssertionHelper();
// a.assertReadWriteFlags("A(&a, b)", "a", READ | WRITE);
// a.assertReadWriteFlags("A(&a, b)", "b", READ | WRITE);
// a.assertReadWriteFlags("x(&a, b)", "a", READ | WRITE);
// a.assertReadWriteFlags("x(&a, b)", "b", READ | WRITE);
// a.assertReadWriteFlags("x(&a, b)", "x", WRITE);
a.assertReadWriteFlags("A(&a, b, c)", "a", READ);
a.assertReadWriteFlags("A(&a, b, c)", "b", READ);
a.assertReadWriteFlags("A(&a, b, c)", "c", READ);
a.assertReadWriteFlags("y(&a, b, c)", "a", READ);
a.assertReadWriteFlags("y(&a, b, c)", "b", READ);
a.assertReadWriteFlags("y(&a, b, c)", "c", READ);
}
// struct A {
// void m();
// void mc() const;

View file

@ -35,14 +35,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
/**
* @author Emanuel Graf IFS
*/
public class AddDeclarationBug extends ChangeGeneratorTest {
public class AddDeclarationBugTest extends ChangeGeneratorTest {
AddDeclarationBug() {
AddDeclarationBugTest() {
super("AddDeclarationBug");
}
public static Test suite() {
return new AddDeclarationBug();
return new AddDeclarationBugTest();
}
@Override
@ -65,16 +65,16 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
ICPPASTCompositeTypeSpecifier classNode = (ICPPASTCompositeTypeSpecifier) declSpec;
IASTSimpleDeclaration newDecl = new CPPASTSimpleDeclaration();
IASTSimpleDeclSpecifier returnTyp = new CPPASTSimpleDeclSpecifier();
returnTyp.setType(IASTSimpleDeclSpecifier.t_int);
newDecl.setDeclSpecifier(returnTyp);
IASTSimpleDeclSpecifier returnType = new CPPASTSimpleDeclSpecifier();
returnType.setType(IASTSimpleDeclSpecifier.t_int);
newDecl.setDeclSpecifier(returnType);
IASTStandardFunctionDeclarator declarator = new CPPASTFunctionDeclarator(
new CPPASTName("exp".toCharArray())); //$NON-NLS-1$
IASTSimpleDeclSpecifier paramTyp = new CPPASTSimpleDeclSpecifier();
paramTyp.setType(IASTSimpleDeclSpecifier.t_int);
IASTSimpleDeclSpecifier paramType = new CPPASTSimpleDeclSpecifier();
paramType.setType(IASTSimpleDeclSpecifier.t_int);
IASTDeclarator decl = new CPPASTDeclarator(new CPPASTName("i".toCharArray())); //$NON-NLS-1$
ICPPASTParameterDeclaration param = new CPPASTParameterDeclaration(paramTyp, decl);
ICPPASTParameterDeclaration param = new CPPASTParameterDeclaration(paramType, decl);
declarator.addParameterDeclaration(param);
newDecl.addDeclarator(declarator);

View file

@ -29,7 +29,7 @@ public class InsertBeforeTestSuite {
suite.addTest(ArrayModifierTest.suite());
suite.addTest(ExpressionTest.suite());
suite.addTest(ArraySizeExpressionTest.suite());
suite.addTest(AddDeclarationBug.suite());
suite.addTest(AddDeclarationBugTest.suite());
suite.addTest(MultilineWhitespaceHandlingTest.suite());
suite.addTest(SelfInsertionTest.suite());

View file

@ -62,6 +62,22 @@ public class ScannerDiscoveryLegacySupport {
}
}
/**
* Checks if Language Settings functionality is defined for given project in preferences.
*
* @param project - project to check the preference
* @return {@code true} if functionality is defined
*
* @noreference This method is temporary and not intended to be referenced by clients.
*
* @since 5.5
*/
public static boolean isLanguageSettingsProvidersFunctionalityDefined(IProject project) {
Preferences pref = getPreferences(project);
String value = pref.get(DISABLE_LSP_PREFERENCE, null);
return value != null;
}
/**
* Checks if Language Settings functionality is enabled for given project.
*

View file

@ -1178,7 +1178,6 @@ public class LanguageSettingsProvidersSerializer {
} else {
providers.add(LanguageSettingsManager.getExtensionProviderCopy(id, true));
}
}
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
}
@ -1193,6 +1192,11 @@ public class LanguageSettingsProvidersSerializer {
}
}
}
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) {
// if not yet defined by user - set preference to tell if this is legacy .cproject (i.e. no LSP storageElement)
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, storageElement != null);
}
}
}

View file

@ -73,6 +73,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
@ -625,6 +626,9 @@ public class ASTStringUtil {
case IASTSimpleDeclSpecifier.t_int:
buffer.append(Keywords.INT).append(' ');
break;
case IASTSimpleDeclSpecifier.t_int128:
buffer.append(GCCKeywords.cp__int128).append(' ');
break;
case IASTSimpleDeclSpecifier.t_float:
buffer.append(Keywords.FLOAT).append(' ');
break;

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.parser.ASTProblem;
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
@ -775,6 +776,14 @@ public class ASTSignatureUtil {
result.append(Keywords.INT);
needSpace = true;
break;
case IASTSimpleDeclSpecifier.t_int128:
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(GCCKeywords.__INT128);
needSpace = true;
break;
case IASTSimpleDeclSpecifier.t_void:
if (needSpace) {
result.append(SPACE);

View file

@ -100,6 +100,11 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
*/
public static final int t_char32_t = 12;
/**
* <code>__int128 i;</code>
* @since 5.5
*/
public static final int t_int128 = 13;
/**
* @since 5.1

View file

@ -22,40 +22,25 @@ public interface IBasicType extends IType {
* @since 5.2
*/
enum Kind {
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean, eChar16, eChar32,
/** @since 5.4 */ eNullPtr
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble,
eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr, /** @since 5.5 */ eInt128
}
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_LONG = 1;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_SHORT = 1 << 1;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_SIGNED = 1 << 2;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_UNSIGNED = 1 << 3;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_COMPLEX = 1 << 4;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_IMAGINARY = 1 << 5;
/**
* @since 5.2
*/
/** @since 5.2 */
final int IS_LONG_LONG = 1 << 6;
/**
* This returns the kind of basic type you are looking at. The type is
* then refined by qualifiers for signed/unsigned and short/long/long long.

View file

@ -128,7 +128,7 @@ public interface IScope {
fLookupPoint= point;
fLookupPointIsName= false;
fLookupKey= name;
fIgnorePointOfDeclaration= true;
fIgnorePointOfDeclaration= false;
if (fLookupPoint == null) {
fTu= null;
fIgnorePointOfDeclaration= true;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Mike Kucera (IBM) - Initial API and implementation
* Mike Kucera (IBM) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTFunctionCallExpression extends IASTFunctionCallExpression, ICPPASTExpression, IASTImplicitNameOwner {
@Override
ICPPASTFunctionCallExpression copy();

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.parser.c.ICParserExtensionConfiguration;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
@ -70,6 +71,11 @@ public class GCCLanguage extends AbstractCLikeLanguage {
return C_GNU_SCANNER_EXTENSION;
}
@Override
protected IScannerExtensionConfiguration getScannerExtensionConfiguration(IScannerInfo info) {
return GCCScannerExtensionConfiguration.getInstance(info);
}
/**
* Returns the extension configuration used for creating the parser.
* @since 5.1

View file

@ -27,7 +27,14 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
*/
public abstract class GNUScannerExtensionConfiguration extends AbstractScannerExtensionConfiguration {
private static GNUScannerExtensionConfiguration sInstance;
/**
* @noreference This method is not intended to be referenced by clients.
*/
protected static int version(int major, int minor) {
return (major << 16) + minor;
}
@SuppressWarnings("nls")
public GNUScannerExtensionConfiguration() {
addMacro("__complex__", "_Complex");

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.c;
@ -21,6 +21,7 @@ import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider;
*/
public class GCCParserExtensionConfiguration extends AbstractCParserExtensionConfiguration {
private static GCCParserExtensionConfiguration sInstance= new GCCParserExtensionConfiguration();
/**
* @since 5.1
*/
@ -28,65 +29,41 @@ public class GCCParserExtensionConfiguration extends AbstractCParserExtensionCon
return sInstance;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportStatementsInExpressions()
*/
@Override
public boolean supportStatementsInExpressions() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportGCCStyleDesignators()
*/
@Override
public boolean supportGCCStyleDesignators() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportTypeofUnaryExpressions()
*/
@Override
public boolean supportTypeofUnaryExpressions() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportAlignOfUnaryExpression()
*/
@Override
public boolean supportAlignOfUnaryExpression() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportKnRC()
*/
@Override
public boolean supportKnRC() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportAttributeSpecifiers()
*/
@Override
public boolean supportAttributeSpecifiers() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportDeclspecSpecifiers()
*/
@Override
public boolean supportDeclspecSpecifiers() {
return true;
}
/*
* @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#getBuiltinSymbolProvider()
*/
@Override
public IBuiltinBindingsProvider getBuiltinBindingsProvider() {
return new GCCBuiltinSymbolProvider(ParserLanguage.C, true);

View file

@ -1,42 +1,77 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
* Copyright (c) 2004, 2010 IBM Corporation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Contributors:
* IBM - Initial API and implementation
* Ed Swartz (Nokia)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.c;
import java.util.Map;
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IScannerInfo;
/**
* Configures the preprocessor for parsing c-sources as accepted by gcc.
*/
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
private static final int VERSION_4_7 = version(4, 7);
private static GCCScannerExtensionConfiguration CONFIG= new GCCScannerExtensionConfiguration();
private static GCCScannerExtensionConfiguration CONFIG_4_7= new GCCScannerExtensionConfiguration(VERSION_4_7);
private static GCCScannerExtensionConfiguration sInstance= new GCCScannerExtensionConfiguration();
/**
* @since 5.1
*/
public static GCCScannerExtensionConfiguration getInstance() {
return sInstance;
return CONFIG;
}
/**
* @since 5.5
*/
public static GCCScannerExtensionConfiguration getInstance(IScannerInfo info) {
if (info != null) {
try {
final Map<String, String> definedSymbols = info.getDefinedSymbols();
int major= Integer.valueOf(definedSymbols.get("__GNUC__")); //$NON-NLS-1$
int minor= Integer.valueOf(definedSymbols.get("__GNUC_MINOR__")); //$NON-NLS-1$
int version= version(major, minor);
if (version >= VERSION_4_7) {
return CONFIG_4_7;
}
} catch (Exception e) {
// Fall-back to the default configuration.
}
}
return CONFIG;
}
@SuppressWarnings("nls")
public GCCScannerExtensionConfiguration() {
this(0);
}
/**
* @since 5.5
*/
@SuppressWarnings("nls")
public GCCScannerExtensionConfiguration(int version) {
addMacro("__null", "(void *)0");
addMacro("__builtin_offsetof(T,m)", "((size_t) &((T *)0)->m)");
if (version >= VERSION_4_7) {
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
*/
@Override
public boolean supportMinAndMaxOperators() {
return false;

View file

@ -29,13 +29,11 @@ import org.eclipse.cdt.core.parser.Keywords;
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
private static final int VERSION_4_3 = version(4, 3);
private static final int VERSION_4_6 = version(4, 6);
private static final int VERSION_4_7 = version(4, 7);
private static GPPScannerExtensionConfiguration CONFIG= new GPPScannerExtensionConfiguration();
private static GPPScannerExtensionConfiguration CONFIG_4_3= new GPPScannerExtensionConfiguration(VERSION_4_3);
private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6);
private static int version(int major, int minor) {
return (major << 16) + minor;
}
private static GPPScannerExtensionConfiguration CONFIG_4_7= new GPPScannerExtensionConfiguration(VERSION_4_7);
public static GPPScannerExtensionConfiguration getInstance() {
return CONFIG;
@ -51,6 +49,9 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
int major= Integer.valueOf(definedSymbols.get("__GNUC__")); //$NON-NLS-1$
int minor= Integer.valueOf(definedSymbols.get("__GNUC_MINOR__")); //$NON-NLS-1$
int version= version(major, minor);
if (version >= VERSION_4_7) {
return CONFIG_4_7;
}
if (version >= VERSION_4_6) {
return CONFIG_4_6;
}
@ -102,11 +103,11 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
addKeyword(GCCKeywords.cp__is_standard_layout, IGCCToken.tTT_is_standard_layout);
addKeyword(GCCKeywords.cp__is_trivial, IGCCToken.tTT_is_trivial);
}
if (version >= VERSION_4_7) {
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
*/
@Override
public boolean supportMinAndMaxOperators() {
return true;

View file

@ -23,6 +23,8 @@ public class GCCKeywords {
public static final String __ALIGNOF__ = "__alignof__";
public static final String __ATTRIBUTE__ = "__attribute__";
public static final String __DECLSPEC = "__declspec";
/** @since 5.5 */
public static final String __INT128 = "__int128";
public static final char[]
cpTYPEOF = TYPEOF.toCharArray(),
@ -46,9 +48,7 @@ public class GCCKeywords {
cp__TYPEOF= "__typeof".toCharArray(),
cp__TYPEOF__= "__typeof__".toCharArray();
/**
* @since 5.3
*/
/** @since 5.3 */
public static final char[]
cp__has_nothrow_assign= "__has_nothrow_assign".toCharArray(),
cp__has_nothrow_copy= "__has_nothrow_copy".toCharArray(),
@ -67,10 +67,9 @@ public class GCCKeywords {
cp__is_polymorphic= "__is_polymorphic".toCharArray(),
cp__is_union= "__is_union".toCharArray();
/**
* @since 5.5
*/
/** @since 5.5 */
public static final char[]
cp__int128= __INT128.toCharArray(),
cp__is_literal_type= "__is_literal_type".toCharArray(),
cp__is_standard_layout= "__is_standard_layout".toCharArray(),
cp__is_trivial= "__is_trivial".toCharArray();

View file

@ -44,4 +44,6 @@ public interface IGCCToken extends IToken {
/** @since 5.5 */ int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22;
/** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
/** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
/** @since 5.5 */ int t__int128 = FIRST_RESERVED_IGCCToken + 25;
}

View file

@ -2591,6 +2591,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
case IToken.t_short:
case IToken.t_int:
case IToken.t_long:
case IGCCToken.t__int128:
case IToken.t_float:
case IToken.t_double:
case IToken.t__Bool:

View file

@ -58,10 +58,12 @@ public class SizeofCalculator {
public final SizeAndAlignment size_2;
public final SizeAndAlignment size_4;
public final SizeAndAlignment size_8;
public final SizeAndAlignment size_16;
public final SizeAndAlignment sizeof_pointer;
public final SizeAndAlignment sizeof_int;
public final SizeAndAlignment sizeof_long;
public final SizeAndAlignment sizeof_long_long;
public final SizeAndAlignment sizeof_int128;
public final SizeAndAlignment sizeof_short;
public final SizeAndAlignment sizeof_bool;
public final SizeAndAlignment sizeof_wchar_t;
@ -118,10 +120,12 @@ public class SizeofCalculator {
size_2 = new SizeAndAlignment(2, Math.min(2, maxAlignment));
size_4 = new SizeAndAlignment(4, Math.min(4, maxAlignment));
size_8 = new SizeAndAlignment(8, Math.min(8, maxAlignment));
size_16 = new SizeAndAlignment(16, Math.min(16, maxAlignment));
sizeof_pointer = getSize(sizeofMacros, "__SIZEOF_POINTER__", maxAlignment); //$NON-NLS-1$
sizeof_int = getSize(sizeofMacros, "__SIZEOF_INT__", maxAlignment); //$NON-NLS-1$
sizeof_long = getSize(sizeofMacros, "__SIZEOF_LONG__", maxAlignment); //$NON-NLS-1$
sizeof_long_long = getSize(sizeofMacros, "__SIZEOF_LONG_LONG__", maxAlignment); //$NON-NLS-1$
sizeof_int128 = getSize(sizeofMacros, "__SIZEOF_INT128__", maxAlignment); //$NON-NLS-1$
sizeof_short = getSize(sizeofMacros, "__SIZEOF_SHORT__", maxAlignment); //$NON-NLS-1$
sizeof_bool = getSize(sizeofMacros, "__SIZEOF_BOOL__", maxAlignment); //$NON-NLS-1$
sizeof_wchar_t = getSize(sizeofMacros, "__SIZEOF_WCHAR_T__", maxAlignment); //$NON-NLS-1$
@ -137,10 +141,12 @@ public class SizeofCalculator {
size_2 = new SizeAndAlignment(2, 2);
size_4 = new SizeAndAlignment(4, 4);
size_8 = new SizeAndAlignment(8, 8);
size_16 = new SizeAndAlignment(16, 16);
sizeof_pointer = null;
sizeof_int = null;
sizeof_long = null;
sizeof_long_long = null;
sizeof_int128 = size_16;
sizeof_short = null;
sizeof_bool = null;
sizeof_wchar_t = null;
@ -201,9 +207,10 @@ public class SizeofCalculator {
case eInt:
return type.isShort() ? sizeof_short : type.isLong() ? sizeof_long :
type.isLongLong() ? sizeof_long_long : sizeof_int;
case eFloat: {
case eInt128:
return sizeof_int128;
case eFloat:
return type.isComplex() ? sizeof_complex_float : sizeof_float;
}
case eDouble:
return type.isComplex() ?
(type.isLong() ? sizeof_long_double : sizeof_double) :
@ -215,7 +222,7 @@ public class SizeofCalculator {
case eChar32:
return size_4;
case eNullPtr:
return sizeAndAlignmentOfPointer();
return sizeof_pointer;
default:
return null;
}

View file

@ -28,6 +28,8 @@ import org.eclipse.cdt.core.dom.ast.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -41,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
@ -188,12 +191,21 @@ public abstract class VariableReadWriteFlags {
final IType type= functionNameExpression.getExpressionType();
if (type instanceof IFunctionType) {
return rwArgumentForFunctionCall((IFunctionType) type, i, indirection);
} else {
IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) funcCall).getImplicitNames();
if (implicitNames.length == 1) {
IASTImplicitName name = implicitNames[0];
IBinding binding = name.resolveBinding();
if (binding instanceof IFunction) {
return rwArgumentForFunctionCall(((IFunction) binding).getType(), i, indirection);
}
}
}
}
break;
}
}
return READ | WRITE; // fallback
return READ | WRITE; // Fallback
}
protected int rwArgumentForFunctionCall(IFunctionType type, int parameterIdx, int indirection) {

View file

@ -98,7 +98,7 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
}
private int getType(Kind kind) {
switch(kind) {
switch (kind) {
case eBoolean:
return t_bool;
case eChar:
@ -112,6 +112,8 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return t_float;
case eInt:
return t_int;
case eInt128:
return t_int128;
case eUnspecified:
return t_unspecified;
case eVoid:

View file

@ -71,6 +71,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
return Kind.eInt128;
case IASTSimpleDeclSpecifier.t_void:
return Kind.eVoid;
default:

View file

@ -1002,6 +1002,13 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IGCCToken.t__int128:
if (encounteredTypename)
break declSpecifiers;
simpleType = IASTSimpleDeclSpecifier.t_int128;
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IToken.t_long:
if (encounteredTypename)
break declSpecifiers;

View file

@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTName;
@ -276,7 +277,11 @@ public class CPPASTFieldReference extends ASTNode
n= ns[ns.length - 1];
}
if (n instanceof ICPPASTTemplateId) {
args= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) n);
try {
args= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) n);
} catch (DOMException e) {
return EvalFixed.INCOMPLETE;
}
}
return new EvalID(ownerEval, qualifier, name.getSimpleID(), false, true, args);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -313,7 +313,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
if (b instanceof IType) {
ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length];
for (int i = 0; i < args.length; i++) {
args[i]= ((ICPPASTExpression) fArguments[i]).getEvaluation();
args[i]= ((ICPPASTInitializerClause) fArguments[i]).getEvaluation();
}
return new EvalTypeId((IType) b, args);
}

View file

@ -92,6 +92,8 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
return t_float;
case eInt:
return t_int;
case eInt128:
return t_int128;
case eUnspecified:
return t_unspecified;
case eVoid:

View file

@ -17,7 +17,6 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
@ -43,17 +42,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.NameOrTemplateIDVariants.Var
*/
public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode implements IASTAmbiguousExpression,
ICPPASTExpression {
private BinaryOperator fLastOperator;
private IASTInitializerClause fLastExpression;
private final BinaryOperator fEndOperator;
private final BranchPoint fVariants;
private IASTNode[] fNodes;
private final AbstractGNUSourceCodeParser fParser;
public CPPASTTemplateIDAmbiguity(AbstractGNUSourceCodeParser parser, BinaryOperator lastOperator, IASTInitializerClause expr,
BranchPoint variants) {
public CPPASTTemplateIDAmbiguity(AbstractGNUSourceCodeParser parser, BinaryOperator endOperator, BranchPoint variants) {
fParser= parser;
fLastOperator= lastOperator;
fLastExpression= expr;
fEndOperator= endOperator;
fVariants= variants;
}
@ -92,10 +88,7 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode implements IASTA
if (selected != null) {
minOffset= selected.getRightOffset();
BinaryOperator targetOp = selected.getTargetOperator();
if (targetOp == null) {
fLastExpression= selected.getExpression();
fLastOperator= v.getLeftOperator();
} else {
if (targetOp != null) {
targetOp.exchange(selected.getExpression());
targetOp.setNext(v.getLeftOperator());
}
@ -106,7 +99,7 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode implements IASTA
owner.replace(nodeToReplace, this);
// Create the expression and replace it
IASTExpression expr = fParser.buildExpression(fLastOperator, fLastExpression);
IASTExpression expr = fParser.buildExpression(fEndOperator.getNext(), fEndOperator.getExpression());
owner.replace(this, expr);
// Resolve further ambiguities within the new expression.
@ -149,8 +142,7 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode implements IASTA
public IASTNode[] getNodes() {
if (fNodes == null) {
List<IASTNode> nl= new ArrayList<IASTNode>();
nl.add(fLastExpression);
BinaryOperator op= fLastOperator;
BinaryOperator op= fEndOperator;
while (op != null) {
nl.add(op.getExpression());
op= op.getNext();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -8,6 +8,7 @@
* Contributors:
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -101,6 +102,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
return Kind.eInt128;
case IASTSimpleDeclSpecifier.t_void:
return Kind.eVoid;
default:
@ -119,16 +122,17 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
if (!(object instanceof ICPPBasicType))
return false;
ICPPBasicType t = (ICPPBasicType) object;
if (fKind != t.getKind())
ICPPBasicType other = (ICPPBasicType) object;
if (fKind != other.getKind())
return false;
int modifiers = getModifiers();
int otherModifiers = other.getModifiers();
if (fKind == Kind.eInt) {
// Signed int and int are equivalent.
return (modifiers & ~IS_SIGNED) == (t.getModifiers() & ~IS_SIGNED);
return (modifiers & ~IS_SIGNED) == (otherModifiers & ~IS_SIGNED);
}
return modifiers == t.getModifiers();
return modifiers == otherModifiers;
}
@Override
@ -278,7 +282,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
}
/**
* @deprecated types don't have values
* @deprecated Types don't have values
*/
@Override
@Deprecated

View file

@ -15,6 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.core.runtime.Assert;
/**
@ -25,7 +26,7 @@ public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
private final IType fOriginalType;
public CPPTemplateTypeArgument(IType type) {
this(type, type);
this(SemanticUtil.getSimplifiedType(type), type);
}
public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {

View file

@ -764,6 +764,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
BinaryOperator lastOperator= null;
NameOrTemplateIDVariants variants= null;
IToken variantMark= mark();
if (expr == null) {
Object e = castExpressionForBinaryExpression(strat);
if (e instanceof IASTExpression) {
@ -773,20 +774,21 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final Variant variant = (Variant) e;
expr= variant.getExpression();
variants.addBranchPoint(variant.getNext(), lastOperator, allowAssignment, conditionCount);
variants.addBranchPoint(variant.getNext(), null, allowAssignment, conditionCount);
}
}
boolean doneExpression= false;
do {
boolean stopWithNextOperator= false;
castExprLoop: for(;;) {
// Typically after a binary operator there cannot be a throw expression
boolean allowThrow= false;
// Brace initializers are allowed on the right hand side of an expression
boolean allowBraceInitializer= false;
BacktrackException tryRecovery= null;
final int operatorOffset= LA().getOffset();
lt1= LT(1);
boolean doneExpression= false;
BacktrackException failure= null;
final int opOffset= LA().getOffset();
lt1= stopWithNextOperator ? IToken.tSEMI : LT(1);
switch (lt1) {
case IToken.tQUESTION:
conditionCount++;
@ -879,7 +881,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(2) != IToken.tGT_in_SHIFTR) {
IToken token = LA(1);
backtrack.initialize(token.getOffset(), token.getLength());
tryRecovery= backtrack;
failure= backtrack;
break;
}
@ -907,35 +909,46 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
doneExpression= true;
break;
}
if (!doneExpression && tryRecovery == null) {
consume(); // consumes the operator
// Link variants that are closed by the new operator
if (variants != null) {
variants.closeVariants(operatorOffset, lastOperator);
// Close variants
if (failure == null) {
if (doneExpression) {
if (variants != null && !variants.hasRightBound(opOffset)) {
// We have a longer variant, ignore this one.
backtrack.initialize(opOffset, 1);
failure= backtrack;
} else {
break castExprLoop;
}
}
// Close variants with matching end
if (variants != null && lastOperator != null) {
variants.closeVariants(opOffset, lastOperator);
}
}
// Determine next sub-expression
if (lt1 == IToken.tQUESTION && LT(1) == IToken.tCOLON) {
// Missing sub-expression after '?' (gnu-extension)
expr= null;
} else if (allowThrow && LT(1) == IToken.t_throw) {
// Throw expression
expr= throwExpression();
lt1= LT(1);
if (lt1 != IToken.tCOLON && lt1 != IToken.tCOMMA)
if (failure == null && !doneExpression) {
// Determine next cast-expression
consume(); // consumes the operator
stopWithNextOperator= false;
try {
if (lt1 == IToken.tQUESTION && LT(1) == IToken.tCOLON) {
// Missing sub-expression after '?' (gnu-extension)
expr= null;
} else if (allowThrow && LT(1) == IToken.t_throw) {
// Throw expression
expr= throwExpression();
lt1= LT(1);
if (lt1 != IToken.tCOLON && lt1 != IToken.tCOMMA)
stopWithNextOperator= true;
break;
} else if (allowBraceInitializer && LT(1) == IToken.tLBRACE) {
// Brace initializer
expr= bracedInitList(true);
lt1= LT(1);
if (lt1 != IToken.tCOLON && lt1 != IToken.tCOMMA)
break;
} else {
// Cast expression
IToken m= mark();
try {
} else if (allowBraceInitializer && LT(1) == IToken.tLBRACE) {
// Brace initializer
expr= bracedInitList(true);
lt1= LT(1);
if (lt1 != IToken.tCOLON && lt1 != IToken.tCOMMA)
stopWithNextOperator= true;
} else {
Object e = castExpressionForBinaryExpression(strat);
if (e instanceof IASTExpression) {
expr= (IASTExpression) e;
@ -947,55 +960,49 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
variants.addBranchPoint(ae.getNext(), lastOperator, allowAssignment, conditionCount);
}
} catch (BacktrackException e) {
if (variants == null)
throw e;
tryRecovery= e;
backup(m);
}
continue castExprLoop;
} catch (BacktrackException e) {
failure= e;
}
}
}
if (tryRecovery != null || doneExpression) {
if (variants != null) {
if (lt1 == IToken.tEOC) {
variants.discardOpenVariants(operatorOffset);
} else {
// Try fall-back to an open variant
Variant fallback= variants.findFallback(operatorOffset);
if (fallback == null) {
if (tryRecovery != null)
throw tryRecovery;
variants.discardOpenVariants(operatorOffset);
} else {
// Restore state and continue
doneExpression= false;
BranchPoint varPoint= fallback.getOwner();
allowAssignment= varPoint.isAllowAssignment();
conditionCount= varPoint.getConditionCount();
lastOperator= varPoint.getLeftOperator();
expr= fallback.getExpression();
variants.useFallback(fallback);
// We need a new variant
Variant variant= variants == null ? null : variants.selectFallback();
if (variant == null) {
if (failure != null)
throw failure;
throwBacktrack(LA(1));
} else {
// Restore variant and continue
BranchPoint varPoint= variant.getOwner();
allowAssignment= varPoint.isAllowAssignment();
conditionCount= varPoint.getConditionCount();
lastOperator= varPoint.getLeftOperator();
expr= variant.getExpression();
// Advance to the right token
int offset= fallback.getRightOffset();
while (LA().getOffset() < offset) {
consume();
}
}
}
backup(variantMark);
int offset= variant.getRightOffset();
while (LA().getOffset() < offset) {
consume();
}
variantMark= mark();
}
} while (!doneExpression);
}
// Check for incomplete conditional expression
if (lt1 != IToken.tEOC && conditionCount > 0)
throwBacktrack(LA(1));
if (variants != null && !variants.isEmpty()) {
CPPASTTemplateIDAmbiguity result = new CPPASTTemplateIDAmbiguity(this, lastOperator, expr, variants.getOrderedBranchPoints());
setRange(result, startOffset, calculateEndOffset(expr));
return result;
if (variants != null) {
BinaryOperator end = new BinaryOperator(lastOperator, expr, -1, 0, 0);
variants.closeVariants(LA(1).getOffset(), end);
variants.removeInvalid(end);
if (!variants.isEmpty()) {
CPPASTTemplateIDAmbiguity result = new CPPASTTemplateIDAmbiguity(this, end, variants.getOrderedBranchPoints());
setRange(result, startOffset, calculateEndOffset(expr));
return result;
}
}
return buildExpression(lastOperator, expr);
@ -1009,7 +1016,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
TemplateIdStrategy strat= new TemplateIdStrategy();
Variant variants= null;
IASTExpression singleExpression= null;
IASTExpression singleResult= null;
IASTName[] firstNames= null;
final IToken mark= mark();
@ -1018,12 +1025,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try {
IASTExpression e = castExpression(CastExprCtx.eDirectlyInBExpr, strat);
if (variants == null) {
if (singleExpression == null || lastToken == null) {
singleExpression= e;
if (singleResult == null || lastToken == null) {
singleResult= e;
firstNames= strat.getTemplateNames();
} else {
variants= new Variant(null, singleExpression, firstNames, lastToken.getOffset());
singleExpression= null;
variants= new Variant(null, singleResult, firstNames, lastToken.getOffset());
singleResult= null;
firstNames= null;
}
}
@ -1045,7 +1052,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
backup(mark);
}
return variants != null ? variants : singleExpression;
return variants != null ? variants : singleResult;
}
@Override
@ -2823,6 +2830,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IGCCToken.t__int128:
if (encounteredTypename)
break declSpecifiers;
simpleType = IASTSimpleDeclSpecifier.t_int128;
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
case IToken.t_float:
if (encounteredTypename)
break declSpecifiers;

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.BinaryOperator;
/**
@ -132,59 +131,31 @@ public class NameOrTemplateIDVariants {
if (v.getTargetOperator() == null) {
if (offset == v.getRightOffset()) {
v.setTargetOperator(lastOperator);
} else if (offset > v.getRightOffset()) {
// Should not happen
assert false;
remove(v);
}
}
}
}
}
}
public void discardOpenVariants(int operatorOffset) {
for (BranchPoint p = fFirst; p != null; p= p.getNext()) {
for (Variant v= p.getFirstVariant(); v != null; v= v.getNext()) {
if (v.getTargetOperator() == null && v.getRightOffset() != operatorOffset) {
remove(v);
}
}
}
}
public Variant findFallback(int operatorOffset) {
public Variant selectFallback() {
// Search for an open variant, with a small right offset and a large left offset
Variant best= null;
for (BranchPoint p = fFirst; p != null; p= p.getNext()) {
Variant best= null;
for (Variant v= p.getFirstVariant(); v != null; v= v.getNext()) {
if (v.fRightOffset > operatorOffset) {
if (v.getTargetOperator() == null) {
if (best == null || v.fRightOffset < best.fRightOffset) {
best= v;
}
}
}
}
return best;
}
public void useFallback(Variant fallback) {
// Discard variants that end within the fallback
int begin= ((ASTNode) fallback.getExpression()).getOffset();
int end= fallback.getRightOffset();
for (BranchPoint p = fFirst; p != null; p= p.getNext()) {
for (Variant v= p.getFirstVariant(); v != null; v= v.getNext()) {
if (v == fallback) {
remove(v);
} else {
int vend= v.getRightOffset();
if (vend > begin && vend < end)
remove(v);
}
if (best != null) {
remove(best);
return best;
}
}
return null;
}
private void remove(Variant remove) {
final BranchPoint owner = remove.fOwner;
final Variant next = remove.getNext();
@ -236,4 +207,41 @@ public class NameOrTemplateIDVariants {
fFirst= null;
return prev;
}
public boolean hasRightBound(int opOffset) {
// Search for an open variant, with a small right offset and a large left offset
for (BranchPoint p = fFirst; p != null; p= p.getNext()) {
for (Variant v= p.getFirstVariant(); v != null; v= v.getNext()) {
if (v.fRightOffset > opOffset)
return false;
}
}
return true;
}
public void removeInvalid(BinaryOperator lastOperator) {
for (BranchPoint p = fFirst; p != null; p= p.getNext()) {
if (!isReachable(p, lastOperator)) {
remove(p);
} else {
for (Variant v= p.getFirstVariant(); v != null; v= v.getNext()) {
if (v.getTargetOperator() == null) {
remove(v);
}
}
}
}
}
private boolean isReachable(BranchPoint bp, BinaryOperator endOperator) {
BinaryOperator op = bp.getLeftOperator();
if (op == null)
return true;
for(; endOperator != null; endOperator= endOperator.getNext()) {
if (endOperator == op)
return true;
}
return false;
}
}

View file

@ -14,6 +14,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
@ -44,12 +45,12 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IPointerType;
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;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
@ -1201,11 +1202,9 @@ public class CPPTemplates {
ICPPPointerToMemberType ptm = (ICPPPointerToMemberType) typeContainer;
IType memberOfClass = ptm.getMemberOfClass();
IType newMemberOfClass = instantiateType(memberOfClass, tpMap, packOffset, within, point);
if (newMemberOfClass instanceof IQualifierType) {
newMemberOfClass = ((IQualifierType) newMemberOfClass).getType();
}
if (!(newMemberOfClass instanceof ICPPClassType || newMemberOfClass instanceof UniqueType
|| newMemberOfClass instanceof ICPPUnknownBinding)) {
IType classType = SemanticUtil.getNestedType(newMemberOfClass, CVTYPE | TDEF);
if (!(classType instanceof ICPPClassType || classType instanceof UniqueType
|| classType instanceof ICPPUnknownBinding)) {
return new ProblemType(ISemanticProblem.BINDING_INVALID_TYPE);
}
if (newNestedType != nestedType || newMemberOfClass != memberOfClass) {
@ -1669,7 +1668,7 @@ public class CPPTemplates {
* @return an array of template arguments, currently modeled as IType objects.
* The empty ICPPTemplateArgument array is returned if id is {@code null}
*/
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) {
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) throws DOMException {
ICPPTemplateArgument[] result= ICPPTemplateArgument.EMPTY_ARGUMENTS;
if (id != null) {
IASTNode[] args= id.getTemplateArguments();
@ -1681,6 +1680,9 @@ public class CPPTemplates {
} else if (arg instanceof ICPPASTExpression) {
ICPPASTExpression expr= (ICPPASTExpression) arg;
result[i]= new CPPTemplateNonTypeArgument(expr.getEvaluation(), expr);
} else if (arg instanceof ICPPASTAmbiguousTemplateArgument) {
IProblemBinding problem = new ProblemBinding(id, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
throw new DOMException(problem);
} else {
throw new IllegalArgumentException("Unexpected type: " + arg.getClass().getName()); //$NON-NLS-1$
}

View file

@ -196,7 +196,11 @@ public class EvalID extends CPPEvaluation {
ICPPTemplateArgument[] templateArgs = null;
final IASTName lastName = name.getLastName();
if (lastName instanceof ICPPASTTemplateId) {
templateArgs= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) lastName);
try {
templateArgs= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) lastName);
} catch (DOMException e) {
return EvalFixed.INCOMPLETE;
}
}
return new EvalID(fieldOwner, owner, name.getSimpleID(), isAddressOf(expr),
name instanceof ICPPASTQualifiedName, templateArgs);

View file

@ -20,7 +20,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@ -116,11 +118,15 @@ public class LookupData extends ScopeLookupData {
if (n == null)
throw new IllegalArgumentException();
ICPPTemplateArgument[] args = null;
if (n instanceof ICPPASTTemplateId) {
fTemplateArguments= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) n);
} else {
fTemplateArguments= null;
try {
args= CPPTemplates.createTemplateArgumentArray((ICPPASTTemplateId) n);
} catch (DOMException e) {
CCorePlugin.log(e);
}
}
fTemplateArguments= args;
configureWith(n);
}

View file

@ -318,7 +318,7 @@ public class SemanticUtil {
/**
* Simplifies type by resolving typedefs within the given type.
*/
static IType getSimplifiedType(IType type) {
public static IType getSimplifiedType(IType type) {
if (type instanceof ICPPFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type;
IType ret = null;

View file

@ -73,6 +73,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
* Algorithms for deducing template arguments in various contexts.
*/
public class TemplateArgumentDeduction {
private static class TypeOfValueDeducedFromArraySize extends CPPBasicType {
public TypeOfValueDeducedFromArraySize() {
super(ICPPBasicType.Kind.eInt, 0);
}
}
/**
* Deduce arguments for a template function from the template id and the template function
* parameters.
@ -194,8 +200,15 @@ public class TemplateArgumentDeduction {
IType type1 = ((ICPPTemplateNonTypeParameter) tpar).getType();
type1= CPPTemplates.instantiateType(type1, map, -1, null, point);
IType type2= arg.getTypeOfNonTypeValue();
if (!type1.isSameType(type2))
// Template-argument deduced from an array bound may be of any integral
// type.
if (type2 instanceof TypeOfValueDeducedFromArraySize && isIntegralType(type1)) {
IValue value = isBooleanType(type1) ? Value.create(true) : arg.getNonTypeValue();
arg = new CPPTemplateNonTypeArgument(value, type1);
deduct.fDeducedArgs.put(tpar, arg);
} else if (!type1.isSameType(type2)) {
return false;
}
}
}
}
@ -206,11 +219,37 @@ public class TemplateArgumentDeduction {
return false;
}
private static boolean deduceFromFunctionArg(IType par, IType arg, ValueCategory valueCat, TemplateArgumentDeduction deduct, IASTNode point) throws DOMException {
// 3.9.1 - 7
private static boolean isIntegralType(IType type) {
type = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
if (!(type instanceof IBasicType))
return false;
switch (((IBasicType) type).getKind()) {
case eInt:
case eInt128:
case eBoolean:
case eChar:
case eChar16:
case eChar32:
case eWChar:
return true;
default:
return false;
}
}
private static boolean isBooleanType(IType type) {
type = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
return type instanceof IBasicType && ((IBasicType) type).getKind() == IBasicType.Kind.eBoolean;
}
private static boolean deduceFromFunctionArg(IType par, IType arg, ValueCategory valueCat,
TemplateArgumentDeduction deduct, IASTNode point) throws DOMException {
boolean isReferenceTypeParameter= false;
if (par instanceof ICPPReferenceType) {
// If P is an rvalue reference to a cv-unqualified template parameter and the argument is an
// lvalue, the type "lvalue reference to A" is used in place of A for type deduction.
// If P is an rvalue reference to a cv-unqualified template parameter and the argument
// is an lvalue, the type "lvalue reference to A" is used in place of A for type
// deduction.
isReferenceTypeParameter= true;
final ICPPReferenceType refPar = (ICPPReferenceType) par;
if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter &&
@ -615,7 +654,8 @@ public class TemplateArgumentDeduction {
private int fPackOffset;
private final int fPackSize;
private TemplateArgumentDeduction(ICPPTemplateParameter[] tpars, CPPTemplateParameterMap explicit, CPPTemplateParameterMap result, int packSize) {
private TemplateArgumentDeduction(ICPPTemplateParameter[] tpars, CPPTemplateParameterMap explicit,
CPPTemplateParameterMap result, int packSize) {
fExplicitArgs= explicit;
fDeducedArgs= result;
fPackSize= packSize;
@ -654,7 +694,8 @@ public class TemplateArgumentDeduction {
/**
* Deduces the template parameter mapping from one pair of template arguments.
*/
private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a, IASTNode point) throws DOMException {
private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a, IASTNode point)
throws DOMException {
if (p.isNonTypeValue() != a.isNonTypeValue())
return false;
@ -735,7 +776,7 @@ public class TemplateArgumentDeduction {
if (parID >= 0) {
ICPPTemplateArgument old= fDeducedArgs.getArgument(parID, fPackOffset);
if (old == null) {
if (!deduce(parID, new CPPTemplateNonTypeArgument(as, new CPPBasicType(ICPPBasicType.Kind.eInt, 0)))) {
if (!deduce(parID, new CPPTemplateNonTypeArgument(as, new TypeOfValueDeducedFromArraySize()))) {
return false;
}
} else if (!as.equals(old.getNonTypeValue())) {
@ -761,14 +802,16 @@ public class TemplateArgumentDeduction {
if (p instanceof IQualifierType)
return false;
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 ICPPFunctionType) {
if (!(a instanceof ICPPFunctionType))
return false;
return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a, point);
} 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.isNonTypeValue())
return false;
@ -776,7 +819,8 @@ public class TemplateArgumentDeduction {
}
if (a == null)
return false;
return deduce(((ICPPTemplateParameter) p).getParameterID(), new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution));
return deduce(((ICPPTemplateParameter) p).getParameterID(),
new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution));
} else if (p instanceof ICPPTemplateInstance) {
if (!(a instanceof ICPPTemplateInstance))
return false;
@ -791,8 +835,8 @@ public class TemplateArgumentDeduction {
return false;
}
private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst, IASTNode point)
throws DOMException {
private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst,
IASTNode point) throws DOMException {
ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst);
ICPPClassTemplate aTemplate= getPrimaryTemplate(aInst);
if (pTemplate == null || aTemplate == null)
@ -853,7 +897,8 @@ public class TemplateArgumentDeduction {
return true;
}
private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta, IASTNode point) throws DOMException {
private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta, IASTNode point)
throws DOMException {
if (ftp.isConst() != fta.isConst() || ftp.isVolatile() != fta.isVolatile())
return false;

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@ -79,6 +80,8 @@ public class DeclSpecWriter extends NodeWriter {
return Keywords.CHAR;
case IASTSimpleDeclSpecifier.t_int:
return Keywords.INT;
case IASTSimpleDeclSpecifier.t_int128:
return GCCKeywords.__INT128;
case IASTSimpleDeclSpecifier.t_float:
return Keywords.FLOAT;

View file

@ -89,7 +89,7 @@ public class DeclaratorWriter extends NodeWriter {
private void writeFunctionDeclarator(IASTStandardFunctionDeclarator funcDec) {
IASTPointerOperator[] pointOps = funcDec.getPointerOperators();
writePointerOperators(funcDec, pointOps);
// XXX: Lambda declarators happen to have null names rather than empty ones when parsed
// Lambda declarators happen to have null names rather than empty ones when parsed.
if (funcDec.getName() != null) {
funcDec.getName().accept(visitor);
}

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.index;
import org.eclipse.cdt.core.index.IIndexManager;
@ -16,7 +15,6 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException;
public interface IWritableIndexManager extends IIndexManager {
/**
* Returns a writable index or <code>null</code> if the project does not exist or is not yet
* registered with the pdom manager.

View file

@ -6,18 +6,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
public class IndexerProgress {
public int fRequestedFilesCount;
public int fCompletedSources;
public int fPrimaryHeaderCount; // headers parsed that were actually requested
public int fCompletedHeaders; // all headers including those found through inclusions
public int fTimeEstimate; // fall-back for the time where no file-count is available
public int fPrimaryHeaderCount; // Headers parsed that were actually requested
public int fCompletedHeaders; // All headers including those found through inclusions
public int fTimeEstimate; // Fall-back for the time where no file-count is available
public IndexerProgress() {
}

View file

@ -226,10 +226,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* 134.0 - Storing unknown bindings via direct marshalling, bug 381824.
* 135.0 - Changed marshalling of EvalUnary, bug 391001.
* 136.0 - Extended CPPTemplateTypeArgument to include the original type, bug 392278.
* 137.0 - Fixed serialization of very large types and template arguments, bug 392278.
*/
private static final int MIN_SUPPORTED_VERSION= version(136, 0);
private static final int MAX_SUPPORTED_VERSION= version(136, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(136, 0);
private static final int MIN_SUPPORTED_VERSION= version(137, 0);
private static final int MAX_SUPPORTED_VERSION= version(137, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(137, 0);
private static int version(int major, int minor) {
return (major << 16) + minor;

View file

@ -111,9 +111,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import com.ibm.icu.text.MessageFormat;
/**
* The PDOM Provider. This is likely temporary since I hope
* to integrate the PDOM directly into the core once it has
* stabilized.
* Manages PDOM updates and events associated with them. Provides methods for index access.
*/
public class PDOMManager implements IWritableIndexManager, IListener {
private static final String TRACE_INDEXER_SETUP = CCorePlugin.PLUGIN_ID + "/debug/indexer/setup"; //$NON-NLS-1$
@ -697,10 +695,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} else {
if (fCurrentTask != null) {
IndexerProgress info= fCurrentTask.getProgressInformation();
fSourceCount+= info.fCompletedSources;
fHeaderCount+= info.fCompletedHeaders;
fSourceCount += info.fCompletedSources;
fHeaderCount += info.fCompletedHeaders;
// for the ticks we don't consider additional headers
fTickCount+= info.fCompletedSources + info.fPrimaryHeaderCount;
fTickCount += info.fCompletedSources + info.fPrimaryHeaderCount;
}
result= fCurrentTask= fTaskQueue.removeFirst();
}
@ -1138,26 +1136,41 @@ public class PDOMManager implements IWritableIndexManager, IListener {
int sourceCount, sourceEstimate, headerCount, tickCount, tickEstimate;
String detail= null;
synchronized (fTaskQueue) {
// add historic data
// Add historic data.
sourceCount= sourceEstimate= fSourceCount;
headerCount= fHeaderCount;
tickCount= tickEstimate= fTickCount;
// add future data
// Add future data.
for (IPDOMIndexerTask task : fTaskQueue) {
final IndexerProgress info= task.getProgressInformation();
sourceEstimate+= info.fRequestedFilesCount;
tickEstimate+= info.getEstimatedTicks();
sourceEstimate += info.fRequestedFilesCount;
tickEstimate += info.getEstimatedTicks();
}
// add current data
// Add current data.
if (fCurrentTask != null) {
final IndexerProgress info= fCurrentTask.getProgressInformation();
sourceCount+= info.fCompletedSources;
sourceEstimate+= info.fRequestedFilesCount - info.fPrimaryHeaderCount;
headerCount+= info.fCompletedHeaders;
// for the ticks we don't consider additional headers
tickCount+= info.fCompletedSources + info.fPrimaryHeaderCount;
tickEstimate+= info.getEstimatedTicks();
sourceCount += info.fCompletedSources;
sourceEstimate += info.fRequestedFilesCount - info.fPrimaryHeaderCount;
headerCount += info.fCompletedHeaders;
int completedPrimary = info.fCompletedSources + info.fPrimaryHeaderCount;
if (info.fRequestedFilesCount != 0) {
// We estimate the number of additional header files that will be encountered
// through resolution of includes by assuming that the number of the completed
// additional header files is proportional to the square root of the number of
// the completed requested files. This assumption reflects the fact that more
// additional header files are encountered at the beginning of indexing than
// towards the end.
tickCount += completedPrimary;
int additionalHeaders = info.fCompletedHeaders - info.fPrimaryHeaderCount;
tickEstimate += info.fRequestedFilesCount;
tickCount += additionalHeaders;
tickEstimate += additionalHeaders * Math.sqrt((double) info.fRequestedFilesCount / Math.max(completedPrimary, 1));
} else {
// For the ticks we don't consider additional headers.
tickCount += completedPrimary;
tickEstimate += info.fTimeEstimate;
}
detail= PDOMIndexerJob.sMonitorDetail;
}
}
@ -1171,9 +1184,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
job.subTask(msg);
if (tickCount > 0 && tickCount <= tickEstimate) {
int newTick= tickCount*base/tickEstimate;
int newTick= tickCount * base / tickEstimate;
if (newTick > currentTicks) {
job.worked(newTick-currentTicks);
job.worked(newTick - currentTicks);
return newTick;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 QNX Software Systems and others.
* Copyright (c) 2005, 2012 QNX Software Systems 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 @@
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.db;
@ -301,21 +302,22 @@ final class Chunk {
}
void put(final long offset, final byte[] data, final int len) {
put(offset, data, 0, len);
}
void put(final long offset, final byte[] data, int dataPos, final int len) {
assert fLocked;
fDirty= true;
fDirty = true;
int idx = recPtrToIndex(offset);
int i= 0;
while (i < len) {
fBuffer[idx++]= data[i++];
}
System.arraycopy(data, dataPos, fBuffer, idx, len);
}
public void get(final long offset, byte[] data) {
get(offset, data, 0, data.length);
}
public void get(final long offset, byte[] data, int dataPos, int len) {
int idx = recPtrToIndex(offset);
final int end= idx + data.length;
int i= 0;
while (idx < end) {
data[i++]= fBuffer[idx++];
}
System.arraycopy(fBuffer, idx, data, dataPos, len);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2012 QNX Software Systems 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
@ -10,6 +10,7 @@
* Symbian - Add some non-javadoc implementation notes
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.db;
@ -72,10 +73,10 @@ public class Database {
public static final int BLOCK_SIZE_DELTA_BITS = 3;
public static final int BLOCK_SIZE_DELTA= 1 << BLOCK_SIZE_DELTA_BITS;
public static final int MIN_BLOCK_DELTAS = 2; // a block must at least be 2 + 2*4 bytes to link the free blocks.
public static final int MAX_BLOCK_DELTAS = CHUNK_SIZE/BLOCK_SIZE_DELTA;
public static final int MAX_MALLOC_SIZE = MAX_BLOCK_DELTAS*BLOCK_SIZE_DELTA - BLOCK_HEADER_SIZE;
public static final int MAX_BLOCK_DELTAS = CHUNK_SIZE / BLOCK_SIZE_DELTA;
public static final int MAX_MALLOC_SIZE = MAX_BLOCK_DELTAS * BLOCK_SIZE_DELTA - BLOCK_HEADER_SIZE;
public static final int PTR_SIZE = 4; // size of a pointer in the database in bytes
public static final int TYPE_SIZE = 2+PTR_SIZE; // size of a type in the database in bytes
public static final int TYPE_SIZE = 2 + PTR_SIZE; // size of a type in the database in bytes
public static final int VALUE_SIZE = TYPE_SIZE; // size of a value in the database in bytes
public static final int ARGUMENT_SIZE = TYPE_SIZE; // size of a template argument in the database in bytes
public static final long MAX_DB_SIZE= ((long) 1 << (Integer.SIZE + BLOCK_SIZE_DELTA_BITS));
@ -90,9 +91,9 @@ public class Database {
private final File fLocation;
private final boolean fReadOnly;
private RandomAccessFile fFile;
private boolean fExclusiveLock= false; // necessary for any write operation
private boolean fExclusiveLock; // necessary for any write operation
private boolean fLocked; // necessary for any operation.
private boolean fIsMarkedIncomplete= false;
private boolean fIsMarkedIncomplete;
private int fVersion;
private final Chunk fHeaderChunk;
@ -150,7 +151,7 @@ public class Database {
fFile.getChannel().read(buf, position);
return;
} catch (ClosedChannelException e) {
// bug 219834 file may have be closed by interrupting a thread during an I/O operation.
// Bug 219834 file may have be closed by interrupting a thread during an I/O operation.
reopen(e, ++retries);
}
} while (true);
@ -163,14 +164,14 @@ public class Database {
fFile.getChannel().write(buf, position);
return;
} catch (ClosedChannelException e) {
// bug 219834 file may have be closed by interrupting a thread during an I/O operation.
// Bug 219834 file may have be closed by interrupting a thread during an I/O operation.
reopen(e, ++retries);
}
}
}
private void reopen(ClosedChannelException e, int attempt) throws ClosedChannelException, FileNotFoundException {
// only if the current thread was not interrupted we try to reopen the file.
// Only if the current thread was not interrupted we try to reopen the file.
if (e instanceof ClosedByInterruptException || attempt >= 20) {
throw e;
}
@ -184,9 +185,9 @@ public class Database {
long position = 0;
long size = from.size();
while (position < size) {
nRead = from.transferTo(position, 4096*16, target);
nRead = from.transferTo(position, 4096 * 16, target);
if (nRead == 0) {
break; // should not happen
break; // Should not happen
} else {
position+= nRead;
}
@ -530,10 +531,18 @@ public class Database {
getChunk(offset).put(offset, data, len);
}
public void putBytes(long offset, byte[] data, int dataPos, int len) throws CoreException {
getChunk(offset).put(offset, data, dataPos, len);
}
public void getBytes(long offset, byte[] data) throws CoreException {
getChunk(offset).get(offset, data);
}
public void getBytes(long offset, byte[] data, int dataPos, int len) throws CoreException {
getChunk(offset).get(offset, data, dataPos, len);
}
public IString newString(String string) throws CoreException {
return newString(string.toCharArray());
}
@ -545,7 +554,7 @@ public class Database {
if (useBytes) {
bytelen= len;
} else {
bytelen= 2*len;
bytelen= 2 * len;
}
if (bytelen > ShortString.MAX_BYTE_LENGTH) {
@ -607,7 +616,7 @@ public class Database {
// chunks have been removed from the cache, so we are fine
fHeaderChunk.clear(0, CHUNK_SIZE);
fHeaderChunk.fDirty= false;
fChunks= new Chunk[] {null};
fChunks= new Chunk[] { null };
fChunksUsed = fChunksAllocated = fChunks.length;
try {
fFile.close();
@ -686,8 +695,7 @@ public class Database {
}
// also handles header chunk
flushAndUnlockChunks(dirtyChunks, flush);
}
finally {
} finally {
fExclusiveLock= false;
}
}
@ -721,7 +729,7 @@ public class Database {
private void flushAndUnlockChunks(final ArrayList<Chunk> dirtyChunks, boolean isComplete) throws CoreException {
assert !Thread.holdsLock(fCache);
synchronized(fHeaderChunk) {
synchronized (fHeaderChunk) {
final boolean haveDirtyChunks = !dirtyChunks.isEmpty();
if (haveDirtyChunks || fHeaderChunk.fDirty) {
markFileIncomplete();

View file

@ -189,8 +189,14 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
putByte(VALUE);
arg.getNonTypeEvaluation().marshal(this, true);
} else {
marshalType(arg.getTypeValue());
marshalType(arg.getOriginalTypeValue());
final IType typeValue = arg.getTypeValue();
final IType originalTypeValue = arg.getOriginalTypeValue();
marshalType(typeValue);
if (typeValue != originalTypeValue) {
marshalType(originalTypeValue);
} else {
marshalType(null);
}
}
}
@ -203,6 +209,8 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
fPos--;
IType type = unmarshalType();
IType originalType = unmarshalType();
if (originalType == null)
originalType= type;
return new CPPTemplateTypeArgument(type, originalType);
}
}

View file

@ -11,6 +11,7 @@
* IBM Corporation
* Andrew Ferguson (Symbian)
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
@ -168,7 +169,6 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
}
}
@Override
public void addChild(PDOMNode child) throws CoreException {
getIndex().insert(child.getRecord());
@ -438,46 +438,94 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
if (type != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
bc.marshalType(type);
int len= bc.getPosition();
if (len > 0) {
if (len <= Database.TYPE_SIZE) {
db.putBytes(offset, bc.getBuffer(), len);
} else if (len <= Database.MAX_MALLOC_SIZE-2){
long ptr= db.malloc(len+2);
storeBuffer(db, offset, bc, Database.TYPE_SIZE);
}
}
private void storeBuffer(Database db, long offset, TypeMarshalBuffer buf, int maxInlineSize) throws CoreException {
int len= buf.getPosition();
if (len > 0) {
if (len <= maxInlineSize) {
db.putBytes(offset, buf.getBuffer(), len);
} else {
db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE);
long chainOffset = offset + 1;
int bufferPos = 0;
while (bufferPos < len) {
int chunkLength = len - bufferPos + 2;
boolean chainingRequired = false;
if (chunkLength > Database.MAX_MALLOC_SIZE) {
chunkLength = Database.MAX_MALLOC_SIZE;
chainingRequired = true;
}
long ptr = db.malloc(chunkLength);
db.putRecPtr(chainOffset, ptr);
db.putShort(ptr, (short) len);
db.putBytes(ptr+2, bc.getBuffer(), len);
db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE);
db.putRecPtr(offset+2, ptr);
int pos = 2;
if (chainingRequired) {
// Reserve space for the chaining pointer.
chainOffset = ptr + 2; pos += Database.PTR_SIZE;
}
chunkLength -= pos;
db.putBytes(ptr + pos, buf.getBuffer(), bufferPos, chunkLength);
bufferPos += chunkLength;
}
}
}
}
private void deleteType(Database db, long offset) throws CoreException {
byte firstByte= db.getByte(offset);
if (firstByte == TypeMarshalBuffer.INDIRECT_TYPE) {
long ptr= db.getRecPtr(offset+2);
clearType(db, offset);
db.free(ptr);
} else {
clearType(db, offset);
private byte[] loadLinkedSerializedData(final Database db, long offset) throws CoreException {
long ptr= db.getRecPtr(offset);
int len= db.getShort(ptr) & 0xffff;
byte[] data= new byte[len];
int bufferPos = 0;
while (bufferPos < len) {
int chunkLength = len - bufferPos + 2;
int pos = 2;
long chunkPtr = ptr;
if (chunkLength > Database.MAX_MALLOC_SIZE) {
chunkLength = Database.MAX_MALLOC_SIZE;
ptr= db.getRecPtr(chunkPtr + pos); pos += Database.PTR_SIZE;
}
chunkLength -= pos;
db.getBytes(chunkPtr + pos, data, bufferPos, chunkLength);
bufferPos += chunkLength;
}
return data;
}
private void clearType(Database db, long offset) throws CoreException {
db.clearBytes(offset, Database.TYPE_SIZE);
private void deleteSerializedData(Database db, long offset, int maxInlineSize) throws CoreException {
byte firstByte= db.getByte(offset);
if (firstByte == TypeMarshalBuffer.INDIRECT_TYPE) {
long ptr= db.getRecPtr(offset + 1);
int len= db.getShort(ptr) & 0xffff;
while (len > 0) {
int chunkLength = len + 2;
int pos = 2;
long chunkPtr = ptr;
if (chunkLength > Database.MAX_MALLOC_SIZE) {
chunkLength = Database.MAX_MALLOC_SIZE;
ptr= db.getRecPtr(chunkPtr + pos); pos += Database.PTR_SIZE;
}
chunkLength -= pos;
db.free(chunkPtr);
len -= chunkLength;
}
}
db.clearBytes(offset, maxInlineSize);
}
private void deleteType(Database db, long offset) throws CoreException {
deleteSerializedData(db, offset, Database.TYPE_SIZE);
}
public IType loadType(long offset) throws CoreException {
final Database db= getDB();
final byte firstByte= db.getByte(offset);
byte[] data= null;
switch(firstByte) {
switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE:
long ptr= db.getRecPtr(offset+2);
int len= db.getShort(ptr) & 0xffff;
data= new byte[len];
db.getBytes(ptr+2, data);
data = loadLinkedSerializedData(db, offset + 1);
break;
case TypeMarshalBuffer.UNSTORABLE_TYPE:
return TypeMarshalBuffer.UNSTORABLE_TYPE_PROBLEM;
@ -501,46 +549,21 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
if (binding != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
bc.marshalBinding(binding);
int len= bc.getPosition();
if (len > 0) {
if (len <= Database.TYPE_SIZE) {
db.putBytes(offset, bc.getBuffer(), len);
} else if (len <= Database.MAX_MALLOC_SIZE-2){
long ptr= db.malloc(len+2);
db.putShort(ptr, (short) len);
db.putBytes(ptr+2, bc.getBuffer(), len);
db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE);
db.putRecPtr(offset+2, ptr);
}
}
storeBuffer(db, offset, bc, Database.TYPE_SIZE);
}
}
private void deleteBinding(Database db, long offset) throws CoreException {
byte firstByte= db.getByte(offset);
if (firstByte == TypeMarshalBuffer.INDIRECT_TYPE) {
long ptr= db.getRecPtr(offset+2);
clearBinding(db, offset);
db.free(ptr);
} else {
clearBinding(db, offset);
}
}
private void clearBinding(Database db, long offset) throws CoreException {
db.clearBytes(offset, Database.TYPE_SIZE);
deleteSerializedData(db, offset, Database.TYPE_SIZE);
}
public IBinding loadBinding(long offset) throws CoreException {
final Database db= getDB();
final byte firstByte= db.getByte(offset);
byte[] data= null;
switch(firstByte) {
switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE:
long ptr= db.getRecPtr(offset+2);
int len= db.getShort(ptr) & 0xffff;
data= new byte[len];
db.getBytes(ptr+2, data);
data = loadLinkedSerializedData(db, offset + 1);
break;
case TypeMarshalBuffer.UNSTORABLE_TYPE:
return new ProblemBinding(null, ISemanticProblem.TYPE_NOT_PERSISTED);
@ -564,52 +587,27 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
if (arg != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
bc.marshalTemplateArgument(arg);
int len= bc.getPosition();
if (len > 0) {
if (len <= Database.ARGUMENT_SIZE) {
db.putBytes(offset, bc.getBuffer(), len);
} else if (len <= Database.MAX_MALLOC_SIZE-2){
long ptr= db.malloc(len+2);
db.putShort(ptr, (short) len);
db.putBytes(ptr+2, bc.getBuffer(), len);
db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE);
db.putRecPtr(offset+2, ptr);
}
}
storeBuffer(db, offset, bc, Database.ARGUMENT_SIZE);
}
}
private void deleteArgument(Database db, long offset) throws CoreException {
byte firstByte= db.getByte(offset);
if (firstByte == TypeMarshalBuffer.INDIRECT_TYPE) {
long ptr= db.getRecPtr(offset+2);
clearArgument(db, offset);
db.free(ptr);
} else {
clearArgument(db, offset);
}
}
private void clearArgument(Database db, long offset) throws CoreException {
db.clearBytes(offset, Database.ARGUMENT_SIZE);
deleteSerializedData(db, offset, Database.ARGUMENT_SIZE);
}
public ICPPTemplateArgument loadTemplateArgument(long offset) throws CoreException {
final Database db= getDB();
final byte firstByte= db.getByte(offset);
byte[] data= null;
switch(firstByte) {
switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE:
long ptr= db.getRecPtr(offset+2);
int len= db.getShort(ptr) & 0xffff;
data= new byte[len];
db.getBytes(ptr+2, data);
data = loadLinkedSerializedData(db, offset + 1);
break;
case TypeMarshalBuffer.UNSTORABLE_TYPE:
case TypeMarshalBuffer.NULL_TYPE:
return null;
default:
data= new byte[Database.TYPE_SIZE];
data= new byte[Database.ARGUMENT_SIZE];
db.getBytes(offset, data);
break;
}
@ -626,40 +624,26 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
if (value != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
bc.marshalValue(value);
int len= bc.getPosition();
if (len > 0) {
if (len <= Database.TYPE_SIZE) {
db.putBytes(offset, bc.getBuffer(), len);
} else if (len <= Database.MAX_MALLOC_SIZE-2){
long ptr= db.malloc(len+2);
db.putShort(ptr, (short) len);
db.putBytes(ptr+2, bc.getBuffer(), len);
db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE);
db.putRecPtr(offset+2, ptr);
}
}
storeBuffer(db, offset, bc, Database.VALUE_SIZE);
}
}
private void deleteValue(Database db, long offset) throws CoreException {
deleteType(db, offset);
deleteSerializedData(db, offset, Database.VALUE_SIZE);
}
public IValue loadValue(long offset) throws CoreException {
final Database db= getDB();
final byte firstByte= db.getByte(offset);
byte[] data= null;
switch(firstByte) {
switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE:
long ptr= db.getRecPtr(offset+2);
int len= db.getShort(ptr) & 0xffff;
data= new byte[len];
db.getBytes(ptr+2, data);
data = loadLinkedSerializedData(db, offset + 1);
break;
case TypeMarshalBuffer.NULL_TYPE:
return null;
default:
data= new byte[Database.TYPE_SIZE];
data= new byte[Database.VALUE_SIZE];
db.getBytes(offset, data);
break;
}

View file

@ -3767,14 +3767,40 @@
menuGroupId="org.eclipse.cdt.ui.newProject"
type="new"
wizardId="org.eclipse.cdt.ui.wizards.NewCWizard1">
<enablement/>
<enablement>
<or>
<with variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<instanceof value="org.eclipse.cdt.core.model.ICElement" />
<and>
<instanceof value="org.eclipse.core.resources.IProject"/>
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
</and>
</or>
</enablement>
</commonWizard>
<commonWizard
associatedExtensionId="org.eclipse.cdt.ui.navigator.content"
menuGroupId="org.eclipse.cdt.ui.newProject"
type="new"
wizardId="org.eclipse.cdt.ui.wizards.NewCWizard2">
<enablement/>
<enablement>
<or>
<with variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<instanceof value="org.eclipse.cdt.core.model.ICElement" />
<and>
<instanceof value="org.eclipse.core.resources.IProject"/>
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
</and>
</or>
</enablement>
</commonWizard>
<commonWizard
associatedExtensionId="org.eclipse.cdt.ui.navigator.content"

View file

@ -41,7 +41,6 @@ import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.help.IContext;
import org.eclipse.help.IContextProvider;
import org.eclipse.jface.action.GroupMarker;
@ -149,7 +148,6 @@ import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.IShowInTargetList;
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
import org.eclipse.ui.texteditor.AnnotationPreference;
@ -3649,7 +3647,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
}
stores.add(CUIPlugin.getDefault().getPreferenceStore());
stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, CCorePlugin.PLUGIN_ID));
stores.add(CUIPlugin.getDefault().getCorePreferenceStore());
stores.add(EditorsUI.getPreferenceStore());
return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011 Jens Elmenthaler and others
* Copyright (c) 2011, 2012 Jens Elmenthaler 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
@ -15,16 +15,13 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
/**
* A preference that on preference from the UI plugin, as well the CDT core.
@ -49,8 +46,8 @@ public abstract class AbstractMixedPreferencePage extends AbstractPreferencePage
};
public AbstractMixedPreferencePage() {
corePrefsOverlayStore = new OverlayPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE,
CCorePlugin.PLUGIN_ID), createCorePrefsOverlayStoreKeys());
corePrefsOverlayStore = new OverlayPreferenceStore(CUIPlugin.getDefault().getCorePreferenceStore(),
createCorePrefsOverlayStoreKeys());
}
protected Button addCorePrefsCheckBox(Composite parent, String label, String key, int indentation) {

View file

@ -1,70 +1,84 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Intel Corporation, QNX Software Systems, 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - initial API and implementation
* QNX Software Systems - [272416] Rework the config sets dialog
*******************************************************************************/
package org.eclipse.cdt.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.workingsets.WorkingSetConfigurationDialog;
/**
*/
public class WorkingSetConfigAction implements IWorkbenchWindowActionDelegate, IPropertyChangeListener {
private static final IWorkingSetManager wsm = CUIPlugin.getDefault().getWorkbench().getWorkingSetManager();
private boolean enabled = true;
private IWorkbenchWindow window;
@Override
public void run(IAction action) {
new WorkingSetConfigurationDialog(window.getShell()).open();
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
checkWS();
if (action.isEnabled() != enabled)
action.setEnabled(enabled);
}
@Override
public void dispose() {
wsm.removePropertyChangeListener(this);
}
@Override
public void init(IWorkbenchWindow window) {
this.window = window;
wsm.addPropertyChangeListener(this);
checkWS();
}
private IWorkingSet[] checkWS() {
IWorkingSet[] w = wsm.getWorkingSets();
if (w == null)
w = new IWorkingSet[0];
enabled = w.length > 0;
return w;
}
@Override
public void propertyChange(PropertyChangeEvent event) {
checkWS();
}
}
/*******************************************************************************
* Copyright (c) 2008, 2009, 2012 Intel Corporation, QNX Software Systems, 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - initial API and implementation
* QNX Software Systems - [272416] Rework the config sets dialog
* Freescale Semiconductor - [392954] disable the action if only empty working sets exist
*******************************************************************************/
package org.eclipse.cdt.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.workingsets.WorkingSetConfigurationDialog;
/**
*/
public class WorkingSetConfigAction implements IWorkbenchWindowActionDelegate, IPropertyChangeListener {
private static final IWorkingSetManager wsm = CUIPlugin.getDefault().getWorkbench().getWorkingSetManager();
private boolean enabled = true;
private IWorkbenchWindow window;
private IAction action;
@Override
public void run(IAction action) {
this.action = action;
checkWS();
if (enabled) {
new WorkingSetConfigurationDialog(window.getShell()).open();
}
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
this.action = action;
checkWS();
}
@Override
public void dispose() {
wsm.removePropertyChangeListener(this);
}
@Override
public void init(IWorkbenchWindow window) {
this.window = window;
wsm.addPropertyChangeListener(this);
checkWS();
}
private void checkWS() {
enabled = false;
IWorkingSet[] w = wsm.getWorkingSets();
if (w == null)
w = new IWorkingSet[0];
for (IWorkingSet ws : w) {
if (!ws.isEmpty()) {
enabled = true;
break;
}
}
if (action != null) {
action.setEnabled(enabled);
}
}
@Override
public void propertyChange(PropertyChangeEvent event) {
checkWS();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2012 Wind River Systems, 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
@ -14,9 +14,9 @@ package org.eclipse.cdt.ui.dialogs;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@ -26,13 +26,12 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CCorePreferenceConstants;
import org.eclipse.cdt.core.dom.CDOM;
import org.eclipse.cdt.core.parser.CodeReaderCache;
import org.eclipse.cdt.core.parser.ICodeReaderCache;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
@ -140,7 +139,7 @@ public class CacheSizeBlock extends AbstractCOptionPage {
}
private void initializeValues() {
ScopedPreferenceStore prefStore= new ScopedPreferenceStore(InstanceScope.INSTANCE, CCorePlugin.PLUGIN_ID);
IPreferenceStore prefStore= CUIPlugin.getDefault().getCorePreferenceStore();
fDBLimitPct.setPreferenceStore(prefStore);
fDBLimitPct.setPropertyChangeListener(validityChangeListener);

View file

@ -74,34 +74,32 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
public static IPath createPath(String path) {
if (path == null)
return null;
if (path.contains("\\")) { //$NON-NLS-1$
// handle Windows slashes and canonicalize
path = path.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
}
// also check for device or UNC
int firstSep = path.indexOf("/"); //$NON-NLS-1$
int idx = path.indexOf(":"); //$NON-NLS-1$
// ':' indicates a Windows device separator if it comes before
// the first segment separator
if (idx > 0 && (firstSep < 0 || idx < firstSep)) {
String device = path.substring(0, idx + 1);
path = path.substring(idx + 1);
return new Path(path).setDevice(device);
} else {
// Cygwin or UNC path
if (path.startsWith("//")) { //$NON-NLS-1$
String network;
idx = path.indexOf("/", 2); //$NON-NLS-1$
if (idx > 0) {
network = path.substring(0, idx);
path = path.substring(idx);
} else {
network = path;
path = ""; //$NON-NLS-1$
}
return new Path(network, path).makeUNC(true);
// Check for windows full-path formatting.
if (path.matches("^([a-zA-Z])[:](.*)$")) { //$NON-NLS-1$
String device = null;
String missingfile = path.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
int idx = missingfile.indexOf(":"); //$NON-NLS-1$
if ( idx > 0 ) {
device = missingfile.substring(0, idx + 1);
missingfile = missingfile.substring(idx + 1);
}
return new Path(device, missingfile);
}
int idx = 0;
// Cygwin or UNC path
if (path.startsWith("//")) { //$NON-NLS-1$
String network;
idx = path.indexOf("/", 2); //$NON-NLS-1$
if (idx > 0) {
network = path.substring(0, idx);
path = path.substring(idx);
} else {
network = path;
path = ""; //$NON-NLS-1$
}
return new Path(network, path).makeUNC(true);
}
// fallthrough

View file

@ -37,7 +37,7 @@ public class MapEntrySourceContainerType extends AbstractSourceContainerTypeDele
Element element = (Element)node;
if (ELEMENT_NAME.equals(element.getNodeName())) {
String path = element.getAttribute(BACKEND_PATH);
IPath backend = new Path(path);
IPath backend = MapEntrySourceContainer.createPath(path);
if (!backend.isValidPath(path)) {
abort(InternalSourceLookupMessages.MapEntrySourceContainerType_0, null);
}

View file

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems, 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
import org.eclipse.core.runtime.IPath;
@SuppressWarnings("restriction")
public class MapEntrySourceContainerTests extends TestCase {
public static Test suite() {
return new TestSuite(MapEntrySourceContainerTests.class);
}
public MapEntrySourceContainerTests(String name) {
super(name);
}
public void testUNCPath() {
String uncPath = "//server/path/on/server";
IPath path = MapEntrySourceContainer.createPath(uncPath);
assertEquals(uncPath, path.toString());
uncPath = "\\\\server\\path\\on\\server";
path = MapEntrySourceContainer.createPath(uncPath);
assertEquals(uncPath, path.toOSString());
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 QNX Software Systems and others.
* Copyright (c) 2004, 2012 QNX Software Systems 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 @@
* QNX Software Systems - Initial API and implementation
* Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
* QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
* Scott Tepavich (WindRiver) - Fixed bad reference to messages.properties string (Bug 393178)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.breakpoints;
@ -567,7 +568,7 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
} else if (!isReadType && isWriteType) {
return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
} else {
return BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_breakpointType_watchpoint_access_label"); //$NON-NLS-1$
return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_access_label"); //$NON-NLS-1$
}
}

View file

@ -272,7 +272,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
protected void locateFile() {
FileDialog dialog = new FileDialog(getEditorSite().getShell(), SWT.NONE);
Path missingPath = new Path(missingFile);
IPath missingPath = MapEntrySourceContainer.createPath(missingFile);
dialog.setFilterNames(new String[] {SourceLookupUIMessages.CSourceNotFoundEditor_2});
dialog.setFilterExtensions(new String[] {"*." + missingPath.getFileExtension()}); //$NON-NLS-1$
String res = dialog.open();

View file

@ -29,6 +29,7 @@ public class Messages extends NLS {
public static String OSView_12;
public static String OSView_13;
public static String OSView_14;
public static String OSView_15;
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);

View file

@ -9,7 +9,7 @@
# Vladimir Prus (Mentor Graphics) - initial API and implementation
###############################################################################
OSView_3=Refresh
OSView_4=Invalid debug session selected.
OSView_4=Invalid debug object selected. Please select a process, thread or frame inside DSF GDB debug session.
OSView_5=Please select resource class.
OSView_6=Fetching data...
OSView_7=No data has been fetched yet. <a href="{0}">Fetch now</a>.
@ -20,3 +20,4 @@ OSView_11=Determining available OS resource classes...
OSView_12=No data has been fetched yet. Target is busy.
OSView_13=Waiting for the debug session to initialize.
OSView_14=Objects from different debug sessions are selected.
OSView_15=No debug session is selected.

View file

@ -82,6 +82,8 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
// Indicates that we've selected objects from different debug sessions.
boolean fMultiple = false;
// Indicates that we have selected object with a wrong type
boolean fWrongType = false;
// UI objects
@ -225,14 +227,20 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
ICommandControlDMContext context = null;
fMultiple = false;
fWrongType = false;
if (s instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) s;
if (ss.size() > 0) {
@SuppressWarnings("rawtypes")
Iterator i = ss.iterator();
context = getCommandControlContext(i.next());
if (context == null)
fWrongType = true;
while (i.hasNext()) {
ICommandControlDMContext nextContext = getCommandControlContext(i.next());
ICommandControlDMContext nextContext = getCommandControlContext(i.next());
if (nextContext == null)
fWrongType = true;
if (nextContext == null && context != null
|| nextContext != null && context == null
|| nextContext != null && context != null && !nextContext.equals(context))
@ -300,18 +308,13 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
public void update() {
// Note that fSessionData always calls the listener in
// UI thread, so we can directly call 'update' here.
OSResourcesView.this.update();
OSResourcesView.this.updateSessionDataContents();
}
}, fViewer.getControl());
}
}
if (newSessionData != fSessionData)
{
fSessionData = newSessionData;
update();
}
update(newSessionData);
}
@Override
@ -323,7 +326,39 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
}
}
private void update() {
// Update UI to showing new session data. If this session data is already
// shown, does nothing.
private void update(SessionOSData newSessionData)
{
if (fViewer == null || fViewer.getControl() == null)
return;
if (fViewer.getControl().isDisposed())
return;
if (newSessionData == null)
{
fSessionData = null;
if (fMultiple)
hideTable(Messages.OSView_14);
else if (fWrongType)
hideTable(Messages.OSView_4);
else
hideTable(Messages.OSView_15);
fResourceClassEditor.setEnabled(false);
fRefreshAction.setEnabled(false);
return;
}
if (newSessionData != fSessionData) {
fSessionData = newSessionData;
updateSessionDataContents();
}
}
// Update the UI according to actual content of fSessionData,
// which must be not null.
private void updateSessionDataContents() {
if (fViewer == null || fViewer.getControl() == null)
return;
@ -331,14 +366,6 @@ public class OSResourcesView extends ViewPart implements DsfSession.SessionEnded
if (fViewer.getControl().isDisposed())
return;
if (fSessionData == null)
{
hideTable(fMultiple ? Messages.OSView_14 : Messages.OSView_4);
fResourceClassEditor.setEnabled(false);
fRefreshAction.setEnabled(false);
return;
}
boolean enable = fSessionData.canFetchData();
fRefreshAction.setEnabled(enable);
fResourceClass = fResourceClassEditor.updateClasses(fSessionData.getResourceClasses());

View file

@ -9,6 +9,7 @@
* Ericsson - Initial API and implementation
* Ericsson - Added support for Mac OS
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - Add timer when fetching GDB version (Bug 376203)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@ -48,11 +49,13 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunchConfiguration;
@ -290,7 +293,7 @@ public class LaunchUtils {
* only once and the resulting version string stored for future uses.
*/
public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException {
Process process = null;
final Process process;
String cmd = getGDBPath(configuration).toOSString() + " --version"; //$NON-NLS-1$
try {
process = ProcessFactory.getFactory().exec(cmd, getLaunchEnvironment(configuration));
@ -299,6 +302,21 @@ public class LaunchUtils {
"Error while launching command: " + cmd, e.getCause()));//$NON-NLS-1$
}
// Start a timeout job to make sure we don't get stuck waiting for
// an answer from a gdb that is hanging
// Bug 376203
Job timeoutJob = new Job("GDB version timeout job") { //$NON-NLS-1$
{ setSystem(true); }
@Override
protected IStatus run(IProgressMonitor arg) {
// Took too long. Kill the gdb process and
// let things clean up.
process.destroy();
return Status.OK_STATUS;
}
};
timeoutJob.schedule(10000);
InputStream stream = null;
StringBuilder cmdOutput = new StringBuilder(200);
try {
@ -314,6 +332,10 @@ public class LaunchUtils {
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
"Error reading GDB STDOUT after sending: " + cmd, e.getCause()));//$NON-NLS-1$
} finally {
// If we get here we are obviously not stuck so we can cancel the timeout job.
// Note that it may already have executed, but that is not a problem.
timeoutJob.cancel();
// Cleanup to avoid leaking pipes
// Close the stream we used, and then destroy the process
// Bug 345164
@ -325,7 +347,12 @@ public class LaunchUtils {
process.destroy();
}
return getGDBVersionFromText(cmdOutput.toString());
String gdbVersion = getGDBVersionFromText(cmdOutput.toString());
if (gdbVersion == null || gdbVersion.isEmpty()) {
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
"Could not determine GDB version after sending: " + cmd, null));//$NON-NLS-1$
}
return gdbVersion;
}
public static boolean getIsAttach(ILaunchConfiguration config) {

View file

@ -10,6 +10,7 @@
* Wind River System
* Ericsson
* Marc Khouzam (Ericsson) - Use the new IMIBackend2 interface (Bug 350837)
* Mark Bozeman (Mentor Graphics) - Report GDB start failures (Bug 376203)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@ -19,7 +20,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
@ -561,22 +561,53 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
return Status.OK_STATUS;
}
BufferedReader inputReader = null;
BufferedReader errorReader = null;
boolean success = false;
try {
Reader r = new InputStreamReader(getMIInputStream());
BufferedReader reader = new BufferedReader(r);
// Read initial GDB prompt
inputReader = new BufferedReader(new InputStreamReader(getMIInputStream()));
String line;
while ((line = reader.readLine()) != null) {
while ((line = inputReader.readLine()) != null) {
line = line.trim();
if (line.endsWith("(gdb)")) { //$NON-NLS-1$
success = true;
break;
}
}
// Failed to read initial prompt, check for error
if (!success) {
errorReader = new BufferedReader(new InputStreamReader(getMIErrorStream()));
String errorInfo = errorReader.readLine();
if (errorInfo == null) {
errorInfo = "GDB prompt not read"; //$NON-NLS-1$
}
gdbLaunchRequestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, errorInfo, null));
}
} catch (IOException e) {
gdbLaunchRequestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Error reading GDB STDOUT", e)); //$NON-NLS-1$
gdbLaunchRequestMonitor.done();
return Status.OK_STATUS;
success = false;
gdbLaunchRequestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Error reading GDB output", e)); //$NON-NLS-1$
}
// In the case of failure, close the MI streams so
// they are not leaked.
if (!success)
{
if (inputReader != null) {
try {
inputReader.close();
} catch (IOException e) {
}
}
if (errorReader != null) {
try {
errorReader.close();
} catch (IOException e) {
}
}
}
gdbLaunchRequestMonitor.done();
return Status.OK_STATUS;
}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
* Grzegorz Kuligowski - Cannot cast to type that contain commas (bug 393474)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@ -69,9 +70,10 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
* the different expressions contained in a group-expression.
* The [] are not part the characters, but are used in the regex format.
* Note that we don't allow a space separator because spaces are valid within
* an expression (e.g., i + 1)
* an expression (e.g., i + 1).
* We also don't allow a comma because they are used in templates (bug 393474)
*/
private final static String GROUP_EXPRESSION_SEPARATORS_REGEXP = "[,;]"; //$NON-NLS-1$
private final static String GROUP_EXPRESSION_SEPARATORS_REGEXP = "[;]"; //$NON-NLS-1$
/**
* A group-expression is an expression that requires expansion into a (potentially empty)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 Wind River Systems and others.
* Copyright (c) 2006, 2012 Wind River Systems 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,8 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
* Marc Khouzam (Ericsson) - Specify the larger size in the new constructor
* of PipedInputStream provided by Java 6
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command;
@ -17,13 +19,12 @@ import java.io.PipedOutputStream;
class LargePipedInputStream extends PipedInputStream {
private final int LARGE_BUF_SIZE = 1024 * 1024; // 1 megs
private static final int LARGE_BUF_SIZE = 1024 * 1024; // 1M
public LargePipedInputStream(PipedOutputStream pipedoutputstream)
throws IOException
{
super(pipedoutputstream);
buffer = new byte[LARGE_BUF_SIZE];
super(pipedoutputstream, LARGE_BUF_SIZE);
}
}

View file

@ -404,7 +404,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupAllRegsAllLocals() throws Throwable {
final String exprString = "$*, *";
final String exprString = "$*; *";
List<String> list = get_X86_REGS();
Collections.sort(list);
list.addAll(Arrays.asList(new String[] { "firstarg", "firstvar", "secondarg", "secondvar" }));
@ -427,7 +427,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupAllLocalsAllRegs() throws Throwable {
final String exprString = "*, $*";
final String exprString = "*; $*";
List<String> list = get_X86_REGS();
Collections.sort(list);
list.addAll(0, Arrays.asList(new String[] { "firstarg", "firstvar", "secondarg", "secondvar" }));
@ -449,7 +449,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupSubExprRange() throws Throwable {
final String exprString = "$eax, $es, *";
final String exprString = "$eax; $es; *";
final String[] children = new String[] { "$es", "firstarg", "firstvar", "secondarg" };
SyncUtil.runToLocation("foo");
@ -468,7 +468,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupOneLocalAllReg() throws Throwable {
final String exprString = "firstvar, $*";
final String exprString = "firstvar; $*";
List<String> list = get_X86_REGS();
Collections.sort(list);
list.addAll(0, Arrays.asList(new String[] { "firstvar" }));
@ -492,7 +492,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testUniqueWhenOverlapReg() throws Throwable {
final String exprString = "$eax, $e?x, $eb?";
final String exprString = "$eax; $e?x; $eb?";
final String[] children = new String[] { "$eax","$ebx","$ecx","$edx", "$ebp" };
SyncUtil.runToLocation("foo");
@ -513,7 +513,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testUniqueWhenOverlapLocal() throws Throwable {
final String exprString = "firstvar,*,firstvar";
final String exprString = "firstvar;*;firstvar";
final String[] children = new String[] { "firstvar", "firstarg", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -577,7 +577,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testSeparatlySorted() throws Throwable {
final String exprString = "$*, *";
final String exprString = "$*; *";
List<String> list = get_X86_REGS();
Collections.sort(list);
List<String> localsList = Arrays.asList(new String[] { "firstarg", "firstvar", "secondarg", "secondvar" });
@ -596,24 +596,25 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
checkChildrenCount(exprDmc, children.length);
}
/**
* Test that group-expression can use a comma as a separator
*/
@Test
public void testCommaSeparation() throws Throwable {
final String exprString = "firstvar,$eax";
final String[] children = new String[] { "firstvar","$eax" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
// Cannot use comma separator because of templates (bug 393474)
// /**
// * Test that group-expression can use a comma as a separator
// */
// @Test
// public void testCommaSeparation() throws Throwable {
// final String exprString = "firstvar,$eax";
// final String[] children = new String[] { "firstvar","$eax" };
//
// SyncUtil.runToLocation("foo");
// MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
//
// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
//
// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
//
// checkChildren(exprDmc, -1, -1, children);
// checkChildrenCount(exprDmc, children.length);
// }
/**
* Test that group-expression can use a semi-colon as a separator
@ -634,46 +635,46 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
checkChildrenCount(exprDmc, children.length);
}
/**
* Test that group-expression can use a comma and a semi-colon as a
* separator at the same time
*/
@Test
public void testCommaAndSemiColonSeparation() throws Throwable {
final String exprString = "firstvar,$eax;$es";
final String[] children = new String[] { "firstvar","$eax","$es" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
// Cannot use comma separator because of templates (bug 393474)
// /**
// * Test that group-expression can use a comma and a semi-colon as a
// * separator at the same time
// */
// @Test
// public void testCommaAndSemiColonSeparation() throws Throwable {
// final String exprString = "firstvar,$eax;$es";
// final String[] children = new String[] { "firstvar","$eax","$es" };
//
// SyncUtil.runToLocation("foo");
// MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
//
// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
//
// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
//
// checkChildren(exprDmc, -1, -1, children);
// checkChildrenCount(exprDmc, children.length);
// }
/**
* Test that group-expression can have empty terms with commas.
*/
@Test
public void testGroupCommaEmptyTerm() throws Throwable {
final String exprString = ",,firstvar,,$eax,,";
final String[] children = new String[] { "firstvar","$eax" };
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
checkChildren(exprDmc, -1, -1, children);
checkChildrenCount(exprDmc, children.length);
}
// Cannot use comma separator because of templates (bug 393474)
// /**
// * Test that group-expression can have empty terms with commas.
// */
// @Test
// public void testGroupCommaEmptyTerm() throws Throwable {
// final String exprString = ",,firstvar,,$eax,,";
// final String[] children = new String[] { "firstvar","$eax" };
//
// SyncUtil.runToLocation("foo");
// MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
//
// IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
//
// final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, exprString);
//
// checkChildren(exprDmc, -1, -1, children);
// checkChildrenCount(exprDmc, children.length);
// }
/**
* Test that group-expression can have empty terms with semi-colon.
@ -699,7 +700,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testExtraSpaces() throws Throwable {
final String exprString = " firstvar , $eax , , ";
final String exprString = " firstvar ; $eax ; ; ";
final String[] children = new String[] { "firstvar","$eax" };
SyncUtil.runToLocation("foo");
@ -718,7 +719,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupExpressionData() throws Throwable {
final String exprString = "$eax,*";
final String exprString = "$eax;*";
// final String[] children = new String[] { "$eax", "firstarg", "firstvar", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -763,7 +764,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupExpressionAddressData() throws Throwable {
final String exprString = "$eax,*";
final String exprString = "$eax;*";
// final String[] children = new String[] { "$eax", "firstarg", "firstvar", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -795,7 +796,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupGetSubExpressions() throws Throwable {
final String exprString = "$eax,*";
final String exprString = "$eax;*";
final String[] children = new String[] { "$eax", "firstarg", "firstvar", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -837,7 +838,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupExpressionNotModifiable() throws Throwable {
final String exprString = "$eax,*";
final String exprString = "$eax;*";
// final String[] children = new String[] { "$eax", "firstarg", "firstvar", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -865,7 +866,7 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
*/
@Test
public void testGroupExpressionAvailableFormats() throws Throwable {
final String exprString = "$eax,*";
final String exprString = "$eax;*";
// final String[] children = new String[] { "$eax", "firstarg", "firstvar", "secondarg", "secondvar" };
SyncUtil.runToLocation("foo");
@ -895,8 +896,8 @@ public class GDBPatternMatchingExpressionsTest extends BaseTestCase {
@Test
public void testGroupExpressionValue() throws Throwable {
final String noMatchExpr = "$zzz*";
final String singleMatchExpr = "$eax,";
final String doubleMatchExpr = "$eax,$ebx";
final String singleMatchExpr = "$eax;";
final String doubleMatchExpr = "$eax;$ebx";
SyncUtil.runToLocation("foo");
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);

View file

@ -380,6 +380,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
});
setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
@ -428,7 +429,16 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
}
@Override
@Override
public void setForegroundColor(Color foreground) {
super.setForegroundColor(foreground);
if (fDetailPaneComposite != null) {
fDetailPaneComposite.setForeground(foreground);
}
fTree.setForeground(foreground);
}
@Override
public void setBackgroundColor(Color background) {
super.setBackgroundColor(background);
if (fDetailPaneComposite != null) {

View file

@ -197,9 +197,55 @@ public class PDAVirtualMachine {
fPC = pc;
}
private int parseArrayParam(String name) {
int lb = name.indexOf('[');
int rb = name.indexOf(']', lb);
if (rb < 0) return -1;
String paramStr = name.substring(lb + 1, rb);
if (paramStr.length() == 0) return -1;
try {
return Integer.parseInt(name.substring(lb + 1, rb));
} catch (NumberFormatException e) {} // Not a number
Object paramVar = fLocalVariables.get(paramStr);
if (paramVar instanceof Integer) {
return (Integer)paramVar;
}
return -1;
}
void declare(String name) {
Object value = Integer.valueOf(0);
if (name.startsWith("$")) {
setRegisterValue(name, value);
} else if (name.indexOf('[') >= 0) {
int size = parseArrayParam(name);
if (size >= 0) {
String arrayName = name.substring(0, name.indexOf('['));
Object[] array = new Object[size];
for (int i = 0; i < size; i++) {
array[i] = value;
}
fLocalVariables.put(arrayName, array);
}
} else {
fLocalVariables.put(name, value);
}
}
void set(String name, Object value) {
if (name.startsWith("$")) {
setRegisterValue(name, value);
} else if (name.indexOf('[') >= 0) {
int index = parseArrayParam(name);
if (index >=0) {
String arrayName = name.substring(0, name.indexOf('['));
Object array = fLocalVariables.get(arrayName);
if (array instanceof Object[] && ((Object[])array).length > index) {
((Object[])array)[index] = value;
}
}
} else {
fLocalVariables.put(name, value);
}
@ -208,6 +254,16 @@ public class PDAVirtualMachine {
Object get(String name) {
if (name.startsWith("$")) {
return getRegisterValue(name);
} else if (name.indexOf('[') >= 0) {
int index = parseArrayParam(name);
if (index >= 0) {
String arrayName = name.substring(0, name.indexOf('['));
Object array = fLocalVariables.get(arrayName);
if (array instanceof Object[] && ((Object[])array).length > index) {
return ((Object[])array)[index];
}
}
return null;
} else {
return fLocalVariables.get(name);
}
@ -716,6 +772,14 @@ public class PDAVirtualMachine {
}
}
Object value = frame.fLocalVariables.get(var);
if (value instanceof Object[]) {
int size = ((Object[])value).length;
for (int i = 0; i < size; i++) {
children.add(var + "[" + Integer.toString(i) + "]");
}
}
StringBuffer result = new StringBuffer();
for (String child : children) {
result.append(child);
@ -1032,10 +1096,12 @@ public class PDAVirtualMachine {
buf.append('|');
buf.append(frame.fFunction);
for (String var : frame.fLocalVariables.keySet()) {
if (var.indexOf('.') == -1) {
buf.append('|');
buf.append(var);
if (var.indexOf('.') >= 0) continue;
if (var.indexOf('[') >= 0) {
var = var.substring(0, var.indexOf('['));
}
buf.append('|');
buf.append(var);
}
return buf.toString();
}
@ -1153,6 +1219,8 @@ public class PDAVirtualMachine {
Object val = frame.get(var);
if (val == null) {
sendCommandResponse("error: variable undefined\n");
} else if (val instanceof Object[]) {
sendCommandResponse("[" + Integer.toString(((Object[])val).length) + "]" + "\n");
} else {
sendCommandResponse(val.toString() + "\n");
}
@ -1362,7 +1430,7 @@ public class PDAVirtualMachine {
void iVar(PDAThread thread, Args args) {
String var = args.getNextStringArg();
thread.fCurrentFrame.set(var, 0);
thread.fCurrentFrame.declare(var);
}
void iInternalEndEval(PDAThread thread, Args args) {

View file

@ -0,0 +1,14 @@
var a[10000]
var i
push 10000
pop $i
:start
push $i
dec
pop $i
push $i
pop $a[i]
push $i
branch_not_zero start
halt

View file

@ -316,7 +316,7 @@ public class PDAExpressions extends AbstractDsfService implements ICachingServic
int end = lengthArg > 0 ? (start + lengthArg) : getData().fValues.length;
IExpressionDMContext[] contexts = new IExpressionDMContext[end - start];
for (int i = start; i < end && i < getData().fValues.length; i++) {
contexts[i] = new ExpressionDMContext(
contexts[i - start] = new ExpressionDMContext(
getSession().getId(), frameCtx, getData().fValues[i]);
}
rm.setData(contexts);

View file

@ -29,7 +29,7 @@ providerName=Eclipse CDT
updateSiteName=Eclipse CDT Update Site
# "description" property - description of the feature
description=Additional features for debug Memory View - traditional rendering, Find/Replace, Import/Export.
description=Additional features for debug Memory View - traditional rendering, floating-point rendering, Find/Replace, Import/Export.
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page

View file

@ -30,6 +30,13 @@
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.cdt.debug.ui.memory.floatingpoint"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.cdt.debug.ui.memory.transport"

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<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="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1 @@
/target

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.debug.ui.memory.floatingpoint</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,95 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,32 @@
compilers.f.unresolved-features=1
compilers.f.unresolved-plugins=1
compilers.incompatible-environment=1
compilers.p.build=1
compilers.p.build.bin.includes=1
compilers.p.build.encodings=2
compilers.p.build.java.compiler=2
compilers.p.build.java.compliance=1
compilers.p.build.missing.output=2
compilers.p.build.output.library=1
compilers.p.build.source.library=1
compilers.p.build.src.includes=1
compilers.p.deprecated=1
compilers.p.discouraged-class=1
compilers.p.internal=1
compilers.p.missing-packages=1
compilers.p.missing-version-export-package=2
compilers.p.missing-version-import-package=1
compilers.p.missing-version-require-bundle=1
compilers.p.no-required-att=0
compilers.p.not-externalized-att=2
compilers.p.unknown-attribute=1
compilers.p.unknown-class=1
compilers.p.unknown-element=1
compilers.p.unknown-identifier=1
compilers.p.unknown-resource=1
compilers.p.unresolved-ex-points=0
compilers.p.unresolved-import=0
compilers.s.create-docs=false
compilers.s.doc-folder=doc
compilers.s.open-tags=1
eclipse.preferences.version=1

View file

@ -0,0 +1,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.floatingpoint;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.debug.core;bundle-version="3.7.100",
org.eclipse.debug.ui;bundle-version="3.8.1",
org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.ui;bundle-version="3.8.0",
org.eclipse.search;bundle-version="3.8.0",
org.eclipse.cdt.debug.core;bundle-version="7.2.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.cdt.debug.ui.memory.floatingpoint.FPRenderingPlugin
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.cdt.debug.ui.memory.floatingpoint

View file

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>June 22, 2007</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, "Program" will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party ("Redistributor") and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
</body></html>

View file

@ -0,0 +1,7 @@
bin.includes = about.html, \
META-INF/,\
plugin.properties,\
plugin.xml,\
.
source.. = src/
src.includes = about.html

Some files were not shown because too many files have changed in this diff Show more