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

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

This commit is contained in:
Andrew Gvozdev 2012-07-09 17:46:29 -04:00
commit e82bdd7f70
404 changed files with 9568 additions and 6100 deletions

View file

@ -2,7 +2,7 @@
<feature <feature
id="org.eclipse.cdt.autotools" id="org.eclipse.cdt.autotools"
label="%featureName" label="%featureName"
version="3.0.1.qualifier" version="3.2.0.qualifier"
provider-name="%provider"> provider-name="%provider">
<description> <description>

View file

@ -7,12 +7,12 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<groupId>org.eclipse.cdt.features</groupId> <groupId>org.eclipse.cdt.features</groupId>
<version>3.0.1-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.autotools</artifactId> <artifactId>org.eclipse.cdt.autotools</artifactId>
<packaging>eclipse-feature</packaging> <packaging>eclipse-feature</packaging>
</project> </project>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -2,7 +2,7 @@
<feature <feature
id="org.eclipse.cdt.autotools.source" id="org.eclipse.cdt.autotools.source"
label="%featureName" label="%featureName"
version="3.0.1.qualifier" version="3.2.0.qualifier"
provider-name="%provider"> provider-name="%provider">
<description> <description>

View file

@ -7,12 +7,12 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<groupId>org.eclipse.cdt.features</groupId> <groupId>org.eclipse.cdt.features</groupId>
<version>3.0.1-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.autotools.source</artifactId> <artifactId>org.eclipse.cdt.autotools.source</artifactId>
<packaging>eclipse-feature</packaging> <packaging>eclipse-feature</packaging>
</project> </project>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -2,7 +2,7 @@
<feature <feature
id="org.eclipse.cdt.gnu.build" id="org.eclipse.cdt.gnu.build"
label="%featureName" label="%featureName"
version="8.1.0.qualifier" version="8.2.0.qualifier"
provider-name="%providerName"> provider-name="%providerName">
<description> <description>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -2,7 +2,7 @@
<feature <feature
id="org.eclipse.cdt.gnu.build.source" id="org.eclipse.cdt.gnu.build.source"
label="%featureName" label="%featureName"
version="8.1.0.qualifier" version="8.2.0.qualifier"
provider-name="%providerName"> provider-name="%providerName">
<description> <description>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Tests Bundle-Name: Tests
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core.tests; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core.tests; singleton:=true
Bundle-Version: 8.1.0.qualifier Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
Bundle-Vendor: Eclipse CDT Bundle-Vendor: Eclipse CDT
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId> <artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging> <packaging>eclipse-test-plugin</packaging>
@ -46,7 +46,7 @@
</dependency> </dependency>
<dependency> <dependency>
<artifactId>org.eclipse.cdt.feature.group</artifactId> <artifactId>org.eclipse.cdt.feature.group</artifactId>
<version>8.1.0.${buildQualifier}</version> <version>8.2.0.${buildQualifier}</version>
<type>p2-installable-unit</type> <type>p2-installable-unit</type>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
Bundle-Version: 8.1.0.qualifier Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.core</artifactId> <artifactId>org.eclipse.cdt.managedbuilder.core</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -14,7 +14,6 @@ import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
/** /**
*
* this interface represent the environment variable provider - the main entry-point * this interface represent the environment variable provider - the main entry-point
* to be used for querying the build environment * to be used for querying the build environment
* *
@ -22,13 +21,11 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IEnvironmentVariableProvider{ public interface IEnvironmentVariableProvider {
/** /**
*
*
* @return the reference to the IBuildEnvironmentVariable interface representing * @return the reference to the IBuildEnvironmentVariable interface representing
* the variable of a given name * the variable of a given name
*
* @param variableName environment variable name * @param variableName environment variable name
* if environment variable names are case insensitive in the current OS, * if environment variable names are case insensitive in the current OS,
* the environment variable provider will query the getVariable method of suppliers always * the environment variable provider will query the getVariable method of suppliers always
@ -48,17 +45,27 @@ public interface IEnvironmentVariableProvider{
* 2. IManagedProject to represent the managed project * 2. IManagedProject to represent the managed project
* 3. IWorkspace to represent the workspace * 3. IWorkspace to represent the workspace
* 4. null to represent the system environment passed to eclipse * 4. null to represent the system environment passed to eclipse
*
* @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead * @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead
*/ */
@Deprecated @Deprecated
public IBuildEnvironmentVariable getVariable( public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
public IEnvironmentVariable getVariable(String variableName,
IConfiguration cfg, boolean resolveMacros);
/** /**
* Get variable for the given configuration, normally including those defined in project properties
* and workspace preferences.
* *
* See also {@code CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(String name, ICConfigurationDescription cfg, boolean resolveMacros)}
*
* @param variableName - name of the variable (not including $ sign).
* @param cfg - configuration or {@code null} for workspace preferences only.
* @param resolveMacros - if {@code true} expand macros, {@code false} otherwise.
* @return variable defined for the configuration or the workspace.
* Returns {@code null} if variable is not defined.
*/
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros);
/**
* if environment variable names are case insensitive in the current OS, * if environment variable names are case insensitive in the current OS,
* the environment variable provider will remove the duplicates of the variables if their names * the environment variable provider will remove the duplicates of the variables if their names
* differ only by case * differ only by case
@ -67,14 +74,22 @@ public interface IEnvironmentVariableProvider{
* @return the array of IBuildEnvironmentVariable that represents the environment variables * @return the array of IBuildEnvironmentVariable that represents the environment variables
*/ */
@Deprecated @Deprecated
public IBuildEnvironmentVariable[] getVariables( public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros);
Object level, boolean includeParentLevels, boolean resolveMacros);
public IEnvironmentVariable[] getVariables(
IConfiguration cfg, boolean resolveMacros);
/** /**
* Get variables for the given configuration, normally including those defined in project properties
* and workspace preferences.
* *
* See also {@code CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(ICConfigurationDescription cfg, boolean resolveMacros)}
*
* @param cfg - configuration or {@code null} for workspace preferences only.
* @param resolveMacros - if {@code true} expand macros, {@code false} otherwise.
* @return array of variables defined for the configuration or the workspace.
* Returns an empty array if no variables are defined.
*/
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros);
/**
* @return the String representing default system delimiter. That is the ":" for Unix-like * @return the String representing default system delimiter. That is the ":" for Unix-like
* systems and the ";" for Win32 systems. This method will be used by the * systems and the ";" for Win32 systems. This method will be used by the
* tool-integrator provided variable supplier e.g. in order to concatenate the list of paths into the * tool-integrator provided variable supplier e.g. in order to concatenate the list of paths into the
@ -97,7 +112,8 @@ public interface IEnvironmentVariableProvider{
/** /**
* returns the array of String that holds the build paths of the specified type * @return the array of String that holds the build paths of the specified type
*
* @param configuration represent the configuration for which the paths were changed * @param configuration represent the configuration for which the paths were changed
* @param buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx * @param buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx
* (the IEnvVarBuildPath will represent the build environment variables, see also * (the IEnvVarBuildPath will represent the build environment variables, see also
@ -107,19 +123,15 @@ public interface IEnvironmentVariableProvider{
String[] getBuildPaths(IConfiguration configuration, int buildPathType); String[] getBuildPaths(IConfiguration configuration, int buildPathType);
/** /**
*
* adds the listener that will return notifications about the include and library paths changes. * adds the listener that will return notifications about the include and library paths changes.
* The ManagedBuildManager will register the change listener and will notify all registered * The ManagedBuildManager will register the change listener and will notify all registered
* Scanned Info Change Listeners about the include paths change. * Scanned Info Change Listeners about the include paths change.
*/ */
void subscribe( void subscribe(IEnvironmentBuildPathsChangeListener listener);
IEnvironmentBuildPathsChangeListener listener);
/** /**
*
* removes the include and library paths change listener * removes the include and library paths change listener
*/ */
void unsubscribe( void unsubscribe(IEnvironmentBuildPathsChangeListener listener);
IEnvironmentBuildPathsChangeListener listener);
} }

View file

@ -35,10 +35,8 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
* build environment functionality to the MBS * build environment functionality to the MBS
* *
* @since 3.0 * @since 3.0
*
*/ */
public class EnvironmentVariableProvider implements public class EnvironmentVariableProvider implements IEnvironmentVariableProvider {
IEnvironmentVariableProvider {
// private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$NON-NLS-1$ // private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$NON-NLS-1$
// private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$ // private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$
@ -58,20 +56,17 @@ public class EnvironmentVariableProvider implements
* paths from environment variable values * paths from environment variable values
* *
* @since 3.0 * @since 3.0
*
*/ */
static public class DefaultBuildPathResolver implements IBuildPathResolver { static public class DefaultBuildPathResolver implements IBuildPathResolver {
private String fDelimiter; private String fDelimiter;
public DefaultBuildPathResolver(String delimiter){ public DefaultBuildPathResolver(String delimiter) {
fDelimiter = delimiter; fDelimiter = delimiter;
} }
@Override @Override
public String[] resolveBuildPaths(int pathType, String variableName, public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
String variableValue, IConfiguration configuration) { if (fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
if(fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
return new String[]{variableValue}; return new String[]{variableValue};
List<String> list = EnvVarOperationProcessor.convertToList(variableValue,fDelimiter); List<String> list = EnvVarOperationProcessor.convertToList(variableValue,fDelimiter);
@ -80,46 +75,39 @@ public class EnvironmentVariableProvider implements
} }
protected EnvironmentVariableProvider(IEnvironmentVariableManager mngr){ protected EnvironmentVariableProvider(IEnvironmentVariableManager mngr) {
fMngr = mngr; fMngr = mngr;
} }
public static EnvironmentVariableProvider getDefault(){ public static EnvironmentVariableProvider getDefault() {
if(fInstance == null){ if (fInstance == null) {
fInstance = new EnvironmentVariableProvider(CCorePlugin.getDefault().getBuildEnvironmentManager()); fInstance = new EnvironmentVariableProvider(CCorePlugin.getDefault().getBuildEnvironmentManager());
fInstance.fBuildPathVarCheckAllowed = true; fInstance.fBuildPathVarCheckAllowed = true;
} }
return fInstance; return fInstance;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
*/
@Override @Override
public IBuildEnvironmentVariable getVariable(String variableName, public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros) {
Object level, boolean includeParentLevels, boolean resolveMacros) { if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
if(variableName == null || "".equals(variableName)) //$NON-NLS-1$
return null; return null;
if(level instanceof IConfiguration){ if (level instanceof IConfiguration) {
return wrap(getVariable(variableName, (IConfiguration)level, resolveMacros)); return wrap(getVariable(variableName, (IConfiguration)level, resolveMacros));
} }
return null; return null;
} }
@Override @Override
public IEnvironmentVariable getVariable(String variableName, public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros) {
IConfiguration cfg, boolean resolveMacros){
return getVariable(variableName, cfg, resolveMacros, true); return getVariable(variableName, cfg, resolveMacros, true);
} }
public IEnvironmentVariable getVariable(String variableName, public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths) {
IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths){
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg); ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg);
if(des != null){ if (des != null) {
IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros); IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros);
if(checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed) if (checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
checkBuildPathVariable(cfg, variableName, variable); checkBuildPathVariable(cfg, variableName, variable);
return variable; return variable;
} }
@ -127,130 +115,109 @@ public class EnvironmentVariableProvider implements
} }
@Override @Override
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros){ public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros) {
return getVariables(cfg, resolveMacros, true); return getVariables(cfg, resolveMacros, true);
} }
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths){ public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths) {
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg); ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg);
if(des != null){ if (des != null) {
IEnvironmentVariable vars[] = fMngr.getVariables(des, resolveMacros); IEnvironmentVariable vars[] = fMngr.getVariables(des, resolveMacros);
if(checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed) if (checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
checkBuildPathVariables(cfg,vars); checkBuildPathVariables(cfg,vars);
return vars; return vars;
} }
return new IBuildEnvironmentVariable[0]; return new IBuildEnvironmentVariable[0];
} }
public static IBuildEnvironmentVariable wrap(IEnvironmentVariable var){ public static IBuildEnvironmentVariable wrap(IEnvironmentVariable var) {
if(var == null) if (var == null)
return null; return null;
if(var instanceof IBuildEnvironmentVariable) if (var instanceof IBuildEnvironmentVariable)
return (IBuildEnvironmentVariable)var; return (IBuildEnvironmentVariable)var;
return new BuildEnvVar(var); return new BuildEnvVar(var);
} }
public static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable vars[]){ public static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable vars[]) {
if(vars == null) if (vars == null)
return null; return null;
if(vars instanceof IBuildEnvironmentVariable[]) if (vars instanceof IBuildEnvironmentVariable[])
return (IBuildEnvironmentVariable[])vars; return (IBuildEnvironmentVariable[])vars;
IBuildEnvironmentVariable[] buildVars = new IBuildEnvironmentVariable[vars.length]; IBuildEnvironmentVariable[] buildVars = new IBuildEnvironmentVariable[vars.length];
for(int i = 0; i < vars.length; i++){ for(int i = 0; i < vars.length; i++) {
buildVars[i] = wrap(vars[i]); buildVars[i] = wrap(vars[i]);
} }
return buildVars; return buildVars;
} }
/* protected ICConfigurationDescription getDescription(IConfiguration cfg){ /* protected ICConfigurationDescription getDescription(IConfiguration cfg) {
IProject project = cfg.getOwner().getProject(); IProject project = cfg.getOwner().getProject();
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false); ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
if(des != null){ if (des != null) {
return des.getConfigurationById(cfg.getId()); return des.getConfigurationById(cfg.getId());
} }
return null; return null;
} }
*/ */
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
*/
@Override @Override
public IBuildEnvironmentVariable[] getVariables(Object level, public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros) {
boolean includeParentLevels, boolean resolveMacros) { if (level instanceof IConfiguration) {
if(level instanceof IConfiguration){
return wrap(getVariables((IConfiguration)level, resolveMacros)); return wrap(getVariables((IConfiguration)level, resolveMacros));
} }
return new IBuildEnvironmentVariable[0]; return new IBuildEnvironmentVariable[0];
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
*/
@Override @Override
public String getDefaultDelimiter() { public String getDefaultDelimiter() {
return fMngr.getDefaultDelimiter(); return fMngr.getDefaultDelimiter();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
*/
@Override @Override
public boolean isVariableCaseSensitive() { public boolean isVariableCaseSensitive() {
return fMngr.isVariableCaseSensitive(); return fMngr.isVariableCaseSensitive();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
*/
@Override @Override
public IEnvironmentVariableSupplier[] getSuppliers(Object level) { public IEnvironmentVariableSupplier[] getSuppliers(Object level) {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getBuildPaths()
*/
@Override @Override
public String[] getBuildPaths(IConfiguration configuration, public String[] getBuildPaths(IConfiguration configuration, int buildPathType) {
int buildPathType) {
ITool tools[] = configuration.getFilteredTools(); ITool tools[] = configuration.getFilteredTools();
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths(); IEnvVarBuildPath pathDescriptors[] = tool.getEnvVarBuildPaths();
if(pathDescriptors == null || pathDescriptors.length == 0) if (pathDescriptors == null || pathDescriptors.length == 0)
continue; continue;
for(int j = 0; j < pathDescriptors.length; j++){ for (IEnvVarBuildPath curPathDes : pathDescriptors) {
IEnvVarBuildPath curPathDes = pathDescriptors[j]; if (curPathDes.getType() != buildPathType)
if(curPathDes.getType() != buildPathType)
continue; continue;
String vars[] = curPathDes.getVariableNames(); String vars[] = curPathDes.getVariableNames();
if(vars == null || vars.length == 0) if (vars == null || vars.length == 0)
continue; continue;
IBuildPathResolver pathResolver = curPathDes.getBuildPathResolver(); IBuildPathResolver pathResolver = curPathDes.getBuildPathResolver();
if(pathResolver == null){ if (pathResolver == null) {
String delimiter = curPathDes.getPathDelimiter(); String delimiter = curPathDes.getPathDelimiter();
if(delimiter == null) if (delimiter == null)
delimiter = getDefaultDelimiter(); delimiter = getDefaultDelimiter();
pathResolver = new DefaultBuildPathResolver(delimiter); pathResolver = new DefaultBuildPathResolver(delimiter);
} }
for(int k = 0; k < vars.length; k++){ for (String varName : vars) {
String varName = vars[k];
IEnvironmentVariable var = getVariable(varName,configuration,true, false); IEnvironmentVariable var = getVariable(varName,configuration,true, false);
if(var == null) if (var == null)
continue; continue;
String varValue = var.getValue(); String varValue = var.getValue();
String paths[] = pathResolver.resolveBuildPaths(buildPathType,varName,varValue,configuration); String paths[] = pathResolver.resolveBuildPaths(buildPathType,varName,varValue,configuration);
if(paths != null && paths.length != 0) if (paths != null && paths.length != 0)
list.addAll(Arrays.asList(paths)); list.addAll(Arrays.asList(paths));
} }
} }
@ -259,45 +226,39 @@ public class EnvironmentVariableProvider implements
return list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
/* /**
* returns a list of registered listeners * @return a list of registered listeners
*/ */
private List<IEnvironmentBuildPathsChangeListener> getListeners(){ private List<IEnvironmentBuildPathsChangeListener> getListeners() {
if(fListeners == null) if (fListeners == null)
fListeners = new ArrayList<IEnvironmentBuildPathsChangeListener>(); fListeners = new ArrayList<IEnvironmentBuildPathsChangeListener>();
return fListeners; return fListeners;
} }
/* /**
* notifies registered listeners * notifies registered listeners
*/ */
private void notifyListeners(IConfiguration configuration, int buildPathType){ private void notifyListeners(IConfiguration configuration, int buildPathType) {
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners(); List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
for (IEnvironmentBuildPathsChangeListener listener : listeners) { for (IEnvironmentBuildPathsChangeListener listener : listeners) {
listener.buildPathsChanged(configuration,buildPathType); listener.buildPathsChanged(configuration,buildPathType);
} }
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#subscribe()
*/
@Override @Override
public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) { public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) {
if(listener == null) if (listener == null)
return; return;
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners(); List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
if(!listeners.contains(listener)) if (!listeners.contains(listener))
listeners.add(listener); listeners.add(listener);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#unsubscribe()
*/
@Override @Override
public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) { public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) {
if(listener == null) if (listener == null)
return; return;
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners(); List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
@ -305,39 +266,39 @@ public class EnvironmentVariableProvider implements
listeners.remove(listener); listeners.remove(listener);
} }
/* /**
* performs a check of the build path variables for the given configuration * performs a check of the build path variables for the given configuration
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
*/ */
public void checkBuildPathVariables(IConfiguration configuration){ public void checkBuildPathVariables(IConfiguration configuration) {
checkBuildPathVariables(configuration, getVariables(configuration ,true, false)); checkBuildPathVariables(configuration, getVariables(configuration ,true, false));
} }
/* /**
* performs a check of the build path variables of the specified type * performs a check of the build path variables of the specified type
* for the given configuration * for the given configuration
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
*/ */
public void checkBuildPathVariables(IConfiguration configuration,int buildPathType){ public void checkBuildPathVariables(IConfiguration configuration,int buildPathType) {
EnvVarCollector cr = new EnvVarCollector(); EnvVarCollector cr = new EnvVarCollector();
cr.add(getVariables(configuration, true, false)); cr.add(getVariables(configuration, true, false));
checkBuildPathVariables(configuration,buildPathType,cr); checkBuildPathVariables(configuration,buildPathType,cr);
} }
/* /**
* performs a check of the build path variables * performs a check of the build path variables
* for the given configuration given the set of the variables * for the given configuration given the set of the variables
* defined for this configuration * defined for this configuration
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
*/ */
protected void checkBuildPathVariables(IConfiguration configuration, IEnvironmentVariable vars[]){ protected void checkBuildPathVariables(IConfiguration configuration, IEnvironmentVariable vars[]) {
EnvVarCollector cr = new EnvVarCollector(); EnvVarCollector cr = new EnvVarCollector();
cr.add(vars); cr.add(vars);
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_INCLUDE,cr); checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_INCLUDE,cr);
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr); checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr);
} }
/* /**
* performs a check of whether the given variable is the build path variable * performs a check of whether the given variable is the build path variable
* and if true checks whether it is changed. * and if true checks whether it is changed.
* In the case of it is changed all other build path variables are checked * In the case of it is changed all other build path variables are checked
@ -345,12 +306,12 @@ public class EnvironmentVariableProvider implements
* If it is not changed, other build path variables are not checked * If it is not changed, other build path variables are not checked
* In the case of the given variable is not the build path one, this method does nothing * In the case of the given variable is not the build path one, this method does nothing
*/ */
protected void checkBuildPathVariable(IConfiguration configuration, String varName, IEnvironmentVariable var){ protected void checkBuildPathVariable(IConfiguration configuration, String varName, IEnvironmentVariable var) {
checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_INCLUDE, varName, var); checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_INCLUDE, varName, var);
checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_LIBRARY, varName, var); checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_LIBRARY, varName, var);
} }
/* /**
* performs a check of whether the given variable is the build path variable * performs a check of whether the given variable is the build path variable
* of the specified type and if true checks whether it is changed. * of the specified type and if true checks whether it is changed.
* In the case of it is changed all other build path variables of that type are checked * In the case of it is changed all other build path variables of that type are checked
@ -358,11 +319,11 @@ public class EnvironmentVariableProvider implements
* If it is not changed, other build path variables are not checked * If it is not changed, other build path variables are not checked
* In the case of the given variable is not the build path one, this method does nothing * In the case of the given variable is not the build path one, this method does nothing
*/ */
protected void checkBuildPathVariable(IConfiguration configuration, int buildPathType, String varName, IEnvironmentVariable var){ protected void checkBuildPathVariable(IConfiguration configuration, int buildPathType, String varName, IEnvironmentVariable var) {
StoredBuildPathEnvironmentContainer buildPathVars = getStoredBuildPathVariables(buildPathType); StoredBuildPathEnvironmentContainer buildPathVars = getStoredBuildPathVariables(buildPathType);
if(buildPathVars == null) if (buildPathVars == null)
return; return;
if(buildPathVars.isVariableChanged(varName,var,configuration)){ if (buildPathVars.isVariableChanged(varName,var,configuration)) {
EnvVarCollector cr = new EnvVarCollector(); EnvVarCollector cr = new EnvVarCollector();
cr.add(getVariables(configuration, true, false)); cr.add(getVariables(configuration, true, false));
buildPathVars.synchronize(cr,configuration); buildPathVars.synchronize(cr,configuration);
@ -370,44 +331,44 @@ public class EnvironmentVariableProvider implements
} }
} }
/* /**
* performs a check of the build path variables of the specified type * performs a check of the build path variables of the specified type
* for the given configuration given the set of the variables * for the given configuration given the set of the variables
* defined for this configuration. * defined for this configuration.
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
*/ */
protected void checkBuildPathVariables(IConfiguration configuration, int buildPathType, EnvVarCollector varSet){ protected void checkBuildPathVariables(IConfiguration configuration, int buildPathType, EnvVarCollector varSet) {
StoredBuildPathEnvironmentContainer buildPathVars = getStoredBuildPathVariables(buildPathType); StoredBuildPathEnvironmentContainer buildPathVars = getStoredBuildPathVariables(buildPathType);
if(buildPathVars == null) if (buildPathVars == null)
return; return;
if(buildPathVars.checkBuildPathChange(varSet,configuration)){ if (buildPathVars.checkBuildPathChange(varSet,configuration)) {
notifyListeners(configuration, buildPathType); notifyListeners(configuration, buildPathType);
} }
} }
/* /**
* returns the container of the build variables of the specified type * returns the container of the build variables of the specified type
*/ */
protected StoredBuildPathEnvironmentContainer getStoredBuildPathVariables(int buildPathType){ protected StoredBuildPathEnvironmentContainer getStoredBuildPathVariables(int buildPathType) {
return buildPathType == IEnvVarBuildPath.BUILDPATH_LIBRARY ? return buildPathType == IEnvVarBuildPath.BUILDPATH_LIBRARY ?
getStoredLibraryBuildPathVariables() : getStoredLibraryBuildPathVariables() :
getStoredIncludeBuildPathVariables(); getStoredIncludeBuildPathVariables();
} }
/* /**
* returns the container of the Include path variables * returns the container of the Include path variables
*/ */
protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables(){ protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables() {
if(fIncludeStoredBuildPathVariables == null) if (fIncludeStoredBuildPathVariables == null)
fIncludeStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_INCLUDE); fIncludeStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_INCLUDE);
return fIncludeStoredBuildPathVariables; return fIncludeStoredBuildPathVariables;
} }
/* /**
* returns the container of the Library path variables * returns the container of the Library path variables
*/ */
protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables(){ protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables() {
if(fLibraryStoredBuildPathVariables == null) if (fLibraryStoredBuildPathVariables == null)
fLibraryStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_LIBRARY); fLibraryStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_LIBRARY);
return fLibraryStoredBuildPathVariables; return fLibraryStoredBuildPathVariables;
} }

View file

@ -605,6 +605,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
* Implementers are expected to add their variables to the end of the list. * Implementers are expected to add their variables to the end of the list.
* *
* @return list of environment variables. * @return list of environment variables.
* @since 8.2
*/ */
protected List<IEnvironmentVariable> getEnvironmentVariables() { protected List<IEnvironmentVariable> getEnvironmentVariables() {
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager(); IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();

View file

@ -48,6 +48,9 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
new MacroOptionParser("#define\\s+(\\S*)\\s*(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), new MacroOptionParser("#define\\s+(\\S*)\\s*(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
}; };
/**
* @since 8.2
*/
@Override @Override
public String getToolchainId() { public String getToolchainId() {
return GCC_TOOLCHAIN_ID; return GCC_TOOLCHAIN_ID;

View file

@ -50,6 +50,7 @@ public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecs
* *
* Tool-chain id must be supplied for global providers where we don't * Tool-chain id must be supplied for global providers where we don't
* have configuration description to figure that out programmatically. * have configuration description to figure that out programmatically.
* @since 8.2
*/ */
public abstract String getToolchainId(); public abstract String getToolchainId();

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.gnu.ui; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.gnu.ui; singleton:=true
Bundle-Version: 8.1.0.qualifier Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin Bundle-Activator: org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.gnu.ui</artifactId> <artifactId>org.eclipse.cdt.managedbuilder.gnu.ui</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -19,7 +19,9 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable; import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.managedbuilder.core.IBuildPathResolver; import org.eclipse.cdt.managedbuilder.core.IBuildPathResolver;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@ -29,7 +31,6 @@ import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
@ -58,21 +59,16 @@ public class CygwinPathResolver implements IBuildPathResolver {
private static final String MINGW_SPECIAL = "mingw "; //$NON-NLS-1$ private static final String MINGW_SPECIAL = "mingw "; //$NON-NLS-1$
private static final String CYGWIN_SPECIAL = "cygwin "; //$NON-NLS-1$ private static final String CYGWIN_SPECIAL = "cygwin "; //$NON-NLS-1$
private static boolean checked = false; private static String envPathValueCached = null;
private static String binCygwin = null; private static String binCygwin = null;
private static String rootCygwin = null; private static String rootCygwin = null;
private static String etcCygwin = null; private static String etcCygwin = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildPathResolver#resolveBuildPaths(int, java.lang.String, java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration)
*/
@Override @Override
public String[] resolveBuildPaths(int pathType, String variableName, public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
String variableValue, IConfiguration configuration) { if(!isWindows()) {
if(!isWindows()){
return variableValue.split(DELIMITER_UNIX); return variableValue.split(DELIMITER_UNIX);
} else if(isMinGW(configuration)){ } else if(isMinGW(configuration)) {
return variableValue.split(DELIMITER_WIN); return variableValue.split(DELIMITER_WIN);
} }
@ -92,27 +88,37 @@ public class CygwinPathResolver implements IBuildPathResolver {
} }
return result; return result;
} }
/*
/**
* returns "/etc" path in Windows format * returns "/etc" path in Windows format
*
* If you use this do not cache results to ensure user preferences are accounted for.
* Please rely on internal caching.
*/ */
public static String getEtcPath() { public static String getEtcPath() {
if (!checked) findPaths(); findPaths();
return etcCygwin; return etcCygwin;
} }
/* /**
* returns "/usr/bin" path in Windows format * returns "/usr/bin" path in Windows format
*
* If you use this do not cache results to ensure user preferences are accounted for.
* Please rely on internal caching.
*/ */
public static String getBinPath() { public static String getBinPath() {
if (!checked) findPaths(); findPaths();
return binCygwin; return binCygwin;
} }
/*
* returns Cygwin root ("/") path in Windows format
*/
/**
* returns Cygwin root ("/") path in Windows format
*
* If you use this do not cache results to ensure user preferences are accounted for.
* Please rely on internal caching.
*/
public static String getRootPath() { public static String getRootPath() {
if (!checked) findPaths(); findPaths();
return rootCygwin; return rootCygwin;
} }
@ -140,6 +146,7 @@ public class CygwinPathResolver implements IBuildPathResolver {
} }
return null; return null;
} }
/** /**
* Returns the absolute path of the pattern by * Returns the absolute path of the pattern by
* simply appending the pattern to the root * simply appending the pattern to the root
@ -165,11 +172,11 @@ public class CygwinPathResolver implements IBuildPathResolver {
* *
* @return The absolute path to cygwin's root or null if not found * @return The absolute path to cygwin's root or null if not found
*/ */
private static String findRoot() { private static String findRoot(String paths) {
String rootValue = null; String rootValue = null;
// 1. Look in PATH values. Look for bin\cygwin1.dll // 1. Look in PATH values. Look for bin\cygwin1.dll
IPath location = PathUtil.findProgramLocation("cygwin1.dll"); //$NON-NLS-1$ IPath location = PathUtil.findProgramLocation("cygwin1.dll", paths); //$NON-NLS-1$
if (location!=null) { if (location!=null) {
rootValue = location.removeLastSegments(2).toOSString(); rootValue = location.removeLastSegments(2).toOSString();
} }
@ -203,16 +210,25 @@ public class CygwinPathResolver implements IBuildPathResolver {
} }
/** /**
* Finds Cygwin's paths and sets corresponding properties * Finds Cygwin's paths and sets corresponding properties.
*/ */
private static synchronized void findPaths() { private static synchronized void findPaths() {
if (checked) return; if (!isWindows()) {
return;
}
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable("PATH", null, true); //$NON-NLS-1$
String envPathValue = varPath != null ? varPath.getValue() : null;
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached)) {
return;
}
etcCygwin = null; etcCygwin = null;
binCygwin = null; binCygwin = null;
rootCygwin = null; rootCygwin = null;
if (!isWindows()) return;
rootCygwin = findRoot(); rootCygwin = findRoot(envPathValue);
// 1. Try to find the paths by appending the patterns to the root dir // 1. Try to find the paths by appending the patterns to the root dir
etcCygwin = getValueFromRoot(ETCPATTERN); etcCygwin = getValueFromRoot(ETCPATTERN);
@ -226,14 +242,14 @@ public class CygwinPathResolver implements IBuildPathResolver {
if(binCygwin == null) if(binCygwin == null)
binCygwin = readValueFromRegistry(REGISTRY_KEY_MOUNTS + BINPATTERN, PATH_NAME); binCygwin = readValueFromRegistry(REGISTRY_KEY_MOUNTS + BINPATTERN, PATH_NAME);
checked = true; envPathValueCached = envPathValue;
} }
private static String[] exec(String cmd, IConfiguration cfg) { private static String[] exec(String cmd, IConfiguration cfg) {
try { try {
IEnvironmentVariable vars[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,true); IEnvironmentVariable vars[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,true);
String env[] = new String[vars.length]; String env[] = new String[vars.length];
for(int i = 0; i < env.length; i++){ for(int i = 0; i < env.length; i++) {
env[i] = vars[i].getName() + "="; //$NON-NLS-1$ env[i] = vars[i].getName() + "="; //$NON-NLS-1$
String value = vars[i].getValue(); String value = vars[i].getValue();
if(value != null) if(value != null)
@ -258,10 +274,10 @@ public class CygwinPathResolver implements IBuildPathResolver {
return null; return null;
} }
public static boolean isMinGW(IConfiguration cfg){ public static boolean isMinGW(IConfiguration cfg) {
String versionInfo[] = exec(GCC_VERSION_CMD, cfg); String versionInfo[] = exec(GCC_VERSION_CMD, cfg);
if(versionInfo != null) { if(versionInfo != null) {
for(int i = 0; i < versionInfo.length; i++){ for(int i = 0; i < versionInfo.length; i++) {
if(versionInfo[i].indexOf(MINGW_SPECIAL) != -1) if(versionInfo[i].indexOf(MINGW_SPECIAL) != -1)
return true; return true;
else if(versionInfo[i].indexOf(CYGWIN_SPECIAL) != -1) else if(versionInfo[i].indexOf(CYGWIN_SPECIAL) != -1)

View file

@ -16,13 +16,10 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider; import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar; import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class GnuCygwinConfigurationEnvironmentSupplier implements public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
IConfigurationEnvironmentVariableSupplier {
private static final String PATH = "PATH"; //$NON-NLS-1$ private static final String PATH = "PATH"; //$NON-NLS-1$
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$ private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
private static final String PROPERTY_DELIMITER = "path.separator"; //$NON-NLS-1$ private static final String PROPERTY_DELIMITER = "path.separator"; //$NON-NLS-1$
@ -32,50 +29,46 @@ public class GnuCygwinConfigurationEnvironmentSupplier implements
private static final String LC_ALL = "LC_ALL"; //$NON-NLS-1$ private static final String LC_ALL = "LC_ALL"; //$NON-NLS-1$
private static final String LC_MESSAGES = "LC_MESSAGES"; //$NON-NLS-1$ private static final String LC_MESSAGES = "LC_MESSAGES"; //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
*/
@Override @Override
public IBuildEnvironmentVariable getVariable(String variableName, public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) { if (variableName == null) {
if (variableName == null)
return null; return null;
}
if (!System.getProperty(PROPERTY_OSNAME).toLowerCase().startsWith("windows ")) //$NON-NLS-1$ if (!System.getProperty(PROPERTY_OSNAME).toLowerCase().startsWith("windows ")) { //$NON-NLS-1$
return null; return null;
}
if (variableName.equalsIgnoreCase(PATH)) { if (variableName.equalsIgnoreCase(PATH)) {
String p = CygwinPathResolver.getBinPath(); String p = CygwinPathResolver.getBinPath();
if (p != null) if (p != null) {
return new BuildEnvVar(PATH, p.replace('/','\\'), IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX)); return new BuildEnvVar(PATH, p.replace('/','\\'), IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX));
}
} else if (variableName.equalsIgnoreCase(LANG)) { } else if (variableName.equalsIgnoreCase(LANG)) {
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1 // Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
String langValue = System.getenv(LANG); String langValue = System.getenv(LANG);
if (langValue == null || langValue.length() == 0) if (langValue == null || langValue.length() == 0) {
langValue = System.getenv(LC_ALL); langValue = System.getenv(LC_ALL);
if (langValue == null || langValue.length() == 0) }
if (langValue == null || langValue.length() == 0) {
langValue = System.getenv(LC_MESSAGES); langValue = System.getenv(LC_MESSAGES);
if (langValue != null && langValue.length() > 0) }
if (langValue != null && langValue.length() > 0) {
// langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict" // langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict"
// we replace codeset with Latin1 as CDT console garbles UTF // we replace codeset with Latin1 as CDT console garbles UTF
// and ignore modifier which is not used by LANG // and ignore modifier which is not used by LANG
langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$ langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$
else } else {
langValue = "C.ISO-8859-1"; //$NON-NLS-1$ langValue = "C.ISO-8859-1"; //$NON-NLS-1$
}
return new BuildEnvVar(LANG, langValue); return new BuildEnvVar(LANG, langValue);
} }
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
*/
@Override @Override
public IBuildEnvironmentVariable[] getVariables( public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) {
IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider); IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider);
IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider); IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider);

View file

@ -16,6 +16,7 @@ import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported; import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.osgi.framework.Version; import org.osgi.framework.Version;
@ -32,32 +33,24 @@ import org.osgi.framework.Version;
* *
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class IsGnuCygwinToolChainSupported implements public class IsGnuCygwinToolChainSupported implements IManagedIsToolChainSupported {
IManagedIsToolChainSupported { private static final String[] CHECKED_NAMES = {"gcc", "binutils", "make"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
static final String[] CHECKED_NAMES = {"gcc", "binutils", "make"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static String etcCygwinCached = null;
private static boolean toolchainIsSupported = false;
static boolean suppChecked = false;
static boolean toolchainIsSupported = false;
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain, org.eclipse.core.runtime.PluginVersionIdentifier, java.lang.String)
*/
/** /**
* @since 8.0 * @since 8.0
*/ */
@Override @Override
public boolean isSupported(IToolChain toolChain, Version version, String instance) { public boolean isSupported(IToolChain toolChain, Version version, String instance) {
if (suppChecked) return toolchainIsSupported;
String etcCygwin = CygwinPathResolver.getEtcPath(); String etcCygwin = CygwinPathResolver.getEtcPath();
if (etcCygwin != null) { if (CDataUtil.objectsEqual(etcCygwin, etcCygwinCached)) {
toolchainIsSupported = arePackagesInstalled(etcCygwin); return toolchainIsSupported;
} }
suppChecked = true; toolchainIsSupported = etcCygwin != null && arePackagesInstalled(etcCygwin);
etcCygwinCached = etcCygwin;
return toolchainIsSupported; return toolchainIsSupported;
} }
@ -80,7 +73,9 @@ public class IsGnuCygwinToolChainSupported implements
String s; String s;
while ((s = data.readLine()) != null ) { while ((s = data.readLine()) != null ) {
for (int j = 0; j < CHECKED_NAMES.length; j++) { for (int j = 0; j < CHECKED_NAMES.length; j++) {
if (s.startsWith(CHECKED_NAMES[j])) {found[j] = true;} if (s.startsWith(CHECKED_NAMES[j])) {
found[j] = true;
}
} }
} }
arePackagesInstalled = true; arePackagesInstalled = true;

View file

@ -11,6 +11,9 @@
package org.eclipse.cdt.managedbuilder.gnu.mingw; package org.eclipse.cdt.managedbuilder.gnu.mingw;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable; import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier; import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
@ -25,13 +28,16 @@ import org.eclipse.core.runtime.Platform;
* *
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class MingwEnvironmentVariableSupplier implements public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
IConfigurationEnvironmentVariableSupplier { private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
private static boolean checked = false; private static String envPathValueCached = null;
private static String envMingwHomeValueCached = null;
private static IPath binDir = null; private static IPath binDir = null;
private static IPath msysBinDir = null;
private static class MingwBuildEnvironmentVariable implements IBuildEnvironmentVariable { private static class MingwBuildEnvironmentVariable implements IBuildEnvironmentVariable {
private static final String PATH_SEPARATOR = ";"; //$NON-NLS-1$
private final String name; private final String name;
private final String value; private final String value;
private final int operation; private final int operation;
@ -59,94 +65,131 @@ public class MingwEnvironmentVariableSupplier implements
@Override @Override
public String getDelimiter() { public String getDelimiter() {
return ";"; //$NON-NLS-1$ return PATH_SEPARATOR;
} }
} }
private IBuildEnvironmentVariable path; /**
* @return location of $MINGW_HOME/bin folder on the file-system.
*
* If you use this do not cache results to ensure user preferences are accounted for.
* Please rely on internal caching.
*/
public static IPath getBinDir() { public static IPath getBinDir() {
if (!checked) { locateMingw();
binDir = findBinDir();
checked = true;
}
return binDir; return binDir;
} }
private static IPath findBinDir() { /**
// Try in MinGW home * @return location of $MINGW_HOME/msys/bin folder on the file-system.
String mingwHome = System.getenv("MINGW_HOME"); //$NON-NLS-1$ *
IPath mingwBinDir = new Path(mingwHome + "\\bin"); //$NON-NLS-1$ * If you use this do not cache results to ensure user preferences are accounted for.
if (mingwBinDir.toFile().isDirectory()) * Please rely on internal caching.
*/
public static IPath getMsysBinDir() {
locateMingw();
return msysBinDir;
}
/**
* Locate MinGW directories. The results are judicially cached so it is reasonably cheap to call.
* The reason to call it each time is to check if user changed environment in preferences.
*/
private static void locateMingw() {
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, null, true);
String envPathValue = varPath != null ? varPath.getValue() : null;
IEnvironmentVariable varMingwHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable("MINGW_HOME", null, true); //$NON-NLS-1$
String envMingwHomeValue = varMingwHome != null ? varMingwHome.getValue() : null;
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envMingwHomeValue, envMingwHomeValueCached)) {
return;
}
envPathValueCached = envPathValue;
envMingwHomeValueCached = envMingwHomeValue;
binDir = locateBinDir();
msysBinDir = locateMsysBinDir(binDir);
}
private static IPath locateBinDir() {
// Check $MINGW_HOME
IPath mingwBinDir = new Path(envMingwHomeValueCached + "\\bin"); //$NON-NLS-1$
if (mingwBinDir.toFile().isDirectory()) {
return mingwBinDir; return mingwBinDir;
}
// Try the mingw directory in the platform install directory // Try the mingw directory in the platform install directory
// CDT distributions like Wascana may distribute MinGW like that // CDT distributions like Wascana may distribute MinGW like that
IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile()); IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$ mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$
if (mingwBinDir.toFile().isDirectory()) if (mingwBinDir.toFile().isDirectory()) {
return mingwBinDir; return mingwBinDir;
}
// Look in PATH values. Look for mingw32-gcc.exe // Look in PATH values. Look for mingw32-gcc.exe
// TODO: Since this dir is already in the PATH, why are we adding it here? // TODO: Since this dir is already in the PATH, why are we adding it here?
// This is really only to support isToolchainAvail. Must be a better way. // This is really only to support isToolchainAvail. Must be a better way.
IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe"); //$NON-NLS-1$ // AG: Because otherwise the toolchain won't be shown in the list of "supported" toolchains in UI
if (gccLoc != null) // when MinGW installed in custom location even if it is in the PATH
IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe", envPathValueCached); //$NON-NLS-1$
if (gccLoc != null) {
return gccLoc.removeLastSegments(1); return gccLoc.removeLastSegments(1);
}
// Try the default MinGW install dir // Try the default MinGW install dir
mingwBinDir = new Path("C:\\MinGW\\bin"); //$NON-NLS-1$ mingwBinDir = new Path("C:\\MinGW\\bin"); //$NON-NLS-1$
if (mingwBinDir.toFile().isDirectory()) if (mingwBinDir.toFile().isDirectory()) {
return mingwBinDir; return mingwBinDir;
return null;
}
public static IPath getMsysBinDir() {
// Just look in the install location parent dir
IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
IPath msysBinPath = installPath.append("msys\\bin"); //$NON-NLS-1$
if (msysBinPath.toFile().isDirectory())
return msysBinPath;
String mingwHome = System.getenv("MINGW_HOME"); //$NON-NLS-1$
if (mingwHome != null) {
msysBinPath = new Path(mingwHome + "\\msys\\1.0\\bin"); //$NON-NLS-1$
if (msysBinPath.toFile().isDirectory())
return msysBinPath;
} }
// Try the new MinGW msys bin dir
msysBinPath = new Path("C:\\MinGW\\msys\\1.0\\bin"); //$NON-NLS-1$
if (msysBinPath.toFile().isDirectory())
return msysBinPath;
return null; return null;
} }
public MingwEnvironmentVariableSupplier() { private static IPath locateMsysBinDir(IPath binPath) {
IPath binPath = getBinDir();
if (binPath != null) { if (binPath != null) {
String pathStr = binPath.toOSString(); // Just look in the install location parent dir
IPath msysBinPath = getMsysBinDir(); IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
if (msysBinPath != null) IPath msysBinPath = installPath.append("msys\\bin"); //$NON-NLS-1$
pathStr += ';' + msysBinPath.toOSString(); if (msysBinPath.toFile().isDirectory()) {
return msysBinPath;
}
path = new MingwBuildEnvironmentVariable("PATH", pathStr, IBuildEnvironmentVariable.ENVVAR_PREPEND); //$NON-NLS-1$ if (envMingwHomeValueCached != null) {
msysBinPath = new Path(envMingwHomeValueCached + "\\msys\\1.0\\bin"); //$NON-NLS-1$
if (msysBinPath.toFile().isDirectory()) {
return msysBinPath;
}
}
// Try the new MinGW msys bin dir
msysBinPath = new Path("C:\\MinGW\\msys\\1.0\\bin"); //$NON-NLS-1$
if (msysBinPath.toFile().isDirectory()) {
return msysBinPath;
}
} }
return null;
} }
@Override @Override
public IBuildEnvironmentVariable getVariable(String variableName, public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) { if (variableName.equals(ENV_PATH)) {
if (path != null && variableName.equals(path.getName())) locateMingw();
return path; if (binDir != null) {
else String pathStr = binDir.toOSString();
return null; if (msysBinDir != null) {
pathStr += MingwBuildEnvironmentVariable.PATH_SEPARATOR + msysBinDir.toOSString();
}
return new MingwBuildEnvironmentVariable(ENV_PATH, pathStr, IBuildEnvironmentVariable.ENVVAR_PREPEND);
}
}
return null;
} }
@Override @Override
public IBuildEnvironmentVariable[] getVariables( public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) { IBuildEnvironmentVariable path = getVariable(ENV_PATH, configuration, provider);
return path != null return path != null
? new IBuildEnvironmentVariable[] { path } ? new IBuildEnvironmentVariable[] { path }
: new IBuildEnvironmentVariable[0]; : new IBuildEnvironmentVariable[0];

View file

@ -21,17 +21,10 @@ import org.osgi.framework.Version;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class MingwIsToolChainSupported implements IManagedIsToolChainSupported { public class MingwIsToolChainSupported implements IManagedIsToolChainSupported {
private final boolean supported;
public MingwIsToolChainSupported() {
// Only supported if we can find the mingw bin dir to run the compiler
supported = MingwEnvironmentVariableSupplier.getBinDir() != null;
}
@Override @Override
public boolean isSupported(IToolChain toolChain, Version version, String instance) { public boolean isSupported(IToolChain toolChain, Version version, String instance) {
return supported; // Only supported if we can find the mingw bin dir to run the compiler
return MingwEnvironmentVariableSupplier.getBinDir() != null;
} }
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Managed Build UI Tests Plug-in Bundle-Name: Managed Build UI Tests Plug-in
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui.tests; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui.tests; singleton:=true
Bundle-Version: 8.1.0.qualifier Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.tests.testplugin.TestsPlugin Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.tests.testplugin.TestsPlugin
Bundle-Vendor: Eclipse CDT Bundle-Vendor: Eclipse CDT
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.ui.tests</artifactId> <artifactId>org.eclipse.cdt.managedbuilder.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging> <packaging>eclipse-test-plugin</packaging>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui; singleton:=true
Bundle-Version: 8.1.0.qualifier Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.ui</artifactId> <artifactId>org.eclipse.cdt.managedbuilder.ui</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -89,8 +89,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import org.osgi.framework.Bundle;
import org.eclipse.ui.dialogs.FilteredTree; import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter; import org.eclipse.ui.dialogs.PatternFilter;
@ -522,25 +520,17 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
*/ */
private class CustomFieldEditorDescriptor private class CustomFieldEditorDescriptor
{ {
private final String editorClassName; private final IConfigurationElement element;
private final String bundleName;
CustomFieldEditorDescriptor(String editorClassName, String bundleName) { public CustomFieldEditorDescriptor(IConfigurationElement providerElement) {
this.editorClassName = editorClassName; this.element = providerElement;
this.bundleName = bundleName;
} }
FieldEditor createEditor() { FieldEditor createEditor() {
try { try {
Bundle bundle = Platform.getBundle(this.bundleName); Object editor = element.createExecutableExtension("class"); //$NON-NLS-1$
if(bundle != null) { if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
Class<?> editorClass = bundle.loadClass(this.editorClassName); return (FieldEditor)editor;
if(editorClass != null) {
Object editor = editorClass.newInstance();
if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
return (FieldEditor)editor;
}
}
} }
} }
catch(Exception x) { catch(Exception x) {
@ -567,11 +557,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
for(IExtension e : ep.getExtensions()) { for(IExtension e : ep.getExtensions()) {
for(IConfigurationElement providerElement : e.getConfigurationElements()) { for(IConfigurationElement providerElement : e.getConfigurationElements()) {
String editorId = providerElement.getAttribute("id"); //$NON-NLS-1$ String editorId = providerElement.getAttribute("id"); //$NON-NLS-1$
String editorClassName = providerElement.getAttribute("class"); //$NON-NLS-1$
String bundleName = providerElement.getContributor().getName(); this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(providerElement));
this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(editorClassName, bundleName));
} }
} }
} }

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.checkers.ui;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.checkers.ui;singleton:=true
Bundle-Version: 1.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator Bundle-Activator: org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.checkers.ui</artifactId> <artifactId>org.eclipse.cdt.codan.checkers.ui</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.checkers;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.checkers;singleton:=true
Bundle-Version: 1.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.checkers.CodanCheckersActivator Bundle-Activator: org.eclipse.cdt.codan.checkers.CodanCheckersActivator
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources, org.eclipse.core.resources,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.checkers</artifactId> <artifactId>org.eclipse.cdt.codan.checkers</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -68,7 +68,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
class OnEachClass extends ASTVisitor { class OnEachClass extends ASTVisitor {
// NOTE: Classes can be nested and even can be declared in constructors of the other classes // NOTE: Classes can be nested and even can be declared in constructors of the other classes
private final Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >(); private final Stack<Set<IField>> constructorsStack = new Stack<Set<IField>>();
private boolean skipConstructorsWithFCalls = skipConstructorsWithFCalls(); private boolean skipConstructorsWithFCalls = skipConstructorsWithFCalls();
OnEachClass() { OnEachClass() {
@ -110,13 +110,13 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
if (skipConstructorsWithFCalls && !constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) { if (skipConstructorsWithFCalls && !constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
Set<IField> actualConstructorFields = constructorsStack.peek(); Set<IField> actualConstructorFields = constructorsStack.peek();
if (!actualConstructorFields.isEmpty()) { if (!actualConstructorFields.isEmpty()) {
IASTFunctionCallExpression fCall = (IASTFunctionCallExpression)expression; IASTFunctionCallExpression fCall = (IASTFunctionCallExpression) expression;
IASTExpression fNameExp = fCall.getFunctionNameExpression(); IASTExpression fNameExp = fCall.getFunctionNameExpression();
if (fNameExp instanceof IASTIdExpression) { if (fNameExp instanceof IASTIdExpression) {
IASTIdExpression fName = (IASTIdExpression)fNameExp; IASTIdExpression fName = (IASTIdExpression) fNameExp;
IBinding fBinding = fName.getName().resolveBinding(); IBinding fBinding = fName.getName().resolveBinding();
if (fBinding instanceof ICPPMethod) { if (fBinding instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod)fBinding; ICPPMethod method = (ICPPMethod) fBinding;
ICompositeType constructorOwner = actualConstructorFields.iterator().next().getCompositeTypeOwner(); ICompositeType constructorOwner = actualConstructorFields.iterator().next().getCompositeTypeOwner();
if (constructorOwner.equals(method.getClassOwner()) && !method.getType().isConst()) { if (constructorOwner.equals(method.getClassOwner()) && !method.getType().isConst()) {
skipCurrentConstructor = true; skipCurrentConstructor = true;
@ -152,12 +152,12 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
*/ */
public boolean referencesThis(IASTNode expr) { public boolean referencesThis(IASTNode expr) {
if (expr instanceof IASTLiteralExpression) { if (expr instanceof IASTLiteralExpression) {
IASTLiteralExpression litArg = (IASTLiteralExpression)expr; IASTLiteralExpression litArg = (IASTLiteralExpression) expr;
if (litArg.getKind() == IASTLiteralExpression.lk_this) { if (litArg.getKind() == IASTLiteralExpression.lk_this) {
return true; return true;
} }
} else if (expr instanceof ICPPASTUnaryExpression) { } else if (expr instanceof ICPPASTUnaryExpression) {
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr; ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression) expr;
switch (unExpr.getOperator()) { switch (unExpr.getOperator()) {
case IASTUnaryExpression.op_amper: case IASTUnaryExpression.op_amper:
case IASTUnaryExpression.op_star: case IASTUnaryExpression.op_star:
@ -239,7 +239,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
type instanceof IPointerType || type instanceof IPointerType ||
type instanceof IEnumeration || type instanceof IEnumeration ||
type instanceof ICPPReferenceType || type instanceof ICPPReferenceType ||
(type instanceof ITypedef && isSimpleType( ((ITypedef)type).getType()) ) ); (type instanceof ITypedef && isSimpleType(((ITypedef) type).getType())));
} }
/** Checks that specified declaration is a class constructor /** Checks that specified declaration is a class constructor
@ -247,11 +247,13 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
*/ */
private ICPPConstructor getConstructor(IASTDeclaration decl) { private ICPPConstructor getConstructor(IASTDeclaration decl) {
if (decl instanceof ICPPASTFunctionDefinition) { if (decl instanceof ICPPASTFunctionDefinition) {
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition)decl; ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl;
if (functionDefinition.isDeleted())
return null;
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding(); IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
if (binding instanceof ICPPConstructor) { if (binding instanceof ICPPConstructor) {
ICPPConstructor constructor = (ICPPConstructor) binding; ICPPConstructor constructor = (ICPPConstructor) binding;
if (constructor.getClassOwner().getKey()!=ICompositeType.k_union) { if (constructor.getClassOwner().getKey() != ICompositeType.k_union) {
return constructor; return constructor;
} }
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.core.cxx;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.core.cxx;singleton:=true
Bundle-Version: 1.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.core.cxx.Activator Bundle-Activator: org.eclipse.cdt.codan.core.cxx.Activator
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.core, org.eclipse.cdt.core,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core.cxx</artifactId> <artifactId>org.eclipse.cdt.codan.core.cxx</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.core.test Bundle-SymbolicName: org.eclipse.cdt.codan.core.test
Bundle-Version: 1.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.core.test.CodanCoreTestActivator Bundle-Activator: org.eclipse.cdt.codan.core.test.CodanCoreTestActivator
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.codan.checkers;bundle-version="1.0.0", org.eclipse.cdt.codan.checkers;bundle-version="1.0.0",

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core.test</artifactId> <artifactId>org.eclipse.cdt.codan.core.test</artifactId>
<packaging>eclipse-test-plugin</packaging> <packaging>eclipse-test-plugin</packaging>

View file

@ -314,6 +314,16 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
checkNoErrors(); checkNoErrors();
} }
// class C {
// public:
// C(const C& c) = delete;
// int i1, i2;
// };
public void testNoErrorsOnDeletedConstructor() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// void func(int & a) { a = 0; } // void func(int & a) { a = 0; }
// class C { // class C {
// C() { func(i); } // No warnings. // C() { func(i); } // No warnings.

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.core;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.core;singleton:=true
Bundle-Version: 2.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.core.CodanCorePlugin Bundle-Activator: org.eclipse.cdt.codan.core.CodanCorePlugin
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>2.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core</artifactId> <artifactId>org.eclipse.cdt.codan.core</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.examples;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.examples;singleton:=true
Bundle-Version: 1.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.examples.Activator Bundle-Activator: org.eclipse.cdt.codan.examples.Activator
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Control Flow Graph Bundle-Name: Control Flow Graph
Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cfgview;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cfgview;singleton:=true
Bundle-Version: 1.0.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.ui.cfgview.ControlFlowGraphPlugin Bundle-Activator: org.eclipse.cdt.codan.ui.cfgview.ControlFlowGraphPlugin
Bundle-Vendor: Eclipse CDT Bundle-Vendor: Eclipse CDT
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx;singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx;singleton:=true
Bundle-Version: 3.0.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.internal.ui.cxx.Activator Bundle-Activator: org.eclipse.cdt.codan.internal.ui.cxx.Activator
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>3.0.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.ui.cxx</artifactId> <artifactId>org.eclipse.cdt.codan.ui.cxx</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.ui; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.codan.ui; singleton:=true
Bundle-Version: 2.1.0.qualifier Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.internal.ui.CodanUIActivator Bundle-Activator: org.eclipse.cdt.codan.internal.ui.CodanUIActivator
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>2.1.0-SNAPSHOT</version> <version>3.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.ui</artifactId> <artifactId>org.eclipse.cdt.codan.ui</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -0,0 +1,96 @@
/*******************************************************************************
* Copyright (c) 2012 Veaceslav Bacu (Freescale Semiconductor 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:
* Veaceslav Bacu (Freescale Semiconductor Inc.) - initial API and implementation (bug 348884)
*
*******************************************************************************/
package org.eclipse.cdt.utils;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.cdtvariables.IUserVarSupplier;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.testplugin.ResourceHelper;
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariable;
import org.eclipse.core.resources.IProject;
public class StorableCdtVariablesTest extends TestCase {
public static Test suite() {
return new TestSuite(StorableCdtVariablesTest.class);
}
@Override
protected void tearDown() throws Exception {
ResourceHelper.cleanUp();
}
/**
* Unit test for bug 348884
*/
public void testSetMacros() throws Exception {
IProject project = ResourceHelper.createCDTProjectWithConfig("projectWithUserVars"); //$NON-NLS-1$
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(project);
ICConfigurationDescription desc = prjDesc.getActiveConfiguration();
StorableCdtVariable varA1 = new StorableCdtVariable("A1", ICdtVariable.VALUE_TEXT, "a1"); //$NON-NLS-1$ //$NON-NLS-2$
StorableCdtVariable varA2 = new StorableCdtVariable("A2", ICdtVariable.VALUE_TEXT, "a2"); //$NON-NLS-1$ //$NON-NLS-2$
StorableCdtVariable varA3 = new StorableCdtVariable("A3", ICdtVariable.VALUE_TEXT, "a3"); //$NON-NLS-1$ //$NON-NLS-2$
StorableCdtVariable varA4 = new StorableCdtVariable("A4", ICdtVariable.VALUE_TEXT, "a4"); //$NON-NLS-1$ //$NON-NLS-2$
StorableCdtVariable varA5 = new StorableCdtVariable("A5", ICdtVariable.VALUE_TEXT, "a5"); //$NON-NLS-1$ //$NON-NLS-2$
IUserVarSupplier supplier = CCorePlugin.getUserVarSupplier();
try{
supplier.setMacros(new ICdtVariable[]{varA1, varA2, varA3, varA4}, desc);
}catch(Throwable e){
fail(e.toString());
}
{
ICdtVariable[] vars = supplier.getMacros(desc);
List<String> macroStrings = new ArrayList<String>();
for (ICdtVariable var : vars) {
macroStrings.add(var.getName() + '=' + var.getStringValue());
}
assertTrue(macroStrings.contains(varA1.getName() + '=' + varA1.getStringValue()));
assertTrue(macroStrings.contains(varA2.getName() + '=' + varA2.getStringValue()));
assertTrue(macroStrings.contains(varA3.getName() + '=' + varA3.getStringValue()));
assertTrue(macroStrings.contains(varA4.getName() + '=' + varA4.getStringValue()));
assertEquals(4, macroStrings.size());
}
try{
supplier.setMacros(new ICdtVariable[]{varA1, varA2, varA5}, desc);
}catch(Exception e){
fail(e.toString());
}
{
ICdtVariable[] vars = supplier.getMacros(desc);
List<String> macroStrings = new ArrayList<String>();
for (ICdtVariable var : vars) {
macroStrings.add(var.getName() + '=' + var.getStringValue());
}
assertTrue(macroStrings.contains(varA1.getName() + '=' + varA1.getStringValue()));
assertTrue(macroStrings.contains(varA2.getName() + '=' + varA2.getStringValue()));
assertTrue(macroStrings.contains(varA5.getName() + '=' + varA5.getStringValue()));
assertEquals(3, macroStrings.size());
}
}
}

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -514,9 +514,13 @@ public class AST2BaseTest extends BaseTestCase {
protected boolean isCPP; protected boolean isCPP;
public BindingAssertionHelper(String contents, boolean isCPP) throws ParserException { public BindingAssertionHelper(String contents, boolean isCPP) throws ParserException {
this(contents, isCPP ? ParserLanguage.CPP : ParserLanguage.C);
}
public BindingAssertionHelper(String contents, ParserLanguage lang) throws ParserException {
this.contents= contents; this.contents= contents;
this.isCPP= isCPP; this.isCPP= lang.isCPP();
this.tu= parse(contents, isCPP ? ParserLanguage.CPP : ParserLanguage.C, true, false); this.tu= parse(contents, lang, true, false);
} }
public IASTTranslationUnit getTranslationUnit() { public IASTTranslationUnit getTranslationUnit() {

View file

@ -4706,8 +4706,9 @@ public class AST2CPPTests extends AST2BaseTest {
} }
// template<typename T> // template<typename T>
// class basic_string { // struct basic_string {
// basic_string& operator+=(const T* s); // basic_string& operator+=(const T* s);
// basic_string& append(const T* s);
// }; // };
// //
// template<typename T> // template<typename T>
@ -4721,8 +4722,9 @@ public class AST2CPPTests extends AST2BaseTest {
// void test(const string& s) { // void test(const string& s) {
// auto s1 = "" + s + ""; // auto s1 = "" + s + "";
// auto s2 = s1 += ""; // auto s2 = s1 += "";
// auto s3 = s2.append("foo");
// } // }
public void testTypedefPreservation_380498() throws Exception { public void testTypedefPreservation_380498_1() throws Exception {
BindingAssertionHelper ba= getAssertionHelper(); BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class); ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class);
assertTrue(s1.getType() instanceof ITypedef); assertTrue(s1.getType() instanceof ITypedef);
@ -4730,6 +4732,25 @@ public class AST2CPPTests extends AST2BaseTest {
ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class); ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class);
assertTrue(s2.getType() instanceof ITypedef); assertTrue(s2.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s2.getType()).getName()); assertEquals("string", ((ITypedef) s2.getType()).getName());
ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class);
assertTrue(s3.getType() instanceof ITypedef);
assertEquals("string", ((ITypedef) s3.getType()).getName());
}
// template <typename T>
// struct vector {
// typedef T* const_iterator;
// const_iterator begin() const;
// };
//
// void test(const vector<int>& v) {
// auto it = v.begin();
// }
public void testTypedefPreservation_380498_2() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class);
assertTrue(it.getType() instanceof ITypedef);
assertEquals("vector<int>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
} }
// int f() { // int f() {

View file

@ -155,7 +155,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField t2 = (ICPPField) col.getName(5).resolveBinding(); ICPPField t2 = (ICPPField) col.getName(5).resolveBinding();
assertSame(t1.getType(), T); assertSame(t1.getType(), T);
assertSame(((IPointerType)t2.getType()).getType(), T); assertSame(((IPointerType) t2.getType()).getType(), T);
ICPPVariable a = (ICPPVariable) col.getName(9).resolveBinding(); ICPPVariable a = (ICPPVariable) col.getName(9).resolveBinding();
@ -170,20 +170,20 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField t = (ICPPField) col.getName(11).resolveBinding(); ICPPField t = (ICPPField) col.getName(11).resolveBinding();
assertTrue(t instanceof ICPPSpecialization); assertTrue(t instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t1); assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t1);
assertSame(t.getScope(), A_int_Scope); assertSame(t.getScope(), A_int_Scope);
IType type = t.getType(); IType type = t.getType();
assertTrue(type instanceof IBasicType); assertTrue(type instanceof IBasicType);
assertEquals(((IBasicType)type).getType(), IBasicType.t_int); assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
t = (ICPPField) col.getName(13).resolveBinding(); t = (ICPPField) col.getName(13).resolveBinding();
assertTrue(t instanceof ICPPSpecialization); assertTrue(t instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t2); assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t2);
assertSame(t.getScope(), A_int_Scope); assertSame(t.getScope(), A_int_Scope);
type = t.getType(); type = t.getType();
assertTrue(type instanceof IPointerType); assertTrue(type instanceof IPointerType);
assertTrue(((IPointerType)type).getType() instanceof IBasicType); assertTrue(((IPointerType) type).getType() instanceof IBasicType);
assertEquals(((IBasicType)((IPointerType)type).getType()).getType(), IBasicType.t_int); assertEquals(((IBasicType) ((IPointerType) type).getType()).getType(), IBasicType.t_int);
} }
// template < class T > class A { // template < class T > class A {
@ -204,7 +204,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IFunctionType ft = f.getType(); IFunctionType ft = f.getType();
assertSame(ft.getReturnType(), T); assertSame(ft.getReturnType(), T);
assertSame(((IPointerType)ft.getParameterTypes()[0]).getType(), T); assertSame(((IPointerType) ft.getParameterTypes()[0]).getType(), T);
ICPPClassType A_int = (ICPPClassType) col.getName(7).resolveBinding(); ICPPClassType A_int = (ICPPClassType) col.getName(7).resolveBinding();
assertTrue(A_int instanceof ICPPTemplateInstance); assertTrue(A_int instanceof ICPPTemplateInstance);
@ -212,10 +212,10 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod f_int = (ICPPMethod) col.getName(11).resolveBinding(); ICPPMethod f_int = (ICPPMethod) col.getName(11).resolveBinding();
assertTrue(f_int instanceof ICPPSpecialization); assertTrue(f_int instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)f_int).getSpecializedBinding(), f); assertSame(((ICPPSpecialization) f_int).getSpecializedBinding(), f);
ft = f_int.getType(); ft = f_int.getType();
assertTrue(ft.getReturnType() instanceof IBasicType); assertTrue(ft.getReturnType() instanceof IBasicType);
assertTrue(((IPointerType)ft.getParameterTypes()[0]).getType() instanceof IBasicType); assertTrue(((IPointerType) ft.getParameterTypes()[0]).getType() instanceof IBasicType);
} }
// template <class T > void f(T); // template <class T > void f(T);
@ -246,7 +246,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunction f3 = (ICPPFunction) col.getName(11).resolveBinding(); ICPPFunction f3 = (ICPPFunction) col.getName(11).resolveBinding();
assertTrue(f3 instanceof ICPPTemplateInstance); assertTrue(f3 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f3).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) f3).getTemplateDefinition(), f);
assertInstances(col, T, 5); assertInstances(col, T, 5);
} }
@ -325,7 +325,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// the instantiation of A<T> has to be deferred. // the instantiation of A<T> has to be deferred.
assertInstance(b0, ICPPUnknownBinding.class); assertInstance(b0, ICPPUnknownBinding.class);
final ICPPBinding parent = ((ICPPInternalUnknownScope)b0.getScope()).getScopeBinding(); final ICPPBinding parent = ((ICPPInternalUnknownScope) b0.getScope()).getScopeBinding();
assertInstance(parent, ICPPDeferredClassInstance.class); assertInstance(parent, ICPPDeferredClassInstance.class);
assertSame(((ICPPDeferredClassInstance) parent).getSpecializedBinding(), A); assertSame(((ICPPDeferredClassInstance) parent).getSpecializedBinding(), A);
@ -360,7 +360,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IFunction f2 = (IFunction) col.getName(5).resolveBinding(); IFunction f2 = (IFunction) col.getName(5).resolveBinding();
assertTrue(f2 instanceof ICPPTemplateInstance); assertTrue(f2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1); assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
} }
// template < class T > void f(T); // #1 // template < class T > void f(T); // #1
@ -385,7 +385,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IFunction f = (IFunction) col.getName(14).resolveBinding(); IFunction f = (IFunction) col.getName(14).resolveBinding();
assertTrue(f instanceof ICPPTemplateInstance); assertTrue(f instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f).getTemplateDefinition(), f3); assertSame(((ICPPTemplateInstance) f).getTemplateDefinition(), f3);
} }
// template < class T > void f(T); // #1 // template < class T > void f(T); // #1
@ -459,11 +459,11 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPVariable a2 = (ICPPVariable) col.getName(15).resolveBinding(); ICPPVariable a2 = (ICPPVariable) col.getName(15).resolveBinding();
assertTrue(a2 instanceof ICPPSpecialization); assertTrue(a2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a); assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
IType at = a2.getType(); IType at = a2.getType();
assertTrue(at instanceof IPointerType); assertTrue(at instanceof IPointerType);
assertSame(((IPointerType)at).getType(), ((IPointerType)bt).getType()); assertSame(((IPointerType) at).getType(), ((IPointerType) bt).getType());
} }
// template < class T1, class T2, int I > class A {}; //#1 // template < class T1, class T2, int I > class A {}; //#1
@ -546,7 +546,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding(); ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
assertTrue(ref instanceof ICPPTemplateInstance); assertTrue(ref instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
} }
// template<class T> void f(T); // template<class T> void f(T);
@ -560,7 +560,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding(); ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
assertTrue(ref instanceof ICPPTemplateInstance); assertTrue(ref instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
} }
// template<class X, class Y> X f(Y); // template<class X, class Y> X f(Y);
@ -591,7 +591,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding(); ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding();
ICPPFunction ref = (ICPPFunction) col.getName(5).resolveBinding(); ICPPFunction ref = (ICPPFunction) col.getName(5).resolveBinding();
assertTrue(ref instanceof ICPPTemplateInstance); assertTrue(ref instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
} }
// template<class T> void f(T); // #1 // template<class T> void f(T); // #1
@ -640,7 +640,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPClassType x2 = (ICPPClassType) col.getName(4).resolveBinding(); ICPPClassType x2 = (ICPPClassType) col.getName(4).resolveBinding();
assertTrue(x1 instanceof ICPPTemplateInstance); assertTrue(x1 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)x1).getTemplateDefinition(), X); assertSame(((ICPPTemplateInstance) x1).getTemplateDefinition(), X);
assertSame(x1, x2); assertSame(x1, x2);
} }
@ -663,19 +663,19 @@ public class AST2TemplateTests extends AST2BaseTest {
assertNotSame(f1, f2); assertNotSame(f1, f2);
assertTrue(f1 instanceof ICPPTemplateInstance); assertTrue(f1 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f1).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) f1).getTemplateDefinition(), f);
assertTrue(f2 instanceof ICPPTemplateInstance); assertTrue(f2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f); assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f);
IType fr1 = f1.getType().getReturnType(); IType fr1 = f1.getType().getReturnType();
IType fr2 = f2.getType().getReturnType(); IType fr2 = f2.getType().getReturnType();
assertTrue(fr1 instanceof IBasicType); assertTrue(fr1 instanceof IBasicType);
assertEquals(((IBasicType)fr1).getType(), IBasicType.t_int); assertEquals(((IBasicType) fr1).getType(), IBasicType.t_int);
assertTrue(fr2 instanceof IPointerType); assertTrue(fr2 instanceof IPointerType);
assertTrue(((IPointerType)fr2).getType() instanceof IBasicType); assertTrue(((IPointerType) fr2).getType() instanceof IBasicType);
assertEquals(((IBasicType) ((IPointerType)fr2).getType()).getType(), IBasicType.t_char); assertEquals(((IBasicType) ((IPointerType) fr2).getType()).getType(), IBasicType.t_char);
} }
// template<class T> void f(T) { } // template<class T> void f(T) { }
@ -696,10 +696,10 @@ public class AST2TemplateTests extends AST2BaseTest {
assertSame(f2.getSpecializedBinding(), f1); assertSame(f2.getSpecializedBinding(), f1);
assertSame(g2.getSpecializedBinding(), g1); assertSame(g2.getSpecializedBinding(), g1);
assertFalse(((ICPPFunction)f1).isInline()); assertFalse(((ICPPFunction) f1).isInline());
assertTrue(((ICPPFunction)g1).isInline()); assertTrue(((ICPPFunction) g1).isInline());
assertTrue(((ICPPFunction)f2).isInline()); assertTrue(((ICPPFunction) f2).isInline());
assertFalse(((ICPPFunction)g2).isInline()); assertFalse(((ICPPFunction) g2).isInline());
} }
// template<class T> class X { // template<class T> class X {
@ -732,10 +732,10 @@ public class AST2TemplateTests extends AST2BaseTest {
assertTrue(a2 instanceof ICPPSpecialization); assertTrue(a2 instanceof ICPPSpecialization);
assertTrue(a3 instanceof ICPPSpecialization); assertTrue(a3 instanceof ICPPSpecialization);
assertTrue(a4 instanceof ICPPSpecialization); assertTrue(a4 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)a1).getSpecializedBinding(), a); assertSame(((ICPPSpecialization) a1).getSpecializedBinding(), a);
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a); assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
assertSame(((ICPPSpecialization)a3).getSpecializedBinding(), a); assertSame(((ICPPSpecialization) a3).getSpecializedBinding(), a);
assertSame(((ICPPSpecialization)a4).getSpecializedBinding(), a); assertSame(((ICPPSpecialization) a4).getSpecializedBinding(), a);
} }
// template<class T> class Y; // template<class T> class Y;
@ -759,7 +759,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPClassType y2 = (ICPPClassType) col.getName(6).resolveBinding(); ICPPClassType y2 = (ICPPClassType) col.getName(6).resolveBinding();
assertTrue(y2 instanceof ICPPTemplateInstance); assertTrue(y2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)y2).getTemplateDefinition(), Y); assertSame(((ICPPTemplateInstance) y2).getTemplateDefinition(), Y);
} }
// template < class T, class U > void f (T (*) (T, U)); // template < class T, class U > void f (T (*) (T, U));
@ -779,7 +779,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IBinding g2 = col.getName(14).resolveBinding(); IBinding g2 = col.getName(14).resolveBinding();
assertTrue(f2 instanceof ICPPTemplateInstance); assertTrue(f2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1); assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
assertSame(g1, g2); assertSame(g1, g2);
} }
@ -809,11 +809,11 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField u2 = (ICPPField) col.getName(11).resolveBinding(); ICPPField u2 = (ICPPField) col.getName(11).resolveBinding();
assertTrue(u2 instanceof ICPPSpecialization); assertTrue(u2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)u2).getSpecializedBinding(), u1); assertSame(((ICPPSpecialization) u2).getSpecializedBinding(), u1);
IType type = u2.getType(); IType type = u2.getType();
assertTrue(type instanceof IBasicType); assertTrue(type instanceof IBasicType);
assertEquals(((IBasicType)type).getType(), IBasicType.t_int); assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
} }
// template < class T > class A { // template < class T > class A {
@ -878,18 +878,18 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField pA2 = (ICPPField) col.getName(17).resolveBinding(); ICPPField pA2 = (ICPPField) col.getName(17).resolveBinding();
assertTrue(f2 instanceof ICPPSpecialization); assertTrue(f2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f); assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
assertTrue(pA2 instanceof ICPPSpecialization); assertTrue(pA2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)pA2).getSpecializedBinding(), pA); assertSame(((ICPPSpecialization) pA2).getSpecializedBinding(), pA);
IType paT = pA2.getType(); IType paT = pA2.getType();
assertTrue(paT instanceof IPointerType); assertTrue(paT instanceof IPointerType);
assertSame(((IPointerType)paT).getType(), AI); assertSame(((IPointerType) paT).getType(), AI);
IParameter p = f2.getParameters()[0]; IParameter p = f2.getParameters()[0];
IType pT = p.getType(); IType pT = p.getType();
assertTrue(pT instanceof IPointerType); assertTrue(pT instanceof IPointerType);
assertSame(((IPointerType)pT).getType(), AI); assertSame(((IPointerType) pT).getType(), AI);
} }
// template <class T> struct A { // template <class T> struct A {
@ -916,7 +916,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod f1_2 = (ICPPMethod) col.getName(11).resolveBinding(); ICPPMethod f1_2 = (ICPPMethod) col.getName(11).resolveBinding();
assertNotSame(f1, f1_2); assertNotSame(f1, f1_2);
assertTrue(f1_2 instanceof ICPPSpecialization); assertTrue(f1_2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)f1_2).getSpecializedBinding(), f1); assertSame(((ICPPSpecialization) f1_2).getSpecializedBinding(), f1);
ICPPClassType A2 = (ICPPClassType) col.getName(9).resolveBinding(); ICPPClassType A2 = (ICPPClassType) col.getName(9).resolveBinding();
assertTrue(A2 instanceof ICPPTemplateInstance); assertTrue(A2 instanceof ICPPTemplateInstance);
@ -924,9 +924,9 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod f2_2 = (ICPPMethod) col.getName(16).resolveBinding(); ICPPMethod f2_2 = (ICPPMethod) col.getName(16).resolveBinding();
assertTrue(f2_2 instanceof ICPPSpecialization); assertTrue(f2_2 instanceof ICPPSpecialization);
IBinding speced = ((ICPPSpecialization)f2_2).getSpecializedBinding(); IBinding speced = ((ICPPSpecialization) f2_2).getSpecializedBinding();
assertTrue(speced instanceof ICPPFunctionTemplate && speced instanceof ICPPSpecialization); assertTrue(speced instanceof ICPPFunctionTemplate && speced instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)speced).getSpecializedBinding(), f2); assertSame(((ICPPSpecialization) speced).getSpecializedBinding(), f2);
ICPPClassType A3 = (ICPPClassType) col.getName(14).resolveBinding(); ICPPClassType A3 = (ICPPClassType) col.getName(14).resolveBinding();
assertSame(A2, A3); assertSame(A2, A3);
@ -940,7 +940,7 @@ public class AST2TemplateTests extends AST2BaseTest {
assertSame(r1, f1_2); assertSame(r1, f1_2);
assertTrue(r2 instanceof ICPPTemplateInstance); assertTrue(r2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)r2).getTemplateDefinition(), speced); assertSame(((ICPPTemplateInstance) r2).getTemplateDefinition(), speced);
assertSame(r3, f2_2); assertSame(r3, f2_2);
} }
@ -963,7 +963,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPClassType r2 = (ICPPClassType) col.getName(7).resolveBinding(); ICPPClassType r2 = (ICPPClassType) col.getName(7).resolveBinding();
assertTrue(r1 instanceof ICPPTemplateInstance); assertTrue(r1 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)r1).getTemplateDefinition(), A1); assertSame(((ICPPTemplateInstance) r1).getTemplateDefinition(), A1);
assertSame(r2, A2); assertSame(r2, A2);
} }
@ -1039,14 +1039,14 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod f1 = (ICPPMethod) col.getName(20).resolveBinding(); ICPPMethod f1 = (ICPPMethod) col.getName(20).resolveBinding();
assertTrue(f1 instanceof ICPPSpecialization); assertTrue(f1 instanceof ICPPSpecialization);
assertTrue(((ICPPSpecialization)f1).getSpecializedBinding() instanceof ICPPMethod); assertTrue(((ICPPSpecialization) f1).getSpecializedBinding() instanceof ICPPMethod);
ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization)f1).getSpecializedBinding(); ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization) f1).getSpecializedBinding();
assertTrue(f2 instanceof ICPPSpecialization); assertTrue(f2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f); assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
IFunctionType ft = f1.getType(); IFunctionType ft = f1.getType();
assertTrue(ft.getReturnType() instanceof IBasicType); assertTrue(ft.getReturnType() instanceof IBasicType);
assertEquals(((IBasicType)ft.getReturnType()).getType(), IBasicType.t_int); assertEquals(((IBasicType) ft.getReturnType()).getType(), IBasicType.t_int);
assertSame(ft.getParameterTypes()[0], C); assertSame(ft.getParameterTypes()[0], C);
} }
@ -1109,23 +1109,23 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField y2 = (ICPPField) col.getName(23).resolveBinding(); ICPPField y2 = (ICPPField) col.getName(23).resolveBinding();
assertTrue(y2 instanceof ICPPSpecialization); assertTrue(y2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)y2).getSpecializedBinding(), y); assertSame(((ICPPSpecialization) y2).getSpecializedBinding(), y);
IType t = y2.getType(); IType t = y2.getType();
assertTrue(t instanceof ICPPTemplateInstance); assertTrue(t instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A1); assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A1);
ICPPField x3 = (ICPPField) col.getName(24).resolveBinding(); ICPPField x3 = (ICPPField) col.getName(24).resolveBinding();
assertTrue(x3 instanceof ICPPSpecialization); assertTrue(x3 instanceof ICPPSpecialization);
assertEquals(((ICPPSpecialization)x3).getSpecializedBinding(), x1); assertEquals(((ICPPSpecialization) x3).getSpecializedBinding(), x1);
ICPPField z2 = (ICPPField) col.getName(26).resolveBinding(); ICPPField z2 = (ICPPField) col.getName(26).resolveBinding();
assertTrue(z2 instanceof ICPPSpecialization); assertTrue(z2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)z2).getSpecializedBinding(), z); assertSame(((ICPPSpecialization) z2).getSpecializedBinding(), z);
t = z2.getType(); t = z2.getType();
assertTrue(t instanceof ICPPTemplateInstance); assertTrue(t instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A2); assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A2);
ICPPField x4 = (ICPPField) col.getName(27).resolveBinding(); ICPPField x4 = (ICPPField) col.getName(27).resolveBinding();
assertTrue(x4 instanceof ICPPSpecialization); assertTrue(x4 instanceof ICPPSpecialization);
assertEquals(((ICPPSpecialization)x4).getSpecializedBinding(), x2); assertEquals(((ICPPSpecialization) x4).getSpecializedBinding(), x2);
} }
// template <class T> class A { // template <class T> class A {
@ -1150,16 +1150,16 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField t2 = (ICPPField) col.getName(11).resolveBinding(); ICPPField t2 = (ICPPField) col.getName(11).resolveBinding();
assertTrue(t2 instanceof ICPPSpecialization); assertTrue(t2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t); assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
IType type = t2.getType(); IType type = t2.getType();
assertTrue(type instanceof ITypedef); assertTrue(type instanceof ITypedef);
assertTrue(type instanceof ICPPSpecialization); assertTrue(type instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), _T); assertSame(((ICPPSpecialization) type).getSpecializedBinding(), _T);
type = ((ITypedef)type).getType(); type = ((ITypedef) type).getType();
assertTrue(type instanceof IBasicType); assertTrue(type instanceof IBasicType);
assertEquals(((IBasicType)type).getType(), IBasicType.t_int); assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
} }
// template <class T> class A { // template <class T> class A {
@ -1186,16 +1186,16 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField t2 = (ICPPField) col.getName(13).resolveBinding(); ICPPField t2 = (ICPPField) col.getName(13).resolveBinding();
assertTrue(b2 instanceof ICPPSpecialization); assertTrue(b2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)b2).getSpecializedBinding(), b); assertSame(((ICPPSpecialization) b2).getSpecializedBinding(), b);
IType type = b2.getType(); IType type = b2.getType();
assertTrue(type instanceof ICPPSpecialization); assertTrue(type instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), B); assertSame(((ICPPSpecialization) type).getSpecializedBinding(), B);
assertTrue(t2 instanceof ICPPSpecialization); assertTrue(t2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t); assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
assertTrue(t2.getType() instanceof IBasicType); assertTrue(t2.getType() instanceof IBasicType);
assertEquals(((IBasicType)t2.getType()).getType(), IBasicType.t_int); assertEquals(((IBasicType) t2.getType()).getType(), IBasicType.t_int);
} }
// template <class T> class A { // template <class T> class A {
@ -1239,18 +1239,18 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPField s2 = (ICPPField) col.getName(21).resolveBinding(); ICPPField s2 = (ICPPField) col.getName(21).resolveBinding();
assertTrue(s2 instanceof ICPPSpecialization); assertTrue(s2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)s2).getSpecializedBinding(), s); assertSame(((ICPPSpecialization) s2).getSpecializedBinding(), s);
IType t = s2.getType(); IType t = s2.getType();
// assertTrue(t instanceof ITypedef); // assertTrue(t instanceof ITypedef);
// assertTrue(t instanceof ICPPSpecialization); // assertTrue(t instanceof ICPPSpecialization);
// assertSame(((ICPPSpecialization)t).getSpecializedBinding(), _xx); // assertSame(((ICPPSpecialization) t).getSpecializedBinding(), _xx);
t = ((ITypedef)t).getType(); t = ((ITypedef) t).getType();
assertTrue(t instanceof ICPPSpecialization); assertTrue(t instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), X2); assertSame(((ICPPSpecialization) t).getSpecializedBinding(), X2);
t = ((ITypedef)t).getType(); t = ((ITypedef) t).getType();
assertSame(t, B); assertSame(t, B);
} }
@ -1469,7 +1469,7 @@ public class AST2TemplateTests extends AST2BaseTest {
assertSame(((ICPPTemplateInstance)A2).getTemplateDefinition(), A); assertSame(((ICPPTemplateInstance)A2).getTemplateDefinition(), A);
ICPPMethod f2 = (ICPPMethod) col.getName(17).resolveBinding(); ICPPMethod f2 = (ICPPMethod) col.getName(17).resolveBinding();
assertTrue(f2 instanceof ICPPSpecialization); assertTrue(f2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f); assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
ICPPTemplateParameter TR = (ICPPTemplateParameter) col.getName(19).resolveBinding(); ICPPTemplateParameter TR = (ICPPTemplateParameter) col.getName(19).resolveBinding();
assertSame(T, TR); assertSame(T, TR);
@ -1492,7 +1492,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod h2 = (ICPPMethod) col.getName(54).resolveBinding(); ICPPMethod h2 = (ICPPMethod) col.getName(54).resolveBinding();
assertTrue(h2 instanceof ICPPSpecialization); assertTrue(h2 instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)h2).getSpecializedBinding(), h); assertSame(((ICPPSpecialization) h2).getSpecializedBinding(), h);
} }
// namespace N { // namespace N {
@ -1551,7 +1551,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunction s2 = (ICPPFunction) col.getName(8).resolveBinding(); ICPPFunction s2 = (ICPPFunction) col.getName(8).resolveBinding();
assertTrue(s2 instanceof ICPPTemplateInstance); assertTrue(s2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s); assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s);
ICPPClassType A3 = (ICPPClassType) col.getName(10).resolveBinding(); ICPPClassType A3 = (ICPPClassType) col.getName(10).resolveBinding();
assertTrue(A3 instanceof ICPPTemplateInstance); assertTrue(A3 instanceof ICPPTemplateInstance);
@ -1576,7 +1576,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunctionTemplate s1 = (ICPPFunctionTemplate) col.getName(5).resolveBinding(); ICPPFunctionTemplate s1 = (ICPPFunctionTemplate) col.getName(5).resolveBinding();
ICPPFunction s2 = (ICPPFunction) col.getName(10).resolveBinding(); ICPPFunction s2 = (ICPPFunction) col.getName(10).resolveBinding();
assertTrue(s2 instanceof ICPPTemplateInstance); assertTrue(s2 instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s1); assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s1);
ICPPClassType A3 = (ICPPClassType) col.getName(11).resolveBinding(); ICPPClassType A3 = (ICPPClassType) col.getName(11).resolveBinding();
assertSame(A2, A3); assertSame(A2, A3);
@ -1595,7 +1595,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IASTName f = col.getName(6); IASTName f = col.getName(6);
IASTFunctionDefinition fdef = (IASTFunctionDefinition) f.getParent().getParent(); IASTFunctionDefinition fdef = (IASTFunctionDefinition) f.getParent().getParent();
IASTExpressionStatement statement = (IASTExpressionStatement) ((IASTCompoundStatement)fdef.getBody()).getStatements()[0]; IASTExpressionStatement statement = (IASTExpressionStatement) ((IASTCompoundStatement) fdef.getBody()).getStatements()[0];
IType type = statement.getExpression().getExpressionType(); IType type = statement.getExpression().getExpressionType();
assertTrue(type.isSameType(p.getType())); assertTrue(type.isSameType(p.getType()));
@ -1662,11 +1662,11 @@ public class AST2TemplateTests extends AST2BaseTest {
IBinding r = col.getName(33).resolveBinding(); IBinding r = col.getName(33).resolveBinding();
assertTrue(r instanceof ICPPSpecialization); assertTrue(r instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), begin); assertSame(((ICPPSpecialization) r).getSpecializedBinding(), begin);
r = col.getName(36).resolveBinding(); r = col.getName(36).resolveBinding();
assertTrue(r instanceof ICPPSpecialization); assertTrue(r instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), end); assertSame(((ICPPSpecialization) r).getSpecializedBinding(), end);
assertSame(foo, col.getName(39).resolveBinding()); assertSame(foo, col.getName(39).resolveBinding());
assertSame(foo, col.getName(41).resolveBinding()); assertSame(foo, col.getName(41).resolveBinding());
@ -1692,8 +1692,8 @@ public class AST2TemplateTests extends AST2BaseTest {
IType type = t.getType(); IType type = t.getType();
assertTrue(type instanceof ICPPSpecialization); assertTrue(type instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), _T); assertSame(((ICPPSpecialization) type).getSpecializedBinding(), _T);
assertSame(((IPointerType)((ITypedef)type).getType()).getType(), B); assertSame(((IPointerType) ((ITypedef) type).getType()).getType(), B);
assertSame(i, col.getName(14).resolveBinding()); assertSame(i, col.getName(14).resolveBinding());
} }
@ -1858,7 +1858,7 @@ public class AST2TemplateTests extends AST2BaseTest {
IBinding b = col.getName(9).resolveBinding(); // resolve the binding of the ICPPASTTemplateId first IBinding b = col.getName(9).resolveBinding(); // resolve the binding of the ICPPASTTemplateId first
assertTrue(b instanceof ICPPTemplateInstance); assertTrue(b instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)b).getSpecializedBinding(), f1); assertSame(((ICPPTemplateInstance) b).getSpecializedBinding(), f1);
assertSame(f1, col.getName(10).resolveBinding()); assertSame(f1, col.getName(10).resolveBinding());
@ -1885,7 +1885,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding(); ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding();
assertTrue(a instanceof ICPPTemplateInstance); assertTrue(a instanceof ICPPTemplateInstance);
assertSame(((ICPPTemplateInstance)a).getTemplateDefinition(), A); assertSame(((ICPPTemplateInstance) a).getTemplateDefinition(), A);
assertSame(local, col.getName(7).resolveBinding()); assertSame(local, col.getName(7).resolveBinding());
} }
@ -1928,7 +1928,7 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPClassTemplate complex = (ICPPClassTemplate) col.getName(1).resolveBinding(); ICPPClassTemplate complex = (ICPPClassTemplate) col.getName(1).resolveBinding();
ICPPClassType cspec = (ICPPClassType) col.getName(2).resolveBinding(); ICPPClassType cspec = (ICPPClassType) col.getName(2).resolveBinding();
assertTrue(cspec instanceof ICPPSpecialization); assertTrue(cspec instanceof ICPPSpecialization);
assertSame(((ICPPSpecialization)cspec).getSpecializedBinding(), complex); assertSame(((ICPPSpecialization) cspec).getSpecializedBinding(), complex);
assertSame(complex, col.getName(5).resolveBinding()); assertSame(complex, col.getName(5).resolveBinding());
assertSame(cspec, col.getName(6).resolveBinding()); assertSame(cspec, col.getName(6).resolveBinding());
@ -2374,7 +2374,7 @@ public class AST2TemplateTests extends AST2BaseTest {
assertInstance(tid.resolveBinding(), ICPPTemplateInstance.class); // *D<int>*(5, 6) assertInstance(tid.resolveBinding(), ICPPTemplateInstance.class); // *D<int>*(5, 6)
assertInstance(tid.resolveBinding(), ICPPConstructor.class); // *D<int>*(5, 6) assertInstance(tid.resolveBinding(), ICPPConstructor.class); // *D<int>*(5, 6)
IBinding tidSpc= ((ICPPTemplateInstance)tid.resolveBinding()).getSpecializedBinding(); IBinding tidSpc= ((ICPPTemplateInstance) tid.resolveBinding()).getSpecializedBinding();
assertInstance(tidSpc, ICPPConstructor.class); assertInstance(tidSpc, ICPPConstructor.class);
assertInstance(tidSpc, ICPPSpecialization.class); assertInstance(tidSpc, ICPPSpecialization.class);
assertInstance(tidSpc, ICPPFunctionTemplate.class); assertInstance(tidSpc, ICPPFunctionTemplate.class);
@ -2807,7 +2807,7 @@ public class AST2TemplateTests extends AST2BaseTest {
tu.accept(col); tu.accept(col);
assertInstance(col.getName(3), ICPPASTTemplateId.class); assertInstance(col.getName(3), ICPPASTTemplateId.class);
assertInstance(((ICPPASTTemplateId)col.getName(3)).getTemplateArguments()[0], ICPPASTUnaryExpression.class); assertInstance(((ICPPASTTemplateId) col.getName(3)).getTemplateArguments()[0], ICPPASTUnaryExpression.class);
} }
// template<class T1, int q> class C {}; // template<class T1, int q> class C {};
@ -5256,7 +5256,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// void test() { // void test() {
// P(C()); // P(C());
// } // }
public void _testFunctionInstanceAsTemplateArg_Bug334472() throws Exception { public void testFunctionInstanceAsTemplateArg_Bug334472() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -125,7 +125,7 @@ import org.eclipse.cdt.internal.core.model.ASTStringUtil;
import org.eclipse.cdt.internal.core.parser.ParserException; import org.eclipse.cdt.internal.core.parser.ParserException;
/** /**
* Testcases on the AST. * Test cases on the AST.
*/ */
public class AST2Tests extends AST2BaseTest { public class AST2Tests extends AST2BaseTest {
private static final int NUM_TESTS = 3; private static final int NUM_TESTS = 3;
@ -4866,10 +4866,9 @@ public class AST2Tests extends AST2BaseTest {
// myUnionPointer->bar=4; // myUnionPointer->bar=4;
// } // }
public void testBug228504_nonExistingMembers() throws Exception { public void testBug228504_nonExistingMembers() throws Exception {
boolean[] isCpps= {true, false}; for (ParserLanguage lang: ParserLanguage.values()) {
for (boolean isCpp : isCpps) { BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang);
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp); for (int i= 1; i < 5; i++) {
for (int i=1; i < 5; i++) {
ba.assertNonProblem("foo=" + i, 3); ba.assertNonProblem("foo=" + i, 3);
ba.assertProblem("bar=" + i, 3); ba.assertProblem("bar=" + i, 3);
} }
@ -4912,10 +4911,9 @@ public class AST2Tests extends AST2BaseTest {
// function1(); // ref // function1(); // ref
// } // }
public void testOutOfOrderResolution_Bug232300() throws Exception { public void testOutOfOrderResolution_Bug232300() throws Exception {
final boolean[] isCpps= {false, true};
String code= getAboveComment(); String code= getAboveComment();
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
IBinding b1= ba.assertNonProblem("function1(); // decl", 9); IBinding b1= ba.assertNonProblem("function1(); // decl", 9);
IBinding b2= ba.assertNonProblem("function1() {", 9); IBinding b2= ba.assertNonProblem("function1() {", 9);
IBinding b3= ba.assertNonProblem("function1(); // ref", 9); IBinding b3= ba.assertNonProblem("function1(); // ref", 9);
@ -4927,10 +4925,9 @@ public class AST2Tests extends AST2BaseTest {
// #define foo __typeof__((int*)0 - (int*)0) // #define foo __typeof__((int*)0 - (int*)0)
// typedef foo ptrdiff_t; // typedef foo ptrdiff_t;
public void testRedefinePtrdiff_Bug230895() throws Exception { public void testRedefinePtrdiff_Bug230895() throws Exception {
final boolean[] isCpps= {false, true};
String code= getAboveComment(); String code= getAboveComment();
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
IBinding b1= ba.assertNonProblem("ptrdiff_t", 9); IBinding b1= ba.assertNonProblem("ptrdiff_t", 9);
assertInstance(b1, ITypedef.class); assertInstance(b1, ITypedef.class);
ITypedef td= (ITypedef) b1; ITypedef td= (ITypedef) b1;
@ -4944,10 +4941,9 @@ public class AST2Tests extends AST2BaseTest {
// struct S; // struct S;
// typedef struct S S; // td // typedef struct S S; // td
public void testRedefineStructInScopeThatIsFullyResolved() throws Exception { public void testRedefineStructInScopeThatIsFullyResolved() throws Exception {
final boolean[] isCpps= {false, true};
String code= getAboveComment(); String code= getAboveComment();
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
ba.assertNonProblem("a; // ref", 1); ba.assertNonProblem("a; // ref", 1);
// now scope is fully resolved // now scope is fully resolved
ICompositeType ct= ba.assertNonProblem("S;", 1, ICompositeType.class); ICompositeType ct= ba.assertNonProblem("S;", 1, ICompositeType.class);
@ -4972,10 +4968,9 @@ public class AST2Tests extends AST2BaseTest {
// VOID func(VOID) { // VOID func(VOID) {
// } // }
public void testTypedefVoid_Bug221567() throws Exception { public void testTypedefVoid_Bug221567() throws Exception {
final boolean[] isCpps= { false, true };
String code= getAboveComment(); String code= getAboveComment();
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
ITypedef td= ba.assertNonProblem("VOID;", 4, ITypedef.class); ITypedef td= ba.assertNonProblem("VOID;", 4, ITypedef.class);
IBinding ref= ba.assertNonProblem("VOID)", 4); IBinding ref= ba.assertNonProblem("VOID)", 4);
assertSame(td, ref); assertSame(td, ref);
@ -5021,9 +5016,8 @@ public class AST2Tests extends AST2BaseTest {
// int f5(int *(tint[10])); // int f5(int *(tint[10]));
public void testParamWithFunctionType_Bug84242() throws Exception { public void testParamWithFunctionType_Bug84242() throws Exception {
final String comment= getAboveComment(); final String comment= getAboveComment();
final boolean[] isCpps= {false, true}; for (ParserLanguage lang: ParserLanguage.values()) {
for (boolean isCpp : isCpps) { BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class); IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
isTypeEqual(f.getType(), "int (int (*)(int))"); isTypeEqual(f.getType(), "int (int (*)(int))");
@ -5055,9 +5049,8 @@ public class AST2Tests extends AST2BaseTest {
// int (*f1 (int par))[5]; // int (*f1 (int par))[5];
public void testFunctionReturningPtrToArray_Bug216609() throws Exception { public void testFunctionReturningPtrToArray_Bug216609() throws Exception {
final String comment= getAboveComment(); final String comment= getAboveComment();
final boolean[] isCpps= {false, true}; for (ParserLanguage lang: ParserLanguage.values()) {
for (boolean isCpp : isCpps) { BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang);
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp);
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class); IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
isTypeEqual(f.getType(), "int (* (int))[5]"); isTypeEqual(f.getType(), "int (* (int))[5]");
@ -5077,7 +5070,6 @@ public class AST2Tests extends AST2BaseTest {
// void ((f4)()); // void ((f4)());
public void testNestedFunctionDeclarators() throws Exception { public void testNestedFunctionDeclarators() throws Exception {
final String comment= getAboveComment(); final String comment= getAboveComment();
final boolean[] isCpps= {false, true};
for (ParserLanguage lang: ParserLanguage.values()) { for (ParserLanguage lang: ParserLanguage.values()) {
IASTTranslationUnit tu= parseAndCheckBindings(comment, lang); IASTTranslationUnit tu= parseAndCheckBindings(comment, lang);
IASTFunctionDefinition fdef= getDeclaration(tu, 0); IASTFunctionDefinition fdef= getDeclaration(tu, 0);
@ -5133,8 +5125,8 @@ public class AST2Tests extends AST2BaseTest {
public void testLocalVariableResolution_Bug235831() throws Exception { public void testLocalVariableResolution_Bug235831() throws Exception {
final String comment= getAboveComment(); final String comment= getAboveComment();
final boolean[] isCpps= {false, true}; final boolean[] isCpps= {false, true};
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
ba.assertNonProblem("b; a", 1, IVariable.class); // fill cache of inner block ba.assertNonProblem("b; a", 1, IVariable.class); // fill cache of inner block
IVariable v3= ba.assertNonProblem("a; }", 1, IVariable.class); IVariable v3= ba.assertNonProblem("a; }", 1, IVariable.class);
@ -5148,9 +5140,8 @@ public class AST2Tests extends AST2BaseTest {
// int foo(int (*ptr) (int, int)); // int foo(int (*ptr) (int, int));
public void testComplexParameterBinding_Bug214482() throws Exception { public void testComplexParameterBinding_Bug214482() throws Exception {
final String comment= getAboveComment(); final String comment= getAboveComment();
final boolean[] isCpps= {false, true}; for (ParserLanguage lang: ParserLanguage.values()) {
for (boolean isCpp : isCpps) { BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
IParameter p= ba.assertNonProblem("ptr", 3, IParameter.class); IParameter p= ba.assertNonProblem("ptr", 3, IParameter.class);
assertEquals("ptr", p.getName()); assertEquals("ptr", p.getName());
} }
@ -5519,8 +5510,8 @@ public class AST2Tests extends AST2BaseTest {
// } // }
public void testAnonymousUnionMember() throws Exception { public void testAnonymousUnionMember() throws Exception {
final boolean[] isCpps= {false, true}; final boolean[] isCpps= {false, true};
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), isCpp); BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), lang);
bh.assertNonProblem("a1=", 2); bh.assertNonProblem("a1=", 2);
bh.assertProblem("a2=", 2); bh.assertProblem("a2=", 2);
bh.assertNonProblem("a3=", 2); bh.assertNonProblem("a3=", 2);
@ -5794,9 +5785,8 @@ public class AST2Tests extends AST2BaseTest {
// enum X {e0, e4=4, e5, e2=2, e3}; // enum X {e0, e4=4, e5, e2=2, e3};
public void testValues() throws Exception { public void testValues() throws Exception {
final String code= getAboveComment(); final String code= getAboveComment();
boolean isCpp= false; for (ParserLanguage lang: ParserLanguage.values()) {
do { BindingAssertionHelper bh= new BindingAssertionHelper(code, lang);
BindingAssertionHelper bh= new BindingAssertionHelper(code, false);
IVariable v= (IVariable) bh.assertNonProblem("a=", 1); IVariable v= (IVariable) bh.assertNonProblem("a=", 1);
checkValue(v.getInitialValue(), -4); checkValue(v.getInitialValue(), -4);
v= (IVariable) bh.assertNonProblem("b=", 1); v= (IVariable) bh.assertNonProblem("b=", 1);
@ -5814,8 +5804,7 @@ public class AST2Tests extends AST2BaseTest {
checkValue(e.getValue(), 4); checkValue(e.getValue(), 4);
e= (IEnumerator) bh.assertNonProblem("e5", 2); e= (IEnumerator) bh.assertNonProblem("e5", 2);
checkValue(e.getValue(), 5); checkValue(e.getValue(), 5);
isCpp= !isCpp; }
} while (isCpp);
} }
private void checkValue(IValue initialValue, int i) { private void checkValue(IValue initialValue, int i) {
@ -6088,11 +6077,10 @@ public class AST2Tests extends AST2BaseTest {
// size_t x = a + 5; // size_t x = a + 5;
// size_t y = 2 + a; // size_t y = 2 + a;
// size_t y = a * 2; // size_t y = a * 2;
public void testTypeOfExpressionWithTypedef_380498() throws Exception { public void testTypeOfExpressionWithTypedef_380498_1() throws Exception {
final boolean[] isCpps= { false, true };
String code= getAboveComment(); String code= getAboveComment();
for (boolean isCpp : isCpps) { for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
IASTExpression exp = ba.assertNode("a + 5", IASTExpression.class); IASTExpression exp = ba.assertNode("a + 5", IASTExpression.class);
assertTrue(exp.getExpressionType() instanceof ITypedef); assertTrue(exp.getExpressionType() instanceof ITypedef);
assertEquals("size_t", ((ITypedef) exp.getExpressionType()).getName()); assertEquals("size_t", ((ITypedef) exp.getExpressionType()).getName());
@ -6105,6 +6093,21 @@ public class AST2Tests extends AST2BaseTest {
} }
} }
// typedef void* VoidPtr;
// typedef VoidPtr (*Func)();
//
// void test(Func f) {
// f();
// }
public void testTypeOfExpressionWithTypedef_380498_2() throws Exception {
String code= getAboveComment();
for (ParserLanguage lang: ParserLanguage.values()) {
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
IASTExpression exp = ba.assertNode("f()", IASTExpression.class);
assertTrue(exp.getExpressionType() instanceof ITypedef);
assertEquals("VoidPtr", ((ITypedef) exp.getExpressionType()).getName());
}
}
// typedef int TInt; // typedef int TInt;
// int a= TInt; //ref // int a= TInt; //ref
public void testTypeAsExpressionIsProblem_261175() throws Exception { public void testTypeAsExpressionIsProblem_261175() throws Exception {
@ -7038,7 +7041,7 @@ public class AST2Tests extends AST2BaseTest {
// newArray var5; // newArray var5;
// //
// void foo() { // void foo() {
// /* The type of the arraysubscript expression should be struct s // /* The type of the array subscript expression should be struct s
// * each of the following statements // * each of the following statements
// */ // */
// var1[1].a = 1; // var1[1].a = 1;

View file

@ -17,6 +17,7 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
@ -1544,19 +1545,19 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// CT<int> v1; // CT<int> v1;
public void testUniqueInstance_Bug241641() throws Exception { public void testUniqueInstance_Bug241641() throws Exception {
IASTName name= findName("v1", 2);
ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class); ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class);
ICPPVariable v2= getBindingFromASTName("v1", 2, ICPPVariable.class);
IType t1= v1.getType(); IType t1= v1.getType();
assertInstance(t1, ICPPTemplateInstance.class); assertInstance(t1, ICPPTemplateInstance.class);
ICPPTemplateInstance inst= (ICPPTemplateInstance) t1; ICPPTemplateInstance inst= (ICPPTemplateInstance) t1;
final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition(); final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition();
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments()); IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), name);
assertSame(inst, inst2); assertSame(inst, inst2);
IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}); IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, name);
IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}); IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, name);
assertSame(charInst1, charInst2); assertSame(charInst1, charInst2);
} }

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -45,7 +45,7 @@
</dependency> </dependency>
<dependency> <dependency>
<artifactId>org.eclipse.cdt.feature.group</artifactId> <artifactId>org.eclipse.cdt.feature.group</artifactId>
<version>8.1.0.${buildQualifier}</version> <version>8.2.0.${buildQualifier}</version>
<type>p2-installable-unit</type> <type>p2-installable-unit</type>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -6,6 +6,10 @@ int Hallo;
//%CPP //%CPP
int TestClass::Hallo; int TestClass::Hallo;
//!FullyQualifiedName
//%CPP
int ::name;
//!OperatorName //!OperatorName
//%CPP //%CPP
class Foo class Foo

View file

@ -2978,6 +2978,7 @@ class test
//= //=
=>leading =>leading
#ifndef TEST_H_ = //TEST
=>trailing =>trailing
=>freestanding =>freestanding
@ -2999,6 +3000,9 @@ class test
//= //=
=>leading =>leading
#ifndef TEST_H_ = /*
* Licence information...
*/
=>trailing =>trailing
=>freestanding =>freestanding
@ -3021,6 +3025,9 @@ class test
//= //=
=>leading =>leading
#ifndef TEST_H_ = /*
* Licence information...
*/
class test class test
{ {
}; = //test }; = //test
@ -3054,7 +3061,11 @@ private:
//= //=
=>leading =>leading
#ifndef HIDEMETHOD_H_ = /*
* HideMethod.h
*/
=>trailing =>trailing
#endif = /* HIDEMETHOD_H_ */
=>freestanding =>freestanding
//!CommentRecognition Bug 233438 //!CommentRecognition Bug 233438
@ -3077,6 +3088,7 @@ private:
//= //=
=>leading =>leading
=>trailing =>trailing
#endif = /* HIDEMETHOD_H_ */
=>freestanding =>freestanding
//@test.cpp //@test.cpp
@ -3122,6 +3134,7 @@ private:
//= //=
=>leading =>leading
=>trailing =>trailing
#endif = /* HIDEMETHOD_H_ */
=>freestanding =>freestanding
//@test.cpp //@test.cpp
@ -3145,4 +3158,44 @@ int HideMethod::methode2(){
=>trailing =>trailing
i++; = //comment i++; = //comment
=>freestanding =>freestanding
//!CommentRecognition preprocessor directives comment recognition
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
//@main.cpp
//c1
int i;//c2
//inc1
//inc2
#include "foo.h" /*inc3*/ /*inc4*/
//main
int main() {
return 0;
//block1
}
//ifdef1
#ifdef X //ifdef2
//=
=>leading
int i; = //c1
#include "foo.h" = //inc1 , //inc2
int main() {
return 0;
//block1
} = //main
#ifdef X = //ifdef1
=>trailing
int i; = //c2
#include "foo.h" = /*inc3*/ , /*inc4*/
#ifdef X = //ifdef2
=>freestanding
{
return 0;
//block1
} = //block1
//@foo.h
void foo();
//=
=>leading
=>trailing
=>freestanding

View file

@ -36,6 +36,7 @@ import org.eclipse.cdt.utils.ByteUtilsTest;
import org.eclipse.cdt.utils.CdtVariableResolverTest; import org.eclipse.cdt.utils.CdtVariableResolverTest;
import org.eclipse.cdt.utils.CommandLineUtilTest; import org.eclipse.cdt.utils.CommandLineUtilTest;
import org.eclipse.cdt.utils.FindProgramLocationTest; import org.eclipse.cdt.utils.FindProgramLocationTest;
import org.eclipse.cdt.utils.StorableCdtVariablesTest;
import org.eclipse.cdt.utils.WeakHashSetTest; import org.eclipse.cdt.utils.WeakHashSetTest;
/** /**
@ -76,6 +77,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
suite.addTest(AllLanguageTests.suite()); suite.addTest(AllLanguageTests.suite());
suite.addTest(RewriteTests.suite()); suite.addTest(RewriteTests.suite());
suite.addTest(CdtVariableResolverTest.suite()); suite.addTest(CdtVariableResolverTest.suite());
suite.addTest(StorableCdtVariablesTest.suite());
suite.addTest(CommandLineUtilTest.suite()); suite.addTest(CommandLineUtilTest.suite());
suite.addTest(WeakHashSetTest.suite()); suite.addTest(WeakHashSetTest.suite());
suite.addTest(FindProgramLocationTest.suite()); suite.addTest(FindProgramLocationTest.suite());

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View file

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><component id="org.eclipse.cdt.core" version="2">
<resource path="model/org/eclipse/cdt/core/settings/model/ICDescriptionDelta.java" type="org.eclipse.cdt.core.settings.model.ICDescriptionDelta">
<filter comment="Temporary filter to ignore added API restictions for interfaces that should be internal to begin with" id="403853384">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.settings.model.ICDescriptionDelta"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/cdt/core/settings/model/ICSettingEntry.java" type="org.eclipse.cdt.core.settings.model.ICSettingEntry">
<filter comment="Temporary filter to ignore added API restictions for interfaces that should be internal to begin with" id="403853384">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.settings.model.ICSettingEntry"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/dom/ast/IASTCopyLocation.java" type="org.eclipse.cdt.core.dom.ast.IASTCopyLocation">
<filter id="403853384">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.dom.ast.IASTCopyLocation"/>
</message_arguments>
</filter>
<filter id="406052990">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.dom.ast.IASTCopyLocation"/>
<message_argument value="getOriginalNode()"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/parser/util/ArrayUtil.java" type="org.eclipse.cdt.core.parser.util.ArrayUtil">
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.addAll(Class&lt;?&gt;, Object[], Object[])"/>
<message_argument value="T"/>
</message_arguments>
</filter>
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.append(Class&lt;?&gt;, Object[], Object)"/>
<message_argument value="T"/>
</message_arguments>
</filter>
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.prepend(Class&lt;?&gt;, Object[], Object)"/>
<message_argument value="T"/>
</message_arguments>
</filter>
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.removeNulls(Class&lt;?&gt;, Object[])"/>
<message_argument value="T"/>
</message_arguments>
</filter>
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.trim(Class&lt;?&gt;, Object[])"/>
<message_argument value="T"/>
</message_arguments>
</filter>
<filter id="420679712">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.parser.util.ArrayUtil.trim(Class&lt;?&gt;, Object[], boolean)"/>
<message_argument value="T"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/resources/RefreshScopeManager.java" type="org.eclipse.cdt.core.resources.RefreshScopeManager">
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="addExclusion(IResource, RefreshExclusion)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="addResourceToRefresh(IProject, IResource)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="clearAllExclusions()"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="clearAllResourcesToRefresh()"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="clearExclusions(IResource)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="clearExclusionsForProject(IProject)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="deleteResourceToRefresh(IProject, IResource)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="getExclusions(IResource)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="getRefreshSchedulingRule(IProject)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="getResourcesToRefresh(IProject)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="removeExclusion(IResource, RefreshExclusion)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="setExclusions(IResource, List&lt;RefreshExclusion&gt;)"/>
</message_arguments>
</filter>
<filter id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="setResourcesToRefresh(IProject, List&lt;IResource&gt;)"/>
</message_arguments>
</filter>
<filter comment="routines no longer needed for RefreshScopeManager" id="338792546">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
<message_argument value="shouldResourceBeRefreshed(IResource)"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
Bundle-Version: 5.4.0.qualifier Bundle-Version: 5.5.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; package org.eclipse.cdt.internal.core.model.ext;
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField { public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
private ASTAccessVisibility fVisibility; private ASTAccessVisibility fVisibility;
private String fTypeName; private String fTypeName;
private boolean fIsStatic; private boolean fIsStatic;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others. * Copyright (c) 2005, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Rational Software - initial implementation * Rational Software - initial implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
@ -350,7 +351,8 @@ public class ASTTypeUtil {
result.append(Keywords.ENUM); result.append(Keywords.ENUM);
result.append(SPACE); result.append(SPACE);
} }
appendCppName((ICPPBinding) type, normalize, normalize, result); boolean qualify = normalize || (type instanceof ITypedef && type instanceof ICPPSpecialization);
appendCppName((ICPPBinding) type, normalize, qualify, result);
} else if (type instanceof ICompositeType) { } else if (type instanceof ICompositeType) {
// 101114 fix, do not display class, and for consistency don't display struct/union as well // 101114 fix, do not display class, and for consistency don't display struct/union as well
appendNameCheckAnonymous((ICompositeType) type, result); appendNameCheckAnonymous((ICompositeType) type, result);
@ -469,13 +471,13 @@ public class ASTTypeUtil {
public static void appendType(IType type, boolean normalize, StringBuilder result) { public static void appendType(IType type, boolean normalize, StringBuilder result) {
IType[] types = new IType[DEAULT_ITYPE_SIZE]; IType[] types = new IType[DEAULT_ITYPE_SIZE];
// push all of the types onto the stack // Push all of the types onto the stack
int i = 0; int i = 0;
IQualifierType cvq= null; IQualifierType cvq= null;
ICPPReferenceType ref= null; ICPPReferenceType ref= null;
while (type != null && ++i < 100) { while (type != null && ++i < 100) {
if (type instanceof ITypedef) { if (type instanceof ITypedef) {
if (normalize || type instanceof ICPPSpecialization) { if (normalize) {
// Skip the typedef and proceed with its target type. // Skip the typedef and proceed with its target type.
} else { } else {
// Output reference, qualifier and typedef, then stop. // Output reference, qualifier and typedef, then stop.
@ -608,18 +610,14 @@ public class ASTTypeUtil {
IBinding binding = declarator.getName().resolveBinding(); IBinding binding = declarator.getName().resolveBinding();
IType type = null; IType type = null;
try { if (binding instanceof IEnumerator) {
if (binding instanceof IEnumerator) { type = ((IEnumerator)binding).getType();
type = ((IEnumerator) binding).getType(); } else if (binding instanceof IFunction) {
} else if (binding instanceof IFunction) { type = ((IFunction)binding).getType();
type = ((IFunction) binding).getType(); } else if (binding instanceof ITypedef) {
} else if (binding instanceof ITypedef) { type = ((ITypedef)binding).getType();
type = ((ITypedef) binding).getType(); } else if (binding instanceof IVariable) {
} else if (binding instanceof IVariable) { type = ((IVariable)binding).getType();
type = ((IVariable) binding).getType();
}
} catch (DOMException e) {
return EMPTY_STRING;
} }
if (type != null) { if (type != null) {

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* John Camelon (IBM Rational Software) - Initial API and implementation * John Camelon (IBM Rational Software) - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
@ -142,7 +142,8 @@ public interface IASTUnaryExpression extends IASTExpression {
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and * <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
* it's nested <code>IASTExpression</code>. * it's nested <code>IASTExpression</code>.
*/ */
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$ public static final ASTNodeProperty OPERAND =
new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$
/** /**
* Get the operand. * Get the operand.

View file

@ -23,7 +23,7 @@ public interface IEnumerator extends IBinding {
* *
* @return the type of the enumeration * @return the type of the enumeration
*/ */
public IType getType() throws DOMException; public IType getType();
/** /**
* Returns the value assigned to this enumerator. * Returns the value assigned to this enumerator.

View file

@ -13,6 +13,7 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFileSet; import org.eclipse.cdt.core.index.IIndexFileSet;
/** /**
@ -87,34 +88,106 @@ public interface IScope {
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings); public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings);
/** /**
* Get the bindings in this scope that the given name or prefix could resolve to. Could * @deprecated Use {@link #getBindings(ScopeLookupData)} instead
* return null if there is no matching bindings in this scope, if the bindings have not
* yet been cached in this scope, or if resolve == false and the appropriate bindings
* have not yet been resolved.
*
* @param name
* @param resolve :
* whether or not to resolve the matching bindings if they have not
* been so already.
* @param prefixLookup whether the lookup is for a full name or a prefix
* @return : the bindings in this scope that match the name or prefix, or null
*/ */
@Deprecated
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup); public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup);
/**
* @deprecated Use {@link #getBindings(ScopeLookupData)} instead
*/
@Deprecated
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings);
/**
* @since 5.5
* @noextend This class is not intended to be subclassed by clients.
*/
public static class ScopeLookupData {
private char[] fLookupKey;
private final IASTNode fLookupPoint;
private final IASTTranslationUnit fTu;
private final boolean fLookupPointIsName;
private boolean fResolve= true;
private boolean fPrefixLookup= false;
private boolean fIgnorePointOfDeclaration= false;
public ScopeLookupData(IASTName name, boolean resolve, boolean prefixLookup) {
if (name == null)
throw new IllegalArgumentException();
fLookupPoint = name;
fLookupPointIsName= true;
fLookupKey= name.getLookupKey();
fResolve = resolve;
fPrefixLookup = prefixLookup;
fTu= name.getTranslationUnit();
}
public ScopeLookupData(char[] name, IASTNode point) {
// To support IScope.find(...) the lookup point may be null.
fLookupPoint= point;
fLookupPointIsName= false;
fLookupKey= name;
fIgnorePointOfDeclaration= true;
if (fLookupPoint == null) {
fTu= null;
fIgnorePointOfDeclaration= true;
} else {
fTu= fLookupPoint.getTranslationUnit();
}
}
public void setPrefixLookup(boolean prefixLookup) {
fPrefixLookup = prefixLookup;
}
public void setResolve(boolean resolve) {
fResolve = resolve;
}
public void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) {
fIgnorePointOfDeclaration = ignorePointOfDeclaration;
}
public void setLookupKey(char[] key) {
fLookupKey= key;
}
public char[] getLookupKey() {
return fLookupKey;
}
public IASTNode getLookupPoint() {
return fLookupPoint;
}
public boolean isResolve() {
return fResolve;
}
public boolean isPrefixLookup() {
return fPrefixLookup;
}
public boolean isIgnorePointOfDeclaration() {
return fIgnorePointOfDeclaration;
}
public IIndexFileSet getIncludedFiles() {
return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet();
}
public IIndex getIndex() {
return fTu == null ? null : fTu.getIndex();
}
public IASTName getLookupName() {
return fLookupPointIsName ? (IASTName) fLookupPoint : null;
}
public IASTTranslationUnit getTranslationUnit() {
return fTu;
}
}
/** /**
* Get the bindings in this scope that the given name or prefix could resolve to. Could * Get the bindings in this scope that the given name or prefix could resolve to. Could
* return null if there is no matching bindings in this scope, if the bindings have not * return null if there is no matching bindings in this scope, if the bindings have not
* yet been cached in this scope, or if resolve == false and the appropriate bindings * yet been cached in this scope, or if resolve == false and the appropriate bindings
* have not yet been resolved. * have not yet been resolved.
* *
* @param name
* @param resolve :
* whether or not to resolve the matching bindings if they have not
* been so already.
* @param prefixLookup whether the lookup is for a full name or a prefix
* @param acceptLocalBindings a set of files for which to accept local bindings.
* @return : the bindings in this scope that match the name or prefix, or null * @return : the bindings in this scope that match the name or prefix, or null
* @since 5.5
*/ */
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings); public IBinding[] getBindings(ScopeLookupData lookup);
} }

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpression, IASTImplicitNameOwner { public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpression, ICPPASTExpression, IASTImplicitNameOwner {
@Override @Override
public ICPPASTArraySubscriptExpression copy(); public ICPPASTArraySubscriptExpression copy();
@ -29,4 +29,16 @@ public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpre
*/ */
@Override @Override
public ICPPASTArraySubscriptExpression copy(CopyStyle style); public ICPPASTArraySubscriptExpression copy(CopyStyle style);
/**
* @since 5.5
*/
@Override
public ICPPASTExpression getArrayExpression();
/**
* @since 5.5
*/
@Override
public ICPPASTInitializerClause getArgument();
} }

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTBinaryExpression extends IASTBinaryExpression, IASTImplicitNameOwner { public interface ICPPASTBinaryExpression extends IASTBinaryExpression, ICPPASTExpression, IASTImplicitNameOwner {
/** /**
* <code>op_pmdot</code> pointer-to-member field dereference. * <code>op_pmdot</code> pointer-to-member field dereference.
*/ */

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTCastExpression extends IASTCastExpression { public interface ICPPASTCastExpression extends IASTCastExpression, ICPPASTExpression {
/** /**
* <code>op_dynamic_cast</code> is used for dynamic_cast<>'s. * <code>op_dynamic_cast</code> is used for dynamic_cast<>'s.
*/ */

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTDeleteExpression extends IASTExpression, IASTImplicitNameOwner { public interface ICPPASTDeleteExpression extends ICPPASTExpression, IASTImplicitNameOwner {
/** /**
* <code>OPERAND</code> is the expression representing the pointer being * <code>OPERAND</code> is the expression representing the pointer being
* deleted. * deleted.

View file

@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
/**
* Interface for c++ expressions.
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 5.5
*/
public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause {
}

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTExpressionList extends IASTExpressionList, IASTImplicitNameOwner { public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner {
@Override @Override
public ICPPASTExpressionList copy(); public ICPPASTExpressionList copy();

View file

@ -22,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTFieldReference extends IASTFieldReference, IASTImplicitNameOwner { public interface ICPPASTFieldReference extends IASTFieldReference, ICPPASTExpression, IASTImplicitNameOwner {
/** /**
* Was template keyword used? * Was template keyword used?
*/ */
@ -52,4 +52,10 @@ public interface ICPPASTFieldReference extends IASTFieldReference, IASTImplicitN
* @since 5.4 * @since 5.4
*/ */
public IType getFieldOwnerType(); public IType getFieldOwnerType();
/**
* @since 5.5
*/
@Override
public ICPPASTExpression getFieldOwner();
} }

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTFunctionCallExpression extends IASTFunctionCallExpression, IASTImplicitNameOwner { public interface ICPPASTFunctionCallExpression extends IASTFunctionCallExpression, ICPPASTExpression, IASTImplicitNameOwner {
@Override @Override
ICPPASTFunctionCallExpression copy(); ICPPASTFunctionCallExpression copy();

View file

@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
/**
* C++ specific initializer clause
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 5.5
*/
public interface ICPPASTInitializerClause extends IASTInitializerClause {
/**
* Returns the evaluation object for this expression.
* @noreference This method is not intended to be referenced by clients.
*/
ICPPEvaluation getEvaluation();
}

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTInitializerList extends IASTInitializerList, ICPPASTPackExpandable { public interface ICPPASTInitializerList extends IASTInitializerList, ICPPASTInitializerClause, ICPPASTPackExpandable {
@Override @Override
ICPPASTInitializerList copy(); ICPPASTInitializerList copy();

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
@ -23,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTLambdaExpression extends IASTExpression, IASTImplicitNameOwner { public interface ICPPASTLambdaExpression extends ICPPASTExpression, IASTImplicitNameOwner {
ASTNodeProperty CAPTURE = new ASTNodeProperty("ICPPASTLambdaExpression - CAPTURE [ICPPASTCapture]"); //$NON-NLS-1$ ASTNodeProperty CAPTURE = new ASTNodeProperty("ICPPASTLambdaExpression - CAPTURE [ICPPASTCapture]"); //$NON-NLS-1$
ASTNodeProperty DECLARATOR = new ASTNodeProperty("ICPPASTLambdaExpression - DECLARATOR [ICPPASTFunctionDeclarator]"); //$NON-NLS-1$ ASTNodeProperty DECLARATOR = new ASTNodeProperty("ICPPASTLambdaExpression - DECLARATOR [ICPPASTFunctionDeclarator]"); //$NON-NLS-1$
ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTLambdaExpression - BODY [IASTCompoundStatement]"); //$NON-NLS-1$ ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTLambdaExpression - BODY [IASTCompoundStatement]"); //$NON-NLS-1$

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTLiteralExpression extends IASTLiteralExpression { public interface ICPPASTLiteralExpression extends IASTLiteralExpression, ICPPASTExpression {
/** /**
* <code>lk_this</code> represents the 'this' keyword. * <code>lk_this</code> represents the 'this' keyword.

View file

@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTNewExpression extends IASTExpression, IASTImplicitNameOwner { public interface ICPPASTNewExpression extends ICPPASTExpression, IASTImplicitNameOwner {
public static final ASTNodeProperty NEW_PLACEMENT = new ASTNodeProperty( public static final ASTNodeProperty NEW_PLACEMENT = new ASTNodeProperty(
"ICPPASTNewExpression.NEW_PLACEMENT [IASTExpression]"); //$NON-NLS-1$ "ICPPASTNewExpression.NEW_PLACEMENT [IASTExpression]"); //$NON-NLS-1$

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
* @since 5.2 * @since 5.2
*/ */
public interface ICPPASTPackExpansionExpression extends IASTExpression { public interface ICPPASTPackExpansionExpression extends ICPPASTExpression {
/** /**
* Represents the relationship between a pack-expansion and its pattern. * Represents the relationship between a pack-expansion and its pattern.

View file

@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTSimpleTypeConstructorExpression extends IASTExpression { public interface ICPPASTSimpleTypeConstructorExpression extends ICPPASTExpression {
/** /**
* @since 5.2 * @since 5.2
*/ */

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTTypeIdExpression extends IASTTypeIdExpression { public interface ICPPASTTypeIdExpression extends IASTTypeIdExpression, ICPPASTExpression {
public static final int op_typeid = IASTTypeIdExpression.op_typeid; public static final int op_typeid = IASTTypeIdExpression.op_typeid;

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTUnaryExpression extends IASTUnaryExpression, IASTImplicitNameOwner { public interface ICPPASTUnaryExpression extends IASTUnaryExpression, ICPPASTExpression, IASTImplicitNameOwner {
/** /**
* <code>op_throw</code> throw exp * <code>op_throw</code> throw exp
*/ */

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