mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
2485747522
76 changed files with 1277 additions and 818 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2011 Red Hat Inc.
|
* Copyright (c) 2009, 2012 Red Hat Inc.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Red Hat Inc. - initial API and implementation
|
* Red Hat Inc. - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.autotools.core.configure;
|
package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
|
|
||||||
|
@ -16,8 +17,9 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
import org.eclipse.osgi.util.TextProcessor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
||||||
|
|
||||||
public class AutotoolsConfiguration implements IAConfiguration {
|
public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
|
|
||||||
|
@ -57,11 +59,11 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return ConfigureMessages.getConfigureDescription(transformedName);
|
return TextProcessor.process(ConfigureMessages.getConfigureDescription(transformedName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToolTip() {
|
public String getToolTip() {
|
||||||
return ConfigureMessages.getConfigureTip(transformedName);
|
return TextProcessor.process(ConfigureMessages.getConfigureTip(transformedName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.autotools.tests.editors.EditorTests;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/** On Windows requires either Cygwin or MinGW to be in PATH */
|
||||||
public class AllAutotoolsTests {
|
public class AllAutotoolsTests {
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007, 2009 Red Hat Inc..
|
* Copyright (c) 2006, 2012 Red Hat Inc..
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Red Hat Incorporated - initial API and implementation
|
* Red Hat Incorporated - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
|
@ -14,6 +15,8 @@ import java.text.MessageFormat;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import org.eclipse.osgi.util.TextProcessor;
|
||||||
|
|
||||||
public class InvokeMessages {
|
public class InvokeMessages {
|
||||||
private static final String BUNDLE_NAME = InvokeMessages.class.getName();
|
private static final String BUNDLE_NAME = InvokeMessages.class.getName();
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ public class InvokeMessages {
|
||||||
*/
|
*/
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
try {
|
try {
|
||||||
return RESOURCE_BUNDLE.getString(key);
|
return TextProcessor.process(RESOURCE_BUNDLE.getString(key));
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
return '!' + key + '!';
|
return '!' + key + '!';
|
||||||
}
|
}
|
||||||
|
@ -47,7 +50,7 @@ public class InvokeMessages {
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(getString(key), (Object[])args);
|
return TextProcessor.process(MessageFormat.format(getString(key), (Object[])args));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
35
build/org.eclipse.cdt.make.core.tests/pom.xml
Normal file
35
build/org.eclipse.cdt.make.core.tests/pom.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.cdt</groupId>
|
||||||
|
<artifactId>cdt-parent</artifactId>
|
||||||
|
<version>8.2.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<version>7.0.0-SNAPSHOT</version>
|
||||||
|
<artifactId>org.eclipse.cdt.make.core.tests</artifactId>
|
||||||
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
|
<version>${tycho-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<useUIHarness>false</useUIHarness>
|
||||||
|
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
|
||||||
|
<includes>
|
||||||
|
<include>**/AutomatedIntegrationSuite.*</include>
|
||||||
|
</includes>
|
||||||
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -21,11 +21,11 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsol
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scanner configuration console parser tests
|
* Scanner configuration console parser tests
|
||||||
*
|
*
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests {
|
public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests {
|
||||||
|
|
||||||
public static TestSuite suite() {
|
public static TestSuite suite() {
|
||||||
return suite(GCCScannerInfoConsoleParserTests.class);
|
return suite(GCCScannerInfoConsoleParserTests.class);
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,10 @@ public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
fOutputParser.shutdown();
|
fOutputParser.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tests GCCScannerInfoConsoleParser. Utility object not provided.
|
* Tests GCCScannerInfoConsoleParser. Utility object not provided.
|
||||||
* Only tests parsing of the input (make build output)
|
* Only tests parsing of the input (make build output)
|
||||||
*/
|
*/
|
||||||
public void testParsingIncludePaths() {
|
public void testParsingIncludePaths() {
|
||||||
fOutputParser.processLine("gcc -I /dir/include -I c:\\dir\\include -ID:/dir/include -c test.c"); // absolute paths //$NON-NLS-1$
|
fOutputParser.processLine("gcc -I /dir/include -I c:\\dir\\include -ID:/dir/include -c test.c"); // absolute paths //$NON-NLS-1$
|
||||||
|
@ -68,7 +68,7 @@ public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests
|
||||||
fOutputParser.processLine("gcc -Imultiline2 \\"); //$NON-NLS-1$
|
fOutputParser.processLine("gcc -Imultiline2 \\"); //$NON-NLS-1$
|
||||||
fOutputParser.processLine("-Imultiline3\\"); //$NON-NLS-1$
|
fOutputParser.processLine("-Imultiline3\\"); //$NON-NLS-1$
|
||||||
fOutputParser.processLine(" -DAA=\"BB\" test.c"); //$NON-NLS-1$
|
fOutputParser.processLine(" -DAA=\"BB\" test.c"); //$NON-NLS-1$
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> sumIncludes = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.INCLUDE_PATHS);
|
List<String> sumIncludes = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.INCLUDE_PATHS);
|
||||||
assertTrue(sumIncludes.contains("/dir/include")); //$NON-NLS-1$
|
assertTrue(sumIncludes.contains("/dir/include")); //$NON-NLS-1$
|
||||||
|
@ -96,10 +96,7 @@ public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests
|
||||||
assertTrue(sumIncludes.contains("//server6/include")); //$NON-NLS-1$
|
assertTrue(sumIncludes.contains("//server6/include")); //$NON-NLS-1$
|
||||||
assertTrue(sumIncludes.contains("/multiline/dir")); //$NON-NLS-1$
|
assertTrue(sumIncludes.contains("/multiline/dir")); //$NON-NLS-1$
|
||||||
assertTrue(sumIncludes.contains("multiline2")); //$NON-NLS-1$
|
assertTrue(sumIncludes.contains("multiline2")); //$NON-NLS-1$
|
||||||
// Fails consistently
|
|
||||||
if (System.getProperty("cdt.skip.known.test.failures") == null) {
|
|
||||||
assertTrue(sumIncludes.contains("multiline3")); //$NON-NLS-1$
|
assertTrue(sumIncludes.contains("multiline3")); //$NON-NLS-1$
|
||||||
}
|
|
||||||
assertTrue(sumIncludes.size() == 26);
|
assertTrue(sumIncludes.size() == 26);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
line= line.trim();
|
if (line.trim().length() == 0) {
|
||||||
if (line.length() == 0) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2011 Intel Corporation and others.
|
* Copyright (c) 2007, 2012 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
* James Blackbrun (Broadcom Corp.)
|
* James Blackbrun (Broadcom Corp.)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
|
import org.eclipse.osgi.util.TextProcessor;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -140,7 +142,7 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
tv.setLabelProvider(new LabelProvider() {
|
tv.setLabelProvider(new LabelProvider() {
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
return element == null ? EMPTY_STR : ((CfgHolder)element).getName();
|
return element == null ? EMPTY_STR : TextProcessor.process(((CfgHolder)element).getName());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) { return IMG_CONFIG; }
|
public Image getImage(Object element) { return IMG_CONFIG; }
|
||||||
|
|
|
@ -17,7 +17,8 @@ extension.name.Marker = Code Analysis Problem
|
||||||
category.name.ProgrammingErrors = Potential Programming Problems
|
category.name.ProgrammingErrors = Potential Programming Problems
|
||||||
category.name.CodeStyle = Coding Style
|
category.name.CodeStyle = Coding Style
|
||||||
category.name.CompilerErrors = Syntax and Semantic Errors
|
category.name.CompilerErrors = Syntax and Semantic Errors
|
||||||
extension-point.name.CodeAnalysis = Code Analysis Checkers
|
codeAnalysisCheckersExtensionPoint = Code Analysis Checkers
|
||||||
|
checkerEnablementExtensionPoint = Verification of Checker Enablement
|
||||||
|
|
||||||
marker.semanticError = Semantic Error
|
marker.semanticError = Semantic Error
|
||||||
category.name.Security = Security Vulnerabilities
|
category.name.Security = Security Vulnerabilities
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
<extension-point id="checkers" name="%extension-point.name.CodeAnalysis" schema="schema/checkers.exsd"/>
|
<extension-point id="checkers" name="%codeAnalysisCheckersExtensionPoint" schema="schema/checkers.exsd"/>
|
||||||
<extension-point id="checkerEnablement" name="Verification of checker enablement" schema="schema/checkerEnablement.exsd"/>
|
<extension-point id="checkerEnablement" name="%checkerEnablementExtensionPoint" schema="schema/checkerEnablement.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
id="codanBuilder"
|
id="codanBuilder"
|
||||||
|
|
|
@ -18,8 +18,8 @@ CodeAnalysisPreferencesBuild.name = Launching
|
||||||
category.name = Code Analysis
|
category.name = Code Analysis
|
||||||
command.name = Run Code Analysis
|
command.name = Run Code Analysis
|
||||||
view.name = Problem Details
|
view.name = Problem Details
|
||||||
extension-point.name = Codan Problem Details
|
codanProblemDetailsExtensionPoint = Codan Problem Details
|
||||||
extension-point.name.codamMarkerResolution = Codan Marker Resolution
|
codanMarkerResolutionExtensionPoint = Codan Marker Resolution
|
||||||
markerTypeCategory.name = Code Analysis Problems
|
markerTypeCategory.name = Code Analysis Problems
|
||||||
markerGrouping.label = Code Analysis Problem Type
|
markerGrouping.label = Code Analysis Problem Type
|
||||||
markerGroupingEntry.category.Unknown = Unknown
|
markerGroupingEntry.category.Unknown = Unknown
|
||||||
|
|
|
@ -71,8 +71,8 @@
|
||||||
name="%view.name">
|
name="%view.name">
|
||||||
</view>
|
</view>
|
||||||
</extension>
|
</extension>
|
||||||
<extension-point id="codanProblemDetails" name="%extension-point.name" schema="schema/codanProblemDetails.exsd"/>
|
<extension-point id="codanProblemDetails" name="%codanProblemDetailsExtensionPoint" schema="schema/codanProblemDetails.exsd"/>
|
||||||
<extension-point id="codanMarkerResolution" name="%extension-point.name.codamMarkerResolution" schema="schema/codanMarkerResolution.exsd"/>
|
<extension-point id="codanMarkerResolution" name="%codanMarkerResolutionExtensionPoint" schema="schema/codanMarkerResolution.exsd"/>
|
||||||
<!--
|
<!--
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.bindings">
|
point="org.eclipse.ui.bindings">
|
||||||
|
|
|
@ -12,15 +12,14 @@ import junit.framework.TestSuite;
|
||||||
public class AllTests extends TestSuite {
|
public class AllTests extends TestSuite {
|
||||||
public static Test suite() throws Exception {
|
public static Test suite() throws Exception {
|
||||||
final AllTests suite = new AllTests();
|
final AllTests suite = new AllTests();
|
||||||
suite.addTest(org.eclipse.cdt.autotools.tests.AllAutotoolsTests.suite()); // Works with MinGW but not Cygwin
|
suite.addTest(org.eclipse.cdt.autotools.tests.AllAutotoolsTests.suite());
|
||||||
// // There are intermittent failures in these tests. No pattern to failures. Seems like indexer is interrupted
|
// // There are intermittent failures in these tests. No pattern to failures. Seems like indexer is interrupted
|
||||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||||
suite.addTest(org.eclipse.cdt.codan.core.test.AutomatedIntegrationSuite.suite());
|
suite.addTest(org.eclipse.cdt.codan.core.test.AutomatedIntegrationSuite.suite());
|
||||||
suite.addTest(org.eclipse.cdt.core.lrparser.tests.LRParserTestSuite.suite());
|
suite.addTest(org.eclipse.cdt.core.lrparser.tests.LRParserTestSuite.suite());
|
||||||
suite.addTest(org.eclipse.cdt.core.parser.xlc.tests.suite.XlcTestSuite.suite());
|
suite.addTest(org.eclipse.cdt.core.parser.xlc.tests.suite.XlcTestSuite.suite());
|
||||||
}
|
|
||||||
|
|
||||||
suite.addTest(org.eclipse.cdt.core.parser.upc.tests.UPCParserTestSuite.suite());
|
suite.addTest(org.eclipse.cdt.core.parser.upc.tests.UPCParserTestSuite.suite());
|
||||||
|
}
|
||||||
suite.addTest(org.eclipse.cdt.core.suite.AutomatedIntegrationSuite.suite());
|
suite.addTest(org.eclipse.cdt.core.suite.AutomatedIntegrationSuite.suite());
|
||||||
|
|
||||||
// These tests fail intermittently due to gdb not shutting down and thus
|
// These tests fail intermittently due to gdb not shutting down and thus
|
||||||
|
|
|
@ -937,15 +937,13 @@ public class ErrorParserFileMatchingTest extends TestCase {
|
||||||
// Skip the test if Cygwin is not available.
|
// Skip the test if Cygwin is not available.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consistently fails, and, yes, I do have Cygwin in my PATH
|
|
||||||
if (System.getProperty("cdt.skip.known.test.failures") != null) { //$NON-NLS-1$
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assertTrue("usrIncludeWindowsPath=["+usrIncludeWindowsPath+"]",
|
assertTrue("usrIncludeWindowsPath=["+usrIncludeWindowsPath+"]",
|
||||||
usrIncludeWindowsPath.charAt(1)==IPath.DEVICE_SEPARATOR);
|
usrIncludeWindowsPath.charAt(1)==IPath.DEVICE_SEPARATOR);
|
||||||
|
|
||||||
|
java.io.File file = new java.io.File(usrIncludeWindowsPath + "\\" + fileName);
|
||||||
|
assertTrue("File " + file + " does not exist, check your cygwin installation", file.exists());
|
||||||
|
|
||||||
ResourceHelper.createLinkedFolder(fProject, "include", usrIncludeWindowsPath);
|
ResourceHelper.createLinkedFolder(fProject, "include", usrIncludeWindowsPath);
|
||||||
|
|
||||||
parseOutput(cygwinFolder+fileName+":1:error");
|
parseOutput(cygwinFolder+fileName+":1:error");
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
private static Map<String, String> getGnuMap() {
|
private static Map<String, String> getGnuMap() {
|
||||||
Map<String, String> map= new HashMap<String, String>();
|
Map<String, String> map= new HashMap<String, String>();
|
||||||
map.put("__GNUC__", "4");
|
map.put("__GNUC__", "4");
|
||||||
map.put("__GNUC_MINOR__", "5");
|
map.put("__GNUC_MINOR__", "7");
|
||||||
map.put("__SIZEOF_INT__", "4");
|
map.put("__SIZEOF_INT__", "4");
|
||||||
map.put("__SIZEOF_LONG__", "8");
|
map.put("__SIZEOF_LONG__", "8");
|
||||||
return map;
|
return map;
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPClassType sc0= assertInstance(b0.getSpecializedBinding(), ICPPClassType.class);
|
ICPPClassType sc0= assertInstance(b0.getSpecializedBinding(), ICPPClassType.class);
|
||||||
ICPPClassType sc1= assertInstance(b1.getSpecializedBinding(), ICPPClassType.class);
|
ICPPClassType sc1= assertInstance(b1.getSpecializedBinding(), ICPPClassType.class);
|
||||||
assertTrue(sc0.isSameType(sc1));
|
assertTrue(sc0.isSameType(sc1));
|
||||||
|
|
||||||
assertInstance(b0, ICPPSpecialization.class);
|
assertInstance(b0, ICPPSpecialization.class);
|
||||||
assertInstance(b1, ICPPTemplateInstance.class);
|
assertInstance(b1, ICPPTemplateInstance.class);
|
||||||
|
|
||||||
|
@ -5988,4 +5988,27 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testSFINAE_b() throws Exception {
|
public void testSFINAE_b() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T>
|
||||||
|
// struct is_pod {
|
||||||
|
// static const bool value = __is_pod(T);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <bool, typename = void>
|
||||||
|
// struct enable_if {};
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// struct enable_if<true, T> {
|
||||||
|
// typedef T type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// void f(typename enable_if<is_pod<T>::value>::type* = 0);
|
||||||
|
//
|
||||||
|
// void test() {
|
||||||
|
// f<int>();
|
||||||
|
// }
|
||||||
|
public void testIsPOD_367993() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2011 Google, 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:
|
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for ClassTypeHelper class.
|
|
||||||
*/
|
|
||||||
public class ClassTypeHelperTests extends AST2BaseTest {
|
|
||||||
|
|
||||||
public ClassTypeHelperTests() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClassTypeHelperTests(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TestSuite suite() {
|
|
||||||
return suite(ClassTypeHelperTests.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException {
|
|
||||||
String code= getAboveComment();
|
|
||||||
return new BindingAssertionHelper(code, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// struct A {
|
|
||||||
// A(const A& a);
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class B {
|
|
||||||
// public:
|
|
||||||
// B();
|
|
||||||
// int x;
|
|
||||||
// A* y;
|
|
||||||
// const A& z;
|
|
||||||
// static A s;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class C {
|
|
||||||
// public:
|
|
||||||
// A a;
|
|
||||||
// };
|
|
||||||
public void testHasTrivialCopyCtor() throws Exception {
|
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
|
||||||
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
|
||||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classA, null));
|
|
||||||
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
|
||||||
assertTrue(ClassTypeHelper.hasTrivialCopyCtor(classB, null));
|
|
||||||
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
|
||||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classC, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
// struct A {
|
|
||||||
// ~A();
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class B {
|
|
||||||
// public:
|
|
||||||
// B();
|
|
||||||
// B(const B& a);
|
|
||||||
// int x;
|
|
||||||
// B* y;
|
|
||||||
// const B& z;
|
|
||||||
// static A s;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class C {
|
|
||||||
// public:
|
|
||||||
// A a;
|
|
||||||
// };
|
|
||||||
public void testHasTrivialDestructor() throws Exception {
|
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
|
||||||
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
|
||||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classA, null));
|
|
||||||
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
|
||||||
assertTrue(ClassTypeHelper.hasTrivialDestructor(classB, null));
|
|
||||||
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
|
||||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classC, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
// struct A {
|
|
||||||
// virtual void m();
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class B {
|
|
||||||
// public:
|
|
||||||
// B();
|
|
||||||
// B(const B& a);
|
|
||||||
// void m();
|
|
||||||
// int x;
|
|
||||||
// B* y;
|
|
||||||
// const B& z;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// class C : public A {
|
|
||||||
// };
|
|
||||||
public void testIsPolymorphic() throws Exception {
|
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
|
||||||
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
|
||||||
assertTrue(ClassTypeHelper.isPolymorphic(classA));
|
|
||||||
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
|
||||||
assertFalse(ClassTypeHelper.isPolymorphic(classB));
|
|
||||||
ICPPClassType classC = helper.assertNonProblem("C", 1, ICPPClassType.class);
|
|
||||||
assertTrue(ClassTypeHelper.isPolymorphic(classC));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,7 +30,7 @@ public class DOMParserTestSuite extends TestCase {
|
||||||
suite.addTest(ASTCPPSpecDefectTests.suite());
|
suite.addTest(ASTCPPSpecDefectTests.suite());
|
||||||
suite.addTest(AST2CPPImplicitNameTests.suite());
|
suite.addTest(AST2CPPImplicitNameTests.suite());
|
||||||
suite.addTest(AST2TemplateTests.suite());
|
suite.addTest(AST2TemplateTests.suite());
|
||||||
suite.addTest(ClassTypeHelperTests.suite());
|
suite.addTest(TypeTraitsTests.suite());
|
||||||
suite.addTestSuite(QuickParser2Tests.class);
|
suite.addTestSuite(QuickParser2Tests.class);
|
||||||
suite.addTest(CompleteParser2Tests.suite());
|
suite.addTest(CompleteParser2Tests.suite());
|
||||||
suite.addTest(DOMLocationTests.suite());
|
suite.addTest(DOMLocationTests.suite());
|
||||||
|
|
|
@ -426,7 +426,7 @@ public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
|
||||||
// b= __is_polymorphic (int);
|
// b= __is_polymorphic (int);
|
||||||
// b= __is_union (int);
|
// b= __is_union (int);
|
||||||
// }
|
// }
|
||||||
public void testTypetraits_Bug342683() throws Exception {
|
public void testTypeTraits_Bug342683() throws Exception {
|
||||||
parseGPP(getAboveComment());
|
parseGPP(getAboveComment());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,239 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011, 2012 Google, 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:
|
||||||
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for ClassTypeHelper class.
|
||||||
|
*/
|
||||||
|
public class TypeTraitsTests extends AST2BaseTest {
|
||||||
|
|
||||||
|
public TypeTraitsTests() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeTraitsTests(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TestSuite suite() {
|
||||||
|
return suite(TypeTraitsTests.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException {
|
||||||
|
String code= getAboveComment();
|
||||||
|
return new BindingAssertionHelper(code, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// A(const A& a);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B {
|
||||||
|
// public:
|
||||||
|
// B();
|
||||||
|
// int x;
|
||||||
|
// A* y;
|
||||||
|
// const A& z;
|
||||||
|
// static A s;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class C {
|
||||||
|
// public:
|
||||||
|
// A a;
|
||||||
|
// };
|
||||||
|
public void testHasTrivialCopyCtor() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.hasTrivialCopyCtor(classA, null));
|
||||||
|
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.hasTrivialCopyCtor(classB, null));
|
||||||
|
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.hasTrivialCopyCtor(classC, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// ~A();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B {
|
||||||
|
// public:
|
||||||
|
// B();
|
||||||
|
// B(const B& a);
|
||||||
|
// int x;
|
||||||
|
// B* y;
|
||||||
|
// const B& z;
|
||||||
|
// static A s;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class C {
|
||||||
|
// public:
|
||||||
|
// A a;
|
||||||
|
// };
|
||||||
|
public void testHasTrivialDestructor() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.hasTrivialDestructor(classA, null));
|
||||||
|
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.hasTrivialDestructor(classB, null));
|
||||||
|
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.hasTrivialDestructor(classC, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// virtual void m();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B {
|
||||||
|
// public:
|
||||||
|
// B();
|
||||||
|
// B(const B& a);
|
||||||
|
// void m();
|
||||||
|
// int x;
|
||||||
|
// B* y;
|
||||||
|
// const B& z;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class C : public A {
|
||||||
|
// };
|
||||||
|
public void testIsPolymorphic() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isPolymorphic(classA, null));
|
||||||
|
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isPolymorphic(classB, null));
|
||||||
|
ICPPClassType classC = helper.assertNonProblem("C", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isPolymorphic(classC, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// A* a;
|
||||||
|
// int b;
|
||||||
|
// A(A* a, int b);
|
||||||
|
// A(A& a);
|
||||||
|
// ~A();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B : public A {
|
||||||
|
// static int c;
|
||||||
|
// void m(A* a);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class C : public A {
|
||||||
|
// int c;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct D {
|
||||||
|
// C c;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct E : public C {
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct F : public B {
|
||||||
|
// virtual ~F();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct G {
|
||||||
|
// int a;
|
||||||
|
// private:
|
||||||
|
// int b;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct H {
|
||||||
|
// int& a;
|
||||||
|
// };
|
||||||
|
public void testIsStandardLayout() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isStandardLayout(classA, null));
|
||||||
|
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isStandardLayout(classB, null));
|
||||||
|
ICPPClassType classC = helper.assertNonProblem("C :", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classC, null));
|
||||||
|
ICPPClassType classD = helper.assertNonProblem("D {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classD, null));
|
||||||
|
ICPPClassType classE = helper.assertNonProblem("E :", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classE, null));
|
||||||
|
ICPPClassType classF = helper.assertNonProblem("F :", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classF, null));
|
||||||
|
ICPPClassType classG = helper.assertNonProblem("G {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classG, null));
|
||||||
|
ICPPClassType classH = helper.assertNonProblem("H {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isStandardLayout(classH, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// A* a;
|
||||||
|
// int b;
|
||||||
|
// A(char* s);
|
||||||
|
// A(const A& a, int b);
|
||||||
|
// A& operator =(const A& a, A* b);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B : public A {
|
||||||
|
// A a;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct C {
|
||||||
|
// C(char* s = 0);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct D {
|
||||||
|
// D(const D& a, int b = 1);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct E {
|
||||||
|
// E& operator =(const E& a, E* b = nullptr);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct F {
|
||||||
|
// ~F();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct G {
|
||||||
|
// C c;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct H : public C {
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct I {
|
||||||
|
// virtual void m();
|
||||||
|
// };
|
||||||
|
public void testIsTrivial() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isTrivial(classA, null));
|
||||||
|
ICPPClassType classB = helper.assertNonProblem("B :", 1, ICPPClassType.class);
|
||||||
|
assertTrue(TypeTraits.isTrivial(classB, null));
|
||||||
|
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classC, null));
|
||||||
|
ICPPClassType classD = helper.assertNonProblem("D {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classD, null));
|
||||||
|
ICPPClassType classE = helper.assertNonProblem("E {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classE, null));
|
||||||
|
ICPPClassType classF = helper.assertNonProblem("F {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classF, null));
|
||||||
|
ICPPClassType classG = helper.assertNonProblem("G {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classG, null));
|
||||||
|
ICPPClassType classH = helper.assertNonProblem("H :", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classH, null));
|
||||||
|
ICPPClassType classI = helper.assertNonProblem("I {", 1, ICPPClassType.class);
|
||||||
|
assertFalse(TypeTraits.isTrivial(classI, null));
|
||||||
|
}
|
||||||
|
}
|
|
@ -108,7 +108,6 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
public class IndexBugsTests extends BaseTestCase {
|
public class IndexBugsTests extends BaseTestCase {
|
||||||
private static final int INDEXER_TIMEOUT_SEC = 20;
|
|
||||||
private ICProject fCProject;
|
private ICProject fCProject;
|
||||||
protected IIndex fIndex;
|
protected IIndex fIndex;
|
||||||
|
|
||||||
|
|
|
@ -75,25 +75,24 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
||||||
public static TestSuite suite() {return suite(ProjectWithDepProj.class);}
|
public static TestSuite suite() {return suite(ProjectWithDepProj.class);}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addTests(TestSuite suite) {
|
public static void addTests(TestSuite suite) {
|
||||||
suite.addTest(IndexCPPBindingResolutionBugsSingleProjectFirstAST.suite());
|
suite.addTest(IndexCPPBindingResolutionBugsSingleProjectFirstAST.suite());
|
||||||
suite.addTest(SingleProject.suite());
|
suite.addTest(SingleProject.suite());
|
||||||
suite.addTest(ProjectWithDepProj.suite());
|
suite.addTest(ProjectWithDepProj.suite());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TestSuite suite() {
|
public static TestSuite suite() {
|
||||||
return suite(IndexCPPBindingResolutionBugs.class);
|
return suite(IndexCPPBindingResolutionBugs.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexCPPBindingResolutionBugs() {
|
public IndexCPPBindingResolutionBugs() {
|
||||||
setStrategy(new SinglePDOMTestStrategy(true));
|
setStrategy(new SinglePDOMTestStrategy(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// #define OBJ void foo()
|
// #define OBJ void foo()
|
||||||
// #define FUNC() void bar()
|
// #define FUNC() void bar()
|
||||||
// #define FUNC2(A) void baz()
|
// #define FUNC2(A) void baz()
|
||||||
|
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
//
|
//
|
||||||
|
@ -102,43 +101,43 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// FUNC2(1) {}
|
// FUNC2(1) {}
|
||||||
public void testBug208558() throws CoreException {
|
public void testBug208558() throws CoreException {
|
||||||
IIndex index= getIndex();
|
IIndex index= getIndex();
|
||||||
|
|
||||||
IIndexMacro[] macrosA= index.findMacros("OBJ".toCharArray(), IndexFilter.ALL, npm());
|
IIndexMacro[] macrosA= index.findMacros("OBJ".toCharArray(), IndexFilter.ALL, npm());
|
||||||
IIndexMacro[] macrosB= index.findMacros("FUNC".toCharArray(), IndexFilter.ALL, npm());
|
IIndexMacro[] macrosB= index.findMacros("FUNC".toCharArray(), IndexFilter.ALL, npm());
|
||||||
IIndexMacro[] macrosC= index.findMacros("FUNC2".toCharArray(), IndexFilter.ALL, npm());
|
IIndexMacro[] macrosC= index.findMacros("FUNC2".toCharArray(), IndexFilter.ALL, npm());
|
||||||
|
|
||||||
assertEquals(1, macrosA.length);
|
assertEquals(1, macrosA.length);
|
||||||
assertEquals(1, macrosB.length);
|
assertEquals(1, macrosB.length);
|
||||||
assertEquals(1, macrosC.length);
|
assertEquals(1, macrosC.length);
|
||||||
IIndexMacro obj= macrosA[0];
|
IIndexMacro obj= macrosA[0];
|
||||||
IIndexMacro func= macrosB[0];
|
IIndexMacro func= macrosB[0];
|
||||||
IIndexMacro func2= macrosC[0];
|
IIndexMacro func2= macrosC[0];
|
||||||
|
|
||||||
assertEquals("OBJ", new String(obj.getName()));
|
assertEquals("OBJ", new String(obj.getName()));
|
||||||
assertEquals("FUNC", new String(func.getName()));
|
assertEquals("FUNC", new String(func.getName()));
|
||||||
assertEquals("FUNC2", new String(func2.getName()));
|
assertEquals("FUNC2", new String(func2.getName()));
|
||||||
|
|
||||||
assertEquals("void foo()", new String(obj.getExpansionImage()));
|
assertEquals("void foo()", new String(obj.getExpansionImage()));
|
||||||
assertEquals("void bar()", new String(func.getExpansionImage()));
|
assertEquals("void bar()", new String(func.getExpansionImage()));
|
||||||
assertEquals("void baz()", new String(func2.getExpansionImage()));
|
assertEquals("void baz()", new String(func2.getExpansionImage()));
|
||||||
|
|
||||||
assertEquals("OBJ", new String(obj.getName()));
|
assertEquals("OBJ", new String(obj.getName()));
|
||||||
assertNull(obj.getParameterList());
|
assertNull(obj.getParameterList());
|
||||||
|
|
||||||
assertEquals("FUNC", new String(func.getName()));
|
assertEquals("FUNC", new String(func.getName()));
|
||||||
assertEquals(0, func.getParameterList().length);
|
assertEquals(0, func.getParameterList().length);
|
||||||
|
|
||||||
assertEquals("FUNC2", new String(func2.getName()));
|
assertEquals("FUNC2", new String(func2.getName()));
|
||||||
assertEquals(1, func2.getParameterList().length);
|
assertEquals(1, func2.getParameterList().length);
|
||||||
assertEquals("A", new String(func2.getParameterList()[0]));
|
assertEquals("A", new String(func2.getParameterList()[0]));
|
||||||
|
|
||||||
IIndexBinding[] bindings= index.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, npm());
|
IIndexBinding[] bindings= index.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, npm());
|
||||||
assertEquals(3, bindings.length);
|
assertEquals(3, bindings.length);
|
||||||
|
|
||||||
IIndexBinding foo= index.findBindings("foo".toCharArray(), IndexFilter.ALL, npm())[0];
|
IIndexBinding foo= index.findBindings("foo".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||||
IIndexBinding bar= index.findBindings("bar".toCharArray(), IndexFilter.ALL, npm())[0];
|
IIndexBinding bar= index.findBindings("bar".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||||
IIndexBinding baz= index.findBindings("baz".toCharArray(), IndexFilter.ALL, npm())[0];
|
IIndexBinding baz= index.findBindings("baz".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||||
|
|
||||||
assertEquals("foo", foo.getName());
|
assertEquals("foo", foo.getName());
|
||||||
assertEquals("bar", bar.getName());
|
assertEquals("bar", bar.getName());
|
||||||
assertEquals("baz", baz.getName());
|
assertEquals("baz", baz.getName());
|
||||||
|
@ -146,7 +145,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertInstance(bar, ICPPFunction.class);
|
assertInstance(bar, ICPPFunction.class);
|
||||||
assertInstance(baz, ICPPFunction.class);
|
assertInstance(baz, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T>
|
// template <class T>
|
||||||
// inline void testTemplate(T& aRef);
|
// inline void testTemplate(T& aRef);
|
||||||
//
|
//
|
||||||
|
@ -162,7 +161,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertInstance(b0, ICPPFunction.class);
|
assertInstance(b0, ICPPFunction.class);
|
||||||
assertInstance(b0, ICPPTemplateInstance.class);
|
assertInstance(b0, ICPPTemplateInstance.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class testdef{
|
// class testdef{
|
||||||
//
|
//
|
||||||
// public:
|
// public:
|
||||||
|
@ -175,7 +174,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
//
|
//
|
||||||
// testdef* global_cBase;
|
// testdef* global_cBase;
|
||||||
// testdef*& global_cBaseRef = global_cBase;
|
// testdef*& global_cBaseRef = global_cBase;
|
||||||
|
|
||||||
// #include "typedefHeader.h"
|
// #include "typedefHeader.h"
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -183,7 +182,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// {
|
// {
|
||||||
// testdef* local_cBase;
|
// testdef* local_cBase;
|
||||||
// testdef*& local_cBaseRef = local_cBase;
|
// testdef*& local_cBaseRef = local_cBase;
|
||||||
//
|
//
|
||||||
// testCall( /*1*/ (void *) local_cBase);
|
// testCall( /*1*/ (void *) local_cBase);
|
||||||
// testCall( /*2*/ local_cBase);
|
// testCall( /*2*/ local_cBase);
|
||||||
//
|
//
|
||||||
|
@ -206,18 +205,17 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IBinding b7= getBindingFromASTName("testCall( /*7*/", 8);
|
IBinding b7= getBindingFromASTName("testCall( /*7*/", 8);
|
||||||
IBinding b8= getBindingFromASTName("testCall( /*8*/", 8);
|
IBinding b8= getBindingFromASTName("testCall( /*8*/", 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// template<typename T1>
|
// template<typename T1>
|
||||||
// class A {};
|
// class A {};
|
||||||
//
|
//
|
||||||
// template<typename T2>
|
// template<typename T2>
|
||||||
// class B : public A<T2> {};
|
// class B : public A<T2> {};
|
||||||
//
|
//
|
||||||
// class C {};
|
// class C {};
|
||||||
//
|
//
|
||||||
// B<C> b;
|
// B<C> b;
|
||||||
|
|
||||||
// void foo() {C c; B<int> b;}
|
// void foo() {C c; B<int> b;}
|
||||||
public void testBug188274() throws Exception {
|
public void testBug188274() throws Exception {
|
||||||
IBinding b0= getBindingFromASTName("C", 1);
|
IBinding b0= getBindingFromASTName("C", 1);
|
||||||
|
@ -226,7 +224,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertInstance(b1, ICPPClassType.class);
|
assertInstance(b1, ICPPClassType.class);
|
||||||
assertInstance(b1, ICPPClassTemplate.class);
|
assertInstance(b1, ICPPClassTemplate.class);
|
||||||
assertInstance(b1, ICPPInstanceCache.class);
|
assertInstance(b1, ICPPInstanceCache.class);
|
||||||
|
|
||||||
ICPPInstanceCache ct= (ICPPInstanceCache) b1;
|
ICPPInstanceCache ct= (ICPPInstanceCache) b1;
|
||||||
ICPPSpecialization inst= ct.getInstance(new ICPPTemplateArgument[]{new CPPTemplateTypeArgument((IType)b0)});
|
ICPPSpecialization inst= ct.getInstance(new ICPPTemplateArgument[]{new CPPTemplateTypeArgument((IType)b0)});
|
||||||
assertInstance(inst, ICPPClassType.class);
|
assertInstance(inst, ICPPClassType.class);
|
||||||
|
@ -235,9 +233,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertEquals(1, bases.length);
|
assertEquals(1, bases.length);
|
||||||
assertInstance(bases[0].getBaseClass(), ICPPClassType.class);
|
assertInstance(bases[0].getBaseClass(), ICPPClassType.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace ns {class A{};}
|
// namespace ns {class A{};}
|
||||||
|
|
||||||
// ns::A a;
|
// ns::A a;
|
||||||
// class B {};
|
// class B {};
|
||||||
public void testBug188324() throws Exception {
|
public void testBug188324() throws Exception {
|
||||||
|
@ -247,41 +245,41 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
ICPPNamespace ns= (ICPPNamespace) b0;
|
ICPPNamespace ns= (ICPPNamespace) b0;
|
||||||
assertEquals(0, ns.getNamespaceScope().getBindings(name, false, false).length);
|
assertEquals(0, ns.getNamespaceScope().getBindings(name, false, false).length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<typename T>
|
// template<typename T>
|
||||||
// class C : public C<T> {};
|
// class C : public C<T> {};
|
||||||
|
|
||||||
// void foo() {
|
// void foo() {
|
||||||
// C<int>::unresolvable();
|
// C<int>::unresolvable();
|
||||||
// };
|
// };
|
||||||
public void testBug185828() throws Exception {
|
public void testBug185828() throws Exception {
|
||||||
// Bug 185828 reports a StackOverflowException is thrown before we get here.
|
// Bug 185828 reports a StackOverflowException is thrown before we get here.
|
||||||
// That the SOE is thrown is detected in BaseTestCase via an Error IStatus
|
// That the SOE is thrown is detected in BaseTestCase via an Error IStatus
|
||||||
|
|
||||||
IBinding b0= getBindingFromASTName("C<int>", 1);
|
IBinding b0= getBindingFromASTName("C<int>", 1);
|
||||||
IBinding b1= getBindingFromASTName("C<int>", 6);
|
IBinding b1= getBindingFromASTName("C<int>", 6);
|
||||||
IBinding b2= getProblemFromASTName("unresolvable", 12);
|
IBinding b2= getProblemFromASTName("unresolvable", 12);
|
||||||
|
|
||||||
assertInstance(b0, ICPPClassType.class);
|
assertInstance(b0, ICPPClassType.class);
|
||||||
assertInstance(b0, ICPPClassTemplate.class);
|
assertInstance(b0, ICPPClassTemplate.class);
|
||||||
|
|
||||||
assertInstance(b1, ICPPClassType.class);
|
assertInstance(b1, ICPPClassType.class);
|
||||||
assertInstance(b1, ICPPSpecialization.class);
|
assertInstance(b1, ICPPSpecialization.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class MyClass {
|
// class MyClass {
|
||||||
// public:
|
// public:
|
||||||
// template<class T>
|
// template<class T>
|
||||||
// T* MopGetObject(T*& aPtr)
|
// T* MopGetObject(T*& aPtr)
|
||||||
// { return 0; }
|
// { return 0; }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// template<class T>
|
// template<class T>
|
||||||
// T* MopGetObjectNoChaining(T*& aPtr)
|
// T* MopGetObjectNoChaining(T*& aPtr)
|
||||||
// { return 0; }
|
// { return 0; }
|
||||||
//
|
//
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// int main() {
|
// int main() {
|
||||||
// MyClass* cls= new MyClass();
|
// MyClass* cls= new MyClass();
|
||||||
// }
|
// }
|
||||||
|
@ -294,12 +292,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertInstance(ms[0], ICPPTemplateDefinition.class);
|
assertInstance(ms[0], ICPPTemplateDefinition.class);
|
||||||
assertInstance(ms[1], ICPPTemplateDefinition.class);
|
assertInstance(ms[1], ICPPTemplateDefinition.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // header file
|
// // header file
|
||||||
// class cl;
|
// class cl;
|
||||||
// typedef cl* t1;
|
// typedef cl* t1;
|
||||||
// typedef t1 t2;
|
// typedef t1 t2;
|
||||||
|
|
||||||
//// referencing content
|
//// referencing content
|
||||||
// void func(t2 a);
|
// void func(t2 a);
|
||||||
// void func(int b);
|
// void func(int b);
|
||||||
|
@ -310,10 +308,10 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testBug166954() {
|
public void testBug166954() {
|
||||||
IBinding b0 = getBindingFromASTName("func(a)", 4);
|
IBinding b0 = getBindingFromASTName("func(a)", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // header
|
// // header
|
||||||
// class Base {
|
// class Base {
|
||||||
// public:
|
// public:
|
||||||
// void foo(int i);
|
// void foo(int i);
|
||||||
// int fooint();
|
// int fooint();
|
||||||
// char* fooovr();
|
// char* fooovr();
|
||||||
|
@ -351,10 +349,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
getBindingFromASTName("fooovr('", 6);
|
getBindingFromASTName("fooovr('", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// // header
|
// // header
|
||||||
// class Base {
|
// class Base {
|
||||||
// public:
|
// public:
|
||||||
// void foo(int i);
|
// void foo(int i);
|
||||||
// int foo2(int i);
|
// int foo2(int i);
|
||||||
// };
|
// };
|
||||||
|
@ -382,9 +379,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
getBindingFromASTName("k=2", 1);
|
getBindingFromASTName("k=2", 1);
|
||||||
getBindingFromASTName("l=2", 1);
|
getBindingFromASTName("l=2", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace X {}
|
// namespace X {}
|
||||||
|
|
||||||
// namespace Y {
|
// namespace Y {
|
||||||
// class Ambiguity {};
|
// class Ambiguity {};
|
||||||
// enum Ambiguity {A1,A2,A3};
|
// enum Ambiguity {A1,A2,A3};
|
||||||
|
@ -400,9 +397,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertNotNull(name);
|
assertNotNull(name);
|
||||||
IBinding binding2= adapted.getNamespaceScope().getBinding(name, true);
|
IBinding binding2= adapted.getNamespaceScope().getBinding(name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace X {int i;}
|
// namespace X {int i;}
|
||||||
|
|
||||||
// // references
|
// // references
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// int a= X::i;
|
// int a= X::i;
|
||||||
|
@ -411,10 +408,10 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(binding instanceof ICPPVariable);
|
assertTrue(binding instanceof ICPPVariable);
|
||||||
IScope scope= binding.getScope();
|
IScope scope= binding.getScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T, class U, class V>
|
// template<class T, class U, class V>
|
||||||
// class A {};
|
// class A {};
|
||||||
|
|
||||||
// template<>
|
// template<>
|
||||||
// class A<int, bool, double> {};
|
// class A<int, bool, double> {};
|
||||||
public void testBug180784() throws Exception {
|
public void testBug180784() throws Exception {
|
||||||
|
@ -432,7 +429,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertNotNull(map.get(ps[1]));
|
assertNotNull(map.get(ps[1]));
|
||||||
assertNotNull(map.get(ps[2]));
|
assertNotNull(map.get(ps[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A{};
|
// class A{};
|
||||||
//
|
//
|
||||||
// template<typename T>
|
// template<typename T>
|
||||||
|
@ -442,7 +439,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// A id (A a) {return a;}
|
// A id (A a) {return a;}
|
||||||
//
|
//
|
||||||
// int id(int x) {return x;}
|
// int id(int x) {return x;}
|
||||||
|
|
||||||
// void foo() {
|
// void foo() {
|
||||||
// id(*new A());
|
// id(*new A());
|
||||||
// id(6);
|
// id(6);
|
||||||
|
@ -453,10 +450,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IBinding b0= getBindingFromASTName("id(*", 2);
|
IBinding b0= getBindingFromASTName("id(*", 2);
|
||||||
IBinding b1= getBindingFromASTName("id(6", 2);
|
IBinding b1= getBindingFromASTName("id(6", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// void func1(void);
|
// void func1(void);
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
//
|
//
|
||||||
// int main(void)
|
// int main(void)
|
||||||
|
@ -467,7 +463,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IBinding b0 = getBindingFromASTName("func1;", 5);
|
IBinding b0 = getBindingFromASTName("func1;", 5);
|
||||||
assertTrue(b0 instanceof IFunction);
|
assertTrue(b0 instanceof IFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class B {
|
// class B {
|
||||||
// public:
|
// public:
|
||||||
// class BB {
|
// class BB {
|
||||||
|
@ -477,9 +473,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// class A : public B::BB {};
|
// class A : public B::BB {};
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
//
|
//
|
||||||
// void foo() {
|
// void foo() {
|
||||||
// A c;
|
// A c;
|
||||||
// c.field;//comment
|
// c.field;//comment
|
||||||
|
@ -488,7 +484,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IBinding b0 = getBindingFromASTName("field;//", 5);
|
IBinding b0 = getBindingFromASTName("field;//", 5);
|
||||||
assertTrue(b0 instanceof ICPPField);
|
assertTrue(b0 instanceof ICPPField);
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef struct {
|
// typedef struct {
|
||||||
// int utm;
|
// int utm;
|
||||||
// } usertype;
|
// } usertype;
|
||||||
|
@ -532,9 +528,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
type= ((ITypedef) type).getType();
|
type= ((ITypedef) type).getType();
|
||||||
assertTrue(type instanceof IEnumeration);
|
assertTrue(type instanceof IEnumeration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // no header needed
|
// // no header needed
|
||||||
|
|
||||||
// typedef class {
|
// typedef class {
|
||||||
// int member;
|
// int member;
|
||||||
// } t_class;
|
// } t_class;
|
||||||
|
@ -570,7 +566,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof ICompositeType);
|
assertTrue(tAST instanceof ICompositeType);
|
||||||
|
@ -585,7 +581,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof ICompositeType);
|
assertTrue(tAST instanceof ICompositeType);
|
||||||
|
@ -600,7 +596,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof IEnumeration);
|
assertTrue(tAST instanceof IEnumeration);
|
||||||
|
@ -610,7 +606,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
}
|
}
|
||||||
|
|
||||||
// // no header needed
|
// // no header needed
|
||||||
|
|
||||||
// namespace ns {
|
// namespace ns {
|
||||||
// typedef class {
|
// typedef class {
|
||||||
// int member;
|
// int member;
|
||||||
|
@ -648,7 +644,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof ICompositeType);
|
assertTrue(tAST instanceof ICompositeType);
|
||||||
|
@ -663,7 +659,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof ICompositeType);
|
assertTrue(tAST instanceof ICompositeType);
|
||||||
|
@ -678,7 +674,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tdIndex instanceof IIndexBinding);
|
assertTrue(tdIndex instanceof IIndexBinding);
|
||||||
assertTrue(tdAST instanceof ITypedef);
|
assertTrue(tdAST instanceof ITypedef);
|
||||||
assertTrue(tdIndex instanceof ITypedef);
|
assertTrue(tdIndex instanceof ITypedef);
|
||||||
|
|
||||||
tAST= ((ITypedef) tdAST).getType();
|
tAST= ((ITypedef) tdAST).getType();
|
||||||
tIndex= ((ITypedef) tdIndex).getType();
|
tIndex= ((ITypedef) tdIndex).getType();
|
||||||
assertTrue(tAST instanceof IEnumeration);
|
assertTrue(tAST instanceof IEnumeration);
|
||||||
|
@ -686,7 +682,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(tAST.isSameType(tIndex));
|
assertTrue(tAST.isSameType(tIndex));
|
||||||
assertTrue(tIndex.isSameType(tAST));
|
assertTrue(tIndex.isSameType(tAST));
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace FOO {
|
// namespace FOO {
|
||||||
// namespace BAR {
|
// namespace BAR {
|
||||||
// class Bar;
|
// class Bar;
|
||||||
|
@ -699,7 +695,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// namespace FOO {
|
// namespace FOO {
|
||||||
// using BAR::Bar;
|
// using BAR::Bar;
|
||||||
//
|
//
|
||||||
// Bar* Foo::Test(Bar* pBar) {
|
// Bar* Foo::Test(Bar* pBar) {
|
||||||
// return pBar;
|
// return pBar;
|
||||||
// }
|
// }
|
||||||
|
@ -716,13 +712,13 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(cl instanceof ICPPClassType);
|
assertTrue(cl instanceof ICPPClassType);
|
||||||
assertEquals("BAR", cl.getScope().getScopeName().toString());
|
assertEquals("BAR", cl.getScope().getScopeName().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct outer {
|
// struct outer {
|
||||||
// union {
|
// union {
|
||||||
// int var1;
|
// int var1;
|
||||||
// };
|
// };
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// void test() {
|
// void test() {
|
||||||
// struct outer x;
|
// struct outer x;
|
||||||
|
@ -746,7 +742,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// int var2;
|
// int var2;
|
||||||
// } hide;
|
// } hide;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// void test() {
|
// void test() {
|
||||||
// union outer x;
|
// union outer x;
|
||||||
|
@ -761,15 +757,15 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IScope outer= f.getCompositeTypeOwner().getScope();
|
IScope outer= f.getCompositeTypeOwner().getScope();
|
||||||
assertTrue(outer instanceof ICPPClassScope);
|
assertTrue(outer instanceof ICPPClassScope);
|
||||||
assertEquals("outer", outer.getScopeName().toString());
|
assertEquals("outer", outer.getScopeName().toString());
|
||||||
|
|
||||||
getProblemFromASTName("var2=", 4);
|
getProblemFromASTName("var2=", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace ns {
|
// namespace ns {
|
||||||
// int v;
|
// int v;
|
||||||
// };
|
// };
|
||||||
// using namespace ns;
|
// using namespace ns;
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// void test() {
|
// void test() {
|
||||||
// v=1;
|
// v=1;
|
||||||
|
@ -781,8 +777,8 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IScope scope= v.getScope();
|
IScope scope= v.getScope();
|
||||||
assertTrue(scope instanceof ICPPNamespaceScope);
|
assertTrue(scope instanceof ICPPNamespaceScope);
|
||||||
assertEquals("ns", scope.getScopeName().toString());
|
assertEquals("ns", scope.getScopeName().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace NSA {
|
// namespace NSA {
|
||||||
// int a;
|
// int a;
|
||||||
// }
|
// }
|
||||||
|
@ -813,7 +809,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(scope instanceof ICPPNamespaceScope);
|
assertTrue(scope instanceof ICPPNamespaceScope);
|
||||||
assertEquals("NSB", scope.getScopeName().toString());
|
assertEquals("NSB", scope.getScopeName().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace N { namespace M {}}
|
// namespace N { namespace M {}}
|
||||||
|
|
||||||
// namespace N {using namespace N::M;}
|
// namespace N {using namespace N::M;}
|
||||||
|
@ -822,9 +818,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testEndlessLoopWithUsingDeclaration_Bug209813() throws DOMException {
|
public void testEndlessLoopWithUsingDeclaration_Bug209813() throws DOMException {
|
||||||
getProblemFromASTName("x;", 1);
|
getProblemFromASTName("x;", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class MyClass {};
|
// class MyClass {};
|
||||||
|
|
||||||
// void test(MyClass* ptr);
|
// void test(MyClass* ptr);
|
||||||
// class MyClass;
|
// class MyClass;
|
||||||
public void testClassRedeclarationAfterReference_Bug229571() throws Exception {
|
public void testClassRedeclarationAfterReference_Bug229571() throws Exception {
|
||||||
|
@ -835,7 +831,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
type= ((IPointerType) type).getType();
|
type= ((IPointerType) type).getType();
|
||||||
assertSame(type, cl);
|
assertSame(type, cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A {
|
// class A {
|
||||||
// public:
|
// public:
|
||||||
// void foo() const volatile;
|
// void foo() const volatile;
|
||||||
|
@ -847,7 +843,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// void bar() const;
|
// void bar() const;
|
||||||
// void bar();
|
// void bar();
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// void A::foo() const volatile { bar();/*1*/ }
|
// void A::foo() const volatile { bar();/*1*/ }
|
||||||
// void A::foo() volatile { bar();/*2*/ }
|
// void A::foo() volatile { bar();/*2*/ }
|
||||||
// void A::foo() const { bar();/*3*/ }
|
// void A::foo() const { bar();/*3*/ }
|
||||||
|
@ -871,12 +867,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
ICPPFunctionType bar_v_ft= bar_v.getType();
|
ICPPFunctionType bar_v_ft= bar_v.getType();
|
||||||
ICPPFunctionType bar_c_ft= bar_c.getType();
|
ICPPFunctionType bar_c_ft= bar_c.getType();
|
||||||
ICPPFunctionType bar_ft= bar.getType();
|
ICPPFunctionType bar_ft= bar.getType();
|
||||||
|
|
||||||
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
||||||
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
||||||
assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
|
assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
|
||||||
assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
|
assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
|
||||||
|
|
||||||
bar_cv= getBindingFromASTName("bar();/*5*/", 3, ICPPMethod.class);
|
bar_cv= getBindingFromASTName("bar();/*5*/", 3, ICPPMethod.class);
|
||||||
bar_v= getBindingFromASTName("bar();/*6*/", 3, ICPPMethod.class);
|
bar_v= getBindingFromASTName("bar();/*6*/", 3, ICPPMethod.class);
|
||||||
bar_c= getBindingFromASTName("bar();/*7*/", 3, ICPPMethod.class);
|
bar_c= getBindingFromASTName("bar();/*7*/", 3, ICPPMethod.class);
|
||||||
|
@ -885,18 +881,18 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
bar_v_ft= bar_v.getType();
|
bar_v_ft= bar_v.getType();
|
||||||
bar_c_ft= bar_c.getType();
|
bar_c_ft= bar_c.getType();
|
||||||
bar_ft= bar.getType();
|
bar_ft= bar.getType();
|
||||||
|
|
||||||
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
||||||
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
||||||
assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
|
assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
|
||||||
assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
|
assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef char t[12];
|
// typedef char t[12];
|
||||||
// void test1(char *);
|
// void test1(char *);
|
||||||
// void test2(char []);
|
// void test2(char []);
|
||||||
// void test3(t);
|
// void test3(t);
|
||||||
|
|
||||||
// void xx() {
|
// void xx() {
|
||||||
// char* x= 0;
|
// char* x= 0;
|
||||||
// test1(x);
|
// test1(x);
|
||||||
|
@ -908,7 +904,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
getBindingFromASTName("test2(x)", 5, ICPPFunction.class);
|
getBindingFromASTName("test2(x)", 5, ICPPFunction.class);
|
||||||
getBindingFromASTName("test3(x)", 5, ICPPFunction.class);
|
getBindingFromASTName("test3(x)", 5, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A {
|
// class A {
|
||||||
// A();
|
// A();
|
||||||
// void l();
|
// void l();
|
||||||
|
@ -965,7 +961,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// int h;
|
// int h;
|
||||||
// class P {};
|
// class P {};
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// C c;
|
// C c;
|
||||||
// CT<int> ct;
|
// CT<int> ct;
|
||||||
// CT<char> ctinst;
|
// CT<char> ctinst;
|
||||||
|
@ -1044,7 +1040,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
|
assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
|
||||||
assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
||||||
assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
|
assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||||
|
|
||||||
// explicit class specialization
|
// explicit class specialization
|
||||||
ct= getBindingFromASTName("C espec", 1);
|
ct= getBindingFromASTName("C espec", 1);
|
||||||
assertInstance(ct, ICPPClassSpecialization.class);
|
assertInstance(ct, ICPPClassSpecialization.class);
|
||||||
|
@ -1071,7 +1067,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
}
|
}
|
||||||
|
|
||||||
// void func(const int* x) {}
|
// void func(const int* x) {}
|
||||||
|
|
||||||
// void func(int* p) {
|
// void func(int* p) {
|
||||||
// const int* q = p;
|
// const int* q = p;
|
||||||
// func(q);
|
// func(q);
|
||||||
|
@ -1124,12 +1120,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
String[] actual= new String[binding.length];
|
String[] actual= new String[binding.length];
|
||||||
for (int i = 0; i < actual.length; i++) {
|
for (int i = 0; i < actual.length; i++) {
|
||||||
actual[i]= binding[i].getName();
|
actual[i]= binding[i].getName();
|
||||||
}
|
}
|
||||||
Arrays.sort(actual);
|
Arrays.sort(actual);
|
||||||
Arrays.sort(expected);
|
Arrays.sort(expected);
|
||||||
assertEquals(toString(expected), toString(actual));
|
assertEquals(toString(expected), toString(actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toString(String[] actual) {
|
private String toString(String[] actual) {
|
||||||
StringBuilder buf= new StringBuilder();
|
StringBuilder buf= new StringBuilder();
|
||||||
buf.append('{');
|
buf.append('{');
|
||||||
|
@ -1144,14 +1140,14 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
buf.append('}');
|
buf.append('}');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// class Derived;
|
// class Derived;
|
||||||
// class X {
|
// class X {
|
||||||
// Derived* d;
|
// Derived* d;
|
||||||
// };
|
// };
|
||||||
// class Base {};
|
// class Base {};
|
||||||
// void useBase(Base* b);
|
// void useBase(Base* b);
|
||||||
|
|
||||||
// class Derived: Base {};
|
// class Derived: Base {};
|
||||||
// void test() {
|
// void test() {
|
||||||
// X x;
|
// X x;
|
||||||
|
@ -1160,7 +1156,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testLateDefinitionOfInheritance_Bug292749() throws Exception {
|
public void testLateDefinitionOfInheritance_Bug292749() throws Exception {
|
||||||
getBindingFromASTName("useBase(x.d", 7, ICPPFunction.class);
|
getBindingFromASTName("useBase(x.d", 7, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace one {
|
// namespace one {
|
||||||
// void fx();
|
// void fx();
|
||||||
// void fx(int);
|
// void fx(int);
|
||||||
|
@ -1169,7 +1165,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// namespace two {
|
// namespace two {
|
||||||
// using one::fx;
|
// using one::fx;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// void test() {
|
// void test() {
|
||||||
// two::fx();
|
// two::fx();
|
||||||
|
@ -1181,7 +1177,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
getBindingFromASTName("fx(1);", 2, ICPPFunction.class);
|
getBindingFromASTName("fx(1);", 2, ICPPFunction.class);
|
||||||
getBindingFromASTName("fx(1,1);", 2, ICPPFunction.class);
|
getBindingFromASTName("fx(1,1);", 2, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct YetAnotherTest {
|
// struct YetAnotherTest {
|
||||||
// void test();
|
// void test();
|
||||||
// friend class InnerClass3;
|
// friend class InnerClass3;
|
||||||
|
@ -1201,10 +1197,10 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testElaboratedTypeSpecifier_Bug303739() throws Exception {
|
public void testElaboratedTypeSpecifier_Bug303739() throws Exception {
|
||||||
getBindingFromASTName("member=0", -2, ICPPField.class);
|
getBindingFromASTName("member=0", -2, ICPPField.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef int xxx::* MBR_PTR;
|
// typedef int xxx::* MBR_PTR;
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
// MBR_PTR x;
|
// MBR_PTR x;
|
||||||
// }
|
// }
|
||||||
public void testProblemInIndexBinding_Bug317146() throws Exception {
|
public void testProblemInIndexBinding_Bug317146() throws Exception {
|
||||||
|
@ -1248,8 +1244,8 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
|
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
|
||||||
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
|
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
|
||||||
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
// f255(
|
// f255(
|
||||||
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
@ -1272,11 +1268,11 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testFunctionsWithManyParameters_Bug319186() throws Exception {
|
public void testFunctionsWithManyParameters_Bug319186() throws Exception {
|
||||||
getBindingFromASTName("f255", 0);
|
getBindingFromASTName("f255", 0);
|
||||||
getBindingFromASTName("f256", 0);
|
getBindingFromASTName("f256", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void f(char16_t x);
|
// void f(char16_t x);
|
||||||
// void f(char32_t x);
|
// void f(char32_t x);
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
// char16_t c16;
|
// char16_t c16;
|
||||||
// char32_t c32;
|
// char32_t c32;
|
||||||
|
@ -1285,11 +1281,11 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
public void testChar16_Bug319186() throws Exception {
|
public void testChar16_Bug319186() throws Exception {
|
||||||
IFunction f= getBindingFromASTName("f(c16)", 1);
|
IFunction f= getBindingFromASTName("f(c16)", 1);
|
||||||
assertEquals("char16_t", ASTTypeUtil.getType(f.getType().getParameterTypes()[0]));
|
assertEquals("char16_t", ASTTypeUtil.getType(f.getType().getParameterTypes()[0]));
|
||||||
|
|
||||||
f= getBindingFromASTName("f(c32)", 1);
|
f= getBindingFromASTName("f(c32)", 1);
|
||||||
assertEquals("char32_t", ASTTypeUtil.getType(f.getType().getParameterTypes()[0]));
|
assertEquals("char32_t", ASTTypeUtil.getType(f.getType().getParameterTypes()[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace ns {
|
// namespace ns {
|
||||||
// extern int* var;
|
// extern int* var;
|
||||||
// void fun();
|
// void fun();
|
||||||
|
@ -1298,7 +1294,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// using ns::var;
|
// using ns::var;
|
||||||
// using ns::fun;
|
// using ns::fun;
|
||||||
// using ns::Type;
|
// using ns::Type;
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// using namespace ::ns;
|
// using namespace ::ns;
|
||||||
// void sabel() {
|
// void sabel() {
|
||||||
|
@ -1311,12 +1307,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IFunction f= getBindingFromASTName("fun", 0);
|
IFunction f= getBindingFromASTName("fun", 0);
|
||||||
ITypedef t= getBindingFromASTName("Type", 0);
|
ITypedef t= getBindingFromASTName("Type", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct base {
|
// struct base {
|
||||||
// virtual void operator+(base const &) { }
|
// virtual void operator+(base const &) { }
|
||||||
// virtual void operator-(base const &) { }
|
// virtual void operator-(base const &) { }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// struct inter : public base {
|
// struct inter : public base {
|
||||||
// virtual void operator+(base const &){}
|
// virtual void operator+(base const &){}
|
||||||
|
@ -1326,14 +1322,14 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
// base *left, *right;
|
// base *left, *right;
|
||||||
//
|
//
|
||||||
// *left + *right;
|
// *left + *right;
|
||||||
// *left - *right;
|
// *left - *right;
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
public void test_Bug356982() throws Exception {
|
public void test_Bug356982() throws Exception {
|
||||||
IASTName name= findName("+ ", 1);
|
IASTName name= findName("+ ", 1);
|
||||||
assertTrue(name instanceof IASTImplicitName);
|
assertTrue(name instanceof IASTImplicitName);
|
||||||
assertEquals("base", name.resolveBinding().getOwner().getName());
|
assertEquals("base", name.resolveBinding().getOwner().getName());
|
||||||
|
|
||||||
name= findName("- ", 1);
|
name= findName("- ", 1);
|
||||||
assertTrue(name instanceof IASTImplicitName);
|
assertTrue(name instanceof IASTImplicitName);
|
||||||
assertEquals("base", name.resolveBinding().getOwner().getName());
|
assertEquals("base", name.resolveBinding().getOwner().getName());
|
||||||
|
|
|
@ -468,7 +468,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
* Convenience class for setting up projects.
|
* Convenience class for setting up projects.
|
||||||
*/
|
*/
|
||||||
class ProjectBuilder {
|
class ProjectBuilder {
|
||||||
private static final int INDEXER_TIMEOUT_SEC = 5;
|
private static final int INDEXER_TIMEOUT_SEC = 10;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean cpp;
|
private final boolean cpp;
|
||||||
private List dependencies = new ArrayList();
|
private List dependencies = new ArrayList();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial implementation
|
* Andrew Ferguson (Symbian) - Initial implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.pdom.tests;
|
package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class PDOMLocationTests extends BaseTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
cproject= CProjectHelper.createCCProject("PDOMLocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
cproject= CProjectHelper.createCCProject("PDOMLocationTests" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ public class PDOMLocationTests extends BaseTestCase {
|
||||||
|
|
||||||
Set<String> externals= new HashSet();
|
Set<String> externals= new HashSet();
|
||||||
externals.addAll(Arrays.asList(linuxExternals));
|
externals.addAll(Arrays.asList(linuxExternals));
|
||||||
if(Platform.getOS().equals("win32")) {
|
if (Platform.getOS().equals("win32")) {
|
||||||
externals.addAll(Arrays.asList(winExternals));
|
externals.addAll(Arrays.asList(winExternals));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String ext : externals) {
|
for (String ext : externals) {
|
||||||
IIndexFileLocation loc = IndexLocationFactory.getExternalIFL(ext);
|
IIndexFileLocation loc = IndexLocationFactory.getExternalIFL(ext);
|
||||||
String raw = converter.toInternalFormat(loc);
|
String raw = converter.toInternalFormat(loc);
|
||||||
IIndexFileLocation roundtrip = converter.fromInternalFormat(raw);
|
IIndexFileLocation roundtrip = converter.fromInternalFormat(raw);
|
||||||
|
|
|
@ -55,9 +55,9 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
final File tempPDOM= File.createTempFile("foo", "bar");
|
final File tempPDOM= File.createTempFile("foo", "bar");
|
||||||
|
|
||||||
{
|
{
|
||||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("foo" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, A_FRAGMENT_OPTIONS);
|
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, A_FRAGMENT_OPTIONS);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
|
@ -76,9 +76,9 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||||
final ICProject cproject2= CProjectHelper.createCCProject("bar"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
final ICProject cproject2= CProjectHelper.createCCProject("bar" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||||
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
||||||
|
@ -127,9 +127,9 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
final File tempPDOM= File.createTempFile("foo", "bar");
|
final File tempPDOM= File.createTempFile("foo", "bar");
|
||||||
|
|
||||||
{
|
{
|
||||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("foo" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, A_FRAGMENT_OPTIONS);
|
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, A_FRAGMENT_OPTIONS);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
|
@ -147,14 +147,14 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
CProjectHelper.delete(cproject);
|
CProjectHelper.delete(cproject);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ICProject cproject3= CProjectHelper.createCCProject("bar"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
final ICProject cproject3= CProjectHelper.createCCProject("bar" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject3.getProject(), new Path("/source.cpp"), "namespace Y { class A {}; }\n\n");
|
TestSourceReader.createFile(cproject3.getProject(), new Path("/source.cpp"), "namespace Y { class A {}; }\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||||
final ICProject cproject2= CProjectHelper.createCCProject("baz"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
final ICProject cproject2= CProjectHelper.createCCProject("baz" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||||
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
||||||
|
@ -241,21 +241,18 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
public void testVersionMismatchOfExternalPDOM_178998() throws Exception {
|
||||||
* see bugzilla 178998
|
|
||||||
*/
|
|
||||||
public void testVersionMismatchOfExternalPDOM() throws Exception {
|
|
||||||
final File tempPDOM= File.createTempFile("foo", "bar");
|
final File tempPDOM= File.createTempFile("foo", "bar");
|
||||||
|
|
||||||
{
|
{
|
||||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("foo" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
ResourceContainerRelativeLocationConverter cvr= new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
ResourceContainerRelativeLocationConverter cvr= new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, tempPDOM, cvr);
|
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, tempPDOM, cvr);
|
||||||
CProjectHelper.delete(cproject);
|
CProjectHelper.delete(cproject);
|
||||||
|
|
||||||
// mimic a pdom with superceded version
|
// Mimic a PDOM with superseded version.
|
||||||
WritablePDOM wpdom= new WritablePDOM(tempPDOM, cvr, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
WritablePDOM wpdom= new WritablePDOM(tempPDOM, cvr, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
wpdom.acquireWriteLock();
|
wpdom.acquireWriteLock();
|
||||||
try {
|
try {
|
||||||
|
@ -267,9 +264,9 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||||
final ICProject cproject2= CProjectHelper.createCCProject("baz"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
final ICProject cproject2= CProjectHelper.createCCProject("baz" + System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm());
|
||||||
|
|
||||||
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||||
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
||||||
|
@ -302,7 +299,7 @@ public class PDOMProviderTests extends PDOMTestBase {
|
||||||
setExpectedNumberOfLoggedNonOKStatusObjects(1); // (this applies to the entire test duration)
|
setExpectedNumberOfLoggedNonOKStatusObjects(1); // (this applies to the entire test duration)
|
||||||
|
|
||||||
for (int i= 0; i < 3; i++) {
|
for (int i= 0; i < 3; i++) {
|
||||||
// try several times in order to test the status is logged only once
|
// Try several times in order to test the status is logged only once.
|
||||||
ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(cproject2.getProject(), false);
|
ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(cproject2.getProject(), false);
|
||||||
assertEquals(0, ipm.getProvidedIndexFragments(pd.getActiveConfiguration(), -1).length);
|
assertEquals(0, ipm.getProvidedIndexFragments(pd.getActiveConfiguration(), -1).length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
@ -49,7 +50,7 @@ public class PDOMSearchTest extends PDOMTestBase {
|
||||||
return o1.getName().compareTo(o2.getName());
|
return o1.getName().compareTo(o2.getName());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
protected ICProject project;
|
protected ICProject project;
|
||||||
protected PDOM pdom;
|
protected PDOM pdom;
|
||||||
protected IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
|
protected IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
|
||||||
protected IndexFilter INDEX_FILTER = IndexFilter.ALL_DECLARED;
|
protected IndexFilter INDEX_FILTER = IndexFilter.ALL_DECLARED;
|
||||||
|
@ -60,16 +61,17 @@ public class PDOMSearchTest extends PDOMTestBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
if (pdom == null) {
|
project = createProject("searchTests", true);
|
||||||
ICProject project = createProject("searchTests", true);
|
pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project);
|
||||||
pdom = (PDOM)CCoreInternals.getPDOMManager().getPDOM(project);
|
|
||||||
}
|
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
pdom.releaseReadLock();
|
pdom.releaseReadLock();
|
||||||
|
if (project != null) {
|
||||||
|
project.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ import org.eclipse.ui.wizards.datatransfer.ImportOperation;
|
||||||
public class PDOMTestBase extends BaseTestCase {
|
public class PDOMTestBase extends BaseTestCase {
|
||||||
protected static final IProgressMonitor PROGRESS = new NullProgressMonitor();
|
protected static final IProgressMonitor PROGRESS = new NullProgressMonitor();
|
||||||
static IPath rootPath = new Path("resources/pdomtests");
|
static IPath rootPath = new Path("resources/pdomtests");
|
||||||
private String projectName= null;
|
private String projectName;
|
||||||
|
|
||||||
protected ICProject createProject(String folderName) throws CoreException {
|
protected ICProject createProject(String folderName) throws CoreException {
|
||||||
return createProject(folderName, false);
|
return createProject(folderName, false);
|
||||||
|
|
|
@ -18,14 +18,12 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class PDOMTests extends TestSuite {
|
public class PDOMTests extends TestSuite {
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite = new PDOMTests();
|
TestSuite suite = new PDOMTests();
|
||||||
|
|
||||||
|
|
||||||
suite.addTest(DBTest.suite());
|
suite.addTest(DBTest.suite());
|
||||||
suite.addTest(DBPropertiesTests.suite());
|
suite.addTest(DBPropertiesTests.suite());
|
||||||
suite.addTest(PDOMCBugsTest.suite());
|
suite.addTest(PDOMCBugsTest.suite());
|
||||||
|
@ -42,7 +40,7 @@ public class PDOMTests extends TestSuite {
|
||||||
suite.addTest(BTreeTests.suite());
|
suite.addTest(BTreeTests.suite());
|
||||||
suite.addTest(FilesOnReindexTests.suite());
|
suite.addTest(FilesOnReindexTests.suite());
|
||||||
suite.addTest(GeneratePDOMApplicationTest.suite());
|
suite.addTest(GeneratePDOMApplicationTest.suite());
|
||||||
|
|
||||||
suite.addTest(CPPFieldTests.suite());
|
suite.addTest(CPPFieldTests.suite());
|
||||||
suite.addTest(CPPFunctionTests.suite());
|
suite.addTest(CPPFunctionTests.suite());
|
||||||
suite.addTest(CPPVariableTests.suite());
|
suite.addTest(CPPVariableTests.suite());
|
||||||
|
@ -50,16 +48,15 @@ public class PDOMTests extends TestSuite {
|
||||||
suite.addTest(CPPFunctionTemplateTests.suite());
|
suite.addTest(CPPFunctionTemplateTests.suite());
|
||||||
suite.addTest(MethodTests.suite());
|
suite.addTest(MethodTests.suite());
|
||||||
suite.addTest(NamespaceTests.suite());
|
suite.addTest(NamespaceTests.suite());
|
||||||
|
|
||||||
suite.addTest(CFunctionTests.suite());
|
suite.addTest(CFunctionTests.suite());
|
||||||
suite.addTest(CVariableTests.suite());
|
suite.addTest(CVariableTests.suite());
|
||||||
suite.addTest(CCompositeTypeTests.suite());
|
suite.addTest(CCompositeTypeTests.suite());
|
||||||
|
|
||||||
suite.addTest(DefDeclTests.suite());
|
suite.addTest(DefDeclTests.suite());
|
||||||
suite.addTest(RaceCondition157992Test.suite());
|
suite.addTest(RaceCondition157992Test.suite());
|
||||||
suite.addTest(ChangeConfigurationTests.suite());
|
suite.addTest(ChangeConfigurationTests.suite());
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,7 +457,7 @@ public class ResourceHelper {
|
||||||
*/
|
*/
|
||||||
public static IFolder createLinkedFolder(IProject project, String folderLink, IPath realFolder) throws CoreException {
|
public static IFolder createLinkedFolder(IProject project, String folderLink, IPath realFolder) throws CoreException {
|
||||||
IFolder folder = project.getFolder(folderLink);
|
IFolder folder = project.getFolder(folderLink);
|
||||||
folder.createLink(realFolder, IResource.REPLACE, null);
|
folder.createLink(realFolder, IResource.REPLACE | IResource.ALLOW_MISSING_LOCAL, null);
|
||||||
Assert.assertTrue(folder.exists());
|
Assert.assertTrue(folder.exists());
|
||||||
resourcesCreated.add(folder);
|
resourcesCreated.add(folder);
|
||||||
return folder;
|
return folder;
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class BaseTestCase extends TestCase {
|
public class BaseTestCase extends TestCase {
|
||||||
|
protected static final int INDEXER_TIMEOUT_SEC = 10;
|
||||||
private boolean fExpectFailure;
|
private boolean fExpectFailure;
|
||||||
private int fBugNumber;
|
private int fBugNumber;
|
||||||
private int fExpectedLoggedNonOK;
|
private int fExpectedLoggedNonOK;
|
||||||
|
@ -290,12 +291,12 @@ public class BaseTestCase extends TestCase {
|
||||||
|
|
||||||
public static void waitForIndexer(ICProject project) throws InterruptedException {
|
public static void waitForIndexer(ICProject project) throws InterruptedException {
|
||||||
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
||||||
assertTrue(indexManager.joinIndexer(10000, npm()));
|
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
|
||||||
long waitms= 1;
|
long waitms= 1;
|
||||||
while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
|
while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
|
||||||
Thread.sleep(waitms);
|
Thread.sleep(waitms);
|
||||||
waitms *= 2;
|
waitms *= 2;
|
||||||
}
|
}
|
||||||
assertTrue(indexManager.joinIndexer(10000, npm()));
|
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
|
||||||
|
@ -204,7 +205,8 @@ public class ASTCache {
|
||||||
ASTRunnable astRunnable) {
|
ASTRunnable astRunnable) {
|
||||||
IIndex index;
|
IIndex index;
|
||||||
try {
|
try {
|
||||||
index = CCorePlugin.getIndexManager().getIndex(tUnit.getCProject());
|
index = CCorePlugin.getIndexManager().getIndex(tUnit.getCProject(),
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
|
|
@ -121,7 +121,8 @@ public class CModelBuilder2 implements IContributedModelBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void parse(boolean quickParseMode) throws Exception {
|
public void parse(boolean quickParseMode) throws Exception {
|
||||||
final IIndexManager indexManager= CCorePlugin.getIndexManager();
|
final IIndexManager indexManager= CCorePlugin.getIndexManager();
|
||||||
IIndex index= indexManager.getIndex(fTranslationUnit.getCProject());
|
IIndex index = indexManager.getIndex(fTranslationUnit.getCProject(),
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
|
|
|
@ -20,9 +20,9 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
|
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of static methods related to types.
|
* A collection of static methods related to types.
|
||||||
|
@ -48,8 +48,8 @@ public class TypeHelper {
|
||||||
if (type instanceof ICompositeType) {
|
if (type instanceof ICompositeType) {
|
||||||
if (type instanceof ICPPClassType) {
|
if (type instanceof ICPPClassType) {
|
||||||
ICPPClassType classType = ((ICPPClassType) type);
|
ICPPClassType classType = ((ICPPClassType) type);
|
||||||
if (!ClassTypeHelper.hasTrivialCopyCtor(classType, ast) ||
|
if (!TypeTraits.hasTrivialCopyCtor(classType, ast) ||
|
||||||
!ClassTypeHelper.hasTrivialDestructor(classType, ast)) {
|
!TypeTraits.hasTrivialDestructor(classType, ast)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,15 @@ public interface IIndexManager extends IPDOMManager {
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public static final int ADD_EXTENSION_FRAGMENTS_SEARCH = 0x200;
|
public static final int ADD_EXTENSION_FRAGMENTS_SEARCH = 0x200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant for passing to getIndex methods. This constant, when set, indicates that each index
|
||||||
|
* content provided via the ReadOnlyIndexFragmentProvider or ReadOnlyPDOMProvider, which is not
|
||||||
|
* disabled for the editor shall be included in the resulting index.
|
||||||
|
*
|
||||||
|
* @since 5.5
|
||||||
|
*/
|
||||||
|
public static final int ADD_EXTENSION_FRAGMENTS_EDITOR = 0x400;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant for indicating that there is no time out period for joining the indexer job.
|
* Constant for indicating that there is no time out period for joining the indexer job.
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||||
|
@ -73,6 +74,20 @@ public class SizeofCalculator {
|
||||||
|
|
||||||
private final IASTTranslationUnit ast;
|
private final IASTTranslationUnit ast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates size and alignment for the given type.
|
||||||
|
*
|
||||||
|
* @param type the type to get size and alignment for.
|
||||||
|
* @param point a node belonging to the AST of the translation unit defining context for
|
||||||
|
* the size calculation.
|
||||||
|
* @return size and alignment, or <code>null</code> if could not be calculated.
|
||||||
|
*/
|
||||||
|
public static SizeAndAlignment getSizeAndAlignment(IType type, IASTNode point) {
|
||||||
|
SizeofCalculator calc = point == null ?
|
||||||
|
getDefault() : ((ASTTranslationUnit) point.getTranslationUnit()).getSizeofCalculator();
|
||||||
|
return calc.sizeAndAlignment(type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default instance of sizeof calculator. The default instance is not aware
|
* Returns the default instance of sizeof calculator. The default instance is not aware
|
||||||
* of the parser configuration and can only calculate sizes that are the same across all
|
* of the parser configuration and can only calculate sizes that are the same across all
|
||||||
|
|
|
@ -11,29 +11,58 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_alignof;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_nothrow_constructor;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_nothrow_copy;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_trivial_assign;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_trivial_constructor;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_trivial_copy;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_trivial_destructor;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_has_virtual_destructor;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_abstract;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_class;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_empty;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_enum;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_literal_type;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_pod;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_polymorphic;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_standard_layout;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_trivial;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_union;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_sizeof;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeid;
|
||||||
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeof;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator;
|
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator.EvalException;
|
import org.eclipse.cdt.internal.core.parser.scanner.ExpressionEvaluator.EvalException;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.TypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.pdom.db.TypeMarshalBuffer;
|
||||||
|
@ -201,7 +230,7 @@ public class Value implements IValue {
|
||||||
|
|
||||||
public static IValue evaluateBinaryExpression(final int op, final long v1, final long v2) {
|
public static IValue evaluateBinaryExpression(final int op, final long v1, final long v2) {
|
||||||
try {
|
try {
|
||||||
return create(combineBinary(op, v1, v2));
|
return create(applyBinaryOperator(op, v1, v2));
|
||||||
} catch (UnknownValueException e) {
|
} catch (UnknownValueException e) {
|
||||||
}
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
|
@ -209,12 +238,101 @@ public class Value implements IValue {
|
||||||
|
|
||||||
public static IValue evaluateUnaryExpression(final int unaryOp, final long value) {
|
public static IValue evaluateUnaryExpression(final int unaryOp, final long value) {
|
||||||
try {
|
try {
|
||||||
return create(combineUnary(unaryOp, value));
|
return create(applyUnaryOperator(unaryOp, value));
|
||||||
} catch (UnknownValueException e) {
|
} catch (UnknownValueException e) {
|
||||||
}
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IValue evaluateUnaryTypeIdExpression(int operator, IType type, IASTNode point) {
|
||||||
|
try {
|
||||||
|
return create(applyUnaryTypeIdOperator(operator, type, point));
|
||||||
|
} catch (UnknownValueException e) {
|
||||||
|
}
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IValue evaluateBinaryTypeIdExpression(IASTBinaryTypeIdExpression.Operator operator,
|
||||||
|
IType type1, IType type2, IASTNode point) {
|
||||||
|
try {
|
||||||
|
return create(applyBinaryTypeIdOperator(operator, type1, type2, point));
|
||||||
|
} catch (UnknownValueException e) {
|
||||||
|
}
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) throws UnknownValueException{
|
||||||
|
switch (operator) {
|
||||||
|
case op_sizeof:
|
||||||
|
return getSizeAndAlignment(type, point).size;
|
||||||
|
case op_alignof:
|
||||||
|
return getSizeAndAlignment(type, point).alignment;
|
||||||
|
case op_typeid:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_nothrow_copy:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_nothrow_constructor:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_trivial_assign:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_trivial_constructor:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_trivial_copy:
|
||||||
|
return !(type instanceof ICPPClassType) ||
|
||||||
|
TypeTraits.hasTrivialCopyCtor((ICPPClassType) type, point) ? 1 : 0;
|
||||||
|
case op_has_trivial_destructor:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_has_virtual_destructor:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_is_abstract:
|
||||||
|
return type instanceof ICPPClassType &&
|
||||||
|
TypeTraits.isAbstract((ICPPClassType) type, point) ? 1 : 0;
|
||||||
|
case op_is_class:
|
||||||
|
return type instanceof ICompositeType &&
|
||||||
|
((ICompositeType) type).getKey() != ICompositeType.k_union ? 1 : 0;
|
||||||
|
case op_is_empty:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_is_enum:
|
||||||
|
return type instanceof IEnumeration ? 1 : 0;
|
||||||
|
case op_is_literal_type:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
case op_is_pod:
|
||||||
|
return TypeTraits.isPOD(type, point) ? 1 : 0;
|
||||||
|
case op_is_polymorphic:
|
||||||
|
return type instanceof ICPPClassType &&
|
||||||
|
TypeTraits.isPolymorphic((ICPPClassType) type, point) ? 1 : 0;
|
||||||
|
case op_is_standard_layout:
|
||||||
|
return TypeTraits.isStandardLayout(type, point) ? 1 : 0;
|
||||||
|
case op_is_trivial:
|
||||||
|
return type instanceof ICPPClassType &&
|
||||||
|
TypeTraits.isTrivial((ICPPClassType) type, point) ? 1 : 0;
|
||||||
|
case op_is_union:
|
||||||
|
return type instanceof ICompositeType &&
|
||||||
|
((ICompositeType) type).getKey() == ICompositeType.k_union ? 1 : 0;
|
||||||
|
case op_typeof:
|
||||||
|
break; // TODO(sprigogin): Implement
|
||||||
|
}
|
||||||
|
throw UNKNOWN_EX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long applyBinaryTypeIdOperator(IASTBinaryTypeIdExpression.Operator operator,
|
||||||
|
IType type1, IType type2, IASTNode point) throws UnknownValueException {
|
||||||
|
switch (operator) {
|
||||||
|
case __is_base_of:
|
||||||
|
if (type1 instanceof ICPPClassType && type1 instanceof ICPPClassType) {
|
||||||
|
return ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw UNKNOWN_EX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SizeAndAlignment getSizeAndAlignment(IType type, IASTNode point) throws UnknownValueException {
|
||||||
|
SizeAndAlignment sizeAndAlignment = SizeofCalculator.getSizeAndAlignment(type, point);
|
||||||
|
if (sizeAndAlignment == null)
|
||||||
|
throw UNKNOWN_EX;
|
||||||
|
return sizeAndAlignment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the value is a template parameter (or a parameter pack).
|
* Tests whether the value is a template parameter (or a parameter pack).
|
||||||
*
|
*
|
||||||
|
@ -348,19 +466,15 @@ public class Value implements IValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exp instanceof IASTTypeIdExpression) {
|
if (exp instanceof IASTTypeIdExpression) {
|
||||||
IASTTypeIdExpression typeIdEx = (IASTTypeIdExpression) exp;
|
ASTTranslationUnit ast = (ASTTranslationUnit) exp.getTranslationUnit();
|
||||||
switch (typeIdEx.getOperator()) {
|
final IType type = ast.createType(((IASTTypeIdExpression) exp).getTypeId());
|
||||||
case IASTTypeIdExpression.op_sizeof:
|
if (type instanceof ICPPUnknownType)
|
||||||
ASTTranslationUnit ast = (ASTTranslationUnit) typeIdEx.getTranslationUnit();
|
return null;
|
||||||
final IType type = ast.createType(typeIdEx.getTypeId());
|
return applyUnaryTypeIdOperator(((IASTTypeIdExpression) exp).getOperator(), type, exp);
|
||||||
if (type instanceof ICPPUnknownType)
|
}
|
||||||
return null;
|
|
||||||
SizeofCalculator calculator = ast.getSizeofCalculator();
|
if (exp instanceof IASTBinaryTypeIdExpression) {
|
||||||
SizeAndAlignment info = calculator.sizeAndAlignment(type);
|
|
||||||
if (info == null)
|
|
||||||
throw UNKNOWN_EX;
|
|
||||||
return info.size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw UNKNOWN_EX;
|
throw UNKNOWN_EX;
|
||||||
}
|
}
|
||||||
|
@ -422,10 +536,10 @@ public class Value implements IValue {
|
||||||
final Long value= evaluate(exp.getOperand(), maxdepth);
|
final Long value= evaluate(exp.getOperand(), maxdepth);
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return null;
|
return null;
|
||||||
return combineUnary(unaryOp, value);
|
return applyUnaryOperator(unaryOp, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long combineUnary(final int unaryOp, final long value) throws UnknownValueException {
|
private static long applyUnaryOperator(final int unaryOp, final long value) throws UnknownValueException {
|
||||||
switch (unaryOp) {
|
switch (unaryOp) {
|
||||||
case IASTUnaryExpression.op_bracketedPrimary:
|
case IASTUnaryExpression.op_bracketedPrimary:
|
||||||
case IASTUnaryExpression.op_plus:
|
case IASTUnaryExpression.op_plus:
|
||||||
|
@ -470,10 +584,10 @@ public class Value implements IValue {
|
||||||
if (o2 == null)
|
if (o2 == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return combineBinary(op, o1, o2);
|
return applyBinaryOperator(op, o1, o2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long combineBinary(final int op, final long v1, final long v2)
|
private static long applyBinaryOperator(final int op, final long v1, final long v2)
|
||||||
throws UnknownValueException {
|
throws UnknownValueException {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case IASTBinaryExpression.op_multiply:
|
case IASTBinaryExpression.op_multiply:
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -40,16 +40,12 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
|
||||||
public CPPASTTypeIdExpression copy() {
|
public CPPASTTypeIdExpression copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTTypeIdExpression copy(CopyStyle style) {
|
public CPPASTTypeIdExpression copy(CopyStyle style) {
|
||||||
CPPASTTypeIdExpression copy = new CPPASTTypeIdExpression(op, typeId == null ? null
|
CPPASTTypeIdExpression copy =
|
||||||
: typeId.copy(style));
|
new CPPASTTypeIdExpression(op, typeId == null ? null : typeId.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
return copy(copy, style);
|
||||||
if (style == CopyStyle.withLocations) {
|
|
||||||
copy.setCopyLocation(this);
|
|
||||||
}
|
|
||||||
return copy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,11 +62,11 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
|
||||||
@Override
|
@Override
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
if (typeId != null) {
|
if (typeId != null) {
|
||||||
typeId.setParent(this);
|
typeId.setParent(this);
|
||||||
typeId.setPropertyInParent(TYPE_ID);
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,9 +83,9 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeId != null && !typeId.accept(action)) return false;
|
if (typeId != null && !typeId.accept(action)) return false;
|
||||||
|
|
||||||
if (action.shouldVisitExpressions) {
|
if (action.shouldVisitExpressions) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT: return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
@ -99,7 +95,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation getEvaluation() {
|
public ICPPEvaluation getEvaluation() {
|
||||||
if (fEvaluation == null) {
|
if (fEvaluation == null) {
|
||||||
|
@ -112,7 +108,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
|
||||||
}
|
}
|
||||||
return fEvaluation;
|
return fEvaluation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IType getExpressionType() {
|
public IType getExpressionType() {
|
||||||
return getEvaluation().getTypeOrFunctionSet(this);
|
return getEvaluation().getTypeOrFunctionSet(this);
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ARRAY;
|
|
||||||
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 java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -39,7 +36,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -60,8 +56,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
@ -78,8 +74,8 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds common implementation of methods for ICPPClassType implementations that have
|
* Holds common implementation of methods for ICPPClassType implementations that have
|
||||||
* a corresponding textual definition in the source code.
|
* a corresponding textual definition in the source code.
|
||||||
*
|
*
|
||||||
* @see CPPClassType
|
* @see CPPClassType
|
||||||
* @see CPPClassTemplate
|
* @see CPPClassTemplate
|
||||||
*/
|
*/
|
||||||
|
@ -101,8 +97,9 @@ public class ClassTypeHelper {
|
||||||
ObjectSet<IBinding> resultSet = new ObjectSet<IBinding>(2);
|
ObjectSet<IBinding> resultSet = new ObjectSet<IBinding>(2);
|
||||||
IASTDeclaration[] members = host.getCompositeTypeSpecifier().getMembers();
|
IASTDeclaration[] members = host.getCompositeTypeSpecifier().getMembers();
|
||||||
for (IASTDeclaration decl : members) {
|
for (IASTDeclaration decl : members) {
|
||||||
while (decl instanceof ICPPASTTemplateDeclaration)
|
while (decl instanceof ICPPASTTemplateDeclaration) {
|
||||||
decl = ((ICPPASTTemplateDeclaration) decl).getDeclaration();
|
decl = ((ICPPASTTemplateDeclaration) decl).getDeclaration();
|
||||||
|
}
|
||||||
|
|
||||||
if (decl instanceof IASTSimpleDeclaration) {
|
if (decl instanceof IASTSimpleDeclaration) {
|
||||||
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) decl).getDeclSpecifier();
|
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) decl).getDeclSpecifier();
|
||||||
|
@ -115,7 +112,7 @@ public class ClassTypeHelper {
|
||||||
if (dtor == null) break;
|
if (dtor == null) break;
|
||||||
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
||||||
resultSet.put(dtor.getName().resolveBinding());
|
resultSet.put(dtor.getName().resolveBinding());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (decl instanceof IASTFunctionDefinition) {
|
} else if (decl instanceof IASTFunctionDefinition) {
|
||||||
|
@ -134,7 +131,7 @@ public class ClassTypeHelper {
|
||||||
/**
|
/**
|
||||||
* Checks if a binding is a friend of a class. Only classes and functions can be friends of a class.
|
* Checks if a binding is a friend of a class. Only classes and functions can be friends of a class.
|
||||||
* A class is considered a friend of itself.
|
* A class is considered a friend of itself.
|
||||||
* @param binding a binding.
|
* @param binding a binding.
|
||||||
* @param classType a class.
|
* @param classType a class.
|
||||||
* @return <code>true</code> if <code>binding</code> is a friend of <code>classType</code>.
|
* @return <code>true</code> if <code>binding</code> is a friend of <code>classType</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -198,7 +195,7 @@ public class ClassTypeHelper {
|
||||||
bindings[i] = new CPPBaseClause(bases[i]);
|
bindings[i] = new CPPBaseClause(bases[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bindings;
|
return bindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICPPField[] getDeclaredFields(ICPPInternalClassTypeMixinHost host) {
|
public static ICPPField[] getDeclaredFields(ICPPInternalClassTypeMixinHost host) {
|
||||||
|
@ -278,7 +275,7 @@ public class ClassTypeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all direct and indirect base classes.
|
* Returns all direct and indirect base classes.
|
||||||
* @param classType a class
|
* @param classType a class
|
||||||
* @return An array of visible base classes in arbitrary order.
|
* @return An array of visible base classes in arbitrary order.
|
||||||
*/
|
*/
|
||||||
|
@ -296,7 +293,7 @@ public class ClassTypeHelper {
|
||||||
IBinding b= base.getBaseClass();
|
IBinding b= base.getBaseClass();
|
||||||
if (b instanceof ICPPClassType) {
|
if (b instanceof ICPPClassType) {
|
||||||
final ICPPClassType baseClass = (ICPPClassType) b;
|
final ICPPClassType baseClass = (ICPPClassType) b;
|
||||||
if (result.add(baseClass)) {
|
if (result.add(baseClass)) {
|
||||||
getAllBases(baseClass, result, point);
|
getAllBases(baseClass, result, point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -346,7 +343,7 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns methods either declared by the given class or generated by the compiler. Does not
|
* Returns methods either declared by the given class or generated by the compiler. Does not
|
||||||
* include methods declared in base classes.
|
* include methods declared in base classes.
|
||||||
*/
|
*/
|
||||||
private static ObjectSet<ICPPMethod> getOwnMethods(ICPPClassType classType, IASTNode point) {
|
private static ObjectSet<ICPPMethod> getOwnMethods(ICPPClassType classType, IASTNode point) {
|
||||||
ObjectSet<ICPPMethod> set= new ObjectSet<ICPPMethod>(4);
|
ObjectSet<ICPPMethod> set= new ObjectSet<ICPPMethod>(4);
|
||||||
|
@ -460,7 +457,7 @@ public class ClassTypeHelper {
|
||||||
}
|
}
|
||||||
if (binding instanceof ICPPClassType)
|
if (binding instanceof ICPPClassType)
|
||||||
result = ArrayUtil.append(ICPPClassType.class, result, (ICPPClassType) binding);
|
result = ArrayUtil.append(ICPPClassType.class, result, (ICPPClassType) binding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ArrayUtil.trim(ICPPClassType.class, result);
|
return ArrayUtil.trim(ICPPClassType.class, result);
|
||||||
}
|
}
|
||||||
|
@ -498,7 +495,7 @@ public class ClassTypeHelper {
|
||||||
public static boolean isVirtual(ICPPMethod m) {
|
public static boolean isVirtual(ICPPMethod m) {
|
||||||
if (m instanceof ICPPConstructor)
|
if (m instanceof ICPPConstructor)
|
||||||
return false;
|
return false;
|
||||||
if (m.isVirtual())
|
if (m.isVirtual())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
final char[] mname= m.getNameCharArray();
|
final char[] mname= m.getNameCharArray();
|
||||||
|
@ -528,7 +525,7 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
IType[] paramsA = a.getParameterTypes();
|
IType[] paramsA = a.getParameterTypes();
|
||||||
IType[] paramsB = b.getParameterTypes();
|
IType[] paramsB = b.getParameterTypes();
|
||||||
|
|
||||||
if (paramsA.length == 1 && paramsB.length == 0) {
|
if (paramsA.length == 1 && paramsB.length == 0) {
|
||||||
if (!SemanticUtil.isVoidType(paramsA[0]))
|
if (!SemanticUtil.isVoidType(paramsA[0]))
|
||||||
return false;
|
return false;
|
||||||
|
@ -550,9 +547,9 @@ public class ClassTypeHelper {
|
||||||
* Returns {@code true} if {@code source} overrides {@code target}.
|
* Returns {@code true} if {@code source} overrides {@code target}.
|
||||||
*/
|
*/
|
||||||
public static boolean isOverrider(ICPPMethod source, ICPPMethod target) {
|
public static boolean isOverrider(ICPPMethod source, ICPPMethod target) {
|
||||||
if (source instanceof ICPPConstructor || target instanceof ICPPConstructor)
|
if (source instanceof ICPPConstructor || target instanceof ICPPConstructor)
|
||||||
return false;
|
return false;
|
||||||
if (!isVirtual(target))
|
if (!isVirtual(target))
|
||||||
return false;
|
return false;
|
||||||
if (!functionTypesAllowOverride(source.getType(), target.getType()))
|
if (!functionTypesAllowOverride(source.getType(), target.getType()))
|
||||||
return false;
|
return false;
|
||||||
|
@ -580,7 +577,7 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
final char[] mname= method.getNameCharArray();
|
final char[] mname= method.getNameCharArray();
|
||||||
final ICPPClassType mcl= method.getClassOwner();
|
final ICPPClassType mcl= method.getClassOwner();
|
||||||
if (mcl == null)
|
if (mcl == null)
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
||||||
final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>();
|
final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>();
|
||||||
|
@ -646,14 +643,14 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all methods found in the index, that override the given {@code method}.
|
* Returns all methods found in the index, that override the given {@code method}.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method) throws CoreException {
|
public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method) throws CoreException {
|
||||||
if (!isVirtual(method))
|
if (!isVirtual(method))
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
||||||
final ICPPClassType mcl= method.getClassOwner();
|
final ICPPClassType mcl= method.getClassOwner();
|
||||||
if (mcl == null)
|
if (mcl == null)
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
||||||
ICPPClassType[] subclasses= getSubClasses(index, mcl);
|
ICPPClassType[] subclasses= getSubClasses(index, mcl);
|
||||||
|
@ -714,24 +711,76 @@ public class ClassTypeHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int KIND_DEFAULT_CTOR= 0;
|
public enum MethodKind {
|
||||||
private static final int KIND_COPY_CTOR= 1;
|
DEFAULT_CTOR,
|
||||||
private static final int KIND_ASSIGNMENT_OP= 2;
|
COPY_CTOR,
|
||||||
private static final int KIND_DTOR= 3;
|
MOVE_CTOR,
|
||||||
private static final int KIND_OTHER= 4;
|
COPY_ASSIGNMENT_OP,
|
||||||
|
MOVE_ASSIGNMENT_OP,
|
||||||
|
DTOR,
|
||||||
|
OTHER
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MethodKind getMethodKind(ICPPClassType classType, ICPPMethod method) {
|
||||||
|
if (method instanceof ICPPConstructor) {
|
||||||
|
final List<IType> params= getTypesOfRequiredParameters(method);
|
||||||
|
if (params.isEmpty())
|
||||||
|
return MethodKind.DEFAULT_CTOR;
|
||||||
|
if (params.size() == 1) {
|
||||||
|
IType t= SemanticUtil.getNestedType(params.get(0), SemanticUtil.TDEF);
|
||||||
|
if (SemanticUtil.isVoidType(t))
|
||||||
|
return MethodKind.DEFAULT_CTOR;
|
||||||
|
|
||||||
|
ICPPReferenceType refToClass = getRefToClass(classType, t);
|
||||||
|
if (refToClass != null)
|
||||||
|
return refToClass.isRValueReference() ? MethodKind.MOVE_CTOR : MethodKind.COPY_CTOR;
|
||||||
|
}
|
||||||
|
return MethodKind.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method.isDestructor())
|
||||||
|
return MethodKind.DTOR;
|
||||||
|
|
||||||
|
if (CharArrayUtils.equals(method.getNameCharArray(), OverloadableOperator.ASSIGN.toCharArray())) {
|
||||||
|
final List<IType> params= getTypesOfRequiredParameters(method);
|
||||||
|
if (params.size() == 1) {
|
||||||
|
IType t= params.get(0);
|
||||||
|
ICPPReferenceType refToClass = getRefToClass(classType, t);
|
||||||
|
if (refToClass != null)
|
||||||
|
return refToClass.isRValueReference() ? MethodKind.MOVE_ASSIGNMENT_OP : MethodKind.COPY_ASSIGNMENT_OP;
|
||||||
|
}
|
||||||
|
return MethodKind.OTHER;
|
||||||
|
}
|
||||||
|
return MethodKind.OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For implicit methods the exception specification is inherited, search it
|
* Returns types of method parameters that don't have defaults.
|
||||||
|
*/
|
||||||
|
private static List<IType> getTypesOfRequiredParameters(ICPPMethod method) {
|
||||||
|
ICPPParameter[] parameters = method.getParameters();
|
||||||
|
if (parameters.length == 0)
|
||||||
|
return Collections.emptyList();
|
||||||
|
List<IType> types = new ArrayList<IType>(parameters.length);
|
||||||
|
for (ICPPParameter parameter : parameters) {
|
||||||
|
if (!parameter.hasDefaultValue() && !parameter.isParameterPack())
|
||||||
|
types.add(parameter.getType());
|
||||||
|
}
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For implicit methods the exception specification is inherited, search it.
|
||||||
*/
|
*/
|
||||||
public static IType[] getInheritedExceptionSpecification(ICPPMethod implicitMethod, IASTNode point) {
|
public static IType[] getInheritedExceptionSpecification(ICPPMethod implicitMethod, IASTNode point) {
|
||||||
// See 15.4.13
|
// See 15.4.13
|
||||||
ICPPClassType owner= implicitMethod.getClassOwner();
|
ICPPClassType owner= implicitMethod.getClassOwner();
|
||||||
if (owner == null || ClassTypeHelper.getBases(owner, point).length == 0)
|
if (owner == null || ClassTypeHelper.getBases(owner, point).length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// we use a list as types aren't comparable, and can have duplicates (15.4.6)
|
// We use a list as types aren't comparable, and can have duplicates (15.4.6)
|
||||||
int kind= getImplicitMethodKind(owner, implicitMethod);
|
MethodKind kind= getMethodKind(owner, implicitMethod);
|
||||||
if (kind == KIND_OTHER)
|
if (kind == MethodKind.OTHER)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<IType> inheritedTypeids = new ArrayList<IType>();
|
List<IType> inheritedTypeids = new ArrayList<IType>();
|
||||||
|
@ -741,7 +790,7 @@ public class ClassTypeHelper {
|
||||||
ICPPMethod baseMethod= getMethodInClass(base, kind, point);
|
ICPPMethod baseMethod= getMethodInClass(base, kind, point);
|
||||||
if (baseMethod != null) {
|
if (baseMethod != null) {
|
||||||
IType[] baseExceptionSpec= baseMethod.getExceptionSpecification();
|
IType[] baseExceptionSpec= baseMethod.getExceptionSpecification();
|
||||||
if (baseExceptionSpec == null)
|
if (baseExceptionSpec == null)
|
||||||
return null;
|
return null;
|
||||||
for (IType baseTypeId : baseMethod.getExceptionSpecification()) {
|
for (IType baseTypeId : baseMethod.getExceptionSpecification()) {
|
||||||
inheritedTypeids.add(baseTypeId);
|
inheritedTypeids.add(baseTypeId);
|
||||||
|
@ -752,275 +801,71 @@ public class ClassTypeHelper {
|
||||||
return inheritedTypeids.toArray(new IType[inheritedTypeids.size()]);
|
return inheritedTypeids.toArray(new IType[inheritedTypeids.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getImplicitMethodKind(ICPPClassType ct, ICPPMethod method) {
|
/**
|
||||||
if (method instanceof ICPPConstructor) {
|
* If {@code type} is a, possibly qualified, reference type referring to {@code classType},
|
||||||
final IFunctionType type= method.getType();
|
* returns that reference type. Otherwise returns {@code null}.
|
||||||
final IType[] params= type.getParameterTypes();
|
*/
|
||||||
if (params.length == 0)
|
private static ICPPReferenceType getRefToClass(ICPPClassType classType, IType type) {
|
||||||
return KIND_DEFAULT_CTOR;
|
while (type instanceof ITypedef) {
|
||||||
if (params.length == 1) {
|
type= ((ITypedef) type).getType();
|
||||||
IType t= SemanticUtil.getNestedType(params[0], SemanticUtil.TDEF);
|
|
||||||
if (SemanticUtil.isVoidType(t))
|
|
||||||
return KIND_DEFAULT_CTOR;
|
|
||||||
|
|
||||||
if (isRefToConstClass(ct, t))
|
|
||||||
return KIND_COPY_CTOR;
|
|
||||||
}
|
|
||||||
return KIND_OTHER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method.isDestructor())
|
if (type instanceof ICPPReferenceType) {
|
||||||
return KIND_DTOR;
|
ICPPReferenceType refType = (ICPPReferenceType) type;
|
||||||
|
type= refType.getType();
|
||||||
if (CharArrayUtils.equals(method.getNameCharArray(), OverloadableOperator.ASSIGN.toCharArray())) {
|
while (type instanceof ITypedef) {
|
||||||
final IFunctionType type= method.getType();
|
type= ((ITypedef) type).getType();
|
||||||
final IType[] params= type.getParameterTypes();
|
}
|
||||||
if (params.length == 1) {
|
if (type instanceof IQualifierType) {
|
||||||
IType t= params[0];
|
type= ((IQualifierType) type).getType();
|
||||||
if (isRefToConstClass(ct, t))
|
if (classType.isSameType(type))
|
||||||
return KIND_ASSIGNMENT_OP;
|
return refType;
|
||||||
}
|
}
|
||||||
return KIND_OTHER;
|
|
||||||
}
|
}
|
||||||
return KIND_OTHER;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isRefToConstClass(ICPPClassType ct, IType t) {
|
private static ICPPMethod getMethodInClass(ICPPClassType ct, MethodKind kind, IASTNode point) {
|
||||||
while (t instanceof ITypedef)
|
|
||||||
t= ((ITypedef) t).getType();
|
|
||||||
|
|
||||||
if (t instanceof ICPPReferenceType) {
|
|
||||||
t= ((ICPPReferenceType) t).getType();
|
|
||||||
while (t instanceof ITypedef)
|
|
||||||
t= ((ITypedef) t).getType();
|
|
||||||
if (t instanceof IQualifierType) {
|
|
||||||
t= ((IQualifierType) t).getType();
|
|
||||||
return ct.isSameType(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ICPPMethod getMethodInClass(ICPPClassType ct, int kind, IASTNode point) {
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case KIND_DEFAULT_CTOR:
|
case DEFAULT_CTOR:
|
||||||
case KIND_COPY_CTOR:
|
case COPY_CTOR:
|
||||||
|
case MOVE_CTOR:
|
||||||
for (ICPPConstructor ctor : getConstructors(ct, point)) {
|
for (ICPPConstructor ctor : getConstructors(ct, point)) {
|
||||||
if (!ctor.isImplicit() && getImplicitMethodKind(ct, ctor) == kind)
|
if (!ctor.isImplicit() && getMethodKind(ct, ctor) == kind)
|
||||||
return ctor;
|
return ctor;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case KIND_ASSIGNMENT_OP:
|
case COPY_ASSIGNMENT_OP:
|
||||||
|
case MOVE_ASSIGNMENT_OP:
|
||||||
for (ICPPMethod method : getDeclaredMethods(ct, point)) {
|
for (ICPPMethod method : getDeclaredMethods(ct, point)) {
|
||||||
if (method instanceof ICPPConstructor)
|
if (method instanceof ICPPConstructor)
|
||||||
continue;
|
continue;
|
||||||
if (getImplicitMethodKind(ct, method) == kind)
|
if (getMethodKind(ct, method) == kind)
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case KIND_DTOR:
|
case DTOR:
|
||||||
for (ICPPMethod method : getDeclaredMethods(ct, point)) {
|
for (ICPPMethod method : getDeclaredMethods(ct, point)) {
|
||||||
if (method.isDestructor())
|
if (method.isDestructor())
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
case OTHER:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 8.5.1 Aggregates [dcl.init.aggr]
|
|
||||||
* An aggregate is an array or a class (Clause 9) with no user-provided constructors (12.1),
|
|
||||||
* no private or protected non-static data members (Clause 11),
|
|
||||||
* no base classes (Clause 10), and no virtual functions (10.3).
|
|
||||||
*/
|
|
||||||
public static boolean isAggregateClass(ICPPClassType classTarget, IASTNode point) {
|
|
||||||
if (ClassTypeHelper.getBases(classTarget, point).length > 0)
|
|
||||||
return false;
|
|
||||||
ICPPMethod[] methods = ClassTypeHelper.getDeclaredMethods(classTarget, point);
|
|
||||||
for (ICPPMethod m : methods) {
|
|
||||||
if (m instanceof ICPPConstructor)
|
|
||||||
return false;
|
|
||||||
if (m.isVirtual()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classTarget, point);
|
|
||||||
for (ICPPField field : fields) {
|
|
||||||
if (!(field.getVisibility() == ICPPMember.v_public || field.isStatic())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial copy constructor.
|
|
||||||
* A copy constructor is trivial if:
|
|
||||||
* <ul>
|
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
|
||||||
* <li><code>isPolymorphic(classTarget) == false</code>, and</li>
|
|
||||||
* <li>the class has no virtual base classes, and</li>
|
|
||||||
* <li>every direct base class has trivial copy constructor, and</li>
|
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
|
||||||
* has trivial copy constructor.</li>
|
|
||||||
* </ul>
|
|
||||||
* Similar to <code>std::tr1::has_trivial_copy</code>.
|
|
||||||
*
|
|
||||||
* @param classTarget the class to check
|
|
||||||
* @return <code>true</code> if the class has a trivial copy constructor
|
|
||||||
*/
|
|
||||||
public static boolean hasTrivialCopyCtor(ICPPClassType classTarget, IASTNode point) {
|
|
||||||
if (getImplicitCopyCtor(classTarget) == null)
|
|
||||||
return false;
|
|
||||||
if (isPolymorphic(classTarget))
|
|
||||||
return false;
|
|
||||||
for (ICPPBase base : classTarget.getBases()) {
|
|
||||||
if (base.isVirtual())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPClassType baseClass : getAllBases(classTarget, point)) {
|
|
||||||
if (!classTarget.isSameType(baseClass) && !hasTrivialCopyCtor(baseClass, point))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPField field : classTarget.getDeclaredFields()) {
|
|
||||||
if (!field.isStatic()) {
|
|
||||||
IType type = field.getType();
|
|
||||||
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
|
||||||
if (type instanceof ICPPClassType && !classTarget.isSameType(type) &&
|
|
||||||
!hasTrivialCopyCtor((ICPPClassType) type, point)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the compiler-generated copy constructor for the given class, or <code>null</code>
|
|
||||||
* if the class doesn't have a compiler-generated copy constructor.
|
|
||||||
*
|
|
||||||
* @param classTarget the class to get the copy ctor for.
|
|
||||||
* @return the compiler-generated copy constructor, or <code>null</code> if the class doesn't
|
|
||||||
* have a compiler-generated copy constructor.
|
|
||||||
*/
|
|
||||||
private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classTarget) {
|
|
||||||
for (ICPPConstructor ctor : classTarget.getConstructors()) {
|
|
||||||
if (ctor.isImplicit() && getImplicitMethodKind(classTarget, ctor) == KIND_COPY_CTOR)
|
|
||||||
return ctor;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial default constructor.
|
|
||||||
* A default constructor is trivial if:
|
|
||||||
* <ul>
|
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
|
||||||
* <li>every direct base class has trivial default constructor, and</li>
|
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
|
||||||
* has trivial default constructor.</li>
|
|
||||||
* </ul>
|
|
||||||
* Similar to <code>std::tr1::has_trivial_default_constructor</code>.
|
|
||||||
*
|
|
||||||
* @param classTarget the class to check
|
|
||||||
* @param point
|
|
||||||
* @return <code>true</code> if the class has a trivial default constructor
|
|
||||||
*/
|
|
||||||
public static boolean hasTrivialDefaultConstructor(ICPPClassType classTarget, IASTNode point) {
|
|
||||||
for (ICPPConstructor ctor : getConstructors(classTarget, point)) {
|
|
||||||
if (!ctor.isImplicit() && ctor.getParameters().length == 0)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPClassType baseClass : getAllBases(classTarget, null)) {
|
|
||||||
if (!classTarget.isSameType(baseClass) && !hasTrivialDefaultConstructor(baseClass, point))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPField field : getDeclaredFields(classTarget, point)) {
|
|
||||||
if (!field.isStatic()) {
|
|
||||||
IType type = field.getType();
|
|
||||||
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
|
||||||
if (type instanceof ICPPClassType && !classTarget.isSameType(type) &&
|
|
||||||
!hasTrivialDefaultConstructor((ICPPClassType) type, point)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial destructor.
|
|
||||||
* A destructor is trivial if:
|
|
||||||
* <ul>
|
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
|
||||||
* <li>every direct base class has trivial destructor, and</li>
|
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
|
||||||
* has trivial destructor.</li>
|
|
||||||
* </ul>
|
|
||||||
* Similar to <code>std::tr1::has_trivial_destructor</code>.
|
|
||||||
*
|
|
||||||
* @param classTarget the class to check
|
|
||||||
* @return <code>true</code> if the class has a trivial destructor
|
|
||||||
*/
|
|
||||||
public static boolean hasTrivialDestructor(ICPPClassType classTarget, IASTNode point) {
|
|
||||||
for (ICPPMethod method : getDeclaredMethods(classTarget, point)) {
|
|
||||||
if (method.isDestructor())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPClassType baseClass : getAllBases(classTarget, null)) {
|
|
||||||
if (!classTarget.isSameType(baseClass) && !hasTrivialDestructor(baseClass, point))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (ICPPField field : getDeclaredFields(classTarget, point)) {
|
|
||||||
if (!field.isStatic()) {
|
|
||||||
IType type = field.getType();
|
|
||||||
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
|
||||||
if (type instanceof ICPPClassType && !classTarget.isSameType(type) &&
|
|
||||||
!hasTrivialDestructor((ICPPClassType) type, point)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if and only if the given class declares or inherits a virtual
|
|
||||||
* function. Similar to <code>std::tr1::is_polymorphic</code>.
|
|
||||||
*
|
|
||||||
* @param classTarget the class to check
|
|
||||||
* @return <code>true</code> if the class declares or inherits a virtual function.
|
|
||||||
*/
|
|
||||||
public static boolean isPolymorphic(ICPPClassType classTarget) {
|
|
||||||
if (hasDeclaredVirtualMethod(classTarget))
|
|
||||||
return true;
|
|
||||||
for (ICPPClassType baseClass : getAllBases(classTarget, null)) {
|
|
||||||
if (hasDeclaredVirtualMethod(baseClass))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasDeclaredVirtualMethod(ICPPClassType classTarget) {
|
|
||||||
for (ICPPMethod method : classTarget.getDeclaredMethods()) {
|
|
||||||
if (method.isVirtual()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether class is abstract, i.e. has pure virtual functions that were
|
* Checks whether class is abstract, i.e. has pure virtual functions that were
|
||||||
* not implemented in base after declaration.
|
* not implemented in base after declaration.
|
||||||
*
|
*
|
||||||
* NOTE: The method produces complete results for template instantiations
|
* NOTE: The method produces complete results for template instantiations
|
||||||
* but doesn't take into account base classes and methods dependent on unspecified
|
* but doesn't take into account base classes and methods dependent on unspecified
|
||||||
* template parameters.
|
* template parameters.
|
||||||
*/
|
*/
|
||||||
public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType, IASTNode point) {
|
public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType, IASTNode point) {
|
||||||
Map<String, List<ICPPMethod>> result= collectPureVirtualMethods(classType,
|
Map<String, List<ICPPMethod>> result= collectPureVirtualMethods(classType,
|
||||||
new HashMap<ICPPClassType, Map<String, List<ICPPMethod>>>(), point);
|
new HashMap<ICPPClassType, Map<String, List<ICPPMethod>>>(), point);
|
||||||
|
|
||||||
int resultArraySize = 0;
|
int resultArraySize = 0;
|
||||||
|
|
|
@ -23,12 +23,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
|
@ -250,11 +247,4 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static SizeAndAlignment getSizeAndAlignment(IType type, IASTNode point) {
|
|
||||||
SizeofCalculator calc = point == null ?
|
|
||||||
SizeofCalculator.getDefault() :
|
|
||||||
((ASTTranslationUnit) point.getTranslationUnit()).getSizeofCalculator();
|
|
||||||
return calc.sizeAndAlignment(type);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.VariableReadWriteFlags;
|
import org.eclipse.cdt.internal.core.dom.parser.VariableReadWriteFlags;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +60,7 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
|
||||||
IType type = CPPVisitor.createType(parent);
|
IType type = CPPVisitor.createType(parent);
|
||||||
if (type instanceof ICPPUnknownType ||
|
if (type instanceof ICPPUnknownType ||
|
||||||
type instanceof ICPPClassType &&
|
type instanceof ICPPClassType &&
|
||||||
!ClassTypeHelper.hasTrivialDefaultConstructor((ICPPClassType) type, parent)) {
|
!TypeTraits.hasTrivialDefaultConstructor((ICPPClassType) type, parent)) {
|
||||||
return WRITE;
|
return WRITE;
|
||||||
}
|
}
|
||||||
return super.rwInDeclarator(parent, indirection);
|
return super.rwInDeclarator(parent, indirection);
|
||||||
|
|
|
@ -368,7 +368,7 @@ public class Conversions {
|
||||||
return Cost.NO_CONVERSION;
|
return Cost.NO_CONVERSION;
|
||||||
|
|
||||||
ICPPClassType classTarget= (ICPPClassType) noCVTarget;
|
ICPPClassType classTarget= (ICPPClassType) noCVTarget;
|
||||||
if (ClassTypeHelper.isAggregateClass(classTarget, point)) {
|
if (TypeTraits.isAggregateClass(classTarget, point)) {
|
||||||
Cost cost= new Cost(arg.getTypeOrFunctionSet(point), target, Rank.IDENTITY);
|
Cost cost= new Cost(arg.getTypeOrFunctionSet(point), target, Rank.IDENTITY);
|
||||||
cost.setUserDefinedConversion(null);
|
cost.setUserDefinedConversion(null);
|
||||||
return cost;
|
return cost;
|
||||||
|
|
|
@ -20,14 +20,12 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -83,13 +81,7 @@ public class EvalBinaryTypeId extends CPPEvaluation {
|
||||||
if (isValueDependent())
|
if (isValueDependent())
|
||||||
return Value.create(this);
|
return Value.create(this);
|
||||||
|
|
||||||
switch (fOperator) {
|
return Value.evaluateBinaryTypeIdExpression(fOperator, fType1, fType2, point);
|
||||||
case __is_base_of:
|
|
||||||
if (!(fType1 instanceof ICPPClassType) || !(fType1 instanceof ICPPClassType))
|
|
||||||
return Value.UNKNOWN;
|
|
||||||
return Value.create(ClassTypeHelper.isSubclass((ICPPClassType) fType2, (ICPPClassType) fType1));
|
|
||||||
}
|
|
||||||
return Value.create(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,6 +49,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArithmeticConversion;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArithmeticConversion;
|
||||||
|
@ -219,11 +220,11 @@ public class EvalUnary extends CPPEvaluation {
|
||||||
|
|
||||||
switch (fOperator) {
|
switch (fOperator) {
|
||||||
case op_sizeof: {
|
case op_sizeof: {
|
||||||
SizeAndAlignment info = getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
|
SizeAndAlignment info = SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
|
||||||
return info == null ? Value.UNKNOWN : Value.create(info.size);
|
return info == null ? Value.UNKNOWN : Value.create(info.size);
|
||||||
}
|
}
|
||||||
case op_alignOf: {
|
case op_alignOf: {
|
||||||
SizeAndAlignment info = getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
|
SizeAndAlignment info = SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point);
|
||||||
return info == null ? Value.UNKNOWN : Value.create(info.alignment);
|
return info == null ? Value.UNKNOWN : Value.create(info.alignment);
|
||||||
}
|
}
|
||||||
case op_noexcept:
|
case op_noexcept:
|
||||||
|
|
|
@ -37,8 +37,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeof;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
|
@ -46,7 +44,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
|
@ -163,55 +160,7 @@ public class EvalUnaryTypeID extends CPPEvaluation {
|
||||||
if (isValueDependent())
|
if (isValueDependent())
|
||||||
return Value.create(this);
|
return Value.create(this);
|
||||||
|
|
||||||
switch (fOperator) {
|
return Value.evaluateUnaryTypeIdExpression(fOperator, fOrigType, point);
|
||||||
case op_sizeof: {
|
|
||||||
SizeAndAlignment info = getSizeAndAlignment(fOrigType, point);
|
|
||||||
return info == null ? Value.UNKNOWN : Value.create(info.size);
|
|
||||||
}
|
|
||||||
case op_alignof: {
|
|
||||||
SizeAndAlignment info = getSizeAndAlignment(fOrigType, point);
|
|
||||||
return info == null ? Value.UNKNOWN : Value.create(info.alignment);
|
|
||||||
}
|
|
||||||
case op_typeid:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_nothrow_copy:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_nothrow_constructor:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_trivial_assign:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_trivial_constructor:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_trivial_copy:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_trivial_destructor:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_has_virtual_destructor:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_abstract:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_class:
|
|
||||||
return Value.create(fOrigType instanceof ICompositeType && ((ICompositeType) fOrigType).getKey() != ICompositeType.k_union);
|
|
||||||
case op_is_empty:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_enum:
|
|
||||||
return Value.create(fOrigType instanceof IEnumeration);
|
|
||||||
case op_is_literal_type:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_pod:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_polymorphic:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_standard_layout:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_trivial:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
case op_is_union:
|
|
||||||
return Value.create(fOrigType instanceof ICompositeType && ((ICompositeType) fOrigType).getKey() == ICompositeType.k_union);
|
|
||||||
case op_typeof:
|
|
||||||
return Value.UNKNOWN; // TODO(sprigogin): Implement
|
|
||||||
}
|
|
||||||
return Value.create(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,328 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 Google, 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:
|
||||||
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
||||||
|
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ARRAY;
|
||||||
|
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 org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper.MethodKind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of static methods for determining type traits.
|
||||||
|
*/
|
||||||
|
public class TypeTraits {
|
||||||
|
private TypeTraits() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C++11: 9-6
|
||||||
|
*/
|
||||||
|
public static boolean isTrivial(ICPPClassType classType, IASTNode point) {
|
||||||
|
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
||||||
|
if (method.isVirtual())
|
||||||
|
return false;
|
||||||
|
switch (ClassTypeHelper.getMethodKind(classType, method)) {
|
||||||
|
case DEFAULT_CTOR:
|
||||||
|
case COPY_CTOR:
|
||||||
|
case MOVE_CTOR:
|
||||||
|
case COPY_ASSIGNMENT_OP:
|
||||||
|
case MOVE_ASSIGNMENT_OP:
|
||||||
|
case DTOR:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
|
||||||
|
for (ICPPField field : fields) {
|
||||||
|
if (!field.isStatic()) {
|
||||||
|
IType fieldType = SemanticUtil.getNestedType(field.getType(), TDEF);
|
||||||
|
if (fieldType instanceof ICPPClassType && !isTrivial((ICPPClassType) fieldType, point))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
|
||||||
|
if (base.isVirtual())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, point);
|
||||||
|
for (ICPPClassType baseClass : baseClasses) {
|
||||||
|
if (!isTrivial(baseClass, point))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C++11: 9-7
|
||||||
|
*/
|
||||||
|
public static boolean isStandardLayout(IType type, IASTNode point) {
|
||||||
|
type = SemanticUtil.getNestedType(type, ARRAY | CVTYPE | TDEF);
|
||||||
|
if (type instanceof ICPPReferenceType)
|
||||||
|
return false;
|
||||||
|
if (!(type instanceof ICPPClassType))
|
||||||
|
return true;
|
||||||
|
ICPPClassType classType = (ICPPClassType) type;
|
||||||
|
int visibility = 0;
|
||||||
|
ICPPField firstNonStaticField = null;
|
||||||
|
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
|
||||||
|
for (ICPPField field : fields) {
|
||||||
|
if (!field.isStatic()) {
|
||||||
|
if (!isStandardLayout(field.getType(), point))
|
||||||
|
return false;
|
||||||
|
int vis = field.getVisibility();
|
||||||
|
if (visibility == 0) {
|
||||||
|
visibility = vis;
|
||||||
|
} else if (vis != visibility) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (firstNonStaticField == null)
|
||||||
|
firstNonStaticField = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasDeclaredVirtualMethod(classType, point))
|
||||||
|
return false;
|
||||||
|
for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
|
||||||
|
if (base.isVirtual())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, point);
|
||||||
|
for (ICPPClassType baseClass : baseClasses) {
|
||||||
|
if (!isStandardLayout(baseClass, point))
|
||||||
|
return false;
|
||||||
|
if (firstNonStaticField != null) {
|
||||||
|
if (TypeTraits.hasNonStaticFields(baseClass, point))
|
||||||
|
return false;
|
||||||
|
if (firstNonStaticField.getType().isSameType(baseClass))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C++11: 9-10
|
||||||
|
*/
|
||||||
|
public static boolean isPOD(IType type, IASTNode point) {
|
||||||
|
if (!isStandardLayout(type, point))
|
||||||
|
return false;
|
||||||
|
type = SemanticUtil.getNestedType(type, ARRAY | CVTYPE | TDEF);
|
||||||
|
if (!(type instanceof ICPPClassType))
|
||||||
|
return true;
|
||||||
|
return isTrivial((ICPPClassType) type, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8.5.1 Aggregates [dcl.init.aggr]
|
||||||
|
* An aggregate is an array or a class (Clause 9) with no user-provided constructors (12.1),
|
||||||
|
* no private or protected non-static data members (Clause 11),
|
||||||
|
* no base classes (Clause 10), and no virtual functions (10.3).
|
||||||
|
*/
|
||||||
|
public static boolean isAggregateClass(ICPPClassType classType, IASTNode point) {
|
||||||
|
if (ClassTypeHelper.getBases(classType, point).length > 0)
|
||||||
|
return false;
|
||||||
|
ICPPMethod[] methods = ClassTypeHelper.getDeclaredMethods(classType, point);
|
||||||
|
for (ICPPMethod m : methods) {
|
||||||
|
if (m instanceof ICPPConstructor)
|
||||||
|
return false;
|
||||||
|
if (m.isVirtual()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
|
||||||
|
for (ICPPField field : fields) {
|
||||||
|
if (!(field.getVisibility() == ICPPMember.v_public || field.isStatic())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if and only if the given class has a trivial copy constructor.
|
||||||
|
* A copy constructor is trivial if:
|
||||||
|
* <ul>
|
||||||
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
|
* <li><code>isPolymorphic(classType) is false</code>, and</li>
|
||||||
|
* <li>the class has no virtual base classes, and</li>
|
||||||
|
* <li>every direct base class has trivial copy constructor, and</li>
|
||||||
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
|
* has trivial copy constructor.</li>
|
||||||
|
* </ul>
|
||||||
|
* Similar to <code>std::tr1::has_trivial_copy</code>.
|
||||||
|
*
|
||||||
|
* @param classType the class to check
|
||||||
|
* @return <code>true</code> if the class has a trivial copy constructor
|
||||||
|
*/
|
||||||
|
public static boolean hasTrivialCopyCtor(ICPPClassType classType, IASTNode point) {
|
||||||
|
if (getImplicitCopyCtor(classType, point) == null)
|
||||||
|
return false;
|
||||||
|
if (isPolymorphic(classType, point))
|
||||||
|
return false;
|
||||||
|
for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
|
||||||
|
if (base.isVirtual())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, point)) {
|
||||||
|
if (!classType.isSameType(baseClass) && !hasTrivialCopyCtor(baseClass, point))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPField field : classType.getDeclaredFields()) {
|
||||||
|
if (!field.isStatic()) {
|
||||||
|
IType type = field.getType();
|
||||||
|
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
||||||
|
if (type instanceof ICPPClassType && !classType.isSameType(type) &&
|
||||||
|
!hasTrivialCopyCtor((ICPPClassType) type, point)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if and only if the given class has a trivial default constructor.
|
||||||
|
* A default constructor is trivial if:
|
||||||
|
* <ul>
|
||||||
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
|
* <li>every direct base class has trivial default constructor, and</li>
|
||||||
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
|
* has trivial default constructor.</li>
|
||||||
|
* </ul>
|
||||||
|
* Similar to <code>std::tr1::has_trivial_default_constructor</code>.
|
||||||
|
*
|
||||||
|
* @param classType the class to check
|
||||||
|
* @param point
|
||||||
|
* @return <code>true</code> if the class has a trivial default constructor
|
||||||
|
*/
|
||||||
|
public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, IASTNode point) {
|
||||||
|
for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
|
||||||
|
if (!ctor.isImplicit() && ctor.getParameters().length == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, null)) {
|
||||||
|
if (!classType.isSameType(baseClass) && !hasTrivialDefaultConstructor(baseClass, point))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPField field : ClassTypeHelper.getDeclaredFields(classType, point)) {
|
||||||
|
if (!field.isStatic()) {
|
||||||
|
IType type = field.getType();
|
||||||
|
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
||||||
|
if (type instanceof ICPPClassType && !classType.isSameType(type) &&
|
||||||
|
!hasTrivialDefaultConstructor((ICPPClassType) type, point)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if and only if the given class has a trivial destructor.
|
||||||
|
* A destructor is trivial if:
|
||||||
|
* <ul>
|
||||||
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
|
* <li>every direct base class has trivial destructor, and</li>
|
||||||
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
|
* has trivial destructor.</li>
|
||||||
|
* </ul>
|
||||||
|
* Similar to <code>std::tr1::has_trivial_destructor</code>.
|
||||||
|
*
|
||||||
|
* @param classType the class to check
|
||||||
|
* @return <code>true</code> if the class has a trivial destructor
|
||||||
|
*/
|
||||||
|
public static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point) {
|
||||||
|
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
||||||
|
if (method.isDestructor())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, null)) {
|
||||||
|
if (!classType.isSameType(baseClass) && !hasTrivialDestructor(baseClass, point))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (ICPPField field : ClassTypeHelper.getDeclaredFields(classType, point)) {
|
||||||
|
if (!field.isStatic()) {
|
||||||
|
IType type = field.getType();
|
||||||
|
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
|
||||||
|
if (type instanceof ICPPClassType && !classType.isSameType(type) &&
|
||||||
|
!hasTrivialDestructor((ICPPClassType) type, point)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if and only if the given class declares or inherits a virtual
|
||||||
|
* function. Similar to <code>std::tr1::is_polymorphic</code>.
|
||||||
|
*
|
||||||
|
* @param classType the class to check
|
||||||
|
* @return <code>true</code> if the class declares or inherits a virtual function.
|
||||||
|
*/
|
||||||
|
public static boolean isPolymorphic(ICPPClassType classType, IASTNode point) {
|
||||||
|
if (hasDeclaredVirtualMethod(classType, point))
|
||||||
|
return true;
|
||||||
|
for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, point)) {
|
||||||
|
if (hasDeclaredVirtualMethod(baseClass, point))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasNonStaticFields(ICPPClassType classType, IASTNode point) {
|
||||||
|
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
|
||||||
|
for (ICPPField field : fields) {
|
||||||
|
if (!field.isStatic())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAbstract(ICPPClassType classType, IASTNode point) {
|
||||||
|
return ClassTypeHelper.getPureVirtualMethods(classType, point).length != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the compiler-generated copy constructor for the given class, or <code>null</code>
|
||||||
|
* if the class doesn't have a compiler-generated copy constructor.
|
||||||
|
*
|
||||||
|
* @param classType the class to get the copy ctor for.
|
||||||
|
* @return the compiler-generated copy constructor, or <code>null</code> if the class doesn't
|
||||||
|
* have a compiler-generated copy constructor.
|
||||||
|
*/
|
||||||
|
private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) {
|
||||||
|
for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
|
||||||
|
if (ctor.isImplicit() && ClassTypeHelper.getMethodKind(classType, ctor) == MethodKind.COPY_CTOR)
|
||||||
|
return ctor;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasDeclaredVirtualMethod(ICPPClassType classType, IASTNode point) {
|
||||||
|
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
||||||
|
if (method.isVirtual()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,7 +47,8 @@ public class IndexFactory {
|
||||||
private static final int ALL_FRAGMENT_OPTIONS = ADD_EXTENSION_FRAGMENTS_ADD_IMPORT
|
private static final int ALL_FRAGMENT_OPTIONS = ADD_EXTENSION_FRAGMENTS_ADD_IMPORT
|
||||||
| ADD_EXTENSION_FRAGMENTS_CALL_HIERARCHY | ADD_EXTENSION_FRAGMENTS_CONTENT_ASSIST
|
| ADD_EXTENSION_FRAGMENTS_CALL_HIERARCHY | ADD_EXTENSION_FRAGMENTS_CONTENT_ASSIST
|
||||||
| ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER | ADD_EXTENSION_FRAGMENTS_NAVIGATION
|
| ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER | ADD_EXTENSION_FRAGMENTS_NAVIGATION
|
||||||
| ADD_EXTENSION_FRAGMENTS_SEARCH | ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY;
|
| ADD_EXTENSION_FRAGMENTS_SEARCH | ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY
|
||||||
|
| ADD_EXTENSION_FRAGMENTS_EDITOR;
|
||||||
|
|
||||||
private PDOMManager fPDOMManager;
|
private PDOMManager fPDOMManager;
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
ATTRIBUTE_CALL_HIERARCHY = "call_hierarchy",
|
ATTRIBUTE_CALL_HIERARCHY = "call_hierarchy",
|
||||||
ATTRIBUTE_TYPE_HIERARCHY = "type_hierarchy",
|
ATTRIBUTE_TYPE_HIERARCHY = "type_hierarchy",
|
||||||
ATTRIBUTE_INCLUDE_BROWSER = "include_browser",
|
ATTRIBUTE_INCLUDE_BROWSER = "include_browser",
|
||||||
ATTRIBUTE_SEARCH = "search";
|
ATTRIBUTE_SEARCH = "search",
|
||||||
|
ATTRIBUTE_EDITOR = "editor";
|
||||||
|
|
||||||
|
|
||||||
private IIndexFragmentProvider[] fragmentProviders;
|
private IIndexFragmentProvider[] fragmentProviders;
|
||||||
|
@ -171,6 +172,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
result |= getOption(elem, ATTRIBUTE_NAVIGATION, IIndexManager.ADD_EXTENSION_FRAGMENTS_NAVIGATION);
|
result |= getOption(elem, ATTRIBUTE_NAVIGATION, IIndexManager.ADD_EXTENSION_FRAGMENTS_NAVIGATION);
|
||||||
result |= getOption(elem, ATTRIBUTE_SEARCH, IIndexManager.ADD_EXTENSION_FRAGMENTS_SEARCH);
|
result |= getOption(elem, ATTRIBUTE_SEARCH, IIndexManager.ADD_EXTENSION_FRAGMENTS_SEARCH);
|
||||||
result |= getOption(elem, ATTRIBUTE_TYPE_HIERARCHY, IIndexManager.ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY);
|
result |= getOption(elem, ATTRIBUTE_TYPE_HIERARCHY, IIndexManager.ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY);
|
||||||
|
result |= getOption(elem, ATTRIBUTE_EDITOR, IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,7 +720,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isIndexerIdle() {
|
public boolean isIndexerIdle() {
|
||||||
return Job.getJobManager().find(this).length == 0;
|
synchronized (fTaskQueue) {
|
||||||
|
return Job.getJobManager().find(this).length == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addProject(final ICProject cproject) {
|
void addProject(final ICProject cproject) {
|
||||||
|
@ -1097,7 +1099,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
@Override
|
@Override
|
||||||
public void done(IJobChangeEvent event) {
|
public void done(IJobChangeEvent event) {
|
||||||
synchronized (idleCondition) {
|
synchronized (idleCondition) {
|
||||||
if (Job.getJobManager().find(PDOMManager.this).length == 0) {
|
if (isIndexerIdle()) {
|
||||||
idleCondition[0] = true;
|
idleCondition[0] = true;
|
||||||
idleCondition.notifyAll();
|
idleCondition.notifyAll();
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1108,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
};
|
};
|
||||||
Job.getJobManager().addJobChangeListener(listener);
|
Job.getJobManager().addJobChangeListener(listener);
|
||||||
try {
|
try {
|
||||||
if (Job.getJobManager().find(this).length == 0) {
|
if (isIndexerIdle()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
synchronized (idleCondition) {
|
synchronized (idleCondition) {
|
||||||
|
|
|
@ -258,6 +258,13 @@ The only information needed for this extension point is the fully qualified name
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="editor" type="boolean" use="optional">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Whether the fragment provider shall be used for C/C++ editor.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests;
|
package org.eclipse.cdt.ui.tests;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -57,18 +57,15 @@ import org.eclipse.cdt.ui.testplugin.CTestPlugin;
|
||||||
import org.eclipse.cdt.ui.testplugin.util.StringAsserts;
|
import org.eclipse.cdt.ui.testplugin.util.StringAsserts;
|
||||||
|
|
||||||
public class BaseUITestCase extends BaseTestCase {
|
public class BaseUITestCase extends BaseTestCase {
|
||||||
|
|
||||||
public BaseUITestCase() {
|
public BaseUITestCase() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseUITestCase(String name) {
|
public BaseUITestCase(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.testplugin.util.BaseTestCase#setUp()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
@ -79,9 +76,6 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.testplugin.util.BaseTestCase#tearDown()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
runEventQueue(0);
|
runEventQueue(0);
|
||||||
|
@ -89,14 +83,14 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a section in comments form the source of the given class. Fully
|
* Reads a section in comments form the source of the given class. Fully
|
||||||
* equivalent to <code>readTaggedComment(getClass(), tag)</code>
|
* equivalent to <code>readTaggedComment(getClass(), tag)</code>
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected String readTaggedComment(final String tag) throws IOException {
|
protected String readTaggedComment(final String tag) throws IOException {
|
||||||
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "ui", getClass(), tag);
|
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "ui", getClass(), tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads multiple sections in comments from the source of the given class.
|
* Reads multiple sections in comments from the source of the given class.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
@ -105,15 +99,15 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
|
return TestSourceReader.getContentsForTest(CTestPlugin.getDefault().getBundle(), "ui",
|
||||||
getClass(), getName(), sections);
|
getClass(), getName(), sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAboveComment() throws IOException {
|
public String getAboveComment() throws IOException {
|
||||||
return getContentsForTest(1)[0].toString();
|
return getContentsForTest(1)[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IFile createFile(IContainer container, String fileName, String contents) throws Exception {
|
protected IFile createFile(IContainer container, String fileName, String contents) throws Exception {
|
||||||
return TestSourceReader.createFile(container, new Path(fileName), contents);
|
return TestSourceReader.createFile(container, new Path(fileName), contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTTranslationUnit createIndexBasedAST(IIndex index, ICProject project, IFile file) throws CModelException, CoreException {
|
protected IASTTranslationUnit createIndexBasedAST(IIndex index, ICProject project, IFile file) throws CModelException, CoreException {
|
||||||
return TestSourceReader.createIndexBasedAST(index, project, file);
|
return TestSourceReader.createIndexBasedAST(index, project, file);
|
||||||
}
|
}
|
||||||
|
@ -128,28 +122,33 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
sleep= Math.min(250, sleep * 2);
|
sleep= Math.min(250, sleep * 2);
|
||||||
}
|
}
|
||||||
firstTime= false;
|
firstTime= false;
|
||||||
|
|
||||||
if (CCorePlugin.getIndexManager().isIndexerSetupPostponed(CoreModel.getDefault().create(file.getProject())))
|
if (CCorePlugin.getIndexManager().isIndexerSetupPostponed(CoreModel.getDefault().create(file.getProject())))
|
||||||
continue;
|
continue;
|
||||||
index.acquireReadLock();
|
|
||||||
try {
|
try {
|
||||||
IIndexFile[] indexFiles= index.getFiles(IndexLocationFactory.getWorkspaceIFL(file));
|
index.acquireReadLock();
|
||||||
for (IIndexFile indexFile : indexFiles) {
|
try {
|
||||||
if (indexFile != null && indexFile.getTimestamp() >= file.getLocalTimeStamp()) {
|
IIndexFile[] indexFiles= index.getFiles(IndexLocationFactory.getWorkspaceIFL(file));
|
||||||
return;
|
for (IIndexFile indexFile : indexFiles) {
|
||||||
|
if (indexFile != null && indexFile.getTimestamp() >= file.getLocalTimeStamp()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
index.releaseReadLock();
|
||||||
|
int time= (int) (endTime - System.currentTimeMillis());
|
||||||
|
if (time > 0) {
|
||||||
|
CCorePlugin.getIndexManager().joinIndexer(time, npm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
}
|
||||||
index.releaseReadLock();
|
catch (InterruptedException e) {
|
||||||
int time= (int) (endTime - System.currentTimeMillis());
|
// index.acquireReadLock() can be interrupted
|
||||||
if (time > 0) {
|
|
||||||
CCorePlugin.getIndexManager().joinIndexer(time, npm());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Exception("Indexer did not complete in time!");
|
throw new Exception("Indexer did not complete in time!");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runEventQueue(int time) {
|
protected void runEventQueue(int time) {
|
||||||
final long endTime= System.currentTimeMillis() + time;
|
final long endTime= System.currentTimeMillis() + time;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -185,11 +184,11 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
expandTreeItem(item);
|
expandTreeItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void expandTreeItem(TreeItem item) {
|
protected void expandTreeItem(TreeItem item) {
|
||||||
Event event = new Event();
|
Event event = new Event();
|
||||||
event.item = item;
|
event.item = item;
|
||||||
item.getParent().notifyListeners(SWT.Expand, event);
|
item.getParent().notifyListeners(SWT.Expand, event);
|
||||||
item.setExpanded(true);
|
item.setExpanded(true);
|
||||||
runEventQueue(0);
|
runEventQueue(0);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +211,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
tree.setSelection(item);
|
tree.setSelection(item);
|
||||||
Event event = new Event();
|
Event event = new Event();
|
||||||
event.item = item;
|
event.item = item;
|
||||||
item.getParent().notifyListeners(SWT.Selection, event);
|
item.getParent().notifyListeners(SWT.Selection, event);
|
||||||
runEventQueue(0);
|
runEventQueue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +222,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
page.closeEditor(editor, false);
|
page.closeEditor(editor, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeAllEditors() {
|
protected void closeAllEditors() {
|
||||||
IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
|
IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||||
for (IWorkbenchWindow window : windows) {
|
for (IWorkbenchWindow window : windows) {
|
||||||
|
@ -233,7 +232,7 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreAllParts() throws WorkbenchException {
|
protected void restoreAllParts() throws WorkbenchException {
|
||||||
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||||
page.zoomOut();
|
page.zoomOut();
|
||||||
|
@ -249,14 +248,14 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
runEventQueue(0);
|
runEventQueue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IViewPart activateView(String id) throws PartInitException {
|
protected IViewPart activateView(String id) throws PartInitException {
|
||||||
IViewPart view= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id);
|
IViewPart view= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id);
|
||||||
assertNotNull(view);
|
assertNotNull(view);
|
||||||
runEventQueue(0);
|
runEventQueue(0);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void executeCommand(IViewPart viewPart, String commandID) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
|
protected void executeCommand(IViewPart viewPart, String commandID) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
|
||||||
IHandlerService hs= (IHandlerService)viewPart.getSite().getService(IHandlerService.class);
|
IHandlerService hs= (IHandlerService)viewPart.getSite().getService(IHandlerService.class);
|
||||||
assertNotNull(hs);
|
assertNotNull(hs);
|
||||||
|
@ -268,8 +267,8 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
findControls(w, clazz, result);
|
findControls(w, clazz, result);
|
||||||
return result.toArray(new Control[result.size()]);
|
return result.toArray(new Control[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findControls(Control w, Class<?> clazz, List<Control> result) {
|
private void findControls(Control w, Class<?> clazz, List<Control> result) {
|
||||||
if (clazz.isInstance(w)) {
|
if (clazz.isInstance(w)) {
|
||||||
result.add(w);
|
result.add(w);
|
||||||
}
|
}
|
||||||
|
@ -285,8 +284,8 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
final protected TreeItem checkTreeNode(IViewPart part, int i0, String label) {
|
final protected TreeItem checkTreeNode(IViewPart part, int i0, String label) {
|
||||||
assertNotNull(label); // we don't handle testing for a base node to not appear; can be added if/when needed
|
assertNotNull(label); // we don't handle testing for a base node to not appear; can be added if/when needed
|
||||||
IViewReference viewRef = part.getViewSite().getPage().findViewReference(part.getViewSite().getId());
|
IViewReference viewRef = part.getViewSite().getPage().findViewReference(part.getViewSite().getId());
|
||||||
Control viewControl = ((WorkbenchPartReference)viewRef).getPane().getControl();
|
Control viewControl = ((WorkbenchPartReference) viewRef).getPane().getControl();
|
||||||
|
|
||||||
Tree tree= null;
|
Tree tree= null;
|
||||||
TreeItem root= null;
|
TreeItem root= null;
|
||||||
StringBuilder cands= new StringBuilder();
|
StringBuilder cands= new StringBuilder();
|
||||||
|
@ -337,17 +336,17 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
fail("Tree node " + label + "{" + i0 + "} does not exist!");
|
fail("Tree node " + label + "{" + i0 + "} does not exist!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass label=null to test that the {i0,i1} node doesn't exist
|
* Pass label=null to test that the {i0,i1} node doesn't exist
|
||||||
*/
|
*/
|
||||||
final protected TreeItem checkTreeNode(Tree tree, int i0, int i1, String label) {
|
final protected TreeItem checkTreeNode(Tree tree, int i0, int i1, String label) {
|
||||||
String firstItemText= null;
|
String firstItemText= null;
|
||||||
int timeout = (label == null) ? 1000 : 5000; // see footnote[0]
|
int timeout = (label == null) ? 1000 : 5000; // see footnote[0]
|
||||||
|
|
||||||
// If {i0,i1} exists, whether or not it matches label (when label != null)
|
// If {i0,i1} exists, whether or not it matches label (when label != null)
|
||||||
boolean nodePresent = false;
|
boolean nodePresent = false;
|
||||||
|
|
||||||
for (int millis= 0; millis < timeout; millis= millis == 0 ? 1 : millis * 2) {
|
for (int millis= 0; millis < timeout; millis= millis == 0 ? 1 : millis * 2) {
|
||||||
nodePresent = false;
|
nodePresent = false;
|
||||||
runEventQueue(millis);
|
runEventQueue(millis);
|
||||||
|
@ -374,13 +373,12 @@ public class BaseUITestCase extends BaseTestCase {
|
||||||
|
|
||||||
if (label == null) {
|
if (label == null) {
|
||||||
assertFalse("Tree node {" + i0 + "," + i1 + "} exists but shouldn't!", nodePresent);
|
assertFalse("Tree node {" + i0 + "," + i1 + "} exists but shouldn't!", nodePresent);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fail("Tree node " + label + "{" + i0 + "," + i1 + "} does not exist!");
|
fail("Tree node " + label + "{" + i0 + "," + i1 + "} does not exist!");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertEqualString(String actual, String expected) {
|
public static void assertEqualString(String actual, String expected) {
|
||||||
StringAsserts.assertEqualString(actual, expected);
|
StringAsserts.assertEqualString(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContext;
|
||||||
* Common base for refactoring tests.
|
* Common base for refactoring tests.
|
||||||
*/
|
*/
|
||||||
public abstract class RefactoringTestBase extends BaseTestCase {
|
public abstract class RefactoringTestBase extends BaseTestCase {
|
||||||
private static final int INDEXER_TIMEOUT_SEC = 300;
|
|
||||||
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
|
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
|
||||||
|
|
||||||
/** Allows empty files to be created during test setup. */
|
/** Allows empty files to be created during test setup. */
|
||||||
|
|
|
@ -70,7 +70,6 @@ import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
||||||
* @author dsteffle
|
* @author dsteffle
|
||||||
*/
|
*/
|
||||||
public class BaseSelectionTestsIndexer extends BaseUITestCase {
|
public class BaseSelectionTestsIndexer extends BaseUITestCase {
|
||||||
protected static final int INDEXER_TIMEOUT_SEC = 20;
|
|
||||||
protected ICProject fCProject;
|
protected ICProject fCProject;
|
||||||
static FileManager fileManager = new FileManager();
|
static FileManager fileManager = new FileManager();
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
IProgressMonitor monitor = new NullProgressMonitor();
|
||||||
|
|
|
@ -100,8 +100,8 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
|
|
||||||
int hoffset= hcode.indexOf("MyInt");
|
int hoffset= hcode.indexOf("MyInt");
|
||||||
int soffset = scode.indexOf("MyInt");
|
int soffset = scode.indexOf("MyInt");
|
||||||
IASTNode decl = testF3(file, soffset+2);
|
IASTNode decl = testF3(file, soffset + 2);
|
||||||
IASTNode def = testF3(hfile, hoffset+2);
|
IASTNode def = testF3(hfile, hoffset + 2);
|
||||||
assertTrue(def instanceof IASTName);
|
assertTrue(def instanceof IASTName);
|
||||||
assertTrue(decl instanceof IASTName);
|
assertTrue(decl instanceof IASTName);
|
||||||
assertEquals("MyInt", ((IASTName) decl).toString()); //$NON-NLS-1$
|
assertEquals("MyInt", ((IASTName) decl).toString()); //$NON-NLS-1$
|
||||||
|
@ -113,8 +113,8 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
|
|
||||||
hoffset= hcode.indexOf("MyConst");
|
hoffset= hcode.indexOf("MyConst");
|
||||||
soffset = scode.indexOf("MyConst");
|
soffset = scode.indexOf("MyConst");
|
||||||
decl = testF3(file, soffset+2);
|
decl = testF3(file, soffset + 2);
|
||||||
def = testF3(hfile, hoffset+2);
|
def = testF3(hfile, hoffset + 2);
|
||||||
assertTrue(def instanceof IASTName);
|
assertTrue(def instanceof IASTName);
|
||||||
assertTrue(decl instanceof IASTName);
|
assertTrue(decl instanceof IASTName);
|
||||||
assertEquals("MyConst", ((IASTName) decl).toString()); //$NON-NLS-1$
|
assertEquals("MyConst", ((IASTName) decl).toString()); //$NON-NLS-1$
|
||||||
|
@ -126,8 +126,8 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
|
|
||||||
hoffset= hcode.indexOf("MyFunc");
|
hoffset= hcode.indexOf("MyFunc");
|
||||||
soffset = scode.indexOf("MyFunc");
|
soffset = scode.indexOf("MyFunc");
|
||||||
decl = testF3(file, soffset+2);
|
decl = testF3(file, soffset + 2);
|
||||||
def = testF3(hfile, hoffset+2);
|
def = testF3(hfile, hoffset + 2);
|
||||||
assertTrue(def instanceof IASTName);
|
assertTrue(def instanceof IASTName);
|
||||||
assertTrue(decl instanceof IASTName);
|
assertTrue(decl instanceof IASTName);
|
||||||
assertEquals("MyFunc", ((IASTName) decl).toString()); //$NON-NLS-1$
|
assertEquals("MyFunc", ((IASTName) decl).toString()); //$NON-NLS-1$
|
||||||
|
@ -139,8 +139,8 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
|
|
||||||
hoffset= hcode.indexOf("MyStruct");
|
hoffset= hcode.indexOf("MyStruct");
|
||||||
soffset = scode.indexOf("MyStruct");
|
soffset = scode.indexOf("MyStruct");
|
||||||
decl = testF3(file, soffset+2);
|
decl = testF3(file, soffset + 2);
|
||||||
def = testF3(hfile, hoffset+2);
|
def = testF3(hfile, hoffset + 2);
|
||||||
assertTrue(def instanceof IASTName);
|
assertTrue(def instanceof IASTName);
|
||||||
assertTrue(decl instanceof IASTName);
|
assertTrue(decl instanceof IASTName);
|
||||||
assertEquals("MyStruct", ((IASTName) decl).toString()); //$NON-NLS-1$
|
assertEquals("MyStruct", ((IASTName) decl).toString()); //$NON-NLS-1$
|
||||||
|
@ -150,8 +150,7 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
|
||||||
assertEquals(hoffset, def.getFileLocation().getNodeOffset());
|
assertEquals(hoffset, def.getFileLocation().getNodeOffset());
|
||||||
assertEquals(8, ((ASTNode) def).getLength());
|
assertEquals(8, ((ASTNode) def).getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// // the header
|
// // the header
|
||||||
// extern int a; // declares
|
// extern int a; // declares
|
||||||
// extern const int c = 1; // defines
|
// extern const int c = 1; // defines
|
||||||
|
|
11
core/org.eclipse.cdt.ui/.settings/.api_filters
Normal file
11
core/org.eclipse.cdt.ui/.settings/.api_filters
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<component id="org.eclipse.cdt.ui" version="2">
|
||||||
|
<resource path="src/org/eclipse/cdt/ui/refactoring/actions/Messages.java" type="org.eclipse.cdt.ui.refactoring.actions.Messages">
|
||||||
|
<filter id="305365105">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.ui.refactoring.actions.Messages"/>
|
||||||
|
<message_argument value="org.eclipse.cdt.ui_5.5.0"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
</component>
|
|
@ -147,7 +147,7 @@ category.refactoring.description= C/C++ Refactorings
|
||||||
category.refactoring.name = Refactor - C++
|
category.refactoring.name = Refactor - C++
|
||||||
refactoringExtractConstant.label = Extract Constant...
|
refactoringExtractConstant.label = Extract Constant...
|
||||||
refactoringExtractLocalVariable.label = Extract Local Variable...
|
refactoringExtractLocalVariable.label = Extract Local Variable...
|
||||||
refactoringHideMethod.label = Hide Memeber Function...
|
refactoringHideMethod.label = Hide Member Function...
|
||||||
|
|
||||||
|
|
||||||
ActionDefinition.renameElement.name= Rename - Refactoring
|
ActionDefinition.renameElement.name= Rename - Refactoring
|
||||||
|
@ -544,7 +544,7 @@ toggleMarkOccurrences.description= Toggles mark occurrences in C/C++ editors
|
||||||
OccurrenceAnnotation.label= C/C++ Occurrences
|
OccurrenceAnnotation.label= C/C++ Occurrences
|
||||||
WriteOccurrenceAnnotation.label= C/C++ Write Occurrences
|
WriteOccurrenceAnnotation.label= C/C++ Write Occurrences
|
||||||
|
|
||||||
DocCommentOwner.name = DocCommentOwner
|
DocCommentOwnerExtensionPoint = Doc Comment Owner
|
||||||
Doxygen.name = Doxygen
|
Doxygen.name = Doxygen
|
||||||
|
|
||||||
# Hyperlinking
|
# Hyperlinking
|
||||||
|
@ -609,7 +609,8 @@ includeFolderDecorator.description = Decorates missing include folders with erro
|
||||||
|
|
||||||
templatesViewName= Templates
|
templatesViewName= Templates
|
||||||
|
|
||||||
AllLanguageSettingEntries.name=Providers
|
AllLanguageSettingEntries.name=Entries
|
||||||
|
AllLanguageSettingProviders.name=Providers
|
||||||
AllLanguageSettingEntries.tooltip=Language Setting Entries Providers
|
AllLanguageSettingEntries.tooltip=Language Setting Entries Providers
|
||||||
|
|
||||||
deleteConfigsCommand.name = Reset to Default
|
deleteConfigsCommand.name = Reset to Default
|
||||||
|
@ -633,7 +634,7 @@ transfer.EditorBehavior.description = Preference related to how the editor proce
|
||||||
# Refresh Exclusion Contributors
|
# Refresh Exclusion Contributors
|
||||||
RefreshExclusionContributor.name = Resources
|
RefreshExclusionContributor.name = Resources
|
||||||
|
|
||||||
extension-point.name = Refresh Exclusion Contributor
|
RefreshExclusionContributorExtensionPoint = Refresh Exclusion Contributor
|
||||||
|
|
||||||
# New New Project Wizard
|
# New New Project Wizard
|
||||||
newProjectWizard.name = C/C++ Project (prototype)
|
newProjectWizard.name = C/C++ Project (prototype)
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
<extension-point id="HelpInfo" name="%HelpInfo" schema="schema/HelpInfo.exsd"/>
|
<extension-point id="HelpInfo" name="%HelpInfo" schema="schema/HelpInfo.exsd"/>
|
||||||
<extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
|
<extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
|
||||||
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
||||||
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
<extension-point id="DocCommentOwner" name="%DocCommentOwnerExtensionPoint" schema="schema/DocCommentOwner.exsd"/>
|
||||||
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
||||||
<extension-point id="LanguageSettingsProviderAssociation" name="%LanguageSettingsProviderAssociationExtensionPoint" schema="schema/LanguageSettingsProviderAssociation.exsd"/>
|
<extension-point id="LanguageSettingsProviderAssociation" name="%LanguageSettingsProviderAssociationExtensionPoint" schema="schema/LanguageSettingsProviderAssociation.exsd"/>
|
||||||
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
<extension-point id="RefreshExclusionContributor" name="%RefreshExclusionContributorExtensionPoint" schema="schema/RefreshExclusionContributor.exsd"/>
|
||||||
<extension-point id="projectTypePages" name="%projectTypePages" schema="schema/projectTypePages.exsd"/>
|
<extension-point id="projectTypePages" name="%projectTypePages" schema="schema/projectTypePages.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
@ -4347,7 +4347,7 @@
|
||||||
<tab
|
<tab
|
||||||
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsEntriesTab"
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsEntriesTab"
|
||||||
icon="icons/obj16/ls_entries.gif"
|
icon="icons/obj16/ls_entries.gif"
|
||||||
name="Entries"
|
name="%AllLanguageSettingEntries.name"
|
||||||
weight="010"
|
weight="010"
|
||||||
helpId="FIXME cdt_u_prop_pns_inc"
|
helpId="FIXME cdt_u_prop_pns_inc"
|
||||||
parent="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage"
|
parent="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage"
|
||||||
|
@ -4355,7 +4355,7 @@
|
||||||
<tab
|
<tab
|
||||||
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab"
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab"
|
||||||
icon="icons/obj16/extension_obj.gif"
|
icon="icons/obj16/extension_obj.gif"
|
||||||
name="Providers"
|
name="%AllLanguageSettingProviders.name"
|
||||||
weight="020"
|
weight="020"
|
||||||
helpId="FIXME cdt_u_prop_pns_inc"
|
helpId="FIXME cdt_u_prop_pns_inc"
|
||||||
parent="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage"
|
parent="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.ltk.core.refactoring.RefactoringContext;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -113,7 +114,8 @@ public class CRefactoringContext extends RefactoringContext {
|
||||||
throw new IllegalStateException("CRefactoringContext is already disposed."); //$NON-NLS-1$
|
throw new IllegalStateException("CRefactoringContext is already disposed."); //$NON-NLS-1$
|
||||||
if (fIndex == null) {
|
if (fIndex == null) {
|
||||||
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
||||||
IIndex index = CCorePlugin.getIndexManager().getIndex(projects);
|
IIndex index = CCorePlugin.getIndexManager().getIndex(projects,
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
try {
|
try {
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.refactoring;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String DeleteFileChange_0;
|
public static String DeleteFileChange_0;
|
||||||
public static String DeleteFileChange_1;
|
public static String DeleteFileChange_1;
|
||||||
public static String Refactoring_name;
|
public static String Refactoring_name;
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.refactoring.dialogs;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String CTextEditChangePreviewViewer_OrgSource;
|
public static String CTextEditChangePreviewViewer_OrgSource;
|
||||||
public static String CTextEditChangePreviewViewer_RefactoredSource;
|
public static String CTextEditChangePreviewViewer_RefactoredSource;
|
||||||
public static String ExtractInputPage_ReplaceInSubclass;
|
public static String ExtractInputPage_ReplaceInSubclass;
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.refactoring.extractconstant;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String InputPage_ConstName;
|
public static String InputPage_ConstName;
|
||||||
public static String InputPage_EnterConstName;
|
public static String InputPage_EnterConstName;
|
||||||
public static String InputPage_NameAlreadyDefined;
|
public static String InputPage_NameAlreadyDefined;
|
||||||
|
|
|
@ -128,10 +128,9 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
"org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"; //$NON-NLS-1$
|
"org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"; //$NON-NLS-1$
|
||||||
|
|
||||||
static final Integer NULL_INTEGER = Integer.valueOf(0);
|
static final Integer NULL_INTEGER = Integer.valueOf(0);
|
||||||
static final char[] ZERO= "0".toCharArray(); //$NON-NLS-1$
|
|
||||||
|
|
||||||
private NodeContainer container;
|
private NodeContainer container;
|
||||||
final ExtractFunctionInformation info;
|
private final ExtractFunctionInformation info;
|
||||||
|
|
||||||
final Map<String, Integer> names;
|
final Map<String, Integer> names;
|
||||||
final Container<Integer> namesCounter;
|
final Container<Integer> namesCounter;
|
||||||
|
@ -142,7 +141,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
|
|
||||||
private FunctionExtractor extractor;
|
private FunctionExtractor extractor;
|
||||||
private INodeFactory nodeFactory;
|
private INodeFactory nodeFactory;
|
||||||
DefaultCodeFormatterOptions formattingOptions;
|
private DefaultCodeFormatterOptions formattingOptions;
|
||||||
|
|
||||||
private IIndex index;
|
private IIndex index;
|
||||||
private IASTTranslationUnit ast;
|
private IASTTranslationUnit ast;
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.refactoring.extractfunction;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String ExtractFunctionRefactoring_ExtractFunction;
|
public static String ExtractFunctionRefactoring_ExtractFunction;
|
||||||
public static String ExtractFunctionRefactoring_NoStmtSelected;
|
public static String ExtractFunctionRefactoring_NoStmtSelected;
|
||||||
public static String ExtractFunctionRefactoring_TooManySelected;
|
public static String ExtractFunctionRefactoring_TooManySelected;
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String CreateLocalVariable;
|
public static String CreateLocalVariable;
|
||||||
public static String EnterVariableName;
|
public static String EnterVariableName;
|
||||||
public static String ExpressionMustBeSelected;
|
public static String ExpressionMustBeSelected;
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String GenerateGettersAndSettersInputPage_DeselectAll;
|
public static String GenerateGettersAndSettersInputPage_DeselectAll;
|
||||||
public static String GenerateGettersAndSettersInputPage_Header;
|
public static String GenerateGettersAndSettersInputPage_Header;
|
||||||
public static String GenerateGettersAndSettersInputPage_LinkDescription;
|
public static String GenerateGettersAndSettersInputPage_LinkDescription;
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.refactoring.hidemethod;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String HideMethodRefactoring_HasExternalReferences;
|
public static String HideMethodRefactoring_HasExternalReferences;
|
||||||
public static String HideMethodRefactoring_HIDE_METHOD;
|
public static String HideMethodRefactoring_HIDE_METHOD;
|
||||||
public static String HideMethodRefactoring_NoNameSelected;
|
public static String HideMethodRefactoring_NoNameSelected;
|
||||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.internal.ui.refactoring.implementmethod;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String ParameterNamesInputPage_Title;
|
public static String ParameterNamesInputPage_Title;
|
||||||
public static String ParameterNamesInputPage_CompleteMissingMails;
|
public static String ParameterNamesInputPage_CompleteMissingMails;
|
||||||
public static String ImplementMethodInputPage_PageTitle;
|
public static String ImplementMethodInputPage_PageTitle;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
|
||||||
|
@ -305,7 +306,8 @@ public class CRenameProcessor extends RenameProcessor {
|
||||||
if (indexLockCount == 0) {
|
if (indexLockCount == 0) {
|
||||||
if (fIndex == null) {
|
if (fIndex == null) {
|
||||||
ICProject[] projects= CoreModel.getDefault().getCModel().getCProjects();
|
ICProject[] projects= CoreModel.getDefault().getCModel().getCProjects();
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(projects);
|
fIndex = CCorePlugin.getIndexManager().getIndex(projects,
|
||||||
|
IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
|
||||||
}
|
}
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class RenameMessages extends NLS {
|
class RenameMessages extends NLS {
|
||||||
public static String ASTManager_error_macro_name_conflict;
|
public static String ASTManager_error_macro_name_conflict;
|
||||||
public static String ASTManager_subtask_analyzing;
|
public static String ASTManager_subtask_analyzing;
|
||||||
public static String ASTManager_task_analyze;
|
public static String ASTManager_task_analyze;
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.refactoring.togglefunction;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class Messages extends NLS {
|
class Messages extends NLS {
|
||||||
public static String DeclaratorFinder_NestedFunction;
|
public static String DeclaratorFinder_NestedFunction;
|
||||||
public static String DeclaratorFinder_NoDeclarator;
|
public static String DeclaratorFinder_NoDeclarator;
|
||||||
public static String DeclaratorFinder_MultipleDeclarators;
|
public static String DeclaratorFinder_MultipleDeclarators;
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.ui.refactoring.utils;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public final class Messages extends NLS {
|
final class Messages extends NLS {
|
||||||
public static String IdentifierHelper_isKeyword;
|
public static String IdentifierHelper_isKeyword;
|
||||||
public static String IdentifierHelper_isValid;
|
public static String IdentifierHelper_isValid;
|
||||||
public static String IdentifierHelper_leadingDigit;
|
public static String IdentifierHelper_leadingDigit;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Intel Corporation, QNX Software Systems, and others.
|
* Copyright (c) 2007, 2012 Intel Corporation, QNX Software Systems, and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
* Andrew Gvozdev
|
* Andrew Gvozdev
|
||||||
* QNX Software Systems - [271628] NPE in configs for project that failed to convert
|
* QNX Software Systems - [271628] NPE in configs for project that failed to convert
|
||||||
* James Blackburn (Broadcom Corp.)
|
* James Blackburn (Broadcom Corp.)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.newui;
|
package org.eclipse.cdt.ui.newui;
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.osgi.util.TextProcessor;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -774,7 +776,7 @@ implements
|
||||||
if (cfgDescs[i].isActive()) {
|
if (cfgDescs[i].isActive()) {
|
||||||
name = name + " " + Messages.AbstractPage_16; //$NON-NLS-1$
|
name = name + " " + Messages.AbstractPage_16; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
configSelector.add(name);
|
configSelector.add(TextProcessor.process(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the last selected config is selected by default
|
// Ensure that the last selected config is selected by default
|
||||||
|
|
|
@ -1,45 +1,33 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
* Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.refactoring.actions;
|
package org.eclipse.cdt.ui.refactoring.actions;
|
||||||
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
/**
|
class Messages extends NLS {
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
|
||||||
*/
|
|
||||||
public class Messages extends NLS {
|
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.refactoring.actions.messages"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
public static String CRefactoringActionGroup_menu;
|
public static String CRefactoringActionGroup_menu;
|
||||||
public static String CRenameAction_label;
|
public static String CRenameAction_label;
|
||||||
public static String ExtractConstantAction_label;
|
public static String ExtractConstantAction_label;
|
||||||
/**
|
|
||||||
* @since 5.1
|
|
||||||
*/
|
|
||||||
public static String ExtractLocalVariableAction_label;
|
public static String ExtractLocalVariableAction_label;
|
||||||
public static String ExtractFunctionAction_label;
|
public static String ExtractFunctionAction_label;
|
||||||
public static String HideMethodAction_label;
|
public static String HideMethodAction_label;
|
||||||
public static String ImplementMethodAction_label;
|
public static String ImplementMethodAction_label;
|
||||||
public static String GettersAndSetters_label;
|
public static String GettersAndSetters_label;
|
||||||
/**
|
|
||||||
* @since 5.3
|
|
||||||
*/
|
|
||||||
public static String ToggleFunctionAction_label;
|
public static String ToggleFunctionAction_label;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
NLS.initializeMessages(Messages.class.getName(), Messages.class);
|
||||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not instantiate
|
||||||
private Messages() {
|
private Messages() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2008 Wind River Systems, Inc. and others.
|
# Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Markus Schorn (Wind River Systems)
|
# Markus Schorn (Wind River Systems)
|
||||||
|
# Sergey Prigogin (Google)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
CRefactoringActionGroup_menu=Refactor
|
CRefactoringActionGroup_menu=Refactor
|
||||||
CRenameAction_label=Rename...
|
CRenameAction_label=Rename...
|
|
@ -32,7 +32,7 @@ public class LRGCCCompleteParseExtensionsTest extends GCCCompleteParseExtensions
|
||||||
|
|
||||||
//override the test failed case for 342683
|
//override the test failed case for 342683
|
||||||
@Override
|
@Override
|
||||||
public void testTypetraits_Bug342683() throws Exception {}
|
public void testTypeTraits_Bug342683() throws Exception {}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -17,7 +17,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<tycho-version>0.14.1</tycho-version>
|
<tycho-version>0.14.1</tycho-version>
|
||||||
<tycho-extras-version>0.14.0</tycho-extras-version>
|
<tycho-extras-version>0.14.0</tycho-extras-version>
|
||||||
<platform-version>3.8milestones</platform-version>
|
<platform-version>3.8</platform-version>
|
||||||
<platform-site>http://download.eclipse.org/eclipse/updates/${platform-version}</platform-site>
|
<platform-site>http://download.eclipse.org/eclipse/updates/${platform-version}</platform-site>
|
||||||
<orbit-version>R20110523182458</orbit-version>
|
<orbit-version>R20110523182458</orbit-version>
|
||||||
<orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit-version}/repository</orbit-site>
|
<orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/${orbit-version}/repository</orbit-site>
|
||||||
|
@ -162,6 +162,7 @@
|
||||||
<module>codan/org.eclipse.cdt.codan.core.test</module>
|
<module>codan/org.eclipse.cdt.codan.core.test</module>
|
||||||
<module>build/org.eclipse.cdt.managedbuilder.core.tests</module>
|
<module>build/org.eclipse.cdt.managedbuilder.core.tests</module>
|
||||||
<module>build/org.eclipse.cdt.managedbuilder.ui.tests</module>
|
<module>build/org.eclipse.cdt.managedbuilder.ui.tests</module>
|
||||||
|
<module>build/org.eclipse.cdt.make.core.tests</module>
|
||||||
<module>dsf-gdb/org.eclipse.cdt.tests.dsf.gdb</module>
|
<module>dsf-gdb/org.eclipse.cdt.tests.dsf.gdb</module>
|
||||||
|
|
||||||
<module>build/org.eclipse.cdt.autotools.core</module>
|
<module>build/org.eclipse.cdt.autotools.core</module>
|
||||||
|
@ -181,6 +182,7 @@
|
||||||
<module>testsrunner/org.eclipse.cdt.testsrunner.feature</module>
|
<module>testsrunner/org.eclipse.cdt.testsrunner.feature</module>
|
||||||
<module>testsrunner/org.eclipse.cdt.testsrunner.source.feature</module>
|
<module>testsrunner/org.eclipse.cdt.testsrunner.source.feature</module>
|
||||||
|
|
||||||
|
<module>xlc/org.eclipse.cdt.errorparsers.xlc.tests</module>
|
||||||
<!--
|
<!--
|
||||||
<module>lrparser/org.eclipse.cdt.core.lrparser.tests</module>
|
<module>lrparser/org.eclipse.cdt.core.lrparser.tests</module>
|
||||||
<module>upc/org.eclipse.cdt.core.parser.upc.tests</module>
|
<module>upc/org.eclipse.cdt.core.parser.upc.tests</module>
|
||||||
|
|
35
xlc/org.eclipse.cdt.errorparsers.xlc.tests/pom.xml
Normal file
35
xlc/org.eclipse.cdt.errorparsers.xlc.tests/pom.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.cdt</groupId>
|
||||||
|
<artifactId>cdt-parent</artifactId>
|
||||||
|
<version>8.2.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<version>5.0.100-SNAPSHOT</version>
|
||||||
|
<artifactId>org.eclipse.cdt.errorparsers.xlc.tests</artifactId>
|
||||||
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
|
<version>${tycho-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<useUIHarness>false</useUIHarness>
|
||||||
|
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
|
||||||
|
<includes>
|
||||||
|
<include>**/AllXlcErrorParserTests.*</include>
|
||||||
|
</includes>
|
||||||
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -110,8 +110,7 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
line= line.trim();
|
if (line.trim().length() == 0) {
|
||||||
if (line.length() == 0) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue