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
8279f629b6
252 changed files with 8976 additions and 6187 deletions
|
@ -1,3 +1,23 @@
|
|||
2012-07-23 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java: New file.
|
||||
* src/org/eclipse/cdt/internal/autotools/core/configure/IConfigureOption.java: Use IAutotoolsOption values for type constants.
|
||||
* src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java: Use AutotoolsOptionConstants
|
||||
for names of configuration options.
|
||||
|
||||
2012-07-20 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java (getAutotoolCfgOptions): New publicly accessible
|
||||
method for retrieving Autotool configuration options for a given build configuration.
|
||||
(updateAutotoolCfgOptions): New publicly accessible method for updating Autotool configuration options for
|
||||
a given build configuration.
|
||||
* src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties: Add new messages for
|
||||
errors caused by user reading and updating configuration options.
|
||||
* src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java: Add synchronization to
|
||||
all public methods.
|
||||
(updateAutotoolCfgOptions): New method to allow external users to update configuration options.
|
||||
(getAutotoolsCfgOptions): New method to get configuration options for a given configuration id.
|
||||
|
||||
2012-04-20 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* META-INF/MANIFEST.MF: Bump up version to 1.1.0.
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name.0
|
||||
Bundle-SymbolicName: org.eclipse.cdt.autotools.core;singleton:=true
|
||||
Bundle-Version: 1.1.0.qualifier
|
||||
Bundle-Version: 1.2.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.autotools.core.AutotoolsPlugin
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.ui;bundle-version="3.4.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#################################################################################
|
||||
# Copyright (c) 2006, 2008, 2009 Red Hat, Inc.
|
||||
# Copyright (c) 2006, 2012 Red Hat, Inc.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
|
@ -7,10 +7,11 @@
|
|||
#
|
||||
# Contributors:
|
||||
# Red Hat Incorporated - initial API and implementation
|
||||
# IBM Corporation
|
||||
#################################################################################
|
||||
ConvertWizard.description=Convert to C/C++ Autotools Project
|
||||
NewCProject.description=GNU C Autotools Project
|
||||
NewCProjectV2.description=GNU C Autootols Project V2
|
||||
NewCProjectV2.description=GNU C Autotools Project V2
|
||||
NewCCProject.description=GNU C++ Autotools Project
|
||||
NewCWizard.name=GNU C Autotools Project
|
||||
NewCWizardV2.name=GNU C Autotools Project V2
|
||||
|
@ -177,4 +178,6 @@ ConfigureScript.name=Configure Script
|
|||
AutogenScript.name=Autogen Script
|
||||
|
||||
AutotoolsProblemMarker.name=Configure Problem
|
||||
AutotoolsErrorParser.name=Autotools Error Parser
|
||||
AutotoolsErrorParser.name=Autotools Error Parser
|
||||
|
||||
AutoconfErrorParser.name=Autoconf Error Parser
|
|
@ -562,7 +562,7 @@
|
|||
<errorparser
|
||||
class="org.eclipse.cdt.internal.autotools.core.ErrorParser"
|
||||
id="org.eclipse.cdt.autotools.core.ErrorParser"
|
||||
name="Autoconf Error Parser">
|
||||
name="%AutoconfErrorParser.name">
|
||||
</errorparser>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.autotools.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package org.eclipse.cdt.autotools.core;
|
||||
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
public class AutotoolsOptionConstants {
|
||||
// IAutotoolOption Names
|
||||
public final static String TOOL_CONFIGURE = "configure"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_GENERAL = "general"; // $NON-NLS-1$
|
||||
public final static String OPT_CONFIGDIR = "configdir"; // $NON-NLS-1$
|
||||
public final static String OPT_CACHE_FILE = "cache-file"; // $NON-NLS-1$
|
||||
public final static String OPT_HELP = "help"; // $NON-NLS-1$
|
||||
public final static String OPT_NO_CREATE = "no-create"; // $NON-NLS-1$
|
||||
public final static String OPT_QUIET = "quiet"; // $NON-NLS-1$
|
||||
public final static String OPT_VERSION = "version"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_PLATFORM = "platform"; // $NON-NLS-1$
|
||||
public final static String OPT_HOST = "host"; // $NON-NLS-1$
|
||||
public final static String OPT_BUILD = "build"; // $NON-NLS-1$
|
||||
public final static String OPT_TARGET = "target"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_DIRECTORIES = "directories"; // $NON-NLS-1$
|
||||
public final static String OPT_PREFIX = "prefix"; // $NON-NLS-1$
|
||||
public final static String OPT_EXEC_PREFIX = "exec-prefix"; // $NON-NLS-1$
|
||||
public final static String OPT_LIBDIR = "libdir"; // $NON-NLS-1$
|
||||
public final static String OPT_BINDIR = "bindir"; // $NON-NLS-1$
|
||||
public final static String OPT_SBINDIR = "sbindir"; // $NON-NLS-1$
|
||||
public final static String OPT_INCLUDEDIR = "includedir"; // $NON-NLS-1$
|
||||
public final static String OPT_DATADIR = "datadir"; // $NON-NLS-1$
|
||||
public final static String OPT_SYSCONFDIR = "sysconfdir"; // $NON-NLS-1$
|
||||
public final static String OPT_INFODIR = "infodir"; // $NON-NLS-1$
|
||||
public final static String OPT_MANDIR = "mandir"; // $NON-NLS-1$
|
||||
public final static String OPT_SRCDIR = "srcdir"; // $NON-NLS-1$
|
||||
public final static String OPT_LOCALSTATEDIR = "localstatedir"; // $NON-NLS-1$
|
||||
public final static String OPT_SHAREDSTATEDIR = "sharedstatedir"; // $NON-NLS-1$
|
||||
public final static String OPT_LIBEXECDIR = "libexecdir"; // $NON-NLS-1$
|
||||
public final static String OPT_OLDINCLUDEDIR = "oldincludedir"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_FILENAMES = "filenames"; // $NON-NLS-1$
|
||||
public final static String OPT_PROGRAM_PREFIX = "program-prefix"; // $NON-NLS-1$
|
||||
public final static String OPT_PROGRAM_SUFFIX = "program-suffix"; // $NON-NLS-1$
|
||||
public final static String OPT_PROGRAM_TRANSFORM_NAME = "program-transform-name"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_FEATURES = "features"; // $NON-NLS-1$
|
||||
public final static String OPT_ENABLE_MAINTAINER_MODE = "enable-maintainer-mode"; // $NON-NLS-1$
|
||||
public final static String FLAG_CFLAGS = "CFLAGS"; // $NON-NLS-1$
|
||||
public final static String OPT_CFLAGS_DEBUG = "cflags-debug"; // $NON-NLS-1$
|
||||
public final static String OPT_CFLAGS_GPROF = "cflags-gprof"; // $NON-NLS-1$
|
||||
public final static String OPT_CFLAGS_GCOV = "cflags-gcov"; // $NON-NLS-1$
|
||||
public final static String OPT_USER = "user"; // $NON-NLS-1$
|
||||
public final static String TOOL_AUTOGEN = "autogen"; // $NON-NLS-1$
|
||||
public final static String CATEGORY_OPTIONS = "options"; // $NON-NLS-1$
|
||||
public final static String OPT_AUTOGENOPTS = "autogenOpts"; // $NON-NLS-1$
|
||||
|
||||
}
|
|
@ -12,9 +12,11 @@ package org.eclipse.cdt.autotools.core;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
|
@ -290,4 +292,34 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return set of Autotool configuration options for a given build configuration id.
|
||||
*
|
||||
* @param project existing autotools project
|
||||
* @param cfgId configuration id
|
||||
* @return a copy of Autotools configurations for the given configuration id
|
||||
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
||||
* @since 1.2
|
||||
*/
|
||||
public Map<String, IAutotoolsOption> getAutotoolCfgOptions(IProject project,
|
||||
String cfgId) throws CoreException {
|
||||
return AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(project, cfgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Autotool configuration options for a specified build configuration
|
||||
*
|
||||
* @param project existing autotools project
|
||||
* @param cfgId configuation id
|
||||
* @param options set of updated Autotool configuration options
|
||||
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void updateAutotoolCfgOptions(IProject project, String cfgId,
|
||||
Map<String,IAutotoolsOption> options) throws CoreException {
|
||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(project, cfgId, options);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.eclipse.cdt.autotools.core;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
public interface IAutotoolsOption {
|
||||
public final static int CATEGORY = 0;
|
||||
public final static int BIN = 1;
|
||||
public final static int STRING = 2;
|
||||
public final static int INTERNAL = 3;
|
||||
public final static int MULTIARG = 4;
|
||||
public final static int TOOL = 5;
|
||||
public final static int FLAG = 6;
|
||||
public final static int FLAGVALUE = 7;
|
||||
public int getType();
|
||||
public boolean canUpdate();
|
||||
public void setValue(String value) throws CoreException;
|
||||
public String getValue();
|
||||
}
|
|
@ -16,6 +16,8 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
||||
|
||||
|
||||
public class AutotoolsConfiguration implements IAConfiguration {
|
||||
|
||||
|
@ -67,48 +69,48 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
// All options following a category are children of that category
|
||||
// in a tree view, up to the next category.
|
||||
private static Option[] configOpts = new Option[] {
|
||||
new Option("configure", IConfigureOption.TOOL), // $NON-NLS-1$
|
||||
new Option("general", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("configdir", IConfigureOption.INTERNAL), // $NON-NLS-1$
|
||||
new Option("cache-file", "cache_file", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("help", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option("no-create", "no_create", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option("quiet", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option("version", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option("platform", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("host", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("build", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("target", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("directories", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("prefix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("exec-prefix", "exec_prefix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("libdir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("bindir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("sbindir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("includedir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("datadir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("sysconfdir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("infodir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("mandir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("srcdir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("localstatedir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("sharedstatedir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("libexecdir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("oldincludedir", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("filenames", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("program-prefix", "program_prefix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("program-suffix", "program_suffix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("program-transform-name", "program_transform_name", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option("features", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("enable-maintainer-mode", "enable_maintainer_mode", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option("CFLAGS", IConfigureOption.FLAG), // $NON-NLS-1$
|
||||
new Option("cflags-debug", "cflags_debug", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option("cflags-gprof", "cflags_gprof", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option("cflags-gcov", "cflags_gcov", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option("user", IConfigureOption.MULTIARG), // $NON-NLS-1$
|
||||
new Option("autogen", "autogen", "autogen.sh", IConfigureOption.TOOL), // $NON-NLS-1$
|
||||
new Option("options", IConfigureOption.CATEGORY), // $NON-NLS-1$
|
||||
new Option("autogenOpts", IConfigureOption.MULTIARG), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.TOOL_CONFIGURE, IConfigureOption.TOOL),
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_GENERAL, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_CONFIGDIR, IConfigureOption.INTERNAL),
|
||||
new Option(AutotoolsOptionConstants.OPT_CACHE_FILE, "cache_file", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.OPT_HELP, IConfigureOption.BIN),
|
||||
new Option(AutotoolsOptionConstants.OPT_NO_CREATE, "no_create", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.OPT_QUIET, IConfigureOption.BIN),
|
||||
new Option(AutotoolsOptionConstants.OPT_VERSION, IConfigureOption.BIN),
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_PLATFORM, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_HOST, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_BUILD, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_TARGET, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_DIRECTORIES, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_PREFIX, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_EXEC_PREFIX, "exec_prefix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.OPT_LIBDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_BINDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_SBINDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_INCLUDEDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_DATADIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_SYSCONFDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_INFODIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_MANDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_SRCDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_LOCALSTATEDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_LIBEXECDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR, IConfigureOption.STRING),
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_FILENAMES, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX, "program_prefix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX, "program_suffix", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME, "program_transform_name", IConfigureOption.STRING), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_FEATURES, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE, "enable_maintainer_mode", IConfigureOption.BIN), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.FLAG_CFLAGS, IConfigureOption.FLAG),
|
||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG, "cflags_debug", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GPROF, "cflags_gprof", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GCOV, "cflags_gcov", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
|
||||
new Option(AutotoolsOptionConstants.OPT_USER, IConfigureOption.MULTIARG),
|
||||
new Option(AutotoolsOptionConstants.TOOL_AUTOGEN, "autogen", "autogen.sh", IConfigureOption.TOOL), // $NON-NLS-1$
|
||||
new Option(AutotoolsOptionConstants.CATEGORY_OPTIONS, IConfigureOption.CATEGORY),
|
||||
new Option(AutotoolsOptionConstants.OPT_AUTOGENOPTS, IConfigureOption.MULTIARG),
|
||||
};
|
||||
|
||||
private static Option[] toolList;
|
||||
|
|
|
@ -20,12 +20,16 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
|
||||
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
|
@ -45,7 +49,10 @@ import org.eclipse.core.resources.IResourceChangeListener;
|
|||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
|
@ -58,8 +65,18 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
public final static String CFG_FILE_NAME = ".autotools"; //$NON-NLS-1$
|
||||
private final static String CFG_CANT_SAVE = "Configure.Error.NoProjectToSave"; //$NON-NLS-1$
|
||||
|
||||
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
public static final String INVALID_AUTOTOOLS_PROJECT = "CfgOptions.Invalid.Project"; //$NON-NLS-1$
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
|
||||
public static final String INVALID_AUTOTOOLS_CONFIG_ID = "CfgOptions.Invalid.Config"; //$NON-NLS-1$
|
||||
|
||||
private static AutotoolsConfigurationManager instance;
|
||||
private static Random rand = new Random();
|
||||
|
||||
private boolean isSyncing;
|
||||
|
||||
|
@ -79,21 +96,21 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
return instance;
|
||||
}
|
||||
|
||||
public IAConfiguration createDefaultConfiguration(IProject project, String id) {
|
||||
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
|
||||
IAConfiguration cfg = new AutotoolsConfiguration(id);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
public IAConfiguration findCfg(IProject p, String id) {
|
||||
public synchronized IAConfiguration findCfg(IProject p, String id) {
|
||||
Map<String, IAConfiguration> cfgs = getConfigurations(p);
|
||||
return cfgs.get(id);
|
||||
}
|
||||
|
||||
public IAConfiguration getConfiguration(IProject p, String cfgId) {
|
||||
public synchronized IAConfiguration getConfiguration(IProject p, String cfgId) {
|
||||
return getConfiguration(p, cfgId, true);
|
||||
}
|
||||
|
||||
public IAConfiguration getConfiguration(IProject p, String cfgId, boolean persist) {
|
||||
public synchronized IAConfiguration getConfiguration(IProject p, String cfgId, boolean persist) {
|
||||
IAConfiguration cfg = findCfg(p, cfgId);
|
||||
if (cfg == null) {
|
||||
cfg = createDefaultConfiguration(p, cfgId);
|
||||
|
@ -109,14 +126,14 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
}
|
||||
|
||||
|
||||
public boolean isConfigurationAlreadySaved(IProject project, ICConfigurationDescription cfgd) {
|
||||
public synchronized boolean isConfigurationAlreadySaved(IProject project, ICConfigurationDescription cfgd) {
|
||||
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
||||
if (cfgs != null)
|
||||
return cfgs.get(cfgd.getId()) != null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addConfiguration(IProject project, IAConfiguration cfg) {
|
||||
public synchronized void addConfiguration(IProject project, IAConfiguration cfg) {
|
||||
String projectName = project.getName();
|
||||
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
||||
if (cfgs == null) {
|
||||
|
@ -127,11 +144,11 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
saveConfigs(project);
|
||||
}
|
||||
|
||||
public boolean isSyncing() {
|
||||
public synchronized boolean isSyncing() {
|
||||
return isSyncing;
|
||||
}
|
||||
|
||||
private void setSyncing(boolean value) {
|
||||
private synchronized void setSyncing(boolean value) {
|
||||
isSyncing = value;
|
||||
}
|
||||
|
||||
|
@ -144,7 +161,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
* @param project to synchronize configurations for
|
||||
*
|
||||
*/
|
||||
public void syncConfigurations(IProject project) {
|
||||
public synchronized void syncConfigurations(IProject project) {
|
||||
setSyncing(true);
|
||||
clearTmpConfigurations(project);
|
||||
ICProjectDescription pd = CoreModel.getDefault().getProjectDescription(project);
|
||||
|
@ -160,13 +177,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
replaceProjectConfigurations(project, newCfgList);
|
||||
}
|
||||
|
||||
public void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs) {
|
||||
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs) {
|
||||
String projectName = project.getName();
|
||||
configs.put(projectName, cfgs);
|
||||
saveConfigs(project);
|
||||
}
|
||||
|
||||
public void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs, ICConfigurationDescription[] cfgds) {
|
||||
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs, ICConfigurationDescription[] cfgds) {
|
||||
String projectName = project.getName();
|
||||
configs.put(projectName, cfgs);
|
||||
saveConfigs(project, cfgds);
|
||||
|
@ -201,7 +218,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
else if (nameNode != null) {
|
||||
String cfgName = nameNode.getNodeValue();
|
||||
ICConfigurationDescription cfgd =
|
||||
CoreModel.getDefault().getProjectDescription(project).getConfigurationByName(cfgName);
|
||||
CoreModel.getDefault().getProjectDescription(project).getConfigurationByName(cfgName);
|
||||
if (cfgd != null)
|
||||
cfgId = cfgd.getId();
|
||||
else
|
||||
|
@ -258,7 +275,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
return list;
|
||||
}
|
||||
|
||||
public IAConfiguration getTmpConfiguration(IProject p, ICConfigurationDescription cfgd) {
|
||||
public synchronized IAConfiguration getTmpConfiguration(IProject p, ICConfigurationDescription cfgd) {
|
||||
Map <String, IAConfiguration> list = getTmpConfigs(p);
|
||||
IAConfiguration acfg = list.get(cfgd.getId());
|
||||
if (acfg != null) {
|
||||
|
@ -278,7 +295,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
* @param cfgd the configuration descriptor for the clone
|
||||
* @return true if the configuration is already saved, false otherwise
|
||||
*/
|
||||
public boolean cloneCfg(IProject p, String oldId, ICConfigurationDescription cfgd) {
|
||||
public synchronized boolean cloneCfg(IProject p, String oldId, ICConfigurationDescription cfgd) {
|
||||
if (isConfigurationAlreadySaved(p, cfgd))
|
||||
return true;
|
||||
Map <String, IAConfiguration> tmpList = getTmpConfigs(p);
|
||||
|
@ -316,13 +333,15 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
return tmpList;
|
||||
}
|
||||
|
||||
public void clearTmpConfigurations(IProject p) {
|
||||
public synchronized void clearTmpConfigurations(IProject p) {
|
||||
tmpConfigs.remove(p.getName());
|
||||
}
|
||||
|
||||
public void saveConfigs(IProject project) {
|
||||
ICConfigurationDescription[] cfgds = CoreModel.getDefault().getProjectDescription(project).getConfigurations();
|
||||
saveConfigs(project, cfgds);
|
||||
public synchronized void saveConfigs(IProject project) {
|
||||
synchronized (project) {
|
||||
ICConfigurationDescription[] cfgds = CoreModel.getDefault().getProjectDescription(project).getConfigurations();
|
||||
saveConfigs(project, cfgds);
|
||||
}
|
||||
}
|
||||
|
||||
private void syncNameField(ICConfigurationDescription cfgd) {
|
||||
|
@ -417,7 +436,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
// with any changes currently that have been made to them. If a configuration has been renamed, but this
|
||||
// has not yet been confirmed by the end-user, then only the changes to the configuration are made. The
|
||||
// name currently remains the same in the output file.
|
||||
public void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) {
|
||||
public synchronized void applyConfigs(String projectName, ICConfigurationDescription[] cfgds) {
|
||||
try {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IResource res = (IProject)root.findMember(projectName, false);
|
||||
|
@ -489,7 +508,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<String, IAConfiguration> getConfigurations(IProject project) {
|
||||
public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) {
|
||||
Map<String, IAConfiguration> list = getSavedConfigs(project);
|
||||
if (list == null) {
|
||||
list = new HashMap<String, IAConfiguration>();
|
||||
|
@ -498,7 +517,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
return list;
|
||||
}
|
||||
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
public synchronized void resourceChanged(IResourceChangeEvent event) {
|
||||
IResource res = event.getResource();
|
||||
if (!(res instanceof IProject))
|
||||
return;
|
||||
|
@ -527,4 +546,134 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
private class AutotoolsOption implements IAutotoolsOption {
|
||||
|
||||
private IConfigureOption option;
|
||||
private final static String UNMODIFIABLE_CONFIG_OPTION = "CfgOptions.Unmodifiable.Option"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public AutotoolsOption(IConfigureOption option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return option.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
int type = getType();
|
||||
switch (type) {
|
||||
case STRING:
|
||||
case BIN:
|
||||
case TOOL:
|
||||
case FLAGVALUE:
|
||||
case MULTIARG:
|
||||
case INTERNAL:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) throws CoreException {
|
||||
if (!canUpdate()) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||
ConfigureMessages.getString(UNMODIFIABLE_CONFIG_OPTION)));
|
||||
}
|
||||
synchronized (option) {
|
||||
option.setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
synchronized (option) {
|
||||
return option.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String createDummyId() {
|
||||
for (;;) {
|
||||
String id = "TEMP_" + rand.nextInt();
|
||||
if (tmpConfigs.get(id) == null)
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
public synchronized Map<String, IAutotoolsOption> getAutotoolsCfgOptions(IProject project,
|
||||
String cfgId) throws CoreException {
|
||||
|
||||
// Verify project is valid Autotools project
|
||||
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
||||
}
|
||||
|
||||
// Verify configuration id is valid
|
||||
ICConfigurationDescription cfgd =
|
||||
CoreModel.getDefault().getProjectDescription(project).getConfigurationById(cfgId);
|
||||
IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||
if (icfg == null) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
||||
}
|
||||
|
||||
IAConfiguration cfg = getConfiguration(project, cfgId);
|
||||
HashMap<String, IAutotoolsOption> options = new HashMap<String, IAutotoolsOption>();
|
||||
|
||||
// Get set of configuration options and convert to set of IAutotoolOptions
|
||||
Map<String, IConfigureOption> cfgOptions = cfg.getOptions();
|
||||
IAConfiguration dummyCfg = createDefaultConfiguration(project, createDummyId());
|
||||
for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) {
|
||||
Map.Entry<String, IConfigureOption> entry = (Entry<String, IConfigureOption>) i.next();
|
||||
String name = entry.getKey();
|
||||
IAutotoolsOption configOption =
|
||||
new AutotoolsOption(entry.getValue().copy((AutotoolsConfiguration)dummyCfg));
|
||||
options.put(name, configOption);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.2
|
||||
*/
|
||||
public synchronized void updateAutotoolCfgOptions(IProject project, String cfgId,
|
||||
Map<String,IAutotoolsOption> options) throws CoreException {
|
||||
|
||||
// Verify project is valid Autotools project
|
||||
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
||||
}
|
||||
|
||||
// Verify configuration id is valid
|
||||
IAConfiguration cfg = findCfg(project, cfgId);
|
||||
if (cfg == null) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
||||
}
|
||||
|
||||
// Get set of configuration options and convert to set of IAutotoolOptions
|
||||
for (Iterator<Entry<String, IAutotoolsOption>> i = options.entrySet().iterator(); i.hasNext();) {
|
||||
Map.Entry<String, IAutotoolsOption> entry = (Entry<String, IAutotoolsOption>) i.next();
|
||||
String name = entry.getKey();
|
||||
IAutotoolsOption option = entry.getValue();
|
||||
IConfigureOption cfgOption = cfg.getOption(name);
|
||||
if (cfgOption != null) {
|
||||
cfgOption.setValue(option.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// Save changes
|
||||
saveConfigs(project);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -98,4 +98,8 @@ Tool.command=Command
|
|||
Tool.allopts=All Options
|
||||
|
||||
Configure.Error.AlreadyExists="A configuration named {0} already exists"
|
||||
Configure.Error.NoProjectToSave="Project: {0} does not exist at time of saving configuration"
|
||||
Configure.Error.NoProjectToSave="Project: {0} does not exist at time of saving configuration"
|
||||
|
||||
CfgOptions.Invalid.Project=Specified project is not a valid existing Autotools project
|
||||
CfgOptions.Invalid.Config=Specified configuration id does not correspond to an existing configuration
|
||||
CfgOptions.Unmodifiable.Option=Attempting to modify an unmodifiable Autotools configure option
|
||||
|
|
|
@ -12,16 +12,18 @@ package org.eclipse.cdt.internal.autotools.core.configure;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
||||
|
||||
public interface IConfigureOption {
|
||||
|
||||
public final static int CATEGORY = 0;
|
||||
public final static int BIN = 1;
|
||||
public final static int STRING = 2;
|
||||
public final static int INTERNAL = 3;
|
||||
public final static int MULTIARG = 4;
|
||||
public final static int TOOL = 5;
|
||||
public final static int FLAG = 6;
|
||||
public final static int FLAGVALUE = 7;
|
||||
public final static int CATEGORY = IAutotoolsOption.CATEGORY;
|
||||
public final static int BIN = IAutotoolsOption.BIN;
|
||||
public final static int STRING = IAutotoolsOption.STRING;
|
||||
public final static int INTERNAL = IAutotoolsOption.INTERNAL;
|
||||
public final static int MULTIARG = IAutotoolsOption.MULTIARG;
|
||||
public final static int TOOL = IAutotoolsOption.TOOL;
|
||||
public final static int FLAG = IAutotoolsOption.FLAG;
|
||||
public final static int FLAGVALUE = IAutotoolsOption.FLAGVALUE;
|
||||
public String getName();
|
||||
public String getParameter();
|
||||
public ArrayList<String> getParameters();
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2012-07-23 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/tests/AllAutotoolsTests.java (suite): Add new UpdateConfigureTest.
|
||||
* src/org/eclipse/cdt/autotools/tests/UpdateConfigureTest.java: New test.
|
||||
* src/org/eclipse/cdt/autotools/tests/AutotoolsProjectTest0.java (testAutotoolsProject0): Fix nature id being tested.
|
||||
* src/org/eclipse/cdt/autotools/tests/AutotoolsProjectTest1.java (testAutotoolsProject1): Ditto.
|
||||
* src/org/eclipse/cdt/autotools/tests/AutotoolsProjectTest2.java (testAutotoolsProject2): Ditto.
|
||||
* src/org/eclipse/cdt/autotools/tests/AutotoolsProjectNatureTest.java (testAutotoolsProjectNature): Ditto.
|
||||
|
||||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/tests/ProjectTools.java
|
||||
|
|
|
@ -23,3 +23,6 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.cdt.autotools.ui;bundle-version="1.0.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Export-Package: org.eclipse.cdt.autotools.tests,
|
||||
org.eclipse.cdt.autotools.tests.autoconf,
|
||||
org.eclipse.cdt.autotools.tests.editors
|
||||
|
|
|
@ -26,6 +26,7 @@ public class AllAutotoolsTests {
|
|||
suite.addTestSuite(AutotoolsProjectNatureTest.class);
|
||||
suite.addTestSuite(AutotoolsProjectTest1.class);
|
||||
suite.addTestSuite(AutotoolsProjectTest2.class);
|
||||
suite.addTestSuite(UpdateConfigureTest.class);
|
||||
suite.addTest(AutoconfTests.suite());
|
||||
suite.addTest(EditorTests.suite());
|
||||
//$JUnit-END$
|
||||
|
|
|
@ -12,8 +12,8 @@ package org.eclipse.cdt.autotools.tests;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
|
||||
public class AutotoolsProjectNatureTest extends TestCase {
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class AutotoolsProjectNatureTest extends TestCase {
|
|||
if(testProject == null) {
|
||||
fail("Unable to create test project");
|
||||
}
|
||||
assertTrue(testProject.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
|
||||
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
||||
testProject.delete(true, false, ProjectTools.getMonitor());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.autotools.tests;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -47,7 +47,7 @@ public class AutotoolsProjectTest0 extends TestCase {
|
|||
public void testAutotoolsProject0() throws Exception {
|
||||
Path p = new Path("zip/project1.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, null, p, null, true);
|
||||
assertTrue(testProject.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
|
||||
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
||||
org.eclipse.core.runtime.Path x = new org.eclipse.core.runtime.Path("ChangeLog");
|
||||
assertTrue(testProject.exists(x));
|
||||
x = new org.eclipse.core.runtime.Path("configure");
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.autotools.tests;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -49,7 +49,7 @@ public class AutotoolsProjectTest1 extends TestCase {
|
|||
public void testAutotoolsProject1() throws Exception {
|
||||
Path p = new Path("zip/project1.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null, true);
|
||||
assertTrue(testProject.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
|
||||
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
||||
org.eclipse.core.runtime.Path x = new org.eclipse.core.runtime.Path("src/ChangeLog");
|
||||
assertTrue(testProject.exists(x));
|
||||
x = new org.eclipse.core.runtime.Path("src/configure");
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.autotools.tests;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -51,7 +51,7 @@ public class AutotoolsProjectTest2 extends TestCase {
|
|||
public void testAutotoolsProject2() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null);
|
||||
assertTrue(testProject.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
|
||||
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
||||
org.eclipse.core.runtime.Path x = new org.eclipse.core.runtime.Path("src/ChangeLog");
|
||||
assertTrue(testProject.exists(x));
|
||||
x = new org.eclipse.core.runtime.Path("src/configure");
|
||||
|
|
|
@ -0,0 +1,484 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2012 Red Hat 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:
|
||||
* Red Hat Incorporated - initial API and implementation
|
||||
* Marc-Andre Laperle - Fix failing test on Windows
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
|
||||
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
// This test verifies an autogen.sh project that builds configure, but
|
||||
// does not run it.
|
||||
public class UpdateConfigureTest extends TestCase {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject2");
|
||||
if (testProject == null) {
|
||||
fail("Unable to create test project");
|
||||
}
|
||||
testProject.open(new NullProgressMonitor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getting and updating configuration options for an Autotools Project. The top-level
|
||||
* contains autogen.sh which will build configure, but not run it.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testGetAndUpdateConfigureOptions() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null);
|
||||
assertTrue(testProject.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
|
||||
ProjectTools.setConfigDir(testProject, "src");
|
||||
ProjectTools.markExecutable(testProject, "src/autogen.sh");
|
||||
assertTrue(ProjectTools.build());
|
||||
ICConfigurationDescription cfgDes = CoreModel.getDefault().getProjectDescription(testProject).getActiveConfiguration();
|
||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
|
||||
assertTrue(cfg.getName().equals("Build (GNU)"));
|
||||
Map<String, IAutotoolsOption> opts = AutotoolsPlugin.getDefault().getAutotoolCfgOptions(testProject, cfg.getId());
|
||||
IAutotoolsOption configdir = opts.get(AutotoolsOptionConstants.OPT_CONFIGDIR);
|
||||
assertEquals(configdir.getType(), IAutotoolsOption.INTERNAL);
|
||||
assertTrue(configdir.getValue().equals("src"));
|
||||
assertTrue(configdir.canUpdate());
|
||||
// Verify we cannot update any of the categories or flags
|
||||
IAutotoolsOption k = opts.get(AutotoolsOptionConstants.CATEGORY_DIRECTORIES);
|
||||
assertFalse(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.CATEGORY);
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.CATEGORY_FEATURES);
|
||||
assertFalse(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.CATEGORY);
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.CATEGORY_FILENAMES);
|
||||
assertFalse(k.canUpdate());
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.CATEGORY_GENERAL);
|
||||
assertEquals(k.getType(), IAutotoolsOption.CATEGORY);
|
||||
assertFalse(k.canUpdate());
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.CATEGORY_OPTIONS);
|
||||
assertEquals(k.getType(), IAutotoolsOption.CATEGORY);
|
||||
assertFalse(k.canUpdate());
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.CATEGORY_PLATFORM);
|
||||
assertFalse(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.CATEGORY);
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.FLAG_CFLAGS);
|
||||
assertFalse(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.FLAG);
|
||||
|
||||
// Tools are ok to update
|
||||
k = opts.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.TOOL);
|
||||
assertEquals(k.getValue(), "autogen.sh"); //$NON-NLS-1$
|
||||
k.setValue("autogen2.sh"); //$NON-NLS-1$
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.TOOL_CONFIGURE);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.TOOL);
|
||||
assertEquals(k.getValue(), "configure"); //$NON-NLS-1$
|
||||
k.setValue("config"); //$NON-NLS-1$
|
||||
|
||||
// Flag values are ok to update
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
// Check other options
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_AUTOGENOPTS);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.MULTIARG);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("some opts");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_BINDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/bin");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_BUILD);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("linux");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("config.status");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_DATADIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/data");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/exec");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_HELP);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_HOST);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("linux");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/include");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_INFODIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/info");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/lib");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/libexec");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/localstate");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_MANDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/man");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/oldinclude");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_PREFIX);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("prefix");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("program_prefix");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("program_suffix");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("program_transform_name");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_QUIET);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/sbin");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/sharedstate");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("src");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("/usr/sysconf");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_TARGET);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("target");
|
||||
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_USER);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.MULTIARG);
|
||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||
k.setValue("user opts");
|
||||
|
||||
k = opts.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||
assertTrue(k.canUpdate());
|
||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||
k.setValue("true");
|
||||
|
||||
// Verify last option changed has changed in our copy, but not
|
||||
// in the actual options
|
||||
assertEquals(k.getValue(), "true");
|
||||
Map<String, IAutotoolsOption> opts2 = AutotoolsPlugin.getDefault().getAutotoolCfgOptions(testProject, cfg.getId());
|
||||
IAutotoolsOption k2 = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||
assertEquals(k2.getValue(), "false");
|
||||
|
||||
// Now update the options we changed
|
||||
AutotoolsPlugin.getDefault().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
||||
opts2 = AutotoolsPlugin.getDefault().getAutotoolCfgOptions(testProject, cfg.getId());
|
||||
|
||||
// Verify new option values
|
||||
k = opts2.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
||||
assertEquals(k.getValue(), "autogen2.sh"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.TOOL_CONFIGURE);
|
||||
assertEquals(k.getValue(), "config"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_AUTOGENOPTS);
|
||||
assertEquals(k.getValue(), "some opts"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_BINDIR);
|
||||
assertEquals(k.getValue(), "/usr/bin"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_BUILD);
|
||||
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
||||
assertEquals(k.getValue(), "config.status"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_DATADIR);
|
||||
assertEquals(k.getValue(), "/usr/data"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
||||
assertEquals(k.getValue(), "/usr/exec"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_HELP);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_HOST);
|
||||
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
||||
assertEquals(k.getValue(), "/usr/include"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_INFODIR);
|
||||
assertEquals(k.getValue(), "/usr/info"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
||||
assertEquals(k.getValue(), "/usr/lib"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
||||
assertEquals(k.getValue(), "/usr/libexec"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
||||
assertEquals(k.getValue(), "/usr/localstate"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_MANDIR);
|
||||
assertEquals(k.getValue(), "/usr/man"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
||||
assertEquals(k.getValue(), "/usr/oldinclude"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_PREFIX);
|
||||
assertEquals(k.getValue(), "prefix"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
||||
assertEquals(k.getValue(), "program_prefix"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
||||
assertEquals(k.getValue(), "program_suffix"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
||||
assertEquals(k.getValue(), "program_transform_name"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_QUIET);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
||||
assertEquals(k.getValue(), "/usr/sbin"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
||||
assertEquals(k.getValue(), "/usr/sharedstate"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
||||
assertEquals(k.getValue(), "src"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
||||
assertEquals(k.getValue(), "/usr/sysconf"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_TARGET);
|
||||
assertEquals(k.getValue(), "target"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_USER);
|
||||
assertEquals(k.getValue(), "user opts"); //$NON-NLS-1$
|
||||
|
||||
k = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||
|
||||
// Verify one updated option in the .autotools file for the project
|
||||
try {
|
||||
IPath fileLocation = testProject.getLocation().append(".autotools"); //$NON-NLS-1$
|
||||
File dirFile = fileLocation.toFile();
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
assertTrue(dirFile.exists());
|
||||
Document d = db.parse(dirFile);
|
||||
Element e = d.getDocumentElement();
|
||||
// Get the stored configuration data
|
||||
NodeList cfgs = e.getElementsByTagName("configuration"); // $NON-NLS-1$
|
||||
for (int x = 0; x < cfgs.getLength(); ++x) {
|
||||
Node n = cfgs.item(x);
|
||||
NodeList l = n.getChildNodes();
|
||||
for (int y = 0; y < l.getLength(); ++y) {
|
||||
Node child = l.item(y);
|
||||
if (child.getNodeName().equals("option")) { // $NON-NLS-1$
|
||||
NamedNodeMap optionAttrs = child.getAttributes();
|
||||
Node id = optionAttrs.getNamedItem("id"); // $NON-NLS-1$
|
||||
Node value = optionAttrs.getNamedItem("value"); // $NON-NLS-1$
|
||||
// Verify the bindir option is updated
|
||||
if (id.equals(AutotoolsOptionConstants.OPT_BINDIR))
|
||||
assertEquals(value, "/usr/bin"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (SAXException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
|
@ -118,7 +118,7 @@ BuildSettingsBlock.label.macros.group=Build Macros usage
|
|||
BuildSettingsBlock.label.macros.expand=Expand Build Environment Macros
|
||||
BuildSettingsBlock.label.internal.builder.group=Internal Builder
|
||||
BuildSettingsBlock.label.internal.builder.enable=Enable Internal Builder
|
||||
BuildSettingsBlock.label.internal.builder.ignore.err=Ignore build errorors
|
||||
BuildSettingsBlock.label.internal.builder.ignore.err=Ignore build errors
|
||||
BuildSettingsBlock.label.internal.builder.experimental.note=NOTE: This is experimental functionality
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,10 @@ public class GCCScannerInfoConsoleParserTests extends BaseBOPConsoleParserTests
|
|||
assertTrue(sumIncludes.contains("//server6/include")); //$NON-NLS-1$
|
||||
assertTrue(sumIncludes.contains("/multiline/dir")); //$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.size() == 26);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2003, 2010 IBM Corporation and others.
|
||||
# Copyright (c) 2003, 2012 IBM Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
|
@ -75,4 +75,8 @@ extension-point.name = Managed Build Tools 2.0 (Deprecated)
|
|||
extension-point.name.0 = Managed Build Definitions
|
||||
extension-point.name.1 = Managed Build Project Converter
|
||||
extension-point.name.2 = Build Properties
|
||||
extension-point.name.3 = ToolChain Modification Info
|
||||
extension-point.name.3 = ToolChain Modification Info
|
||||
|
||||
GCCBuildOutputParser.name = CDT GCC Build Output Parser
|
||||
GCCBuildinCompilerSettings.name = CDT GCC Builtin Compiler Settings
|
||||
ManagedBuildSettingEntries.name = CDT Managed Build Setting Entries
|
|
@ -603,12 +603,12 @@
|
|||
<provider
|
||||
class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.MBSLanguageSettingsProvider"
|
||||
id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"
|
||||
name="CDT Managed Build Setting Entries">
|
||||
name="%ManagedBuildSettingEntries.name">
|
||||
</provider>
|
||||
<provider
|
||||
class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector"
|
||||
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
||||
name="CDT GCC Builtin Compiler Settings"
|
||||
name="%GCCBuildinCompilerSettings.name"
|
||||
parameter="${COMMAND} -E -P -v -dD ${INPUTS}">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
|
@ -632,7 +632,7 @@
|
|||
<provider
|
||||
class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser"
|
||||
id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"
|
||||
name="CDT GCC Build Output Parser"
|
||||
name="%GCCBuildOutputParser.name"
|
||||
parameter="(gcc)|([gc]\+\+)|(clang)"
|
||||
prefer-non-shared="true">
|
||||
</provider>
|
||||
|
|
|
@ -16,3 +16,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.core.resources
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Export-Package: org.eclipse.cdt.managedbuilder.ui.tests,
|
||||
org.eclipse.cdt.managedbuilder.ui.tests.suite,
|
||||
org.eclipse.cdt.managedbuilder.ui.tests.testplugin,
|
||||
org.eclipse.cdt.managedbuilder.ui.tests.util,
|
||||
org.eclipse.cdt.managedbuilder.ui.tests.wizardPages
|
||||
|
|
|
@ -188,7 +188,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
|||
* Checks whether specified type (class or typedef to the class) is an abstract class.
|
||||
* If it is, reports violations on each pure virtual method
|
||||
*/
|
||||
private void reportProblemsIfAbstract(IType typeToCheck, IASTNode problemNode ) {
|
||||
private void reportProblemsIfAbstract(IType typeToCheck, IASTNode problemNode) {
|
||||
IType unwindedType = CxxAstUtils.unwindTypedef(typeToCheck);
|
||||
if (!(unwindedType instanceof ICPPClassType) || unwindedType instanceof IProblemBinding) {
|
||||
return;
|
||||
|
@ -196,7 +196,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
|||
ICPPClassType classType = (ICPPClassType) unwindedType;
|
||||
ICPPMethod[] pureVirtualMethods = pureVirtualMethodsCache.get(classType);
|
||||
if (pureVirtualMethods == null) {
|
||||
pureVirtualMethods = ClassTypeHelper.getPureVirtualMethods(classType);
|
||||
pureVirtualMethods = ClassTypeHelper.getPureVirtualMethods(classType, problemNode);
|
||||
pureVirtualMethodsCache.put(classType, pureVirtualMethods);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
|
||||
|
@ -84,7 +85,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
Set<IField> fieldsInConstructor = constructorsStack.push(new HashSet<IField>());
|
||||
|
||||
// Add all class fields
|
||||
for (IField field : constructor.getClassOwner().getDeclaredFields()) {
|
||||
for (IField field : ClassTypeHelper.getDeclaredFields(constructor.getClassOwner(), declaration)) {
|
||||
if (isSimpleType(field.getType()) && !field.isStatic()) {
|
||||
fieldsInConstructor.add(field);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
|||
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.ICPPMethod;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +47,8 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
|||
ast.accept(new OnEachClass());
|
||||
}
|
||||
|
||||
private static ICPPMethod getDestructor(ICPPClassType classType) {
|
||||
for (ICPPMethod method : classType.getDeclaredMethods()) {
|
||||
private static ICPPMethod getDestructor(ICPPClassType classType, IASTNode point) {
|
||||
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
||||
if (method.isDestructor()) {
|
||||
return method;
|
||||
}
|
||||
|
@ -55,18 +56,18 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static boolean hasVirtualDestructor(ICPPClassType classType) {
|
||||
private static boolean hasVirtualDestructor(ICPPClassType classType, IASTNode point) {
|
||||
checkedClassTypes.add(classType);
|
||||
ICPPMethod destructor = getDestructor(classType);
|
||||
ICPPMethod destructor = getDestructor(classType, point);
|
||||
if (destructor != null && destructor.isVirtual()) {
|
||||
return true;
|
||||
}
|
||||
ICPPBase[] bases = classType.getBases();
|
||||
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
|
||||
for (ICPPBase base : bases) {
|
||||
IBinding baseClass = base.getBaseClass();
|
||||
if (baseClass instanceof ICPPClassType) {
|
||||
ICPPClassType cppClassType = (ICPPClassType) baseClass;
|
||||
if (!checkedClassTypes.contains(cppClassType) && hasVirtualDestructor(cppClassType)) {
|
||||
if (!checkedClassTypes.contains(cppClassType) && hasVirtualDestructor(cppClassType, point)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -89,13 +90,13 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
|||
return PROCESS_SKIP;
|
||||
}
|
||||
ICPPClassType classType = (ICPPClassType) binding;
|
||||
boolean hasVirtualDestructor = hasVirtualDestructor(classType);
|
||||
boolean hasVirtualDestructor = hasVirtualDestructor(classType, className);
|
||||
checkedClassTypes.clear();
|
||||
if (hasVirtualDestructor) {
|
||||
return PROCESS_SKIP;
|
||||
}
|
||||
ICPPMethod virtualMethod = null;
|
||||
for (ICPPMethod method : classType.getAllDeclaredMethods()) {
|
||||
for (ICPPMethod method : ClassTypeHelper.getAllDeclaredMethods(classType, className)) {
|
||||
if (!method.isDestructor() && method.isVirtual()) {
|
||||
virtualMethod = method;
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
|||
if (virtualMethod == null) {
|
||||
return PROCESS_SKIP;
|
||||
}
|
||||
ICPPMethod destructor = getDestructor(classType);
|
||||
ICPPMethod destructor = getDestructor(classType, className);
|
||||
if (destructor != null &&
|
||||
destructor.getVisibility() != ICPPASTVisibilityLabel.v_public &&
|
||||
classType.getFriends().length == 0) {
|
||||
|
|
7
core/org.eclipse.cdt.alltests/.classpath
Normal file
7
core/org.eclipse.cdt.alltests/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
28
core/org.eclipse.cdt.alltests/.project
Normal file
28
core/org.eclipse.cdt.alltests/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.alltests</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,65 @@
|
|||
#Fri Apr 25 15:24:03 EDT 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=error
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
44
core/org.eclipse.cdt.alltests/CDT Master Test Suite.launch
Normal file
44
core/org.eclipse.cdt.alltests/CDT Master Test Suite.launch
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="true"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="true"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="true"/>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.eclipse.cdt.alltests/src/org/eclipse/cdt/alltests/AllTests.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
|
||||
<mapEntry key="PATH" value="${env_var:PATH};d:\mingw\bin;d:\mingw\msys\1.0\bin"/>
|
||||
</mapAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.cdt.alltests.AllTests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.cdt.alltests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m -Xmx896m -XX:MaxPermSize=356M"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
|
||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||
<booleanAttribute key="useProduct" value="true"/>
|
||||
</launchConfiguration>
|
26
core/org.eclipse.cdt.alltests/META-INF/MANIFEST.MF
Normal file
26
core/org.eclipse.cdt.alltests/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,26 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name.0
|
||||
Bundle-SymbolicName: org.eclipse.cdt.alltests
|
||||
Bundle-Version: 8.1.0.qualifier
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.junit,
|
||||
org.eclipse.cdt.core.tests,
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.cdt.autotools.tests,
|
||||
org.eclipse.cdt.core.tests,
|
||||
org.eclipse.cdt.ui.tests,
|
||||
org.eclipse.cdt.codan.core.test,
|
||||
org.eclipse.cdt.core.lrparser.tests,
|
||||
org.eclipse.cdt.make.core.tests,
|
||||
org.eclipse.cdt.managedbuilder.core.tests,
|
||||
org.eclipse.cdt.managedbuilder.ui.tests,
|
||||
org.eclipse.cdt.testsrunner.test,
|
||||
org.eclipse.cdt.core.parser.upc.tests,
|
||||
org.eclipse.cdt.errorparsers.xlc.tests,
|
||||
org.eclipse.cdt.core.lrparser.xlc.tests,
|
||||
org.eclipse.cdt.debug.ui.tests
|
||||
Bundle-Vendor: %Bundle-Vendor.0
|
||||
Bundle-Localization: plugin
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
7
core/org.eclipse.cdt.alltests/README.txt
Normal file
7
core/org.eclipse.cdt.alltests/README.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
This plugin is a convenience for developers wanting to run all the junit3 tests
|
||||
in CDT from within the IDE with a single click. It contains a container test
|
||||
class and a launch configuration. If you're interested in running only a subset
|
||||
of the tests, simply comment out lines in AllTests.java.
|
||||
|
||||
Keep in mind some of the tests require a toolchain to be in PATH. So Windows
|
||||
developers will need to have MinGW or Cygwin installed.
|
24
core/org.eclipse.cdt.alltests/about.html
Normal file
24
core/org.eclipse.cdt.alltests/about.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>February 8, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
17
core/org.eclipse.cdt.alltests/build.properties
Normal file
17
core/org.eclipse.cdt.alltests/build.properties
Normal file
|
@ -0,0 +1,17 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2007, 2009 IBM Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
###############################################################################
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
about.html,\
|
||||
plugin.properties
|
||||
src.includes = about.html
|
13
core/org.eclipse.cdt.alltests/plugin.properties
Normal file
13
core/org.eclipse.cdt.alltests/plugin.properties
Normal file
|
@ -0,0 +1,13 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2012 Freescale Semiconductor Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Freescale Semiconductor - initial API and implementation
|
||||
###############################################################################
|
||||
# properties file for org.eclipse.cdt.core.parser.c99.tests
|
||||
Bundle-Vendor.0 = Eclipse CDT
|
||||
Bundle-Name.0 = CDT Master Test Suite
|
35
core/org.eclipse.cdt.alltests/pom.xml
Normal file
35
core/org.eclipse.cdt.alltests/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.1.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.core.parser.upc.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>**/UPCParserTestSuite.*</include>
|
||||
</includes>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,39 @@
|
|||
package org.eclipse.cdt.alltests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Container for all the junit3 tests in CDT
|
||||
*
|
||||
* Keep in mind that some of these tests require that a GNU toolchain be in
|
||||
* PATH. (I.e., on Windows, make sure you have MinGW or Cygwin)
|
||||
*/
|
||||
public class AllTests extends TestSuite {
|
||||
public static Test suite() throws Exception {
|
||||
final AllTests suite = new AllTests();
|
||||
suite.addTest(org.eclipse.cdt.autotools.tests.AllAutotoolsTests.suite()); // Works with MinGW but not Cygwin
|
||||
// // 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$
|
||||
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.parser.xlc.tests.suite.XlcTestSuite.suite());
|
||||
}
|
||||
|
||||
suite.addTest(org.eclipse.cdt.core.parser.upc.tests.UPCParserTestSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.suite.AutomatedIntegrationSuite.suite());
|
||||
|
||||
// These tests fail intermittently due to gdb not shutting down and thus
|
||||
// not being able to delete the project (exe locked)
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
suite.addTest(org.eclipse.cdt.debug.core.tests.AllDebugTests.suite());
|
||||
}
|
||||
suite.addTest(org.eclipse.cdt.errorparsers.xlc.tests.AllXlcErrorParserTests.suite());
|
||||
suite.addTest(org.eclipse.cdt.make.core.tests.AutomatedIntegrationSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.managedbuilder.tests.suite.AllManagedBuildTests.suite());
|
||||
suite.addTest(org.eclipse.cdt.managedbuilder.ui.tests.suite.AllManagedBuildUITests.suite());
|
||||
suite.addTest(org.eclipse.cdt.testsrunner.test.TestsRunnerSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.ui.tests.AutomatedSuite.suite());
|
||||
return suite;
|
||||
}
|
||||
}
|
|
@ -937,6 +937,12 @@ public class ErrorParserFileMatchingTest extends TestCase {
|
|||
// Skip the test if Cygwin is not available.
|
||||
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+"]",
|
||||
usrIncludeWindowsPath.charAt(1)==IPath.DEVICE_SEPARATOR);
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
public class RefreshScopeTests extends TestCase {
|
||||
|
||||
private IProject fProject;
|
||||
private IProject fGeneralProject;
|
||||
private IFolder fFolder1;
|
||||
private IFolder fFolder2;
|
||||
private IFolder fFolder3;
|
||||
|
@ -73,6 +74,20 @@ public class RefreshScopeTests extends TestCase {
|
|||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
ICProject cProject = CProjectHelper.createNewStileCProject("testRefreshScope", IPDOMManager.ID_NO_INDEXER, false);
|
||||
fProject = cProject.getProject();
|
||||
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
fGeneralProject = root.getProject("testRefreshScopeGeneral");
|
||||
assertNotNull(fGeneralProject);
|
||||
|
||||
if (!fGeneralProject.exists()) {
|
||||
fGeneralProject.create(null);
|
||||
} else {
|
||||
fGeneralProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
}
|
||||
|
||||
if (!fGeneralProject.isOpen()) {
|
||||
fGeneralProject.open(null);
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
|
||||
|
@ -662,6 +677,21 @@ public class RefreshScopeTests extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
public void testNullProjectDescription_bug387428() {
|
||||
final String CFG_NAME="empty_config";
|
||||
|
||||
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
||||
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fGeneralProject, false);
|
||||
assertNull(projectDescription);
|
||||
|
||||
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
||||
manager.clearAllData();
|
||||
|
||||
List<IResource> empty_config_resources = manager.getResourcesToRefresh(fGeneralProject, CFG_NAME);
|
||||
assertEquals(1,empty_config_resources.size());
|
||||
assertEquals(true,empty_config_resources.contains(fGeneralProject));
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(RefreshScopeTests.class);
|
||||
}
|
||||
|
|
|
@ -458,6 +458,10 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
|||
// "relative" should make no difference for VALUE_WORKSPACE_PATH
|
||||
IPath incWorkspaceRelativePath_3 = incWorkspace_3.getFullPath().makeRelative();
|
||||
IPath incWorkspaceLocation_3 = incWorkspace_3.getLocation();
|
||||
// not having "RESOLVED" should make no difference for well formed path
|
||||
IFolder incWorkspace_4 = ResourceHelper.createFolder(project, "include_4");
|
||||
IPath incWorkspacePathNoResolved_4 = incWorkspace_4.getFullPath();
|
||||
IPath incWorkspaceLocation_4 = incWorkspace_4.getLocation();
|
||||
// folder defined by absolute path on the filesystem
|
||||
IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem");
|
||||
|
||||
|
@ -465,12 +469,14 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
|||
CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
|
||||
CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||
CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||
CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4, ICSettingEntry.VALUE_WORKSPACE_PATH);
|
||||
CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
|
||||
|
||||
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||
entries.add(incWorkspaceEntry_1);
|
||||
entries.add(incWorkspaceEntry_2);
|
||||
entries.add(incWorkspaceEntry_3);
|
||||
entries.add(incWorkspaceEntry_4);
|
||||
entries.add(incFilesystemEntry);
|
||||
|
||||
// add provider to the configuration
|
||||
|
@ -490,8 +496,9 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
|||
assertEquals(incWorkspaceLocation_1, new Path(actualIncludePaths[0]));
|
||||
assertEquals(incWorkspaceLocation_2, new Path(actualIncludePaths[1]));
|
||||
assertEquals(incWorkspaceLocation_3, new Path(actualIncludePaths[2]));
|
||||
assertEquals(incFilesystem, new Path(actualIncludePaths[3]));
|
||||
assertEquals(4, actualIncludePaths.length);
|
||||
assertEquals(incWorkspaceLocation_4, new Path(actualIncludePaths[3]));
|
||||
assertEquals(incFilesystem, new Path(actualIncludePaths[4]));
|
||||
assertEquals(5, actualIncludePaths.length);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.io.IOException;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -141,12 +140,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
return parse(code, lang, useGNUExtensions, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param c
|
||||
* @return
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions,
|
||||
boolean expectNoProblems) throws ParserException {
|
||||
return parse(code, lang, useGNUExtensions, expectNoProblems, false);
|
||||
|
@ -221,9 +214,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
return scanner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
protected void validateSimplePostfixInitializerExpressionC(String code) throws ParserException {
|
||||
ICASTTypeIdInitializerExpression e = (ICASTTypeIdInitializerExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -231,10 +221,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
assertNotNull(e.getInitializer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleUnaryTypeIdExpression(String code, int op) throws ParserException {
|
||||
IASTCastExpression e = (IASTCastExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -244,11 +230,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
assertEquals(x.getName().toString(), "x"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @param op
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleTypeIdExpressionC(String code, int op) throws ParserException {
|
||||
IASTTypeIdExpression e = (IASTTypeIdExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -256,11 +237,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
assertNotNull(e.getTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param op_prefixIncr
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleUnaryExpressionC(String code, int operator) throws ParserException {
|
||||
IASTUnaryExpression e = (IASTUnaryExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -269,10 +245,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
assertEquals(x.getName().toString(), "x"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateConditionalExpressionC(String code) throws ParserException {
|
||||
IASTConditionalExpression e = (IASTConditionalExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -284,10 +256,6 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
assertEquals(x.getName().toString(), x2.getName().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operand
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleBinaryExpressionC(String code, int operand) throws ParserException {
|
||||
IASTBinaryExpression e = (IASTBinaryExpression) getExpressionFromStatementInCode(code, ParserLanguage.C);
|
||||
assertNotNull(e);
|
||||
|
@ -322,24 +290,29 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
{
|
||||
shouldVisitNames = true;
|
||||
}
|
||||
public List nameList = new ArrayList();
|
||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return (IASTName) nameList.get(idx);
|
||||
return nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
|
||||
public int size() {
|
||||
return nameList.size();
|
||||
}
|
||||
}
|
||||
|
||||
protected void assertInstances(CNameCollector collector, IBinding binding, int num) throws Exception {
|
||||
int count = 0;
|
||||
|
||||
if (binding == null) assertTrue(false);
|
||||
assertNotNull(binding);
|
||||
|
||||
for (int i = 0; i < collector.size(); i++) {
|
||||
if (collector.getName(i).resolveBinding() == binding)
|
||||
|
@ -354,17 +327,22 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
shouldVisitNames = true;
|
||||
}
|
||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
|
||||
public int size() {
|
||||
return nameList.size();
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
for (int i= 0; i < size(); i++) {
|
||||
|
@ -434,9 +412,10 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
{
|
||||
shouldVisitNames = true;
|
||||
}
|
||||
public int numProblemBindings=0;
|
||||
public int numNullBindings=0;
|
||||
public List nameList = new ArrayList();
|
||||
public int numProblemBindings;
|
||||
public int numNullBindings;
|
||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
|
@ -447,21 +426,26 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
numNullBindings++;
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return (IASTName) nameList.get(idx);
|
||||
return nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
|
||||
public int size() {
|
||||
return nameList.size();
|
||||
}
|
||||
}
|
||||
|
||||
static protected class CPPNameResolver extends ASTVisitor {
|
||||
{
|
||||
shouldVisitNames = true;
|
||||
}
|
||||
public int numProblemBindings=0;
|
||||
public int numNullBindings=0;
|
||||
public List nameList = new ArrayList();
|
||||
public int numProblemBindings;
|
||||
public int numNullBindings;
|
||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
|
@ -472,12 +456,16 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
numNullBindings++;
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return (IASTName) nameList.get(idx);
|
||||
return nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
|
||||
public int size() {
|
||||
return nameList.size();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getAboveComment() throws IOException {
|
||||
|
@ -575,7 +563,7 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
if (implicits.length > 1) {
|
||||
boolean found = false;
|
||||
for (IASTImplicitName n : implicits) {
|
||||
if (((ASTNode) n).getOffset() == ((ASTNode)name).getOffset()) {
|
||||
if (((ASTNode) n).getOffset() == ((ASTNode) name).getOffset()) {
|
||||
assertFalse(found);
|
||||
found = true;
|
||||
}
|
||||
|
@ -662,8 +650,8 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch(IllegalAccessException iae) {
|
||||
throw new RuntimeException(iae);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return "Unknown problem ID";
|
||||
}
|
||||
|
@ -736,18 +724,14 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
}
|
||||
|
||||
final protected void assertNoProblemBindings(CNameCollector col) {
|
||||
Iterator i = col.nameList.iterator();
|
||||
while (i.hasNext()) {
|
||||
IASTName n = (IASTName) i.next();
|
||||
for (IASTName n : col.nameList) {
|
||||
assertFalse("ProblemBinding for " + n.getRawSignature(), n.resolveBinding() instanceof IProblemBinding);
|
||||
}
|
||||
}
|
||||
|
||||
final protected void assertProblemBindings(CNameCollector col, int count) {
|
||||
Iterator i = col.nameList.iterator();
|
||||
int sum = 0;
|
||||
while (i.hasNext()) {
|
||||
IASTName n = (IASTName) i.next();
|
||||
for (IASTName n : col.nameList) {
|
||||
if (n.getBinding() instanceof IProblemBinding)
|
||||
++sum;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Devin Steffler (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -859,6 +860,12 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
|||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||
}
|
||||
|
||||
// const char* strchr(const char* s, int c);
|
||||
// bool b = noexcept (strchr("abc", 'b'));
|
||||
public void test5_3_7() throws Exception {
|
||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||
}
|
||||
|
||||
// struct A {};
|
||||
// struct I1 : A {};
|
||||
// struct I2 : A {};
|
||||
|
@ -5747,7 +5754,7 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
|||
// g<C>(0); // The N member of C is not a non-type
|
||||
// h<D>(0); // The TT member of D is not a template
|
||||
// }
|
||||
public void _test14_8_2s8d() throws Exception {
|
||||
public void test14_8_2s8d() throws Exception {
|
||||
final String content= getAboveComment();
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(content, true);
|
||||
bh.assertProblem("f<A>", 0);
|
||||
|
@ -6386,6 +6393,21 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
|||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// void f(T p);
|
||||
//
|
||||
// template <typename T>
|
||||
// void g(T p) noexcept;
|
||||
//
|
||||
// template <typename T>
|
||||
// void fg(T a) noexcept (noexcept(f(a)) && noexcept(g(a))) {
|
||||
// f(a);
|
||||
// g(a);
|
||||
// }
|
||||
public void test15_4s1c() throws Exception {
|
||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||
}
|
||||
|
||||
// struct B {
|
||||
// virtual void f() throw (int, double);
|
||||
// virtual void g();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
* Thomas Corbat (IFS)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -6252,20 +6253,20 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertFalse(ClassTypeHelper.isOverrider(m5, m2));
|
||||
assertTrue(ClassTypeHelper.isOverrider(m4, m2));
|
||||
|
||||
ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0);
|
||||
ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0, null);
|
||||
assertEquals(0, ors.length);
|
||||
ors= ClassTypeHelper.findOverridden(m1);
|
||||
ors= ClassTypeHelper.findOverridden(m1, null);
|
||||
assertEquals(0, ors.length);
|
||||
ors= ClassTypeHelper.findOverridden(m2);
|
||||
ors= ClassTypeHelper.findOverridden(m2, null);
|
||||
assertEquals(1, ors.length);
|
||||
assertSame(ors[0], m1);
|
||||
ors= ClassTypeHelper.findOverridden(m3);
|
||||
ors= ClassTypeHelper.findOverridden(m3, null);
|
||||
assertEquals(0, ors.length);
|
||||
ors= ClassTypeHelper.findOverridden(m4);
|
||||
ors= ClassTypeHelper.findOverridden(m4, null);
|
||||
assertEquals(2, ors.length);
|
||||
assertSame(ors[0], m2);
|
||||
assertSame(ors[1], m1);
|
||||
ors= ClassTypeHelper.findOverridden(m5);
|
||||
ors= ClassTypeHelper.findOverridden(m5, null);
|
||||
assertEquals(1, ors.length);
|
||||
assertSame(ors[0], m1);
|
||||
}
|
||||
|
@ -8732,14 +8733,14 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertFalse(ClassTypeHelper.isOverrider(m3, m0));
|
||||
assertFalse(ClassTypeHelper.isOverrider(m3, m1));
|
||||
|
||||
ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0);
|
||||
ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0, null);
|
||||
assertEquals(0, ors.length);
|
||||
ors= ClassTypeHelper.findOverridden(m1);
|
||||
ors= ClassTypeHelper.findOverridden(m1, null);
|
||||
assertEquals(0, ors.length);
|
||||
ors= ClassTypeHelper.findOverridden(m2);
|
||||
ors= ClassTypeHelper.findOverridden(m2, null);
|
||||
assertEquals(1, ors.length);
|
||||
assertSame(ors[0], m0);
|
||||
ors= ClassTypeHelper.findOverridden(m3);
|
||||
ors= ClassTypeHelper.findOverridden(m3, null);
|
||||
assertEquals(0, ors.length);
|
||||
}
|
||||
|
||||
|
@ -9288,7 +9289,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
|
||||
// auto f2 (); // missing late return type.
|
||||
public void testBug332114a() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||
IBinding b= bh.assertNonProblem("f2", 0);
|
||||
// Must not throw a NPE
|
||||
IndexCPPSignatureUtil.getSignature(b);
|
||||
|
@ -9546,7 +9547,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
public void testRecursiveClassInheritance_Bug357256() throws Exception {
|
||||
BindingAssertionHelper bh= getAssertionHelper();
|
||||
ICPPClassType c= bh.assertNonProblem("A", 1);
|
||||
assertEquals(0, ClassTypeHelper.getPureVirtualMethods(c).length);
|
||||
assertEquals(0, ClassTypeHelper.getPureVirtualMethods(c, null).length);
|
||||
}
|
||||
|
||||
// template <typename T> struct CT1 {};
|
||||
|
@ -9713,7 +9714,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
// g( nullptr ); // error
|
||||
// }
|
||||
public void testNullptr_327298b() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||
bh.assertProblem("checkNullPtr(1)", 12);
|
||||
bh.assertProblem("checklvalue(nullptr)", 11);
|
||||
bh.assertProblem("g( nullptr )", 1);
|
||||
|
@ -9727,7 +9728,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
// }
|
||||
public void testNullptr_327298c() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||
IFunction f= bh.assertNonProblem("f( nullptr )", 1);
|
||||
assertEquals("void (char *)", ASTTypeUtil.getType(f.getType()));
|
||||
f= bh.assertNonProblem("f( 0 )", 1);
|
||||
|
@ -9736,10 +9737,35 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
|
||||
// void foo(struct S s);
|
||||
public void testParameterForwardDeclaration_379511() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||
ICPPClassType struct= bh.assertNonProblem("S", 1, ICPPClassType.class);
|
||||
IName[] declarations= bh.getTranslationUnit().getDeclarations(struct);
|
||||
assertEquals(1, declarations.length);
|
||||
assertEquals(bh.findName("S", 1), declarations[0]);
|
||||
}
|
||||
|
||||
// struct F {};
|
||||
// struct S {
|
||||
// friend F;
|
||||
// };
|
||||
public void testFriendClass() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct F {};
|
||||
// typedef F T;
|
||||
// struct S {
|
||||
// friend T;
|
||||
// };
|
||||
public void testFriendTypedef() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template<typename P>
|
||||
// struct T {
|
||||
// friend P;
|
||||
// };
|
||||
public void testFriendTemplateParameter() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,31 +73,20 @@ public class AST2SelectionParseBaseTest extends FileBasePluginTest {
|
|||
return tu.getNodeSelector(null).findNode(offset, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param c
|
||||
* @return
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
|
||||
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems) throws ParserException {
|
||||
FileContent codeReader = FileContent.create("<test-code>", code.toCharArray());
|
||||
ScannerInfo scannerInfo = new ScannerInfo();
|
||||
IScanner scanner= AST2BaseTest.createScanner(codeReader, lang, ParserMode.COMPLETE_PARSE, scannerInfo);
|
||||
|
||||
ISourceCodeParser parser2 = null;
|
||||
if( lang == ParserLanguage.CPP )
|
||||
{
|
||||
if (lang == ParserLanguage.CPP) {
|
||||
ICPPParserExtensionConfiguration config = null;
|
||||
if (useGNUExtensions)
|
||||
config = new GPPParserExtensionConfiguration();
|
||||
else
|
||||
config = new ANSICPPParserExtensionConfiguration();
|
||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE,
|
||||
NULL_LOG,
|
||||
config );
|
||||
}
|
||||
else
|
||||
{
|
||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, config);
|
||||
} else {
|
||||
ICParserExtensionConfiguration config = null;
|
||||
|
||||
if (useGNUExtensions)
|
||||
|
@ -105,56 +94,45 @@ public class AST2SelectionParseBaseTest extends FileBasePluginTest {
|
|||
else
|
||||
config = new ANSICParserExtensionConfiguration();
|
||||
|
||||
parser2 = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE,
|
||||
NULL_LOG, config );
|
||||
parser2 = new GNUCSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, config);
|
||||
}
|
||||
|
||||
IASTTranslationUnit tu = parser2.parse();
|
||||
|
||||
if( parser2.encounteredError() && expectNoProblems )
|
||||
throw new ParserException( "FAILURE"); //$NON-NLS-1$
|
||||
if (parser2.encounteredError() && expectNoProblems)
|
||||
throw new ParserException("FAILURE"); //$NON-NLS-1$
|
||||
|
||||
if( lang == ParserLanguage.C && expectNoProblems )
|
||||
{
|
||||
assertEquals( CVisitor.getProblems(tu).length, 0 );
|
||||
assertEquals( tu.getPreprocessorProblems().length, 0 );
|
||||
if (lang == ParserLanguage.C && expectNoProblems) {
|
||||
assertEquals(CVisitor.getProblems(tu).length, 0);
|
||||
assertEquals(tu.getPreprocessorProblems().length, 0);
|
||||
} else if (lang == ParserLanguage.CPP && expectNoProblems) {
|
||||
assertEquals(CPPVisitor.getProblems(tu).length, 0);
|
||||
assertEquals(tu.getPreprocessorProblems().length, 0);
|
||||
}
|
||||
else if ( lang == ParserLanguage.CPP && expectNoProblems )
|
||||
{
|
||||
assertEquals( CPPVisitor.getProblems(tu).length, 0 );
|
||||
assertEquals( tu.getPreprocessorProblems().length, 0 );
|
||||
}
|
||||
if( expectNoProblems )
|
||||
assertEquals( 0, tu.getPreprocessorProblems().length );
|
||||
|
||||
if (expectNoProblems)
|
||||
assertEquals(0, tu.getPreprocessorProblems().length);
|
||||
|
||||
return tu;
|
||||
}
|
||||
|
||||
protected IASTTranslationUnit parse( IFile file, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
|
||||
|
||||
IASTTranslationUnit tu=null;
|
||||
protected IASTTranslationUnit parse(IFile file, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems) throws ParserException {
|
||||
IASTTranslationUnit tu= null;
|
||||
try {
|
||||
tu = CDOM.getInstance().getASTService().getTranslationUnit(file);
|
||||
} catch (UnsupportedDialectException e) {
|
||||
assertFalse(true); // shouldn't happen
|
||||
}
|
||||
|
||||
if( lang == ParserLanguage.C && expectNoProblems )
|
||||
{
|
||||
assertEquals( CVisitor.getProblems(tu).length, 0 );
|
||||
assertEquals( tu.getPreprocessorProblems().length, 0 );
|
||||
if (lang == ParserLanguage.C && expectNoProblems) {
|
||||
assertEquals(CVisitor.getProblems(tu).length, 0);
|
||||
assertEquals(tu.getPreprocessorProblems().length, 0);
|
||||
} else if (lang == ParserLanguage.CPP && expectNoProblems) {
|
||||
assertEquals(CPPVisitor.getProblems(tu).length, 0);
|
||||
assertEquals(tu.getPreprocessorProblems().length, 0);
|
||||
}
|
||||
else if ( lang == ParserLanguage.CPP && expectNoProblems )
|
||||
{
|
||||
assertEquals( CPPVisitor.getProblems(tu).length, 0 );
|
||||
assertEquals( tu.getPreprocessorProblems().length, 0 );
|
||||
}
|
||||
if( expectNoProblems )
|
||||
assertEquals( 0, tu.getPreprocessorProblems().length );
|
||||
|
||||
if (expectNoProblems)
|
||||
assertEquals(0, tu.getPreprocessorProblems().length);
|
||||
|
||||
return tu;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6327,11 +6327,6 @@ public class AST2Tests extends AST2BaseTest {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarations
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
private IBasicType getTypeForDeclaration(IASTDeclaration[] declarations, int index) {
|
||||
IASTInitializer init = ((IASTSimpleDeclaration) declarations[index]).getDeclarators()[0].getInitializer();
|
||||
return (IBasicType)((IASTExpression)((IASTEqualsInitializer) init).getInitializerClause()).getExpressionType();
|
||||
|
|
|
@ -59,11 +59,11 @@ public class ClassTypeHelperTests extends AST2BaseTest {
|
|||
public void testHasTrivialCopyCtor() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classA));
|
||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classA, null));
|
||||
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||
assertTrue(ClassTypeHelper.hasTrivialCopyCtor(classB));
|
||||
assertTrue(ClassTypeHelper.hasTrivialCopyCtor(classB, null));
|
||||
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classC));
|
||||
assertFalse(ClassTypeHelper.hasTrivialCopyCtor(classC, null));
|
||||
}
|
||||
|
||||
// struct A {
|
||||
|
@ -87,11 +87,11 @@ public class ClassTypeHelperTests extends AST2BaseTest {
|
|||
public void testHasTrivialDestructor() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
ICPPClassType classA = helper.assertNonProblem("A {", 1, ICPPClassType.class);
|
||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classA));
|
||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classA, null));
|
||||
ICPPClassType classB = helper.assertNonProblem("B {", 1, ICPPClassType.class);
|
||||
assertTrue(ClassTypeHelper.hasTrivialDestructor(classB));
|
||||
assertTrue(ClassTypeHelper.hasTrivialDestructor(classB, null));
|
||||
ICPPClassType classC = helper.assertNonProblem("C {", 1, ICPPClassType.class);
|
||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classC));
|
||||
assertFalse(ClassTypeHelper.hasTrivialDestructor(classC, null));
|
||||
}
|
||||
|
||||
// struct A {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -151,15 +151,10 @@ public class DOMLocationInclusionTests extends AST2FileBasePluginTest {
|
|||
public String getParserDialect() {
|
||||
return dialect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param className
|
||||
*/
|
||||
public DOMLocationInclusionTests(String name) {
|
||||
super(name, DOMLocationInclusionTests.class);
|
||||
}
|
||||
|
@ -178,13 +173,6 @@ public class DOMLocationInclusionTests extends AST2FileBasePluginTest {
|
|||
new ParserConfiguration(s, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pathEndsWith
|
||||
* TODO
|
||||
* @param offset
|
||||
* @param length
|
||||
* @param declarator
|
||||
*/
|
||||
protected void assertSoleFileLocation(IASTNode n, String pathEndsWith, int offset, int length) {
|
||||
IASTNodeLocation[] locations = n.getNodeLocations();
|
||||
assertEquals(locations.length, 1);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -178,11 +178,6 @@ public class DOMLocationTests extends AST2BaseTest {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarator
|
||||
* @param offset
|
||||
* @param length
|
||||
*/
|
||||
private void assertSoleLocation(IASTNode n, int offset, int length) {
|
||||
assertEquals(length, ((ASTNode)n).getLength());
|
||||
IASTNodeLocation[] locations = n.getNodeLocations();
|
||||
|
|
|
@ -35,8 +35,8 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.content.IContentType;
|
||||
|
||||
/**
|
||||
* Utility class to have commonly used algorithms in one place for searching with the DOM.
|
||||
*
|
||||
* Utility class to have commonly used algorithms in one place for searching with the DOM.
|
||||
*
|
||||
* @author dsteffle
|
||||
*/
|
||||
public class DOMSearchUtil {
|
||||
|
@ -48,28 +48,26 @@ public class DOMSearchUtil {
|
|||
public static final int DECLARATIONS_DEFINITIONS = 3;
|
||||
public static final int REFERENCES = 4;
|
||||
public static final int ALL_OCCURRENCES = 5;
|
||||
|
||||
/**
|
||||
* This retrieves the ParserLanguage from an IFile.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
* Retrieves the ParserLanguage from an file.
|
||||
*/
|
||||
public static ParserLanguage getLanguageFromFile(IFile file) {
|
||||
IProject project = file.getProject();
|
||||
IContentType contentType = CCorePlugin.getContentType(project, file.getFullPath().lastSegment());
|
||||
if (contentType != null) {
|
||||
String lid = contentType.getId();
|
||||
if (CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(lid) ||
|
||||
if (CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(lid) ||
|
||||
CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(lid)) {
|
||||
return ParserLanguage.CPP;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ParserLanguage.C;
|
||||
}
|
||||
|
||||
/**
|
||||
* The CPPNameCollector used to get IASTNames from an IASTNode.
|
||||
*
|
||||
*
|
||||
* @author dsteffle
|
||||
*/
|
||||
static public class CPPNameCollector extends ASTVisitor {
|
||||
|
@ -78,21 +76,21 @@ public class DOMSearchUtil {
|
|||
}
|
||||
public List nameList = new ArrayList();
|
||||
@Override
|
||||
public int visit( IASTName name ){
|
||||
nameList.add( name );
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
public IASTName getName( int idx ){
|
||||
if( idx < 0 || idx >= nameList.size() )
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return (IASTName) nameList.get( idx );
|
||||
return (IASTName) nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
public int size() { return nameList.size(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The CNameCollector used to get IASTNames from an IASTNode.
|
||||
*
|
||||
*
|
||||
* @author dsteffle
|
||||
*/
|
||||
static public class CNameCollector extends ASTVisitor {
|
||||
|
@ -101,27 +99,22 @@ public class DOMSearchUtil {
|
|||
}
|
||||
public List nameList = new ArrayList();
|
||||
@Override
|
||||
public int visit( IASTName name ){
|
||||
nameList.add( name );
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
public IASTName getName( int idx ){
|
||||
if( idx < 0 || idx >= nameList.size() )
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return (IASTName) nameList.get( idx );
|
||||
return (IASTName) nameList.get(idx);
|
||||
}
|
||||
public int size() { return nameList.size(); }
|
||||
public int size() { return nameList.size(); }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ParserLanguage corresponding to the IPath and IProject. Returns ParserLanguage.CPP if the file type is a header.
|
||||
*
|
||||
* @param path
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
public static ParserLanguage getLanguage( IPath path, IProject project )
|
||||
{
|
||||
public static ParserLanguage getLanguage(IPath path, IProject project) {
|
||||
//FIXME: ALAIN, for headers should we assume CPP ??
|
||||
// The problem is that it really depends on how the header was included.
|
||||
String id = null;
|
||||
|
@ -135,7 +128,7 @@ public class DOMSearchUtil {
|
|||
} else if (CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(id)) {
|
||||
return ParserLanguage.CPP;
|
||||
} else if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(id)) {
|
||||
return ParserLanguage.C;
|
||||
return ParserLanguage.C;
|
||||
} else if (CCorePlugin.CONTENT_TYPE_CSOURCE.equals(id)) {
|
||||
return ParserLanguage.C;
|
||||
} else if (CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(id)) {
|
||||
|
@ -148,24 +141,24 @@ public class DOMSearchUtil {
|
|||
|
||||
/**
|
||||
* This is used to get the names from the TU that the IASTName searchName belongs to.
|
||||
*
|
||||
* @param searchName the IASTName whose references/delcarations are to be retrieved
|
||||
* @param limitTo used to specify whether to get declarations, references, or both, one of:
|
||||
* ( CSearchPattern.DECLARATION | CSearchPattern.REFERENCES | CSearchPattern.ALL_OCCURRENCES )
|
||||
*
|
||||
* @param searchName the IASTName whose references/declarations are to be retrieved
|
||||
* @param limitTo used to specify whether to get declarations, references, or both, one of:
|
||||
* (CSearchPattern.DECLARATION | CSearchPattern.REFERENCES | CSearchPattern.ALL_OCCURRENCES)
|
||||
* @return IASTName[] declarations, references, or both depending on limitTo that correspond to the IASTName searchName searched for
|
||||
*/
|
||||
public static IName[] getNamesFromDOM(IASTName searchName, int limitTo) {
|
||||
IName[] names = null;
|
||||
IASTTranslationUnit tu = searchName.getTranslationUnit();
|
||||
|
||||
|
||||
if (tu == null) {
|
||||
return BLANK_NAME_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
IBinding binding = searchName.resolveBinding();
|
||||
if (binding instanceof IIndexBinding) {
|
||||
Assert.fail("Not implemented");
|
||||
// try {
|
||||
// try {
|
||||
// ArrayList pdomNames = new ArrayList();
|
||||
// IPDOMResolver pdom= ((PDOMBinding) binding).getPDOM();
|
||||
// // First decls
|
||||
|
@ -180,22 +173,23 @@ public class DOMSearchUtil {
|
|||
// }
|
||||
} else {
|
||||
names = getNames(tu, binding, limitTo);
|
||||
|
||||
if (names == null || names.length == 0) { // try alternate strategies
|
||||
|
||||
if (names == null || names.length == 0) { // try alternate strategies
|
||||
try {
|
||||
// fix for 86829, 95224
|
||||
if ((binding instanceof ICPPConstructor || (binding instanceof ICPPMethod && ((ICPPMethod)binding).isDestructor()))
|
||||
if ((binding instanceof ICPPConstructor || (binding instanceof ICPPMethod && ((ICPPMethod)binding).isDestructor()))
|
||||
&& binding.getScope() instanceof ICPPClassScope) {
|
||||
binding = ((ICPPClassScope)binding.getScope()).getClassType();
|
||||
names = getNames(tu, binding, limitTo);
|
||||
}
|
||||
} catch (DOMException e) {}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
private static IASTName[] getNames(IASTTranslationUnit tu, IBinding binding, int limitTo) {
|
||||
IASTName[] names = null;
|
||||
if (limitTo == DECLARATIONS ||
|
||||
|
@ -205,15 +199,14 @@ public class DOMSearchUtil {
|
|||
names = tu.getReferences(binding);
|
||||
} else if (limitTo == DEFINITIONS) {
|
||||
names = tu.getDefinitionsInAST(binding);
|
||||
} else if (limitTo == ALL_OCCURRENCES){
|
||||
} else if (limitTo == ALL_OCCURRENCES) {
|
||||
names = tu.getDeclarationsInAST(binding);
|
||||
names = ArrayUtil.addAll(IASTName.class, names, tu.getReferences(binding));
|
||||
} else { // assume ALL
|
||||
names = tu.getDeclarationsInAST(binding);
|
||||
names = ArrayUtil.addAll(IASTName.class, names, tu.getReferences(binding));
|
||||
}
|
||||
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
|
@ -44,23 +44,15 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
* @author jcamelon
|
||||
*/
|
||||
public class QuickParser2Tests extends TestCase {
|
||||
|
||||
private static final NullLogService NULL_LOG = new NullLogService();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public QuickParser2Tests() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public QuickParser2Tests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
|
@ -69,7 +61,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test code: int x = 5; Purpose: to test the simple decaration in it's
|
||||
* Test code: int x = 5; Purpose: to test the simple declaration in it's
|
||||
* simplest form.
|
||||
*/
|
||||
public void testIntGlobal() throws Exception {
|
||||
|
@ -160,30 +152,29 @@ public class QuickParser2Tests extends TestCase {
|
|||
public void testSimpleClassMembers() throws Exception {
|
||||
// Parse and get the translaton unit
|
||||
Writer code = new StringWriter();
|
||||
code
|
||||
.write("class A : public B, private C, virtual protected D { public: int x, y; float a,b,c; };");
|
||||
code.write("class A : public B, private C, virtual protected D { public: int x, y; float a,b,c; };");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code: int myFunction( void );
|
||||
* Test code: int myFunction(void);
|
||||
*/
|
||||
public void testSimpleFunctionDeclaration() throws Exception {
|
||||
// Parse and get the translaton unit
|
||||
Writer code = new StringWriter();
|
||||
code.write("void myFunction( void );");
|
||||
code.write("void myFunction(void);");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code: bool myFunction( int parm1 = 3 * 4, double parm2 );
|
||||
* Test code: bool myFunction(int parm1 = 3 * 4, double parm2);
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testFunctionDeclarationWithParameters() throws Exception {
|
||||
// Parse and get the translaton unit
|
||||
Writer code = new StringWriter();
|
||||
code.write("bool myFunction( int parm1 = 3 * 4, double parm2 );");
|
||||
code.write("bool myFunction(int parm1 = 3 * 4, double parm2);");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
|
@ -208,8 +199,8 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug36290() throws Exception {
|
||||
parse("typedef void ( A:: * pMethod ) ( void ); ");
|
||||
parse("typedef void (boo) ( void ); ");
|
||||
parse("typedef void (A:: * pMethod) (void); ");
|
||||
parse("typedef void (boo) (void); ");
|
||||
parse("typedef void boo (void); ");
|
||||
}
|
||||
|
||||
|
@ -245,113 +236,113 @@ public class QuickParser2Tests extends TestCase {
|
|||
|
||||
// failing, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236856
|
||||
public void _testBug36932C() throws Exception {
|
||||
parse("X::X( ) : var( new int ) {}");
|
||||
parse("X::X( ) : var( new int(5) ) {}");
|
||||
parse("X::X( ) : var( new int(B) ) {}");
|
||||
parse("X::X( ) : var( new int(B,C) ) {}");
|
||||
parse("X::X( ) : var( new int[5] ) {}");
|
||||
parse("X::X( ) : var( new int[5][10] ) {}");
|
||||
parse("X::X( ) : var( new int[B] ) {}");
|
||||
parse("X::X( ) : var( new int[B][C][D] ) {}");
|
||||
parse("X::X() : var(new int) {}");
|
||||
parse("X::X() : var(new int(5)) {}");
|
||||
parse("X::X() : var(new int(B)) {}");
|
||||
parse("X::X() : var(new int(B,C)) {}");
|
||||
parse("X::X() : var(new int[5]) {}");
|
||||
parse("X::X() : var(new int[5][10]) {}");
|
||||
parse("X::X() : var(new int[B]) {}");
|
||||
parse("X::X() : var(new int[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new A ) {}");
|
||||
parse("X::X( ) : var( new A(5) ) {}");
|
||||
parse("X::X( ) : var( new A(B) ) {}");
|
||||
parse("X::X( ) : var( new A(B,C) ) {}");
|
||||
parse("X::X( ) : var( new A[5] ) {}");
|
||||
parse("X::X( ) : var( new A[5][10] ) {}");
|
||||
parse("X::X( ) : var( new A[B] ) {}");
|
||||
parse("X::X( ) : var( new A[B][C][D] ) {}");
|
||||
parse("X::X() : var(new A) {}");
|
||||
parse("X::X() : var(new A(5)) {}");
|
||||
parse("X::X() : var(new A(B)) {}");
|
||||
parse("X::X() : var(new A(B,C)) {}");
|
||||
parse("X::X() : var(new A[5]) {}");
|
||||
parse("X::X() : var(new A[5][10]) {}");
|
||||
parse("X::X() : var(new A[B]) {}");
|
||||
parse("X::X() : var(new A[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new (int) ) {}");
|
||||
parse("X::X( ) : var( new (int)(5) ) {}");
|
||||
parse("X::X( ) : var( new (int)(B) ) {}");
|
||||
parse("X::X( ) : var( new (int)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (int[5]) ) {}");
|
||||
parse("X::X( ) : var( new (int[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (int[B]) ) {}");
|
||||
parse("X::X( ) : var( new (int[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (int)) {}");
|
||||
parse("X::X() : var(new (int)(5)) {}");
|
||||
parse("X::X() : var(new (int)(B)) {}");
|
||||
parse("X::X() : var(new (int)(B,C)) {}");
|
||||
parse("X::X() : var(new (int[5])) {}");
|
||||
parse("X::X() : var(new (int[5][10])) {}");
|
||||
parse("X::X() : var(new (int[B])) {}");
|
||||
parse("X::X() : var(new (int[B][C][D])) {}");
|
||||
|
||||
parse("X::X( ) : var( new (A) ) {}");
|
||||
parse("X::X( ) : var( new (A)(5) ) {}");
|
||||
parse("X::X( ) : var( new (A)(B) ) {}");
|
||||
parse("X::X( ) : var( new (A)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (A[5]) ) {}");
|
||||
parse("X::X( ) : var( new (A[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (A[B]) ) {}");
|
||||
parse("X::X( ) : var( new (A[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (A)) {}");
|
||||
parse("X::X() : var(new (A)(5)) {}");
|
||||
parse("X::X() : var(new (A)(B)) {}");
|
||||
parse("X::X() : var(new (A)(B,C)) {}");
|
||||
parse("X::X() : var(new (A[5])) {}");
|
||||
parse("X::X() : var(new (A[5][10])) {}");
|
||||
parse("X::X() : var(new (A[B])) {}");
|
||||
parse("X::X() : var(new (A[B][C][D])) {}");
|
||||
|
||||
parse("X::X( ) : var( new (0) int ) {}");
|
||||
parse("X::X( ) : var( new (0) int(5) ) {}");
|
||||
parse("X::X( ) : var( new (0) int(B) ) {}");
|
||||
parse("X::X( ) : var( new (0) int(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (0) int[5] ) {}");
|
||||
parse("X::X( ) : var( new (0) int[5][10] ) {}");
|
||||
parse("X::X( ) : var( new (0) int[B] ) {}");
|
||||
parse("X::X( ) : var( new (0) int[B][C][D] ) {}");
|
||||
parse("X::X() : var(new (0) int) {}");
|
||||
parse("X::X() : var(new (0) int(5)) {}");
|
||||
parse("X::X() : var(new (0) int(B)) {}");
|
||||
parse("X::X() : var(new (0) int(B,C)) {}");
|
||||
parse("X::X() : var(new (0) int[5]) {}");
|
||||
parse("X::X() : var(new (0) int[5][10]) {}");
|
||||
parse("X::X() : var(new (0) int[B]) {}");
|
||||
parse("X::X() : var(new (0) int[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new (0) A ) {}");
|
||||
parse("X::X( ) : var( new (0) A(5) ) {}");
|
||||
parse("X::X( ) : var( new (0) A(B) ) {}");
|
||||
parse("X::X( ) : var( new (0) A(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (0) A[5] ) {}");
|
||||
parse("X::X( ) : var( new (0) A[5][10] ) {}");
|
||||
parse("X::X( ) : var( new (0) A[B] ) {}");
|
||||
parse("X::X( ) : var( new (0) A[B][C][D] ) {}");
|
||||
parse("X::X() : var(new (0) A) {}");
|
||||
parse("X::X() : var(new (0) A(5)) {}");
|
||||
parse("X::X() : var(new (0) A(B)) {}");
|
||||
parse("X::X() : var(new (0) A(B,C)) {}");
|
||||
parse("X::X() : var(new (0) A[5]) {}");
|
||||
parse("X::X() : var(new (0) A[5][10]) {}");
|
||||
parse("X::X() : var(new (0) A[B]) {}");
|
||||
parse("X::X() : var(new (0) A[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new (0) (int) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int)(5) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int)(B) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int[5]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int[B]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (int[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (0) (int)) {}");
|
||||
parse("X::X() : var(new (0) (int)(5)) {}");
|
||||
parse("X::X() : var(new (0) (int)(B)) {}");
|
||||
parse("X::X() : var(new (0) (int)(B,C)) {}");
|
||||
parse("X::X() : var(new (0) (int[5])) {}");
|
||||
parse("X::X() : var(new (0) (int[5][10])) {}");
|
||||
parse("X::X() : var(new (0) (int[B])) {}");
|
||||
parse("X::X() : var(new (0) (int[B][C][D])) {}");
|
||||
|
||||
parse("X::X( ) : var( new (0) (A) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A)(5) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A)(B) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A[5]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A[B]) ) {}");
|
||||
parse("X::X( ) : var( new (0) (A[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (0) (A)) {}");
|
||||
parse("X::X() : var(new (0) (A)(5)) {}");
|
||||
parse("X::X() : var(new (0) (A)(B)) {}");
|
||||
parse("X::X() : var(new (0) (A)(B,C)) {}");
|
||||
parse("X::X() : var(new (0) (A[5])) {}");
|
||||
parse("X::X() : var(new (0) (A[5][10])) {}");
|
||||
parse("X::X() : var(new (0) (A[B])) {}");
|
||||
parse("X::X() : var(new (0) (A[B][C][D])) {}");
|
||||
|
||||
parse("X::X( ) : var( new (P) int ) {}");
|
||||
parse("X::X( ) : var( new (P) int(5) ) {}");
|
||||
parse("X::X( ) : var( new (P) int(B) ) {}");
|
||||
parse("X::X( ) : var( new (P) int(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (P) int[5] ) {}");
|
||||
parse("X::X( ) : var( new (P) int[5][10] ) {}");
|
||||
parse("X::X( ) : var( new (P) int[B] ) {}");
|
||||
parse("X::X( ) : var( new (P) int[B][C][D] ) {}");
|
||||
parse("X::X() : var(new (P) int) {}");
|
||||
parse("X::X() : var(new (P) int(5)) {}");
|
||||
parse("X::X() : var(new (P) int(B)) {}");
|
||||
parse("X::X() : var(new (P) int(B,C)) {}");
|
||||
parse("X::X() : var(new (P) int[5]) {}");
|
||||
parse("X::X() : var(new (P) int[5][10]) {}");
|
||||
parse("X::X() : var(new (P) int[B]) {}");
|
||||
parse("X::X() : var(new (P) int[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new (P) A ) {}");
|
||||
parse("X::X( ) : var( new (P) A(5) ) {}");
|
||||
parse("X::X( ) : var( new (P) A(B) ) {}");
|
||||
parse("X::X( ) : var( new (P) A(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (P) A[5] ) {}");
|
||||
parse("X::X( ) : var( new (P) A[5][10] ) {}");
|
||||
parse("X::X( ) : var( new (P) A[B] ) {}");
|
||||
parse("X::X( ) : var( new (P) A[B][C][D] ) {}");
|
||||
parse("X::X() : var(new (P) A) {}");
|
||||
parse("X::X() : var(new (P) A(5)) {}");
|
||||
parse("X::X() : var(new (P) A(B)) {}");
|
||||
parse("X::X() : var(new (P) A(B,C)) {}");
|
||||
parse("X::X() : var(new (P) A[5]) {}");
|
||||
parse("X::X() : var(new (P) A[5][10]) {}");
|
||||
parse("X::X() : var(new (P) A[B]) {}");
|
||||
parse("X::X() : var(new (P) A[B][C][D]) {}");
|
||||
|
||||
parse("X::X( ) : var( new (P) (int) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int)(5) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int)(B) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int[5]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int[B]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (int[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (P) (int)) {}");
|
||||
parse("X::X() : var(new (P) (int)(5)) {}");
|
||||
parse("X::X() : var(new (P) (int)(B)) {}");
|
||||
parse("X::X() : var(new (P) (int)(B,C)) {}");
|
||||
parse("X::X() : var(new (P) (int[5])) {}");
|
||||
parse("X::X() : var(new (P) (int[5][10])) {}");
|
||||
parse("X::X() : var(new (P) (int[B])) {}");
|
||||
parse("X::X() : var(new (P) (int[B][C][D])) {}");
|
||||
|
||||
parse("X::X( ) : var( new (P) (A) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A)(5) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A)(B) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A)(B,C) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A[5]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A[5][10]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A[B]) ) {}");
|
||||
parse("X::X( ) : var( new (P) (A[B][C][D]) ) {}");
|
||||
parse("X::X() : var(new (P) (A)) {}");
|
||||
parse("X::X() : var(new (P) (A)(5)) {}");
|
||||
parse("X::X() : var(new (P) (A)(B)) {}");
|
||||
parse("X::X() : var(new (P) (A)(B,C)) {}");
|
||||
parse("X::X() : var(new (P) (A[5])) {}");
|
||||
parse("X::X() : var(new (P) (A[5][10])) {}");
|
||||
parse("X::X() : var(new (P) (A[B])) {}");
|
||||
parse("X::X() : var(new (P) (A[B][C][D])) {}");
|
||||
}
|
||||
|
||||
public void testBugSingleton192() throws Exception {
|
||||
|
@ -372,7 +363,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug37019() throws Exception {
|
||||
parse("static const A a( 1, 0 );");
|
||||
parse("static const A a(1, 0);");
|
||||
}
|
||||
|
||||
public void testBug36766and36769A() throws Exception {
|
||||
|
@ -414,7 +405,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug36932A() throws Exception {
|
||||
parse("A::A( ) : var( new char [ (unsigned)bufSize ] ) {}");
|
||||
parse("A::A() : var(new char[ (unsigned)bufSize ]) {}");
|
||||
}
|
||||
|
||||
// failing, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236856
|
||||
|
@ -529,7 +520,6 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug36769A() throws Exception {
|
||||
|
||||
parse("template <class A, B> cls<A, C>::operator otherType() const {}\n");
|
||||
parse("template <class A, B> cls<A, C>::cls() {}\n");
|
||||
parse("template <class A, B> cls<A, C>::~cls() {}\n");
|
||||
|
@ -539,7 +529,6 @@ public class QuickParser2Tests extends TestCase {
|
|||
Writer code = new StringWriter();
|
||||
code.write("unsigned long a = 0UL;\n");
|
||||
code.write("unsigned long a2 = 0L; \n");
|
||||
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
|
@ -548,11 +537,11 @@ public class QuickParser2Tests extends TestCase {
|
|||
"class Functor {"+
|
||||
"template <typename Fun> Functor(Fun fun) : spImpl_(new FunctorHandler<Functor, Fun>(fun)){}" +
|
||||
"};"
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public void testBug36932() throws Exception {
|
||||
parse("A::A(): b( new int( 5 ) ), b( new B ), c( new int ) {}");
|
||||
parse("A::A(): b(new int(5)), b(new B), c(new int) {}");
|
||||
}
|
||||
|
||||
public void testBug36704() throws Exception {
|
||||
|
@ -590,8 +579,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
Writer code = new StringWriter();
|
||||
code.write("void mad_decoder_init(struct mad_decoder *, void *,\n");
|
||||
code.write(" enum mad_flow (*)(void *, struct mad_stream *),\n");
|
||||
code
|
||||
.write(" enum mad_flow (*)(void *, struct mad_header const *),\n");
|
||||
code.write(" enum mad_flow (*)(void *, struct mad_header const *),\n");
|
||||
code.write(" enum mad_flow (*)(void *,\n");
|
||||
code.write(" struct mad_stream const *,\n");
|
||||
code.write(" struct mad_frame *),\n");
|
||||
|
@ -605,16 +593,13 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write(");\n");
|
||||
|
||||
parse(code.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testBug36852() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code
|
||||
.write("int CBT::senseToAllRect( double id_standardQuot = DOSE, double id_minToleranz =15.0,\n");
|
||||
code
|
||||
.write("double id_maxToleranz = 15.0, unsigned int iui_minY = 0, \n");
|
||||
code.write("unsigned int iui_maxY = HEIGHT );\n");
|
||||
code.write("int CBT::senseToAllRect(double id_standardQuot = DOSE, double id_minToleranz =15.0,\n");
|
||||
code.write("double id_maxToleranz = 15.0, unsigned int iui_minY = 0, \n");
|
||||
code.write("unsigned int iui_maxY = HEIGHT);\n");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
|
@ -623,14 +608,12 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write("template\n");
|
||||
code.write("<\n");
|
||||
code.write("class AbstractFact,\n");
|
||||
code
|
||||
.write("template <class, class> class Creator = OpNewFactoryUnit,\n");
|
||||
code.write("template <class, class> class Creator = OpNewFactoryUnit,\n");
|
||||
code.write("class TList = typename AbstractFact::ProductList\n");
|
||||
code.write(">\n");
|
||||
code.write("class ConcreteFactory\n");
|
||||
code.write(": public GenLinearHierarchy<\n");
|
||||
code
|
||||
.write("typename TL::Reverse<TList>::Result, Creator, AbstractFact>\n");
|
||||
code.write("typename TL::Reverse<TList>::Result, Creator, AbstractFact>\n");
|
||||
code.write("{\n");
|
||||
code.write("public:\n");
|
||||
code.write("typedef typename AbstractFact::ProductList ProductList;\n");
|
||||
|
@ -688,23 +671,23 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test code: "class A { int floor( double input ), someInt; };"
|
||||
* Test code: "class A { int floor(double input), someInt; };"
|
||||
*/
|
||||
public void testMultipleDeclarators() throws Exception {
|
||||
// Parse and get the translaton unit
|
||||
parse("class A { int floor( double input ), someInt; };");
|
||||
// Parse and get the translation unit
|
||||
parse("class A { int floor(double input), someInt; };");
|
||||
}
|
||||
|
||||
public void testFunctionModifiers() throws Exception {
|
||||
parse("class A {virtual void foo( void ) const throw ( yay, nay, we::dont::care ) = 0;};");
|
||||
parse("class A {virtual void foo(void) const throw (yay, nay, we::dont::care) = 0;};");
|
||||
}
|
||||
|
||||
public void testArrays() throws Exception {
|
||||
parse("int x [5][];");
|
||||
parse("int x[5][];");
|
||||
}
|
||||
|
||||
public void testElaboratedParms() throws Exception {
|
||||
parse("int x( struct A myA ) { /* junk */ }");
|
||||
parse("int x(struct A myA) { /* junk */ }");
|
||||
}
|
||||
|
||||
public void testMemberDeclarations() throws Exception {
|
||||
|
@ -733,16 +716,16 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testASMDefinition() throws Exception {
|
||||
parse("asm( \"mov ep1 ds2\");");
|
||||
parse("asm(\"mov ep1 ds2\");");
|
||||
}
|
||||
|
||||
public void testConstructorChain() throws Exception {
|
||||
//TODO - requires CPPVisitor in order to reduce ambiguities
|
||||
parse("TrafficLight_Actor::TrafficLight_Actor( RTController * rtg_rts, RTActorRef * rtg_ref ) : RTActor( rtg_rts, rtg_ref ), myId( 0 ) {}");
|
||||
parse("TrafficLight_Actor::TrafficLight_Actor(RTController * rtg_rts, RTActorRef * rtg_ref) : RTActor(rtg_rts, rtg_ref), myId(0) {}");
|
||||
}
|
||||
|
||||
public void testBug36237() throws Exception {
|
||||
parse("A::A():B( (char *)0 ){}");
|
||||
parse("A::A():B((char *)0){}");
|
||||
}
|
||||
|
||||
public void testBug36532() throws Exception {
|
||||
|
@ -760,7 +743,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testTemplateDeclarationOfFunction() throws Exception {
|
||||
parse("template<class A, typename B=C> A aTemplatedFunction( B bInstance );");
|
||||
parse("template<class A, typename B=C> A aTemplatedFunction(B bInstance);");
|
||||
}
|
||||
|
||||
public void testTemplateDeclarationOfClass() throws Exception {
|
||||
|
@ -779,15 +762,15 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug36250() throws Exception {
|
||||
parse("int f( int = 0 );");
|
||||
parse("int f(int = 0);");
|
||||
}
|
||||
|
||||
public void testBug36240() throws Exception {
|
||||
parse("A & A::operator=( A ){}");
|
||||
parse("A & A::operator=(A){}");
|
||||
}
|
||||
|
||||
public void testBug36254() throws Exception {
|
||||
parse("unsigned i;\nvoid f( unsigned p1 = 0 );");
|
||||
parse("unsigned i;\nvoid f(unsigned p1 = 0);");
|
||||
}
|
||||
|
||||
public void testBug36432() throws Exception {
|
||||
|
@ -868,8 +851,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
public void testBug36692() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template <typename T, typename Destroyer>\n");
|
||||
code
|
||||
.write("void SetLongevity(T* pDynObject, unsigned int longevity,\n");
|
||||
code.write("void SetLongevity(T* pDynObject, unsigned int longevity,\n");
|
||||
code.write("Destroyer d = Private::Deleter<T>::Delete){}\n");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
@ -888,7 +870,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
// code.write("INLINE_DEF int f ();\n");
|
||||
// code.write("INLINE_DEF A g ();");
|
||||
// code.write("INLINE_DEF A * h ();");
|
||||
// code.write("INLINE_DEF A & unlock( void );");
|
||||
// code.write("INLINE_DEF A & unlock(void);");
|
||||
// code.write("};");
|
||||
// parse(code.toString());
|
||||
// }
|
||||
|
@ -911,7 +893,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
|
||||
public void testPointersToFunctions() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("void (*name)( void );\n");
|
||||
code.write("void (*name)(void);\n");
|
||||
code
|
||||
.write("static void * (* const orig_malloc_hook)(const char *file, int line, size_t size);\n");
|
||||
|
||||
|
@ -924,8 +906,8 @@ public class QuickParser2Tests extends TestCase {
|
|||
|
||||
public void testBug36713() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("A ( * const fPtr) (void *); \n");
|
||||
code.write("A (* const fPtr2) ( A * ); \n");
|
||||
code.write("A (* const fPtr) (void *); \n");
|
||||
code.write("A (* const fPtr2) (A *); \n");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
|
@ -935,7 +917,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
// {
|
||||
// // Parse and get the translaton unit
|
||||
// Writer code = new StringWriter();
|
||||
// code.write("bool myFunction( parm1, parm2, parm3 )\n");
|
||||
// code.write("bool myFunction(parm1, parm2, parm3)\n");
|
||||
// code.write("const char* parm1;\n");
|
||||
// code.write("int (*parm2)(float);\n");
|
||||
// code.write("{}");
|
||||
|
@ -946,82 +928,82 @@ public class QuickParser2Tests extends TestCase {
|
|||
// assertEquals(1, declarations.size());
|
||||
// SimpleDeclaration simpleDeclaration =
|
||||
// (SimpleDeclaration)declarations.get(0);
|
||||
// assertEquals( simpleDeclaration.getDeclSpecifier().getType(),
|
||||
// DeclSpecifier.t_bool );
|
||||
// assertEquals(simpleDeclaration.getDeclSpecifier().getType(),
|
||||
// DeclSpecifier.t_bool);
|
||||
// List declarators = simpleDeclaration.getDeclarators();
|
||||
// assertEquals( 1, declarators.size() );
|
||||
// Declarator functionDeclarator = (Declarator)declarators.get( 0 );
|
||||
// assertEquals( functionDeclarator.getName().toString(), "myFunction" );
|
||||
// assertEquals(1, declarators.size());
|
||||
// Declarator functionDeclarator = (Declarator)declarators.get(0);
|
||||
// assertEquals(functionDeclarator.getName().toString(), "myFunction");
|
||||
//
|
||||
// ParameterDeclarationClause pdc = functionDeclarator.getParms();
|
||||
// assertNotNull( pdc );
|
||||
// assertNotNull(pdc);
|
||||
// List parameterDecls = pdc.getDeclarations();
|
||||
// assertEquals( 3, parameterDecls.size() );
|
||||
// ParameterDeclaration parm1 = (ParameterDeclaration)parameterDecls.get( 0
|
||||
// );
|
||||
// assertNotNull( parm1.getDeclSpecifier().getName() );
|
||||
// assertEquals( "parm1", parm1.getDeclSpecifier().getName().toString() );
|
||||
// assertEquals(3, parameterDecls.size());
|
||||
// ParameterDeclaration parm1 = (ParameterDeclaration)parameterDecls.get(0
|
||||
//);
|
||||
// assertNotNull(parm1.getDeclSpecifier().getName());
|
||||
// assertEquals("parm1", parm1.getDeclSpecifier().getName().toString());
|
||||
// List parm1Decls = parm1.getDeclarators();
|
||||
// assertEquals( 1, parm1Decls.size() );
|
||||
// assertEquals(1, parm1Decls.size());
|
||||
//
|
||||
// ParameterDeclaration parm2 = (ParameterDeclaration)parameterDecls.get( 1
|
||||
// );
|
||||
// assertNotNull( parm2.getDeclSpecifier().getName() );
|
||||
// assertEquals( "parm2", parm2.getDeclSpecifier().getName().toString() );
|
||||
// ParameterDeclaration parm2 = (ParameterDeclaration)parameterDecls.get(1
|
||||
//);
|
||||
// assertNotNull(parm2.getDeclSpecifier().getName());
|
||||
// assertEquals("parm2", parm2.getDeclSpecifier().getName().toString());
|
||||
// List parm2Decls = parm2.getDeclarators();
|
||||
// assertEquals( 1, parm2Decls.size() );
|
||||
// assertEquals(1, parm2Decls.size());
|
||||
//
|
||||
// ParameterDeclaration parm3 = (ParameterDeclaration)parameterDecls.get( 2
|
||||
// );
|
||||
// assertNotNull( parm3.getDeclSpecifier().getName() );
|
||||
// assertEquals( "parm3", parm3.getDeclSpecifier().getName().toString() );
|
||||
// ParameterDeclaration parm3 = (ParameterDeclaration)parameterDecls.get(2
|
||||
//);
|
||||
// assertNotNull(parm3.getDeclSpecifier().getName());
|
||||
// assertEquals("parm3", parm3.getDeclSpecifier().getName().toString());
|
||||
// List parm3Decls = parm3.getDeclarators();
|
||||
// assertEquals( 1, parm3Decls.size() );
|
||||
// assertEquals(1, parm3Decls.size());
|
||||
//
|
||||
// OldKRParameterDeclarationClause clause = pdc.getOldKRParms();
|
||||
// assertNotNull( clause );
|
||||
// assertEquals( clause.getDeclarations().size(), 2 );
|
||||
// assertNotNull(clause);
|
||||
// assertEquals(clause.getDeclarations().size(), 2);
|
||||
// SimpleDeclaration decl1 =
|
||||
// (SimpleDeclaration)clause.getDeclarations().get(0);
|
||||
// assertEquals( decl1.getDeclarators().size(), 1 );
|
||||
// assertEquals(decl1.getDeclarators().size(), 1);
|
||||
// assertTrue(decl1.getDeclSpecifier().isConst());
|
||||
// assertFalse(decl1.getDeclSpecifier().isVolatile());
|
||||
// assertEquals( decl1.getDeclSpecifier().getType(), DeclSpecifier.t_char);
|
||||
// Declarator declarator1 = (Declarator)decl1.getDeclarators().get( 0 );
|
||||
// assertEquals( declarator1.getName().toString(), "parm1" );
|
||||
// assertEquals(decl1.getDeclSpecifier().getType(), DeclSpecifier.t_char);
|
||||
// Declarator declarator1 = (Declarator)decl1.getDeclarators().get(0);
|
||||
// assertEquals(declarator1.getName().toString(), "parm1");
|
||||
// List ptrOps1 = declarator1.getPointerOperators();
|
||||
// assertNotNull( ptrOps1 );
|
||||
// assertEquals( 1, ptrOps1.size() );
|
||||
// assertNotNull(ptrOps1);
|
||||
// assertEquals(1, ptrOps1.size());
|
||||
// PointerOperator po1 = (PointerOperator)ptrOps1.get(0);
|
||||
// assertNotNull( po1 );
|
||||
// assertFalse( po1.isConst() );
|
||||
// assertFalse( po1.isVolatile() );
|
||||
// assertEquals( po1.getType(), PointerOperator.t_pointer );
|
||||
// assertNotNull(po1);
|
||||
// assertFalse(po1.isConst());
|
||||
// assertFalse(po1.isVolatile());
|
||||
// assertEquals(po1.getType(), PointerOperator.t_pointer);
|
||||
//
|
||||
// SimpleDeclaration declaration =
|
||||
// (SimpleDeclaration)clause.getDeclarations().get(1);
|
||||
// assertEquals( declaration.getDeclSpecifier().getType(),
|
||||
// DeclSpecifier.t_int );
|
||||
// assertEquals( declaration.getDeclarators().size(), 1);
|
||||
// assertNull( ((Declarator)declaration.getDeclarators().get(0)).getName()
|
||||
// );
|
||||
// assertEquals(declaration.getDeclSpecifier().getType(),
|
||||
// DeclSpecifier.t_int);
|
||||
// assertEquals(declaration.getDeclarators().size(), 1);
|
||||
// assertNull(((Declarator)declaration.getDeclarators().get(0)).getName()
|
||||
//);
|
||||
// assertNotNull(
|
||||
// ((Declarator)declaration.getDeclarators().get(0)).getDeclarator() );
|
||||
// ((Declarator)declaration.getDeclarators().get(0)).getDeclarator());
|
||||
// assertEquals(
|
||||
// ((Declarator)declaration.getDeclarators().get(0)).getDeclarator().getName().toString(),
|
||||
// "parm2" );
|
||||
// "parm2");
|
||||
// ParameterDeclarationClause clause2 =
|
||||
// ((Declarator)declaration.getDeclarators().get(0)).getParms();
|
||||
// assertEquals( clause2.getDeclarations().size(), 1 );
|
||||
// assertEquals(clause2.getDeclarations().size(), 1);
|
||||
// assertEquals(
|
||||
// ((ParameterDeclaration)clause2.getDeclarations().get(0)).getDeclarators().size(),
|
||||
// 1 );
|
||||
// 1);
|
||||
// assertNull(
|
||||
// ((Declarator)((ParameterDeclaration)clause2.getDeclarations().get(0)).getDeclarators().get(0)).getName()
|
||||
// );
|
||||
//);
|
||||
// assertEquals(
|
||||
// ((ParameterDeclaration)clause2.getDeclarations().get(0)).getDeclSpecifier().getType(),
|
||||
// DeclSpecifier.t_float );
|
||||
// DeclSpecifier.t_float);
|
||||
// }
|
||||
|
||||
public void testPointersToMemberFunctions() throws Exception {
|
||||
|
@ -1038,10 +1020,8 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write("%:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */\n");
|
||||
code.write("#ifndef glue\n");
|
||||
code.write("#error glue not defined!\n");
|
||||
code.write("#endif\n");
|
||||
|
||||
code.write("#endif\n");
|
||||
code.write("%:define str(x) %:x /* #define str(x) #x */\n");
|
||||
|
||||
code.write("int main (int argc, char *argv<::>) /* argv[] */\n");
|
||||
code.write("glue (<, %) /* { */\n");
|
||||
code.write(" /* di_str[] = */\n");
|
||||
|
@ -1063,17 +1043,14 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write("??=include <stdio.h>\n");
|
||||
code.write("??=define TWELVE 1??/\n");
|
||||
code.write("2\n");
|
||||
|
||||
code.write("static const char str??(??) = \"0123456789??/n\";\n");
|
||||
|
||||
code.write("int\n");
|
||||
code.write("main(void)\n");
|
||||
code.write("??<\n");
|
||||
code.write(" unsigned char x = 5;\n");
|
||||
code.write(" if (sizeof str != TWELVE)\n");
|
||||
code.write(" abort ();\n");
|
||||
code
|
||||
.write(" /* Test ^=, the only multi-character token to come from trigraphs. */\n");
|
||||
code.write(" /* Test ^=, the only multi-character token to come from trigraphs. */\n");
|
||||
code.write(" x ??'= 3;\n");
|
||||
code.write(" if (x != 6)\n");
|
||||
code.write(" abort ();\n");
|
||||
|
@ -1098,7 +1075,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testIndirectDeclarators() throws Exception {
|
||||
parse("void (*x)( int );");
|
||||
parse("void (*x)(int);");
|
||||
}
|
||||
|
||||
public void testBug39532() throws Exception {
|
||||
|
@ -1143,7 +1120,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write("template <class T, class U> struct SuperSubclass {\n");
|
||||
code.write("enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && \n");
|
||||
code.write("!::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; };");
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
parse(code.toString());
|
||||
}
|
||||
|
@ -1210,7 +1187,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write(" catch (...)\n");
|
||||
code.write(" { if (c != 3) r |= 1; }\n");
|
||||
code.write("};\n");
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
parse(code.toString());
|
||||
}
|
||||
|
@ -1266,64 +1243,64 @@ public class QuickParser2Tests extends TestCase {
|
|||
}
|
||||
|
||||
public void testBug43110() throws Exception {
|
||||
parse("void x( int y, ... );");
|
||||
parse("void x(int y, ...);");
|
||||
}
|
||||
|
||||
// public void testBug44370() throws Exception
|
||||
// {
|
||||
// parse( "#define SWAP(x,y) {x|=y;y|=x;x|=y;}\n");
|
||||
// parse("#define SWAP(x,y) {x|=y;y|=x;x|=y;}\n");
|
||||
// Iterator macros = quickParseCallback.getMacros();
|
||||
// assertNotNull(macros);
|
||||
// assertTrue( macros.hasNext());
|
||||
// assertTrue(macros.hasNext());
|
||||
// IASTMacro swap = (IASTMacro) macros.next();
|
||||
// assertFalse( macros.hasNext() );
|
||||
// assertEquals( swap.getName(), "SWAP");
|
||||
// assertEquals( swap.getMacroType(),
|
||||
// IMacroDescriptor.MacroType.FUNCTION_LIKE );
|
||||
// String [] params = swap.getParameters();
|
||||
// assertEquals( params.length, 2 );
|
||||
// assertEquals( params[0], "x");
|
||||
// assertEquals( params[1], "y");
|
||||
// assertFalse(macros.hasNext());
|
||||
// assertEquals(swap.getName(), "SWAP");
|
||||
// assertEquals(swap.getMacroType(),
|
||||
// IMacroDescriptor.MacroType.FUNCTION_LIKE);
|
||||
// String[] params = swap.getParameters();
|
||||
// assertEquals(params.length, 2);
|
||||
// assertEquals(params[0], "x");
|
||||
// assertEquals(params[1], "y");
|
||||
// String completeSignature = swap.getCompleteSignature().trim();
|
||||
// assertEquals( completeSignature, "#define SWAP(x,y) {x|=y;y|=x;x|=y;}");
|
||||
// assertEquals(completeSignature, "#define SWAP(x,y) {x|=y;y|=x;x|=y;}");
|
||||
//
|
||||
// assertEquals( swap.getExpansionSignature().trim(),"{x|=y;y|=x;x|=y;}");
|
||||
// assertEquals(swap.getExpansionSignature().trim(),"{x|=y;y|=x;x|=y;}");
|
||||
//
|
||||
// IToken [] tokens = swap.getTokenizedExpansion();
|
||||
// validateToken( tokens[0], IToken.tLBRACE);
|
||||
// validateIdentifier( tokens[1], "x");
|
||||
// validateToken( tokens[2], IToken.tBITORASSIGN );
|
||||
// validateIdentifier( tokens[3], "y");
|
||||
// validateToken( tokens[4], IToken.tSEMI );
|
||||
// validateIdentifier( tokens[5], "y");
|
||||
// validateToken( tokens[6], IToken.tBITORASSIGN );
|
||||
// validateIdentifier( tokens[7], "x");
|
||||
// validateToken( tokens[8], IToken.tSEMI );
|
||||
// validateIdentifier( tokens[9], "x");
|
||||
// validateToken( tokens[10], IToken.tBITORASSIGN );
|
||||
// validateIdentifier( tokens[11], "y");
|
||||
// validateToken( tokens[12], IToken.tSEMI );
|
||||
// validateToken( tokens[13], IToken.tRBRACE );
|
||||
// IToken[] tokens = swap.getTokenizedExpansion();
|
||||
// validateToken(tokens[0], IToken.tLBRACE);
|
||||
// validateIdentifier(tokens[1], "x");
|
||||
// validateToken(tokens[2], IToken.tBITORASSIGN);
|
||||
// validateIdentifier(tokens[3], "y");
|
||||
// validateToken(tokens[4], IToken.tSEMI);
|
||||
// validateIdentifier(tokens[5], "y");
|
||||
// validateToken(tokens[6], IToken.tBITORASSIGN);
|
||||
// validateIdentifier(tokens[7], "x");
|
||||
// validateToken(tokens[8], IToken.tSEMI);
|
||||
// validateIdentifier(tokens[9], "x");
|
||||
// validateToken(tokens[10], IToken.tBITORASSIGN);
|
||||
// validateIdentifier(tokens[11], "y");
|
||||
// validateToken(tokens[12], IToken.tSEMI);
|
||||
// validateToken(tokens[13], IToken.tRBRACE);
|
||||
// }
|
||||
// /**
|
||||
// * @param token
|
||||
// * @param string
|
||||
// */
|
||||
// private void validateIdentifier(IToken token, String identifierName ) {
|
||||
// validateToken( token, IToken.tIDENTIFIER);
|
||||
// assertEquals( token.getImage(), identifierName );
|
||||
// private void validateIdentifier(IToken token, String identifierName) {
|
||||
// validateToken(token, IToken.tIDENTIFIER);
|
||||
// assertEquals(token.getImage(), identifierName);
|
||||
// }
|
||||
// /**
|
||||
// * @param token
|
||||
// * @param i
|
||||
// */
|
||||
// private void validateToken(IToken token, int signal) {
|
||||
// assertEquals( token.getType(), signal );
|
||||
// assertEquals(token.getType(), signal);
|
||||
// }
|
||||
|
||||
public void testBug47752() throws Exception {
|
||||
//TODO requires CPPVisitor
|
||||
parse("void func( cFoo bar ) try { } catch ( const char * error ){ }");
|
||||
parse("void func(cFoo bar) try { } catch (const char * error){ }");
|
||||
}
|
||||
|
||||
public void testBug47628() throws Exception {
|
||||
|
@ -1354,15 +1331,8 @@ public class QuickParser2Tests extends TestCase {
|
|||
parse("struct file_operations driver_fops = { open: device_open, release: device_release };", true, ParserLanguage.C, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param b
|
||||
* @param c
|
||||
* @param d
|
||||
*/
|
||||
protected void parse(String code, boolean expectedToPass,
|
||||
ParserLanguage lang, boolean gcc) throws Exception {
|
||||
|
||||
FileContent codeReader = FileContent.create("<test-code>", code.toCharArray());
|
||||
IScannerInfo scannerInfo = new ScannerInfo();
|
||||
IScanner scanner= AST2BaseTest.createScanner(codeReader, lang, ParserMode.COMPLETE_PARSE, scannerInfo);
|
||||
|
@ -1373,8 +1343,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
config = new GPPParserExtensionConfiguration();
|
||||
else
|
||||
config = new ANSICPPParserExtensionConfiguration();
|
||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.QUICK_PARSE,
|
||||
NULL_LOG, config);
|
||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.QUICK_PARSE, NULL_LOG, config);
|
||||
} else {
|
||||
ICParserExtensionConfiguration config = null;
|
||||
if (gcc)
|
||||
|
@ -1382,23 +1351,18 @@ public class QuickParser2Tests extends TestCase {
|
|||
else
|
||||
config = new ANSICParserExtensionConfiguration();
|
||||
|
||||
parser2 = new GNUCSourceParser(scanner, ParserMode.QUICK_PARSE,
|
||||
NULL_LOG, config);
|
||||
parser2 = new GNUCSourceParser(scanner, ParserMode.QUICK_PARSE, NULL_LOG, config);
|
||||
}
|
||||
IASTTranslationUnit tu = parser2.parse();
|
||||
if (parser2.encounteredError() && expectedToPass)
|
||||
throw new ParserException("FAILURE");
|
||||
if (expectedToPass)
|
||||
{
|
||||
if( lang == ParserLanguage.C )
|
||||
{
|
||||
IASTProblem [] problems = CVisitor.getProblems(tu);
|
||||
assertEquals( problems.length, 0 );
|
||||
}
|
||||
else if ( lang == ParserLanguage.CPP )
|
||||
{
|
||||
IASTProblem [] problems = CPPVisitor.getProblems(tu);
|
||||
assertEquals( problems.length, 0 );
|
||||
if (expectedToPass) {
|
||||
if (lang == ParserLanguage.C) {
|
||||
IASTProblem[] problems = CVisitor.getProblems(tu);
|
||||
assertEquals(problems.length, 0);
|
||||
} else if (lang == ParserLanguage.CPP) {
|
||||
IASTProblem[] problems = CPPVisitor.getProblems(tu);
|
||||
assertEquals(problems.length, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1409,8 +1373,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
|
||||
public void testBug61431() throws Exception {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ParserLanguage language = (i == 0) ? ParserLanguage.C
|
||||
: ParserLanguage.CPP;
|
||||
ParserLanguage language = (i == 0) ? ParserLanguage.C : ParserLanguage.CPP;
|
||||
parse("int k[][] = { {0, {1}, {2,3}};", false, language);
|
||||
}
|
||||
}
|
||||
|
@ -1458,14 +1421,14 @@ public class QuickParser2Tests extends TestCase {
|
|||
StringWriter writer = new StringWriter();
|
||||
writer.write("#define __declspec(x) __attribute__((x))");
|
||||
writer.write("__declspec (dllimport) int foo;");
|
||||
parse( writer.toString() );
|
||||
parse(writer.toString());
|
||||
}
|
||||
|
||||
public void testBug39704D() throws Exception {
|
||||
StringWriter writer = new StringWriter();
|
||||
writer.write("#define __declspec(x) __attribute__((x))");
|
||||
writer.write("__declspec(dllexport) int func1 (int a) {}");
|
||||
parse( writer.toString() );
|
||||
parse(writer.toString());
|
||||
}
|
||||
|
||||
public void testBug39695() throws Exception {
|
||||
|
@ -1510,8 +1473,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
Writer code = new StringWriter();
|
||||
code.write("__complex__ double x; // complex double\n");
|
||||
code.write("__complex__ short int a; // complex short int\n");
|
||||
code
|
||||
.write("__complex__ float y = 2.5fi; // 2.5 imaginary float literal\n");
|
||||
code.write("__complex__ float y = 2.5fi; // 2.5 imaginary float literal\n");
|
||||
code.write("__complex__ int a = 3i; // imaginary intege r literal\n");
|
||||
code.write("double v = __real__ x; // real part of expression\n");
|
||||
code.write("double w = __imag__ x; // imaginary part of expression\n");
|
||||
|
@ -1532,7 +1494,7 @@ public class QuickParser2Tests extends TestCase {
|
|||
public void testBug39677() throws Exception {
|
||||
parse("B::B() : a(({ 1; })) {}", true, ParserLanguage.CPP, true);
|
||||
Writer writer = new StringWriter();
|
||||
writer.write("B::B() : a(( { int y = foo (); int z;\n");
|
||||
writer.write("B::B() : a(({ int y = foo (); int z;\n");
|
||||
writer.write("if (y > 0) z = y;\n");
|
||||
writer.write("else z = - y;\n");
|
||||
writer.write("z; })) {}\n");
|
||||
|
@ -1562,5 +1524,4 @@ public class QuickParser2Tests extends TestCase {
|
|||
public void testBug39701C() throws Exception {
|
||||
parse("static template class Foo<int>;", true, ParserLanguage.CPP, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SemanticsTests extends AST2BaseTest {
|
|||
// Test getDeclaredConversionOperators()
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
|
||||
ICPPClassType c= ba.assertNonProblem("X {", 1, ICPPClassType.class);
|
||||
ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c);
|
||||
ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c, null);
|
||||
assertEquals(2, cops.length);
|
||||
Set actual= new HashSet();
|
||||
actual.add(cops[0].getName()); actual.add(cops[1].getName());
|
||||
|
|
|
@ -278,4 +278,31 @@ public class InclusionTests extends PreprocessorTestsBase {
|
|||
validateInteger("1");
|
||||
validateEOF();
|
||||
}
|
||||
|
||||
// #include "test.h"
|
||||
public void testSuppressingUseOfCurrentFileDirectory() throws Exception {
|
||||
String content= getAboveComment();
|
||||
|
||||
importFolder("f1");
|
||||
IFolder inc = importFolder("f1/inc");
|
||||
importFile("f1/test.h", "1");
|
||||
importFile("f1/inc/test.h", "2");
|
||||
IFile base = importFile("f1/base.cpp", getAboveComment());
|
||||
|
||||
String[] path = {inc.getLocation().toFile().toString()};
|
||||
IScannerInfo scannerInfo = new ExtendedScannerInfo(Collections.EMPTY_MAP, path, new String[]{}, null);
|
||||
FileContent reader= FileContent.create(base);
|
||||
initializeScanner(reader, ParserLanguage.C, ParserMode.COMPLETE_PARSE, scannerInfo);
|
||||
|
||||
validateInteger("1");
|
||||
validateEOF();
|
||||
|
||||
path = new String[] {inc.getLocation().toFile().toString(), "-"}; // Suppress use of current file directory
|
||||
scannerInfo = new ExtendedScannerInfo(Collections.EMPTY_MAP, path, new String[]{}, null);
|
||||
reader= FileContent.create(base);
|
||||
initializeScanner(reader, ParserLanguage.C, ParserMode.COMPLETE_PARSE, scannerInfo);
|
||||
|
||||
validateInteger("2");
|
||||
validateEOF();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2010 Symbian Software Systems and others.
|
||||
* Copyright (c) 2006, 2012 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
|
||||
|
@ -59,30 +60,31 @@ import org.osgi.framework.Bundle;
|
|||
* is backed by the PDOM), it must be possible to resolve which binding a name
|
||||
* in the AST is referring to. If the binding is not defined in the AST fragment
|
||||
* then it is assumed to have come from a file which is already indexed.
|
||||
*
|
||||
*
|
||||
* This class is for testing the process by which bindings are looked up in
|
||||
* the PDOM purely from AST information (i.e. without a real binding from the DOM)
|
||||
*/
|
||||
public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||
private static final boolean DEBUG= false;
|
||||
private static final int INDEXER_TIMEOUT_SEC = 300;
|
||||
protected ITestStrategy strategy;
|
||||
|
||||
|
||||
public void setStrategy(ITestStrategy strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
strategy.setUp();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
strategy.tearDown();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
protected IASTName findName(String section, int len) {
|
||||
if (len == 0)
|
||||
len= section.length();
|
||||
|
@ -97,10 +99,10 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to get an IBinding from the initial specified number of characters
|
||||
* from the specified code fragment. Fails the test if
|
||||
|
@ -122,25 +124,25 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
IASTName name= findName(section, len);
|
||||
assertNotNull("Name not found for \"" + section + "\"", name);
|
||||
assertEquals(section.substring(0, len), name.getRawSignature());
|
||||
|
||||
|
||||
IBinding binding = name.resolveBinding();
|
||||
assertNotNull("No binding for " + name.getRawSignature(), binding);
|
||||
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
|
||||
assertInstance(binding, clazz, cs);
|
||||
return clazz.cast(binding);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see IndexBindingResolutionTestBase#getBindingFromASTName(Class, String, int)
|
||||
*/
|
||||
protected <T extends IBinding> T getBindingFromASTName(String section, int len) {
|
||||
if (len <= 0)
|
||||
len += section.length();
|
||||
|
||||
|
||||
IASTName name= findName(section, len);
|
||||
assertNotNull("Name not found for \"" + section + "\"", name);
|
||||
assertEquals(section.substring(0, len), name.getRawSignature());
|
||||
|
||||
|
||||
IBinding binding = name.resolveBinding();
|
||||
assertNotNull("No binding for " + name.getRawSignature(), binding);
|
||||
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
|
||||
|
@ -157,17 +159,17 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
IASTName name= findName(section, len);
|
||||
assertNotNull("Name not found for \"" + section + "\"", name);
|
||||
assertEquals(section.substring(0, len), name.getRawSignature());
|
||||
|
||||
|
||||
IBinding binding = name.resolveBinding();
|
||||
assertNotNull("No binding for " + name.getRawSignature(), binding);
|
||||
assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
|
||||
return name.resolveBinding();
|
||||
}
|
||||
|
||||
|
||||
protected static void assertQNEquals(String expectedQN, IBinding b) {
|
||||
assertInstance(b, IBinding.class);
|
||||
if (b instanceof ICPPBinding) {
|
||||
assertEquals(expectedQN, ASTTypeUtil.getQualifiedName((ICPPBinding)b));
|
||||
assertEquals(expectedQN, ASTTypeUtil.getQualifiedName((ICPPBinding) b));
|
||||
} else {
|
||||
assertEquals(expectedQN, b.getName());
|
||||
}
|
||||
|
@ -175,7 +177,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
protected IType getVariableType(IBinding binding) throws DOMException {
|
||||
assertTrue(binding instanceof IVariable);
|
||||
return ((IVariable)binding).getType();
|
||||
return ((IVariable) binding).getType();
|
||||
}
|
||||
|
||||
protected IType getPtrType(IBinding binding) throws DOMException {
|
||||
|
@ -195,8 +197,8 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
// assert function is IFunctionType
|
||||
IFunctionType ft = (IFunctionType) function;
|
||||
assertTrue(ICPPClassType.class.isInstance((ft.getParameterTypes()[index])));
|
||||
assertEquals(compositeTypeKey, ((ICPPClassType)ft.getParameterTypes()[index]).getKey());
|
||||
assertEquals(qn, ASTTypeUtil.getQualifiedName((ICPPClassType)ft.getParameterTypes()[index]));
|
||||
assertEquals(compositeTypeKey, ((ICPPClassType) ft.getParameterTypes()[index]).getKey());
|
||||
assertEquals(qn, ASTTypeUtil.getQualifiedName((ICPPClassType) ft.getParameterTypes()[index]));
|
||||
}
|
||||
|
||||
protected static <T> T assertInstance(Object o, Class<T> clazz, Class ... cs) {
|
||||
|
@ -207,7 +209,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
}
|
||||
return clazz.cast(o);
|
||||
}
|
||||
|
||||
|
||||
protected String readTaggedComment(final String tag) throws IOException {
|
||||
return TestSourceReader.readTaggedComment(CTestPlugin.getDefault().getBundle(), "parser", getClass(), tag);
|
||||
}
|
||||
|
@ -216,6 +218,63 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return strategy.getIndex();
|
||||
}
|
||||
|
||||
protected static void assertVariable(IBinding b, String qn, Class expType, String expTypeQN) {
|
||||
assertInstance(b, IVariable.class);
|
||||
IVariable variable = (IVariable) b;
|
||||
assertQNEquals(qn, variable);
|
||||
assertInstance(variable.getType(), expType);
|
||||
if (expTypeQN != null) {
|
||||
IType type= variable.getType();
|
||||
assertInstance(type, IBinding.class);
|
||||
assertQNEquals(expTypeQN, (IBinding) type);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) {
|
||||
assertInstance(conType, ITypeContainer.class);
|
||||
assertInstance(conType, containerType);
|
||||
IType containedType= ((ITypeContainer) conType).getType();
|
||||
assertInstance(containedType, expContainedType);
|
||||
if (expContainedTypeQN != null) {
|
||||
assertInstance(containedType, IBinding.class);
|
||||
assertQNEquals(expContainedTypeQN, (IBinding) containedType);
|
||||
}
|
||||
}
|
||||
|
||||
final protected void checkBindings() throws Exception {
|
||||
for (int i = 0; i < strategy.getAstCount(); i++) {
|
||||
IASTTranslationUnit ast = strategy.getAst(i);
|
||||
CNameCollector col = new CNameCollector();
|
||||
ast.accept(col);
|
||||
for (IASTName n : col.nameList) {
|
||||
assertFalse("ProblemBinding for " + n.getRawSignature(), n.resolveBinding() instanceof IProblemBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static protected class CNameCollector extends ASTVisitor {
|
||||
{
|
||||
shouldVisitNames = true;
|
||||
}
|
||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
nameList.add(name);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
public IASTName getName(int idx) {
|
||||
if (idx < 0 || idx >= nameList.size())
|
||||
return null;
|
||||
return nameList.get(idx);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return nameList.size();
|
||||
}
|
||||
}
|
||||
|
||||
interface ITestStrategy {
|
||||
IIndex getIndex();
|
||||
void setUp() throws Exception;
|
||||
|
@ -227,30 +286,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public ICProject getCProject();
|
||||
public boolean isCompositeIndex();
|
||||
}
|
||||
|
||||
protected static void assertVariable(IBinding b, String qn, Class expType, String expTypeQN) {
|
||||
assertInstance(b, IVariable.class);
|
||||
IVariable variable = (IVariable) b;
|
||||
assertQNEquals(qn, variable);
|
||||
assertInstance(variable.getType(), expType);
|
||||
if (expTypeQN != null) {
|
||||
IType type= variable.getType();
|
||||
assertInstance(type, IBinding.class);
|
||||
assertQNEquals(expTypeQN, (IBinding) type);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) {
|
||||
assertInstance(conType, ITypeContainer.class);
|
||||
assertInstance(conType, containerType);
|
||||
IType containedType= ((ITypeContainer)conType).getType();
|
||||
assertInstance(containedType, expContainedType);
|
||||
if (expContainedTypeQN != null) {
|
||||
assertInstance(containedType, IBinding.class);
|
||||
assertQNEquals(expContainedTypeQN, (IBinding) containedType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SinglePDOMTestFirstASTStrategy implements ITestStrategy {
|
||||
private IIndex index;
|
||||
private ICProject cproject;
|
||||
|
@ -266,7 +302,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public ICProject getCProject() {
|
||||
return cproject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
|
@ -293,8 +329,9 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
cproject = cpp ?
|
||||
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||
testData = TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 2);
|
||||
|
||||
|
@ -302,11 +339,11 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
return;
|
||||
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Project PDOM: " + getName());
|
||||
((PDOM)CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
}
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
|
@ -330,7 +367,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public IIndex getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompositeIndex() {
|
||||
return false;
|
||||
|
@ -379,21 +416,22 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
cproject = cpp ? CProjectHelper.createCCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||
: CProjectHelper.createCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
cproject = cpp ?
|
||||
CProjectHelper.createCCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||
CProjectHelper.createCProject(getName()+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||
testData = TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 2);
|
||||
|
||||
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("references.c" + (cpp ? "pp" : "")), testData[1].toString());
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Project PDOM: " + getName());
|
||||
((PDOM)CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
}
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
|
@ -416,7 +454,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public IIndex getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompositeIndex() {
|
||||
return false;
|
||||
|
@ -472,8 +510,9 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
cproject = cpp ? CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||
: CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
cproject = cpp ?
|
||||
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||
testData = TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 0);
|
||||
|
||||
|
@ -498,8 +537,8 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Project PDOM: " + getName());
|
||||
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
|
@ -527,7 +566,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public IIndex getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompositeIndex() {
|
||||
return false;
|
||||
|
@ -549,7 +588,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public ICProject getCProject() {
|
||||
return cproject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
if (index != null) {
|
||||
|
@ -565,8 +604,9 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
cproject= cpp ? CProjectHelper.createCCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||
: CProjectHelper.createCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
cproject= cpp ?
|
||||
CProjectHelper.createCCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||
CProjectHelper.createCProject("OnlineContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
Bundle b= CTestPlugin.getDefault().getBundle();
|
||||
testData= TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 2);
|
||||
referenced = createReferencedContent();
|
||||
|
@ -581,11 +621,11 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(cproject);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Online: "+getName());
|
||||
((PDOM)CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
|
||||
}
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(cproject, IIndexManager.ADD_DEPENDENCIES);
|
||||
|
@ -594,21 +634,22 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected ICProject createReferencedContent() throws CoreException {
|
||||
ICProject referenced = cpp ? CProjectHelper.createCCProject("ReferencedContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER)
|
||||
: CProjectHelper.createCProject("ReferencedContent"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
ICProject referenced = cpp ?
|
||||
CProjectHelper.createCCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||
CProjectHelper.createCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
String content = testData[0].toString();
|
||||
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
|
||||
|
||||
|
||||
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(referenced);
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, new NullProgressMonitor()));
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.println("Referenced: "+getName());
|
||||
((PDOM)CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter());
|
||||
((PDOM) CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter());
|
||||
}
|
||||
|
||||
|
||||
return referenced;
|
||||
}
|
||||
|
||||
|
@ -640,7 +681,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
public StringBuilder[] getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompositeIndex() {
|
||||
return true;
|
||||
|
@ -650,7 +691,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
/**
|
||||
* When a test is failing only for the strategy where the test data is split over
|
||||
* multiple index fragments, we artificially fail the single fragment strategy also.
|
||||
* This is not ideal, but as both strategies behavior are typically the same, is
|
||||
* This is not ideal, but as both strategies behavior are typically the same, is
|
||||
* quite rare.
|
||||
*/
|
||||
protected void fakeFailForSingle() {
|
||||
|
@ -662,7 +703,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
/**
|
||||
* When a test is failing only for the strategy where the test data is not split over
|
||||
* multiple index fragments, we artificially fail the single fragment strategy also.
|
||||
* This is not ideal, but as both strategies behavior are typically the same, is
|
||||
* This is not ideal, but as both strategies behavior are typically the same, is
|
||||
* quite rare.
|
||||
*/
|
||||
protected void fakeFailForMultiProject() {
|
||||
|
|
|
@ -108,7 +108,7 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
public class IndexBugsTests extends BaseTestCase {
|
||||
private static final int INDEX_WAIT_TIME = 800000; //XXX
|
||||
private static final int INDEXER_TIMEOUT_SEC = 20;
|
||||
private ICProject fCProject;
|
||||
protected IIndex fIndex;
|
||||
|
||||
|
@ -305,13 +305,13 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
private void waitForIndexer() throws InterruptedException {
|
||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
|
||||
long waitms= 1;
|
||||
while (waitms < 2000 && indexManager.isIndexerSetupPostponed(fCProject)) {
|
||||
Thread.sleep(waitms);
|
||||
waitms *= 2;
|
||||
}
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
|
||||
}
|
||||
|
||||
protected Pattern[] getPattern(String qname) {
|
||||
|
@ -385,7 +385,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String[] content= getContentsForTest(2);
|
||||
|
||||
IFile file= createFile(getProject(), "header.h", content[0]);
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
|
@ -399,7 +399,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
file= createFile(getProject(), "header.h", content[1]);
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
|
@ -425,10 +425,10 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
content.append("unsigned int arrayDataSize = sizeof(arrayData);\n");
|
||||
int indexOfDecl = content.indexOf(varName);
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
|
||||
IFile file= createFile(getProject(), fileName, content.toString());
|
||||
// must be done in a reasonable amount of time
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings(getPattern("arrayDataSize"), true, IndexFilter.ALL, npm());
|
||||
|
@ -451,7 +451,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test156671.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -469,7 +469,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
||||
TestScannerProvider.sIncludeFiles= new String[]{include.getName()};
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test160281_1.cpp", "");
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -493,7 +493,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
||||
TestScannerProvider.sMacroFiles= new String[]{include.getName()};
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test160281_2.cpp", "int X;");
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -528,7 +528,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
int indexOfDecl = content.indexOf(funcName);
|
||||
int indexOfDef = content.indexOf(funcName, indexOfDecl+1);
|
||||
IFile file= createFile(getProject(), fileName, content);
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
// make sure the ast is correct
|
||||
ITranslationUnit tu= (ITranslationUnit) fCProject.findElement(new Path(fileName));
|
||||
|
@ -569,7 +569,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
||||
TestScannerProvider.sIncludeFiles= new String[] { include.getLocation().toOSString() };
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -592,7 +592,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
||||
TestScannerProvider.sMacroFiles= new String[]{include.getLocation().toOSString()};
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -618,7 +618,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164500.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -655,7 +655,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String[] testData = getContentsForTest(3);
|
||||
IFile header= TestSourceReader.createFile(cproject.getProject(), "header.h", testData[0]);
|
||||
IFile referer= TestSourceReader.createFile(cproject.getProject(), "content.cpp", testData[1]);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, referer, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, referer, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
|
@ -670,7 +670,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
InputStream in = new ByteArrayInputStream(testData[2].getBytes());
|
||||
header.setContents(in, IResource.FORCE, null);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, header, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, header, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
|
@ -695,7 +695,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test172454.c", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -728,7 +728,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test172454.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -762,7 +762,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test173997.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -781,7 +781,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
long timestamp= file.getLocalTimeStamp();
|
||||
content= "int UPDATED20070213;\n" + content.replaceFirst("int", "float");
|
||||
file= TestSourceReader.createFile(fCProject.getProject(), "test173997.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -814,7 +814,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String[] content= getContentsForTest(2);
|
||||
|
||||
IFile file= createFile(getProject(), "header.h", content[0]);
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
|
@ -829,7 +829,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
file= createFile(getProject(), "header.h", content[1]);
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
|
@ -971,7 +971,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index = CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
String content= getContentsForTest(1)[0];
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), "content.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
CProjectHelper.delete(cproject);
|
||||
|
||||
cproject = CProjectHelper.createCCProject(pname, "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
|
@ -997,7 +997,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index = CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
String content= getContentsForTest(1)[0];
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), "content.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
// move the project to a random new location
|
||||
File newLocation = CProjectHelper.freshDir();
|
||||
|
@ -1030,7 +1030,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "testFBWP.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -1063,7 +1063,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String content= getContentsForTest(1)[0];
|
||||
|
||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "testFilterFindBindingsFQCharArray.cpp", content);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEX_WAIT_TIME);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
@ -1186,7 +1186,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String[] contents= getContentsForTest(2);
|
||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
IFile f1= TestSourceReader.createFile(fCProject.getProject(), "header.h", contents[0]);
|
||||
waitUntilFileIsIndexed(f1, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(f1, INDEXER_TIMEOUT_SEC * 1000);
|
||||
IFile f2= TestSourceReader.createFile(fCProject.getProject(), "src.cpp", contents[1]);
|
||||
waitForIndexer();
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
String[] contents= getContentsForTest(2);
|
||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
IFile f1= TestSourceReader.createFile(fCProject.getProject(), "header.h", contents[0]);
|
||||
waitUntilFileIsIndexed(f1, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(f1, INDEXER_TIMEOUT_SEC * 1000);
|
||||
IFile f2= TestSourceReader.createFile(fCProject.getProject(), "src.cpp", contents[1]);
|
||||
waitForIndexer();
|
||||
|
||||
|
@ -2303,7 +2303,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
s= TestSourceReader.createFile(src, "source.cpp", "#include \"../h/a.h\"");
|
||||
waitUntilFileIsIndexed(s, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(s, INDEXER_TIMEOUT_SEC * 1000);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
r = index.findBindings("version2".toCharArray(), IndexFilter.ALL_DECLARED, null);
|
||||
|
@ -2313,7 +2313,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
s= TestSourceReader.createFile(h, "a.h", "int version3;");
|
||||
waitUntilFileIsIndexed(s, INDEX_WAIT_TIME);
|
||||
waitUntilFileIsIndexed(s, INDEXER_TIMEOUT_SEC * 1000);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
r = index.findBindings("version2".toCharArray(), IndexFilter.ALL_DECLARED, null);
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.index.tests;
|
||||
|
||||
|
@ -55,7 +56,8 @@ import org.eclipse.cdt.core.index.IIndexBinding;
|
|||
import org.eclipse.cdt.core.index.IIndexMacro;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeArgument;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -226,10 +228,10 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
|||
assertInstance(b1, ICPPInstanceCache.class);
|
||||
|
||||
ICPPInstanceCache ct= (ICPPInstanceCache) b1;
|
||||
ICPPSpecialization inst= ct.getInstance(new ICPPTemplateArgument[]{new CPPTemplateArgument((IType)b0)});
|
||||
ICPPSpecialization inst= ct.getInstance(new ICPPTemplateArgument[]{new CPPTemplateTypeArgument((IType)b0)});
|
||||
assertInstance(inst, ICPPClassType.class);
|
||||
ICPPClassType c2t= (ICPPClassType) inst;
|
||||
ICPPBase[] bases= c2t.getBases();
|
||||
ICPPBase[] bases= ClassTypeHelper.getBases(c2t, null);
|
||||
assertEquals(1, bases.length);
|
||||
assertInstance(bases[0].getBaseClass(), ICPPClassType.class);
|
||||
}
|
||||
|
@ -998,74 +1000,74 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
|||
// class template instance
|
||||
ct= getBindingFromASTName("CT<int>", 7);
|
||||
assertInstance(ct, ICPPTemplateInstance.class);
|
||||
assertBindings(new String[] {"B"}, ct.getBases());
|
||||
assertBindings(new String[] {"n", "m", "B", "CT"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"CT", "CT"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"g"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"n", "CT"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"f", "g"}, ct.getFields());
|
||||
assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"O"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"n", "CT"}, ClassTypeHelper.getDeclaredMethods(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[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
|
||||
// explicit class template instance
|
||||
ct= getBindingFromASTName("CT<char>", 8);
|
||||
assertInstance(ct, ICPPTemplateInstance.class);
|
||||
assertBindings(new String[] {"A"}, ct.getBases());
|
||||
assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"CT", "CT", "CT"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"h"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"o", "CT", "CT"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"e", "h"}, ct.getFields());
|
||||
assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"P"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"CT", "CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"o", "CT", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
|
||||
assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
||||
assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
|
||||
// class specialization
|
||||
ct= getBindingFromASTName("C spec", 1);
|
||||
assertInstance(ct, ICPPClassSpecialization.class);
|
||||
assertBindings(new String[] {"B"}, ct.getBases());
|
||||
assertBindings(new String[] {"n", "m", "B", "C"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"C", "C"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"g"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"n", "C"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"f", "g"}, ct.getFields());
|
||||
assertBindings(new String[] {"m", "n", "C", "C", "~C", "B", "B", "~B", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"O"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"n", "m", "B", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"C", "C"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"n", "C"}, ClassTypeHelper.getDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
|
||||
assertBindings(new String[] {"m", "n", "C", "C", "~C", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
||||
assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
|
||||
// class template specialization
|
||||
ct= getBindingFromASTName("CT<int> spect", 2);
|
||||
assertInstance(ct, ICPPClassTemplate.class, ICPPClassSpecialization.class);
|
||||
assertBindings(new String[] {"B"}, ct.getBases());
|
||||
assertBindings(new String[] {"n", "m", "B", "CT"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"CT", "CT"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"g"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"n", "CT"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"f", "g"}, ct.getFields());
|
||||
assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"O"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"n", "CT"}, ClassTypeHelper.getDeclaredMethods(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[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
|
||||
// explicit class specialization
|
||||
ct= getBindingFromASTName("C espec", 1);
|
||||
assertInstance(ct, ICPPClassSpecialization.class);
|
||||
assertBindings(new String[] {"A"}, ct.getBases());
|
||||
assertBindings(new String[] {"o", "l", "A", "C", "C"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"C", "C", "C"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"h"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"o", "C", "C"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"e", "h"}, ct.getFields());
|
||||
assertBindings(new String[] {"l", "o", "C", "C", "C", "~C", "A", "A", "~A", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"P"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"o", "l", "A", "C", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"C", "C", "C"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"o", "C", "C"}, ClassTypeHelper.getDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
|
||||
assertBindings(new String[] {"l", "o", "C", "C", "C", "~C", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
||||
assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
|
||||
// explicit class template specialization
|
||||
ct= getBindingFromASTName("CT<int> espect", 7);
|
||||
assertInstance(ct, ICPPTemplateInstance.class);
|
||||
assertBindings(new String[] {"A"}, ct.getBases());
|
||||
assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ct.getAllDeclaredMethods());
|
||||
assertBindings(new String[] {"CT", "CT", "CT"}, ct.getConstructors());
|
||||
assertBindings(new String[] {"h"}, ct.getDeclaredFields());
|
||||
assertBindings(new String[] {"o", "CT", "CT"}, ct.getDeclaredMethods());
|
||||
assertBindings(new String[] {"e", "h"}, ct.getFields());
|
||||
assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ct.getMethods());
|
||||
assertBindings(new String[] {"P"}, ct.getNestedClasses());
|
||||
assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
|
||||
assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"CT", "CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
|
||||
assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
|
||||
assertBindings(new String[] {"o", "CT", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
|
||||
assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
|
||||
assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
|
||||
assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
|
||||
}
|
||||
|
||||
// void func(const int* x) {}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -34,6 +35,7 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
|||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||
|
@ -237,9 +239,10 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
ICPPVariable var= (ICPPVariable) bs[0];
|
||||
assertInstance(var.getType(), ICPPClassType.class);
|
||||
ICPPClassType ct= (ICPPClassType) var.getType();
|
||||
assertEquals(1, ct.getFields().length);
|
||||
assertInstance(ct.getFields()[0].getType(), IPointerType.class);
|
||||
IPointerType pt= (IPointerType) ct.getFields()[0].getType();
|
||||
IField[] fields = ClassTypeHelper.getFields(ct, null);
|
||||
assertEquals(1, fields.length);
|
||||
assertInstance(fields[0].getType(), IPointerType.class);
|
||||
IPointerType pt= (IPointerType) fields[0].getType();
|
||||
assertInstance(pt.getType(), IFunctionType.class);
|
||||
IFunctionType ft= (IFunctionType) pt.getType();
|
||||
assertInstance(ft.getReturnType(), ICPPClassType.class);
|
||||
|
|
|
@ -62,12 +62,19 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
public static Test suite() throws Exception {
|
||||
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
|
||||
|
||||
// Add all success tests
|
||||
// Add all success tests
|
||||
|
||||
// Has intermittent failures
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) {
|
||||
suite.addTest(CDescriptorTests.suite());
|
||||
}
|
||||
suite.addTest(CDescriptorOldTests.suite());
|
||||
suite.addTest(IEnvironmentVariableManagerTests.suite());
|
||||
suite.addTest(ErrorParserTests.suite());
|
||||
// Has intermittent failures
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) {
|
||||
suite.addTest(ParserTestSuite.suite());
|
||||
}
|
||||
suite.addTest(AllCoreTests.suite());
|
||||
suite.addTest(ElementDeltaTests.suite());
|
||||
suite.addTest(WorkingCopyTests.suite());
|
||||
|
@ -84,9 +91,12 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
suite.addTest(EFSExtensionTests.suite());
|
||||
suite.addTest(ByteUtilsTest.suite());
|
||||
|
||||
// Has intermittent failures
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
// Add in PDOM tests
|
||||
suite.addTest(PDOMTests.suite());
|
||||
suite.addTest(IndexTests.suite());
|
||||
}
|
||||
|
||||
suite.addTest(RefreshScopeTests.suite());
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ILinkage;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IIndexFile;
|
||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
|
@ -315,18 +316,21 @@ public class TestSourceReader {
|
|||
* @since 4.0
|
||||
*/
|
||||
public static void waitUntilFileIsIndexed(IIndex index, IFile file, int maxmillis) throws Exception {
|
||||
long fileTimestamp = file.getLocalTimeStamp();
|
||||
IIndexFileLocation indexFileLocation = IndexLocationFactory.getWorkspaceIFL(file);
|
||||
|
||||
long endTime= System.currentTimeMillis() + maxmillis;
|
||||
int timeLeft= maxmillis;
|
||||
while (timeLeft >= 0) {
|
||||
Assert.assertTrue(CCorePlugin.getIndexManager().joinIndexer(timeLeft, new NullProgressMonitor()));
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IIndexFile[] files= index.getFiles(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file));
|
||||
if (files.length > 0 && areAllFilesNotOlderThan(files, file.getLocalTimeStamp())) {
|
||||
IIndexFile[] files= index.getFiles(ILinkage.CPP_LINKAGE_ID, indexFileLocation);
|
||||
if (files.length > 0 && areAllFilesNotOlderThan(files, fileTimestamp)) {
|
||||
return;
|
||||
}
|
||||
files= index.getFiles(ILinkage.C_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file));
|
||||
if (files.length > 0 && areAllFilesNotOlderThan(files, file.getLocalTimeStamp())) {
|
||||
files= index.getFiles(ILinkage.C_LINKAGE_ID, indexFileLocation);
|
||||
if (files.length > 0 && areAllFilesNotOlderThan(files, fileTimestamp)) {
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -224,14 +225,21 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
|||
for (ICLanguageSettingEntry entry : entriesPath) {
|
||||
ACPathEntry entryPath = (ACPathEntry)entry;
|
||||
if (entryPath.isValueWorkspacePath()) {
|
||||
IPath loc = entryPath.getLocation();
|
||||
if (loc!=null) {
|
||||
if (checkBit(entryPath.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
||||
// handle frameworks, see IScannerInfo.getIncludePaths()
|
||||
locations.add(loc.append(FRAMEWORK_HEADERS_INCLUDE).toOSString());
|
||||
locations.add(loc.append(FRAMEWORK_PRIVATE_HEADERS_INCLUDE).toOSString());
|
||||
} else {
|
||||
locations.add(loc.toOSString());
|
||||
ICLanguageSettingEntry[] entries = new ICLanguageSettingEntry[] {entry};
|
||||
if (!entry.isResolved()) {
|
||||
entries = CDataUtil.resolveEntries(entries, cfgDescription);
|
||||
}
|
||||
|
||||
for (ICLanguageSettingEntry resolved : entries) {
|
||||
IPath loc = ((ACPathEntry) resolved).getLocation();
|
||||
if (loc != null) {
|
||||
if (checkBit(resolved.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
||||
// handle frameworks, see IScannerInfo.getIncludePaths()
|
||||
locations.add(loc.append(FRAMEWORK_HEADERS_INCLUDE).toOSString());
|
||||
locations.add(loc.append(FRAMEWORK_PRIVATE_HEADERS_INCLUDE).toOSString());
|
||||
} else {
|
||||
locations.add(loc.toOSString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -945,6 +945,7 @@ public class ASTStringUtil {
|
|||
// need to add a space to the unary expression if it is a specific operator
|
||||
switch (expression.getOperator()) {
|
||||
case IASTUnaryExpression.op_sizeof:
|
||||
case ICPPASTUnaryExpression.op_noexcept:
|
||||
case ICPPASTUnaryExpression.op_throw:
|
||||
case ICPPASTUnaryExpression.op_typeid:
|
||||
buffer.append(SPACE);
|
||||
|
@ -986,6 +987,8 @@ public class ASTStringUtil {
|
|||
public static char[] getUnaryOperatorString(IASTUnaryExpression ue) {
|
||||
int op = ue.getOperator();
|
||||
switch (op) {
|
||||
case IASTUnaryExpression.op_noexcept:
|
||||
return Keywords.cNOEXCEPT;
|
||||
case IASTUnaryExpression.op_throw:
|
||||
return Keywords.cTHROW;
|
||||
case IASTUnaryExpression.op_typeid:
|
||||
|
|
|
@ -48,7 +48,6 @@ import org.eclipse.cdt.internal.core.model.ASTStringUtil;
|
|||
*/
|
||||
@Deprecated
|
||||
public class ASTSignatureUtil {
|
||||
|
||||
private static final String COMMA_SPACE = ", "; //$NON-NLS-1$
|
||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||
private static final String SPACE = " "; //$NON-NLS-1$
|
||||
|
@ -1044,9 +1043,10 @@ public class ASTSignatureUtil {
|
|||
if (!postOperator && !primaryBracketed)
|
||||
buffer.append(getUnaryOperatorString(expression));
|
||||
|
||||
// need to add a space to the unary expression if it is a specific operator
|
||||
// Need to add a space to the unary expression if it is a specific operator
|
||||
switch (expression.getOperator()) {
|
||||
case IASTUnaryExpression.op_sizeof:
|
||||
case ICPPASTUnaryExpression.op_noexcept:
|
||||
case ICPPASTUnaryExpression.op_throw:
|
||||
case ICPPASTUnaryExpression.op_typeid:
|
||||
buffer.append(SPACE);
|
||||
|
@ -1117,6 +1117,9 @@ public class ASTSignatureUtil {
|
|||
|
||||
if (ue instanceof ICPPASTUnaryExpression) {
|
||||
switch (op) {
|
||||
case ICPPASTUnaryExpression.op_noexcept:
|
||||
opString = Keywords.NOEXCEPT;
|
||||
break;
|
||||
case ICPPASTUnaryExpression.op_throw:
|
||||
opString = Keywords.THROW;
|
||||
break;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTForStatement extends IASTStatement {
|
||||
|
||||
/**
|
||||
* <code>CONDITION</code> represents the relationship between a
|
||||
* <code>IASTForStatement</code> and its <code>IASTExpression</code>
|
||||
|
@ -40,7 +39,8 @@ public interface IASTForStatement extends IASTStatement {
|
|||
* <code>IASTForStatement</code> and its <code>IASTStatement</code>
|
||||
* body.
|
||||
*/
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty(
|
||||
"IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <code>INITIALIZER</code> represents the relationship between a
|
||||
|
|
|
@ -120,7 +120,7 @@ public interface IASTTypeIdExpression extends IASTExpression {
|
|||
* Built-in type trait of g++.
|
||||
* @since 5.3
|
||||
*/
|
||||
public static final int op_is_polymorphic=17;
|
||||
public static final int op_is_polymorphic= 17;
|
||||
|
||||
/**
|
||||
* Built-in type trait of g++.
|
||||
|
@ -128,6 +128,24 @@ public interface IASTTypeIdExpression extends IASTExpression {
|
|||
*/
|
||||
public static final int op_is_union= 18;
|
||||
|
||||
/**
|
||||
* Built-in type trait of g++.
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final int op_is_literal_type= 19;
|
||||
|
||||
/**
|
||||
* Built-in type trait of g++.
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final int op_is_standard_layout= 20;
|
||||
|
||||
/**
|
||||
* Built-in type trait of g++.
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final int op_is_trivial= 21;
|
||||
|
||||
/**
|
||||
* @deprecated constants should be declared here, to avoid using the same constant in different
|
||||
* interfaces.
|
||||
|
|
|
@ -106,17 +106,23 @@ public interface IASTUnaryExpression extends IASTExpression {
|
|||
public static final int op_typeof = 14;
|
||||
|
||||
/**
|
||||
* for gnu parsers, only. <code>op_alignOf</code> is used for __alignOf( unaryExpression ) type
|
||||
* For gnu parsers, only. <code>op_alignOf</code> is used for __alignOf( unaryExpression ) type
|
||||
* expressions.
|
||||
*/
|
||||
public static final int op_alignOf = 15;
|
||||
|
||||
/**
|
||||
* For c++, only: 'sizeof...(parameterPack)'
|
||||
* For c++, only: 'sizeof... ( parameterPack )'
|
||||
* @since 5.2
|
||||
*/
|
||||
public static final int op_sizeofParameterPack = 16;
|
||||
|
||||
/**
|
||||
* For c++, only: noexcept ( expression )
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final int op_noexcept = 17;
|
||||
|
||||
/**
|
||||
* <code>op_last</code> is made available for subclasses.
|
||||
* @deprecated all constants must be defined in this interface
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
|
||||
/**
|
||||
* Interface for basic types.
|
||||
*
|
||||
*
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
|
@ -22,10 +22,10 @@ public interface IBasicType extends IType {
|
|||
* @since 5.2
|
||||
*/
|
||||
enum Kind {
|
||||
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean, eChar16, eChar32,
|
||||
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean, eChar16, eChar32,
|
||||
/** @since 5.4 */ eNullPtr
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
|
@ -45,15 +45,15 @@ public interface IBasicType extends IType {
|
|||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
final int IS_COMPLEX = 1 << 4;
|
||||
final int IS_COMPLEX = 1 << 4;
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
final int IS_IMAGINARY = 1 << 5;
|
||||
final int IS_IMAGINARY = 1 << 5;
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
final int IS_LONG_LONG = 1 << 6;
|
||||
final int IS_LONG_LONG = 1 << 6;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -62,13 +62,13 @@ public interface IBasicType extends IType {
|
|||
* @since 5.2
|
||||
*/
|
||||
Kind getKind();
|
||||
|
||||
|
||||
/**
|
||||
* This returns the combination of modifier bits for this type.
|
||||
* @since 5.2
|
||||
*/
|
||||
int getModifiers();
|
||||
|
||||
|
||||
public boolean isSigned();
|
||||
public boolean isUnsigned();
|
||||
public boolean isShort();
|
||||
|
@ -84,7 +84,7 @@ public interface IBasicType extends IType {
|
|||
* @since 5.2
|
||||
*/
|
||||
public boolean isComplex();
|
||||
|
||||
|
||||
/**
|
||||
* Is imaginary number? e.g. _Imaginr
|
||||
* @return true if it is an imaginary number, false otherwise
|
||||
|
@ -97,13 +97,13 @@ public interface IBasicType extends IType {
|
|||
*/
|
||||
@Deprecated
|
||||
public int getType() throws DOMException;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated, types don't have values.
|
||||
*/
|
||||
@Deprecated
|
||||
public IASTExpression getValue() throws DOMException;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated, use the type-safe version getKind(), instead.
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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:
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
|
||||
/**
|
||||
* Interface for problem bindings.
|
||||
*
|
||||
*
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
*/
|
||||
|
@ -22,12 +22,12 @@ public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProbl
|
|||
* Returns the AST node that this problem was created for
|
||||
*/
|
||||
public IASTNode getASTNode();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the file name this problem occurred in, or <code>null</code> if it is unknown.
|
||||
* Returns the file name this problem occurred in, or {@code null} if it is unknown.
|
||||
*/
|
||||
public String getFileName();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the line number for this problem, or -1 if it is unknown.
|
||||
*/
|
||||
|
@ -37,10 +37,8 @@ public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProbl
|
|||
* Returns bindings that were considered when resolving the node corresponding
|
||||
* to this problem binding, but rejected for some reason.
|
||||
* @return an array of candidate bindings.
|
||||
*
|
||||
* This method is experimental. Clients calling this method should expect
|
||||
* possible changes.
|
||||
* @since 5.1 experimental
|
||||
*
|
||||
* @since 5.1
|
||||
*/
|
||||
public IBinding[] getCandidateBindings();
|
||||
|
||||
|
@ -70,6 +68,4 @@ public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProbl
|
|||
*/
|
||||
@Deprecated
|
||||
public static final int LAST_PROBLEM = 0x00E;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -109,8 +109,8 @@ public interface IScope {
|
|||
private final IASTTranslationUnit fTu;
|
||||
private final boolean fLookupPointIsName;
|
||||
private boolean fResolve= true;
|
||||
private boolean fPrefixLookup= false;
|
||||
private boolean fIgnorePointOfDeclaration= false;
|
||||
private boolean fPrefixLookup;
|
||||
private boolean fIgnorePointOfDeclaration;
|
||||
|
||||
public ScopeLookupData(IASTName name, boolean resolve, boolean prefixLookup) {
|
||||
if (name == null)
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||
|
||||
/**
|
||||
* Models a value of a variable, enumerator or expression.
|
||||
*
|
||||
|
@ -19,27 +22,33 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
*/
|
||||
public interface IValue {
|
||||
/**
|
||||
* Returns the value as a number, or <code>null</code> if this is not possible.
|
||||
* Returns the value as a number, or {@code null} if it is not possible.
|
||||
*/
|
||||
Long numericalValue();
|
||||
|
||||
|
||||
/**
|
||||
* Returns an internal representation of the expression that builds up
|
||||
* the value. It is suitable for instantiating dependent values but may not be
|
||||
* used for the purpose of displaying values.
|
||||
* Returns the evaluation object if this value is dependent, or {@code null} otherwise.
|
||||
* If {@link #numericalValue()} returns {@code null}, {@link #getEvaluation()} returns
|
||||
* not {@code null} and vice versa.
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
char[] getInternalExpression();
|
||||
|
||||
ICPPEvaluation getEvaluation();
|
||||
|
||||
/**
|
||||
* A value may be dependent on template parameters, in which case a list
|
||||
* of unknown bindings is maintained for later instantiation.
|
||||
*/
|
||||
IBinding[] getUnknownBindings();
|
||||
|
||||
/**
|
||||
* Returns a signature containing both the internal representation and
|
||||
* the unknown bindings. The representation is sufficient to distinguish values
|
||||
* for the purpose of instantiation, it may not be used to display the value.
|
||||
* Returns a signature uniquely identifying the value. Two values with identical
|
||||
* signatures are guaranteed to be equal.
|
||||
*/
|
||||
char[] getSignature();
|
||||
|
||||
/**
|
||||
* @deprecated Returns an empty character array.
|
||||
*/
|
||||
@Deprecated
|
||||
char[] getInternalExpression();
|
||||
|
||||
/**
|
||||
* @deprecated Returns an empty array.
|
||||
*/
|
||||
@Deprecated
|
||||
IBinding[] getUnknownBindings();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2009, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Mike Kucera (IBM) - Initial API and implementation
|
||||
* Mike Kucera (IBM) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
|
@ -19,8 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpression, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
|
||||
public interface ICPPASTArraySubscriptExpression
|
||||
extends IASTArraySubscriptExpression, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
@Override
|
||||
public ICPPASTArraySubscriptExpression copy();
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
@ -20,5 +19,4 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|||
* @since 5.5
|
||||
*/
|
||||
public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,12 +8,15 @@
|
|||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.parser.Keywords;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
||||
|
||||
/**
|
||||
* C++ adds a few things to function declarators.
|
||||
|
@ -28,9 +31,19 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
*/
|
||||
public static final IASTTypeId[] NO_EXCEPTION_SPECIFICATION = {};
|
||||
|
||||
/**
|
||||
* Represents a 'noexcept' specification without an expression.
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final ICPPASTLiteralExpression NOEXCEPT_DEFAULT =
|
||||
new CPPASTLiteralExpression(ICPPASTLiteralExpression.lk_true, Keywords.cTRUE);
|
||||
|
||||
public static final ASTNodeProperty EXCEPTION_TYPEID = new ASTNodeProperty(
|
||||
"ICPPASTFunctionDeclarator.EXCEPTION_TYPEID [IASTTypeId]"); //$NON-NLS-1$
|
||||
/** @since 5.2*/
|
||||
/** @since 5.5 */
|
||||
public static final ASTNodeProperty NOEXCEPT_EXPRESSION = new ASTNodeProperty(
|
||||
"ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION [ICPPASTExpression]"); //$NON-NLS-1$
|
||||
/** @since 5.2 */
|
||||
public static final ASTNodeProperty TRAILING_RETURN_TYPE = new ASTNodeProperty(
|
||||
"ICPPASTFunctionDeclarator.TRAILING_RETURN_TYPE [IASTTypeId]"); //$NON-NLS-1$
|
||||
|
||||
|
@ -40,7 +53,7 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
public boolean isConst();
|
||||
|
||||
/**
|
||||
* Set the method to be const or not.
|
||||
* Sets the method to be const or not.
|
||||
*/
|
||||
public void setConst(boolean value);
|
||||
|
||||
|
@ -50,7 +63,7 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
public boolean isVolatile();
|
||||
|
||||
/**
|
||||
* Set the method to be volatile or not.
|
||||
* Sets the method to be volatile or not.
|
||||
*/
|
||||
public void setVolatile(boolean value);
|
||||
|
||||
|
@ -72,7 +85,7 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
public boolean isPureVirtual();
|
||||
|
||||
/**
|
||||
* Set this method to be pure virtual.
|
||||
* Sets this method to be pure virtual.
|
||||
*/
|
||||
public void setPureVirtual(boolean isPureVirtual);
|
||||
|
||||
|
@ -101,6 +114,20 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
*/
|
||||
public void setEmptyExceptionSpecification();
|
||||
|
||||
/**
|
||||
* Returns the noexcept expression, {@link #NOEXCEPT_DEFAULT} if the noexcept specification
|
||||
* does not contain an expression, or {@code null} the noexcept specification is not present.
|
||||
* See C++11 5.4.1.
|
||||
* @since 5.5
|
||||
*/
|
||||
public ICPPASTExpression getNoexceptExpression();
|
||||
|
||||
/**
|
||||
* Sets the noexcept expression.
|
||||
* @since 5.5
|
||||
*/
|
||||
public void setNoexceptExpression(ICPPASTExpression expression);
|
||||
|
||||
/**
|
||||
* Returns the trailing return type as in <code> auto f() -> int </code>, or <code>null</code>.
|
||||
* @since 5.2
|
||||
|
@ -114,8 +141,8 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
|||
public void setTrailingReturnType(IASTTypeId typeId);
|
||||
|
||||
/**
|
||||
* Get function scope this node represents. Returns <code>null</code>, if this declarator does not
|
||||
* declare a function-prototype or function-definition.
|
||||
* Get function scope this node represents. Returns <code>null</code>, if this declarator
|
||||
* does not declare a function-prototype or function-definition.
|
||||
*/
|
||||
@Override
|
||||
public ICPPFunctionScope getFunctionScope();
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTFunctionDefinition extends IASTFunctionDefinition {
|
||||
|
||||
/**
|
||||
* <code>MEMBER_INITIALIZER</code> is the role of a member initializer in the function definition.
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTInitializerList extends IASTInitializerList, ICPPASTInitializerClause, ICPPASTPackExpandable {
|
||||
|
||||
@Override
|
||||
ICPPASTInitializerList copy();
|
||||
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for class scopes.
|
||||
*
|
||||
|
@ -20,17 +19,15 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
|||
*/
|
||||
public interface ICPPClassScope extends ICPPScope {
|
||||
/**
|
||||
* Get the binding for the class this scope is associated with
|
||||
*
|
||||
* Returns the binding for the class this scope is associated with.
|
||||
*/
|
||||
ICPPClassType getClassType();
|
||||
|
||||
/**
|
||||
* Returns an array of methods that were implicitly added to this class
|
||||
* scope. These methods may or may not have been explicitly declared in the
|
||||
* code. The methods that will be implicitly declared are: the default
|
||||
* scope. These methods may or may not have been explicitly declared in
|
||||
* the code. The methods that will be implicitly declared are: the default
|
||||
* constructor, copy constructor, copy assignment operator, and destructor
|
||||
*
|
||||
*/
|
||||
public ICPPMethod[] getImplicitMethods();
|
||||
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
* 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:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
|
||||
/**
|
||||
* Specializations of all sorts of class types.
|
||||
|
@ -21,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPClassSpecialization extends ICPPSpecialization, ICPPClassType {
|
||||
|
||||
@Override
|
||||
ICPPClassType getSpecializedBinding();
|
||||
|
||||
|
@ -37,4 +38,67 @@ public interface ICPPClassSpecialization extends ICPPSpecialization, ICPPClassTy
|
|||
* @since 5.5
|
||||
*/
|
||||
IBinding specializeMember(IBinding binding, IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getBases()} but a accepts a starting point for template
|
||||
* instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPBase[] getBases(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getConstructors()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPConstructor[] getConstructors(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getDeclaredFields()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPField[] getDeclaredFields(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getMethods()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPMethod[] getMethods(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getAllDeclaredMethods()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPMethod[] getAllDeclaredMethods(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getDeclaredMethods()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPMethod[] getDeclaredMethods(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
IBinding[] getFriends(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
IField[] getFields(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getNestedClasses()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
ICPPClassType[] getNestedClasses(IASTNode point);
|
||||
}
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
|
||||
/**
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
|
|
|
@ -25,10 +25,8 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
public static final int k_class = ICPPASTCompositeTypeSpecifier.k_class;
|
||||
|
||||
/**
|
||||
* Returns a list of base class relationships. The list is empty if there
|
||||
* Returns an array of base class relationships. The returned array is empty if there
|
||||
* are none.
|
||||
*
|
||||
* @return List of ICPPBase
|
||||
*/
|
||||
public ICPPBase[] getBases();
|
||||
|
||||
|
@ -88,18 +86,17 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
* Returns an array of ICPPConstructor objects representing the constructors
|
||||
* for this class. This list includes both declared and implicit
|
||||
* constructors.
|
||||
*
|
||||
*/
|
||||
public ICPPConstructor[] getConstructors();
|
||||
|
||||
/**
|
||||
* return an array of bindings for those classes/functions declared as
|
||||
* Returns an array of bindings for those classes/functions declared as
|
||||
* friends of this class.
|
||||
*/
|
||||
public IBinding[] getFriends();
|
||||
|
||||
/**
|
||||
* return an array of nested classes/structures
|
||||
* Returns an array of nested classes/structures
|
||||
*/
|
||||
public ICPPClassType[] getNestedClasses();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
||||
/**
|
||||
* Specialization of a method.
|
||||
* @since 5.5
|
||||
*
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPMethodSpecialization extends ICPPSpecialization, ICPPMethod {
|
||||
/**
|
||||
* Similar to {@link ICPPFunction#getExceptionSpecification()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
*/
|
||||
IType[] getExceptionSpecification(IASTNode point);
|
||||
}
|
|
@ -23,7 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IValue;
|
|||
*/
|
||||
public interface ICPPTemplateArgument {
|
||||
ICPPTemplateArgument[] EMPTY_ARGUMENTS = {};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this is an integral value, suitable for a template non-type parameter.
|
||||
*/
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.parser.cpp;
|
||||
|
||||
|
@ -27,16 +27,16 @@ import org.eclipse.cdt.core.parser.Keywords;
|
|||
* Configures the preprocessor for c++-sources as accepted by g++.
|
||||
*/
|
||||
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
|
||||
|
||||
private static final int VERSION_4_3 = version(4,3);
|
||||
private static final int VERSION_4_3 = version(4, 3);
|
||||
private static final int VERSION_4_6 = version(4, 6);
|
||||
private static GPPScannerExtensionConfiguration CONFIG= new GPPScannerExtensionConfiguration();
|
||||
private static GPPScannerExtensionConfiguration CONFIG_4_3= new GPPScannerExtensionConfiguration(VERSION_4_3);
|
||||
private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6);
|
||||
|
||||
private static int version(int major, int minor) {
|
||||
return (major << 16) + minor;
|
||||
}
|
||||
|
||||
|
||||
public static GPPScannerExtensionConfiguration getInstance() {
|
||||
return CONFIG;
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
|||
int major= Integer.valueOf(definedSymbols.get("__GNUC__")); //$NON-NLS-1$
|
||||
int minor= Integer.valueOf(definedSymbols.get("__GNUC_MINOR__")); //$NON-NLS-1$
|
||||
int version= version(major, minor);
|
||||
if (version >= VERSION_4_6) {
|
||||
return CONFIG_4_6;
|
||||
}
|
||||
if (version >= VERSION_4_3) {
|
||||
return CONFIG_4_3;
|
||||
}
|
||||
|
@ -94,6 +97,11 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
|||
addKeyword(GCCKeywords.cp__is_polymorphic, IGCCToken.tTT_is_polymorphic);
|
||||
addKeyword(GCCKeywords.cp__is_union, IGCCToken.tTT_is_union);
|
||||
}
|
||||
if (version >= VERSION_4_6) {
|
||||
addKeyword(GCCKeywords.cp__is_literal_type, IGCCToken.tTT_is_literal_type);
|
||||
addKeyword(GCCKeywords.cp__is_standard_layout, IGCCToken.tTT_is_standard_layout);
|
||||
addKeyword(GCCKeywords.cp__is_trivial, IGCCToken.tTT_is_trivial);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
|||
* @since 5.4
|
||||
*/
|
||||
public class TypeHelper {
|
||||
|
||||
// Do not instantiate - all methods are static.
|
||||
private TypeHelper() {
|
||||
}
|
||||
|
@ -49,8 +48,8 @@ public class TypeHelper {
|
|||
if (type instanceof ICompositeType) {
|
||||
if (type instanceof ICPPClassType) {
|
||||
ICPPClassType classType = ((ICPPClassType) type);
|
||||
if (!ClassTypeHelper.hasTrivialCopyCtor(classType) ||
|
||||
!ClassTypeHelper.hasTrivialDestructor(classType)) {
|
||||
if (!ClassTypeHelper.hasTrivialCopyCtor(classType, ast) ||
|
||||
!ClassTypeHelper.hasTrivialDestructor(classType, ast)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public class GCCKeywords {
|
|||
public static final String __ATTRIBUTE__ = "__attribute__";
|
||||
public static final String __DECLSPEC = "__declspec";
|
||||
|
||||
public static final char []
|
||||
public static final char[]
|
||||
cpTYPEOF = TYPEOF.toCharArray(),
|
||||
cp__ALIGNOF__ = __ALIGNOF__.toCharArray(),
|
||||
cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray(),
|
||||
|
@ -48,7 +49,7 @@ public class GCCKeywords {
|
|||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
public static final char []
|
||||
public static final char[]
|
||||
cp__has_nothrow_assign= "__has_nothrow_assign".toCharArray(),
|
||||
cp__has_nothrow_copy= "__has_nothrow_copy".toCharArray(),
|
||||
cp__has_nothrow_constructor= "__has_nothrow_constructor".toCharArray(),
|
||||
|
@ -65,4 +66,12 @@ public class GCCKeywords {
|
|||
cp__is_pod= "__is_pod".toCharArray(),
|
||||
cp__is_polymorphic= "__is_polymorphic".toCharArray(),
|
||||
cp__is_union= "__is_union".toCharArray();
|
||||
|
||||
/**
|
||||
* @since 5.5
|
||||
*/
|
||||
public static final char[]
|
||||
cp__is_literal_type= "__is_literal_type".toCharArray(),
|
||||
cp__is_standard_layout= "__is_standard_layout".toCharArray(),
|
||||
cp__is_trivial= "__is_trivial".toCharArray();
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* John Camelon, IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* Extension to {@link IScannerInfo}, allows for providing additional preprocessor options.
|
||||
*/
|
||||
public interface IExtendedScannerInfo extends IScannerInfo {
|
||||
|
||||
|
@ -31,6 +31,10 @@ public interface IExtendedScannerInfo extends IScannerInfo {
|
|||
/**
|
||||
* Return an array of paths that is searched after the current directory, when an include directive
|
||||
* with double-quotes is processed.
|
||||
* <p>
|
||||
* In order to suppress the use of the directory of the current file (side effect of gcc option
|
||||
* -I-) you can pass '-' as one of the include paths. Other than that, the '-' will not have an
|
||||
* effect, in particular it will not split the include path as the -I- option would do.
|
||||
*/
|
||||
public String [] getLocalIncludePath();
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
/**
|
||||
|
@ -41,4 +41,7 @@ public interface IGCCToken extends IToken {
|
|||
/** @since 5.3 */ int tTT_is_pod= FIRST_RESERVED_IGCCToken + 19;
|
||||
/** @since 5.3 */ int tTT_is_polymorphic= FIRST_RESERVED_IGCCToken + 20;
|
||||
/** @since 5.3 */ int tTT_is_union= FIRST_RESERVED_IGCCToken + 21;
|
||||
/** @since 5.5 */ int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22;
|
||||
/** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
|
||||
/** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
|
@ -19,11 +19,10 @@ import java.util.Map;
|
|||
*/
|
||||
public interface IScannerInfo {
|
||||
/**
|
||||
* Returns a <code>Map</code> containing all the defined preprocessor
|
||||
* symbols and their values.
|
||||
* Returns a {@link Map} containing all the defined preprocessor symbols and their values.
|
||||
* Symbols defined without values have an empty string for a value. For
|
||||
* example,-Dsymbol=value would have a map entry (symbol,value). A symbol
|
||||
* defined as -Dsymbol= would have a map entry of (symbol,"").
|
||||
* example, -Dsymbol=value would have a map entry (symbol, value). A symbol
|
||||
* defined as -Dsymbol= would have a map entry of (symbol, "").
|
||||
*/
|
||||
public Map<String, String> getDefinedSymbols();
|
||||
|
||||
|
@ -31,14 +30,20 @@ public interface IScannerInfo {
|
|||
* Returns an array of paths that are searched when processing an include directive.
|
||||
* see {@link IExtendedScannerInfo#getLocalIncludePath()}
|
||||
* <p>
|
||||
* In order to suppress the use of the directory of the current file (side effect of gcc option
|
||||
* -I-) you can pass '-' as one of the include paths. Other than that, the '-' will not have an
|
||||
* effect, in particular it will not split the include path as the -I- option would do. To achieve
|
||||
* that, use {@link IExtendedScannerInfo#getLocalIncludePath()}.
|
||||
* <p>
|
||||
* In order to handle framework includes used on Apple Computers you can make use of
|
||||
* the two variables: '__framework__' and '__header__'.
|
||||
* <br> E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__,
|
||||
* /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__
|
||||
* would handle the framework search for '/System/Library/Frameworks'
|
||||
* <br> The variables are handled only, if a search path element makes use of both of the variables.
|
||||
* The __framework__ variable will receive the first segment of the include, the __header__ variable
|
||||
* the rest. Such a search path element is not used for directives with a single segment (e.g. 'header.h')
|
||||
* <br> The variables are handled only, if a search path element makes use of both of
|
||||
* the variables. The __framework__ variable will receive the first segment of the include,
|
||||
* the __header__ variable the rest. Such a search path element is not used for directives
|
||||
* with a single segment (e.g. 'header.h')
|
||||
*/
|
||||
public String[] getIncludePaths();
|
||||
}
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
|
|
|
@ -329,7 +329,7 @@ public class CharArrayUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Find an array of chars in an array of arrays of chars.
|
||||
* Finds an array of chars in an array of arrays of chars.
|
||||
* @return offset where the array was found or <code>-1</code>
|
||||
*/
|
||||
public static int indexOf(final char[] searchFor, final char[][] searchIn) {
|
||||
|
@ -340,4 +340,15 @@ public class CharArrayUtils {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link StringBuilder} to a character array.
|
||||
* @since 5.5
|
||||
*/
|
||||
public static char[] extractChars(StringBuilder buf) {
|
||||
final int len = buf.length();
|
||||
char[] result= new char[len];
|
||||
buf.getChars(0, len, result, 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.parser.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Automatically growing integer array.
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
public class IntArray {
|
||||
private static final int INITIAL_CAPACITY = 10;
|
||||
private static final int[] EMPTY_ARRAY = {};
|
||||
|
||||
private int[] buffer = EMPTY_ARRAY;
|
||||
private int size;
|
||||
|
||||
public IntArray() {
|
||||
}
|
||||
|
||||
public IntArray(int initialCapacity) {
|
||||
this.buffer = new int[initialCapacity];
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return size == 0;
|
||||
}
|
||||
|
||||
public void add(int value) {
|
||||
grow(size + 1);
|
||||
buffer[size++] = value;
|
||||
}
|
||||
|
||||
public void add(int index, int value) {
|
||||
checkBounds(index);
|
||||
grow(size + 1);
|
||||
System.arraycopy(buffer, index, buffer, index + 1, size - index);
|
||||
buffer[index] = value;
|
||||
size++;
|
||||
}
|
||||
|
||||
public void addAll(IntArray other) {
|
||||
grow(size + other.size());
|
||||
System.arraycopy(other.buffer, 0, buffer, size, other.size);
|
||||
size += other.size;
|
||||
return;
|
||||
}
|
||||
|
||||
public void addAll(int[] array) {
|
||||
grow(size + array.length);
|
||||
System.arraycopy(array, 0, buffer, size, array.length);
|
||||
size += array.length;
|
||||
return;
|
||||
}
|
||||
|
||||
public int remove(int index) {
|
||||
checkBounds(index);
|
||||
int old = buffer[index];
|
||||
int n = size - index - 1;
|
||||
if (n > 0) {
|
||||
System.arraycopy(buffer, index + 1, buffer, index, n);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
public void remove(int from, int to) {
|
||||
checkBounds(from);
|
||||
checkBounds(to);
|
||||
System.arraycopy(buffer, to, buffer, from, size - to);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
size = 0;
|
||||
}
|
||||
|
||||
public int get(int index) {
|
||||
checkRange(index);
|
||||
return buffer[index];
|
||||
}
|
||||
|
||||
public int set(int index, int value) {
|
||||
checkBounds(index);
|
||||
int old = buffer[index];
|
||||
buffer[index] = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
public int[] toArray() {
|
||||
return size == 0 ? EMPTY_ARRAY : Arrays.copyOf(buffer, size);
|
||||
}
|
||||
|
||||
public void trimToSize() {
|
||||
if (size == 0) {
|
||||
buffer = EMPTY_ARRAY;
|
||||
} else if (size < buffer.length) {
|
||||
buffer = Arrays.copyOf(buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureCapacity(int minCapacity) {
|
||||
if (minCapacity > 0) {
|
||||
grow(minCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
private void grow(int minCapacity) {
|
||||
if (minCapacity < 0) // Overflow
|
||||
throw new OutOfMemoryError();
|
||||
|
||||
int capacity = buffer.length;
|
||||
if (minCapacity > capacity) {
|
||||
int newCapacity = capacity == 0 ? INITIAL_CAPACITY : capacity + (capacity >> 1);
|
||||
// newCapacity may be negative due to overflow.
|
||||
if (newCapacity < minCapacity)
|
||||
newCapacity = minCapacity;
|
||||
// newCapacity is guaranteed to be non negative.
|
||||
try {
|
||||
buffer = Arrays.copyOf(buffer, newCapacity);
|
||||
} catch (OutOfMemoryError e) {
|
||||
// Try again it case we were too aggressive in reserving capacity.
|
||||
buffer = Arrays.copyOf(buffer, minCapacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBounds(int index) {
|
||||
if (index < 0) {
|
||||
throw new IndexOutOfBoundsException("Negative index: " + index); //$NON-NLS-1$
|
||||
}
|
||||
checkRange(index);
|
||||
}
|
||||
|
||||
private void checkRange(int index) {
|
||||
if (index >= size) {
|
||||
throw new IndexOutOfBoundsException("Index: " + index + ", size: " + size); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ public class Linkage implements ILinkage {
|
|||
}
|
||||
|
||||
public static String getLinkageName(int linkageID) throws CoreException {
|
||||
switch(linkageID) {
|
||||
switch (linkageID) {
|
||||
case NO_LINKAGE_ID: return NO_LINKAGE_NAME;
|
||||
case C_LINKAGE_ID: return C_LINKAGE_NAME;
|
||||
case CPP_LINKAGE_ID: return CPP_LINKAGE_NAME;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -61,6 +62,7 @@ public interface ITypeMarshalBuffer {
|
|||
IValue unmarshalValue() throws CoreException;
|
||||
IBinding unmarshalBinding() throws CoreException;
|
||||
ISerializableEvaluation unmarshalEvaluation() throws CoreException;
|
||||
ICPPTemplateArgument unmarshalTemplateArgument() throws CoreException;
|
||||
int getByte() throws CoreException;
|
||||
int getShort() throws CoreException;
|
||||
int getInt() throws CoreException;
|
||||
|
@ -71,6 +73,7 @@ public interface ITypeMarshalBuffer {
|
|||
void marshalValue(IValue value) throws CoreException;
|
||||
void marshalBinding(IBinding binding) throws CoreException;
|
||||
void marshalEvaluation(ISerializableEvaluation eval, boolean includeValue) throws CoreException;
|
||||
void marshalTemplateArgument(ICPPTemplateArgument arg) throws CoreException;
|
||||
void putByte(byte data);
|
||||
void putShort(short data);
|
||||
void putInt(int data);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -42,13 +42,12 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class ProblemBinding extends PlatformObject implements IProblemBinding, IASTInternalScope {
|
||||
public static ProblemBinding NOT_INITIALIZED= new ProblemBinding(null, 0);
|
||||
|
||||
|
||||
protected final int id;
|
||||
protected char[] arg;
|
||||
protected IASTNode node;
|
||||
private final String message = null;
|
||||
private IBinding[] candidateBindings;
|
||||
|
||||
|
||||
public ProblemBinding(IASTName name, int id) {
|
||||
this(name, id, null, null);
|
||||
}
|
||||
|
@ -57,6 +56,37 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
this(name, id, null, candidateBindings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name that could not be resolved, may be {@code null}
|
||||
* @param point the point in code where the problem was encountered
|
||||
* @param id the ID of the problem, see {@link IProblemBinding}
|
||||
*/
|
||||
public ProblemBinding(IASTName name, IASTNode point, int id) {
|
||||
this(name, point, id, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name that could not be resolved, may be {@code null}
|
||||
* @param point the point in code where the problem was encountered
|
||||
* @param id the ID of the problem, see {@link IProblemBinding}
|
||||
* @param candidateBindings candidate bindings that were rejected due to ambiguity or for other
|
||||
* reasons, may be {@code null}
|
||||
*/
|
||||
public ProblemBinding(IASTName name, IASTNode point, int id, IBinding[] candidateBindings) {
|
||||
this.id = id;
|
||||
if (name != null && name.getTranslationUnit() != null) {
|
||||
this.node = name;
|
||||
} else {
|
||||
this.node = point;
|
||||
if (name != null) {
|
||||
this.arg = name.getSimpleID();
|
||||
} else if (candidateBindings != null && candidateBindings.length != 0) {
|
||||
this.arg = candidateBindings[0].getNameCharArray();
|
||||
}
|
||||
}
|
||||
this.candidateBindings = candidateBindings;
|
||||
}
|
||||
|
||||
public ProblemBinding(IASTNode node, int id, char[] arg) {
|
||||
this(node, id, arg, null);
|
||||
}
|
||||
|
@ -67,8 +97,8 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
this.node = node;
|
||||
this.candidateBindings = candidateBindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public EScopeKind getKind() {
|
||||
return EScopeKind.eLocal;
|
||||
}
|
||||
|
@ -82,34 +112,30 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
public IBinding[] getCandidateBindings() {
|
||||
return candidateBindings != null ? candidateBindings : IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
public void setCandidateBindings(IBinding[] foundBindings) {
|
||||
candidateBindings= foundBindings;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IProblemBinding#getID()
|
||||
*/
|
||||
@Override
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IProblemBinding#getMessage()
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (message != null)
|
||||
return message;
|
||||
|
||||
String msg = ParserMessages.getProblemPattern(this);
|
||||
if (msg == null)
|
||||
return ""; //$NON-NLS-1$
|
||||
|
||||
if (arg == null && node instanceof IASTName)
|
||||
arg= ((IASTName) node).toCharArray();
|
||||
|
||||
|
||||
if (arg == null) {
|
||||
if (node instanceof IASTName) {
|
||||
arg= ((IASTName) node).toCharArray();
|
||||
} else if (candidateBindings != null && candidateBindings.length != 0) {
|
||||
arg = candidateBindings[0].getNameCharArray();
|
||||
}
|
||||
}
|
||||
|
||||
if (arg != null) {
|
||||
msg = MessageFormat.format(msg, new Object[] { new String(arg) });
|
||||
}
|
||||
|
@ -149,7 +175,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
return getASTNode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
// Don't clone problems
|
||||
|
@ -262,7 +288,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
public ILinkage getLinkage() {
|
||||
return Linkage.NO_LINKAGE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getMessage();
|
||||
|
@ -291,7 +317,8 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void removeNestedFromCache(IASTNode container) {}
|
||||
public void removeNestedFromCache(IASTNode container) {
|
||||
}
|
||||
|
||||
// Dummy methods for derived classes
|
||||
public IType getType() {
|
||||
|
|
|
@ -22,6 +22,7 @@ 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.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
|
@ -31,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||
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.semantics.SemanticUtil;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +50,8 @@ public class SizeofCalculator {
|
|||
}
|
||||
}
|
||||
|
||||
private static final SizeofCalculator defaultInstance = new SizeofCalculator();
|
||||
|
||||
private static final SizeAndAlignment SIZE_1 = new SizeAndAlignment(1, 1);
|
||||
|
||||
public final SizeAndAlignment size_2;
|
||||
|
@ -67,7 +71,19 @@ public class SizeofCalculator {
|
|||
public final SizeAndAlignment sizeof_long_double;
|
||||
public final SizeAndAlignment sizeof_complex_long_double;
|
||||
|
||||
private final IASTTranslationUnit ast;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* C/C++ implementations.
|
||||
*/
|
||||
public static SizeofCalculator getDefault() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public SizeofCalculator(IASTTranslationUnit ast) {
|
||||
this.ast = ast;
|
||||
int maxAlignment = 32;
|
||||
Map<String, String> sizeofMacros = new HashMap<String, String>();
|
||||
for (IASTPreprocessorMacroDefinition macro : ast.getBuiltinMacroDefinitions()) {
|
||||
|
@ -102,6 +118,26 @@ public class SizeofCalculator {
|
|||
sizeof_complex_long_double = getSizeOfPair(sizeof_long_double);
|
||||
}
|
||||
|
||||
private SizeofCalculator() {
|
||||
size_2 = new SizeAndAlignment(2, 2);
|
||||
size_4 = new SizeAndAlignment(4, 4);
|
||||
size_8 = new SizeAndAlignment(8, 8);
|
||||
sizeof_pointer = null;
|
||||
sizeof_int = null;
|
||||
sizeof_long = null;
|
||||
sizeof_long_long = null;
|
||||
sizeof_short = null;
|
||||
sizeof_bool = null;
|
||||
sizeof_wchar_t = null;
|
||||
sizeof_float = null;
|
||||
sizeof_complex_float = null;
|
||||
sizeof_double = null;
|
||||
sizeof_complex_double = null;
|
||||
sizeof_long_double = null;
|
||||
sizeof_complex_long_double = null;
|
||||
ast = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates size and alignment for the given type.
|
||||
* @param type the type to get size and alignment for.
|
||||
|
@ -109,7 +145,9 @@ public class SizeofCalculator {
|
|||
*/
|
||||
public SizeAndAlignment sizeAndAlignment(IType type) {
|
||||
type = SemanticUtil.getNestedType(type, SemanticUtil.CVTYPE | SemanticUtil.TDEF);
|
||||
|
||||
if (type instanceof IFunctionType) {
|
||||
return sizeAndAlignment(((IFunctionType) type).getReturnType());
|
||||
}
|
||||
if (type instanceof IBasicType) {
|
||||
return sizeAndAlignment((IBasicType) type);
|
||||
}
|
||||
|
@ -213,7 +251,7 @@ public class SizeofCalculator {
|
|||
IField[] fields;
|
||||
if (type instanceof ICPPClassType) {
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
for (ICPPBase base : classType.getBases()) {
|
||||
for (ICPPBase base : ClassTypeHelper.getBases(classType, ast)) {
|
||||
if (base.isVirtual())
|
||||
return null; // Don't know how to calculate size when there are virtual bases.
|
||||
IBinding baseClass = base.getBaseClass();
|
||||
|
@ -225,14 +263,14 @@ public class SizeofCalculator {
|
|||
size += info.alignment - (size - 1) % info.alignment - 1 + info.size;
|
||||
if (maxAlignment < info.alignment)
|
||||
maxAlignment = info.alignment;
|
||||
for (ICPPMethod method : classType.getDeclaredMethods()) {
|
||||
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, ast)) {
|
||||
if (method.isVirtual()) {
|
||||
// Don't know how to calculate size when there are virtual functions.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
fields = classType.getDeclaredFields();
|
||||
fields = ClassTypeHelper.getDeclaredFields(classType, ast);
|
||||
} else {
|
||||
fields = type.getFields();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Devin Steffler (IBM Corporation) - initial API and implementation
|
||||
* Devin Steffler (IBM Corporation) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -157,7 +157,6 @@ public class CArrayType implements ICArrayType, ITypeContainer, ISerializableTyp
|
|||
return ASTTypeUtil.getType(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
|
||||
int firstByte= ITypeMarshalBuffer.ARRAY_TYPE;
|
||||
|
@ -174,14 +173,13 @@ public class CArrayType implements ICArrayType, ITypeContainer, ISerializableTyp
|
|||
firstByte |= ITypeMarshalBuffer.FLAG1;
|
||||
}
|
||||
|
||||
|
||||
val= getSize();
|
||||
if (val != null) {
|
||||
firstByte |= ITypeMarshalBuffer.FLAG2;
|
||||
Long num= val.numericalValue();
|
||||
if (num != null) {
|
||||
long l= num;
|
||||
if (l>=0 && l <= Short.MAX_VALUE) {
|
||||
if (l >= 0 && l <= Short.MAX_VALUE) {
|
||||
nval= (short) l;
|
||||
firstByte |= ITypeMarshalBuffer.FLAG3;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue