mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
e82bdd7f70
404 changed files with 9568 additions and 6100 deletions
|
@ -2,7 +2,7 @@
|
|||
<feature
|
||||
id="org.eclipse.cdt.autotools"
|
||||
label="%featureName"
|
||||
version="3.0.1.qualifier"
|
||||
version="3.2.0.qualifier"
|
||||
provider-name="%provider">
|
||||
|
||||
<description>
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.eclipse.cdt.features</groupId>
|
||||
<version>3.0.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.autotools</artifactId>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
</project>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<feature
|
||||
id="org.eclipse.cdt.autotools.source"
|
||||
label="%featureName"
|
||||
version="3.0.1.qualifier"
|
||||
version="3.2.0.qualifier"
|
||||
provider-name="%provider">
|
||||
|
||||
<description>
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<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>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
</project>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<feature
|
||||
id="org.eclipse.cdt.gnu.build"
|
||||
label="%featureName"
|
||||
version="8.1.0.qualifier"
|
||||
version="8.2.0.qualifier"
|
||||
provider-name="%providerName">
|
||||
|
||||
<description>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<feature
|
||||
id="org.eclipse.cdt.gnu.build.source"
|
||||
label="%featureName"
|
||||
version="8.1.0.qualifier"
|
||||
version="8.2.0.qualifier"
|
||||
provider-name="%providerName">
|
||||
|
||||
<description>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Tests
|
||||
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-Vendor: Eclipse CDT
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>org.eclipse.cdt.feature.group</artifactId>
|
||||
<version>8.1.0.${buildQualifier}</version>
|
||||
<version>8.2.0.${buildQualifier}</version>
|
||||
<type>p2-installable-unit</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
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-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.managedbuilder.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
|||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
|
||||
/**
|
||||
*
|
||||
* this interface represent the environment variable provider - the main entry-point
|
||||
* 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.
|
||||
* @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
|
||||
* the variable of a given name
|
||||
*
|
||||
* @param variableName environment variable name
|
||||
* if environment variable names are case insensitive in the current OS,
|
||||
* 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
|
||||
* 3. IWorkspace to represent the workspace
|
||||
* 4. null to represent the system environment passed to eclipse
|
||||
*
|
||||
* @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public IBuildEnvironmentVariable getVariable(
|
||||
String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros);
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, 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,
|
||||
* the environment variable provider will remove the duplicates of the variables if their names
|
||||
* differ only by case
|
||||
|
@ -67,14 +74,22 @@ public interface IEnvironmentVariableProvider{
|
|||
* @return the array of IBuildEnvironmentVariable that represents the environment variables
|
||||
*/
|
||||
@Deprecated
|
||||
public IBuildEnvironmentVariable[] getVariables(
|
||||
Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
public IEnvironmentVariable[] getVariables(
|
||||
IConfiguration cfg, boolean resolveMacros);
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, 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
|
||||
* 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
|
||||
|
@ -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 buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx
|
||||
* (the IEnvVarBuildPath will represent the build environment variables, see also
|
||||
|
@ -107,19 +123,15 @@ public interface IEnvironmentVariableProvider{
|
|||
String[] getBuildPaths(IConfiguration configuration, int buildPathType);
|
||||
|
||||
/**
|
||||
*
|
||||
* 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
|
||||
* Scanned Info Change Listeners about the include paths change.
|
||||
*/
|
||||
void subscribe(
|
||||
IEnvironmentBuildPathsChangeListener listener);
|
||||
void subscribe(IEnvironmentBuildPathsChangeListener listener);
|
||||
|
||||
/**
|
||||
*
|
||||
* removes the include and library paths change listener
|
||||
*/
|
||||
void unsubscribe(
|
||||
IEnvironmentBuildPathsChangeListener listener);
|
||||
void unsubscribe(IEnvironmentBuildPathsChangeListener listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,8 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
|
|||
* build environment functionality to the MBS
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
public class EnvironmentVariableProvider implements
|
||||
IEnvironmentVariableProvider {
|
||||
public class EnvironmentVariableProvider implements IEnvironmentVariableProvider {
|
||||
// private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$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
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
static public class DefaultBuildPathResolver implements IBuildPathResolver {
|
||||
private String fDelimiter;
|
||||
|
||||
public DefaultBuildPathResolver(String delimiter){
|
||||
public DefaultBuildPathResolver(String delimiter) {
|
||||
fDelimiter = delimiter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] resolveBuildPaths(int pathType, String variableName,
|
||||
String variableValue, IConfiguration configuration) {
|
||||
|
||||
if(fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
|
||||
public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
|
||||
if (fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
|
||||
return new String[]{variableValue};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static EnvironmentVariableProvider getDefault(){
|
||||
if(fInstance == null){
|
||||
public static EnvironmentVariableProvider getDefault() {
|
||||
if (fInstance == null) {
|
||||
fInstance = new EnvironmentVariableProvider(CCorePlugin.getDefault().getBuildEnvironmentManager());
|
||||
fInstance.fBuildPathVarCheckAllowed = true;
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||
Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
|
||||
if(variableName == null || "".equals(variableName)) //$NON-NLS-1$
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
|
||||
return null;
|
||||
|
||||
if(level instanceof IConfiguration){
|
||||
if (level instanceof IConfiguration) {
|
||||
return wrap(getVariable(variableName, (IConfiguration)level, resolveMacros));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros){
|
||||
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros) {
|
||||
return getVariable(variableName, cfg, resolveMacros, true);
|
||||
}
|
||||
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths){
|
||||
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths) {
|
||||
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||
if(des != null){
|
||||
if (des != null) {
|
||||
IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros);
|
||||
if(checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
|
||||
if (checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
|
||||
checkBuildPathVariable(cfg, variableName, variable);
|
||||
return variable;
|
||||
}
|
||||
|
@ -127,130 +115,109 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros){
|
||||
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros) {
|
||||
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);
|
||||
if(des != null){
|
||||
if (des != null) {
|
||||
IEnvironmentVariable vars[] = fMngr.getVariables(des, resolveMacros);
|
||||
if(checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
|
||||
if (checkBuildPaths && resolveMacros && fBuildPathVarCheckAllowed)
|
||||
checkBuildPathVariables(cfg,vars);
|
||||
return vars;
|
||||
}
|
||||
return new IBuildEnvironmentVariable[0];
|
||||
}
|
||||
|
||||
public static IBuildEnvironmentVariable wrap(IEnvironmentVariable var){
|
||||
if(var == null)
|
||||
public static IBuildEnvironmentVariable wrap(IEnvironmentVariable var) {
|
||||
if (var == null)
|
||||
return null;
|
||||
if(var instanceof IBuildEnvironmentVariable)
|
||||
if (var instanceof IBuildEnvironmentVariable)
|
||||
return (IBuildEnvironmentVariable)var;
|
||||
return new BuildEnvVar(var);
|
||||
}
|
||||
|
||||
public static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable vars[]){
|
||||
if(vars == null)
|
||||
public static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable vars[]) {
|
||||
if (vars == null)
|
||||
return null;
|
||||
if(vars instanceof IBuildEnvironmentVariable[])
|
||||
if (vars instanceof IBuildEnvironmentVariable[])
|
||||
return (IBuildEnvironmentVariable[])vars;
|
||||
|
||||
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]);
|
||||
}
|
||||
return buildVars;
|
||||
}
|
||||
|
||||
/* protected ICConfigurationDescription getDescription(IConfiguration cfg){
|
||||
/* protected ICConfigurationDescription getDescription(IConfiguration cfg) {
|
||||
IProject project = cfg.getOwner().getProject();
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if(des != null){
|
||||
if (des != null) {
|
||||
return des.getConfigurationById(cfg.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level,
|
||||
boolean includeParentLevels, boolean resolveMacros) {
|
||||
|
||||
if(level instanceof IConfiguration){
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
if (level instanceof IConfiguration) {
|
||||
return wrap(getVariables((IConfiguration)level, resolveMacros));
|
||||
}
|
||||
return new IBuildEnvironmentVariable[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultDelimiter() {
|
||||
return fMngr.getDefaultDelimiter();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
|
||||
*/
|
||||
@Override
|
||||
public boolean isVariableCaseSensitive() {
|
||||
return fMngr.isVariableCaseSensitive();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariableSupplier[] getSuppliers(Object level) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getBuildPaths()
|
||||
*/
|
||||
@Override
|
||||
public String[] getBuildPaths(IConfiguration configuration,
|
||||
int buildPathType) {
|
||||
public String[] getBuildPaths(IConfiguration configuration, int buildPathType) {
|
||||
ITool tools[] = configuration.getFilteredTools();
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
for(int i = 0; i < tools.length; i++){
|
||||
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths();
|
||||
for (ITool tool : tools) {
|
||||
IEnvVarBuildPath pathDescriptors[] = tool.getEnvVarBuildPaths();
|
||||
|
||||
if(pathDescriptors == null || pathDescriptors.length == 0)
|
||||
if (pathDescriptors == null || pathDescriptors.length == 0)
|
||||
continue;
|
||||
|
||||
for(int j = 0; j < pathDescriptors.length; j++){
|
||||
IEnvVarBuildPath curPathDes = pathDescriptors[j];
|
||||
if(curPathDes.getType() != buildPathType)
|
||||
for (IEnvVarBuildPath curPathDes : pathDescriptors) {
|
||||
if (curPathDes.getType() != buildPathType)
|
||||
continue;
|
||||
|
||||
String vars[] = curPathDes.getVariableNames();
|
||||
if(vars == null || vars.length == 0)
|
||||
if (vars == null || vars.length == 0)
|
||||
continue;
|
||||
|
||||
IBuildPathResolver pathResolver = curPathDes.getBuildPathResolver();
|
||||
if(pathResolver == null){
|
||||
if (pathResolver == null) {
|
||||
String delimiter = curPathDes.getPathDelimiter();
|
||||
if(delimiter == null)
|
||||
if (delimiter == null)
|
||||
delimiter = getDefaultDelimiter();
|
||||
pathResolver = new DefaultBuildPathResolver(delimiter);
|
||||
}
|
||||
|
||||
for(int k = 0; k < vars.length; k++){
|
||||
String varName = vars[k];
|
||||
|
||||
for (String varName : vars) {
|
||||
IEnvironmentVariable var = getVariable(varName,configuration,true, false);
|
||||
if(var == null)
|
||||
if (var == null)
|
||||
continue;
|
||||
|
||||
String varValue = var.getValue();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -259,45 +226,39 @@ public class EnvironmentVariableProvider implements
|
|||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
* returns a list of registered listeners
|
||||
/**
|
||||
* @return a list of registered listeners
|
||||
*/
|
||||
private List<IEnvironmentBuildPathsChangeListener> getListeners(){
|
||||
if(fListeners == null)
|
||||
private List<IEnvironmentBuildPathsChangeListener> getListeners() {
|
||||
if (fListeners == null)
|
||||
fListeners = new ArrayList<IEnvironmentBuildPathsChangeListener>();
|
||||
return fListeners;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* notifies registered listeners
|
||||
*/
|
||||
private void notifyListeners(IConfiguration configuration, int buildPathType){
|
||||
private void notifyListeners(IConfiguration configuration, int buildPathType) {
|
||||
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
|
||||
for (IEnvironmentBuildPathsChangeListener listener : listeners) {
|
||||
listener.buildPathsChanged(configuration,buildPathType);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#subscribe()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) {
|
||||
if(listener == null)
|
||||
if (listener == null)
|
||||
return;
|
||||
|
||||
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
|
||||
|
||||
if(!listeners.contains(listener))
|
||||
if (!listeners.contains(listener))
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#unsubscribe()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) {
|
||||
if(listener == null)
|
||||
if (listener == null)
|
||||
return;
|
||||
|
||||
List<IEnvironmentBuildPathsChangeListener> listeners = getListeners();
|
||||
|
@ -305,39 +266,39 @@ public class EnvironmentVariableProvider implements
|
|||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables for the given configuration
|
||||
* 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));
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables of the specified type
|
||||
* for the given configuration
|
||||
* 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();
|
||||
cr.add(getVariables(configuration, true, false));
|
||||
checkBuildPathVariables(configuration,buildPathType,cr);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables
|
||||
* for the given configuration given the set of the variables
|
||||
* defined for this configuration
|
||||
* 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();
|
||||
cr.add(vars);
|
||||
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_INCLUDE,cr);
|
||||
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of whether the given variable is the build path variable
|
||||
* and if true checks whether it is changed.
|
||||
* 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
|
||||
* 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_LIBRARY, varName, var);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
* 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);
|
||||
if(buildPathVars == null)
|
||||
if (buildPathVars == null)
|
||||
return;
|
||||
if(buildPathVars.isVariableChanged(varName,var,configuration)){
|
||||
if (buildPathVars.isVariableChanged(varName,var,configuration)) {
|
||||
EnvVarCollector cr = new EnvVarCollector();
|
||||
cr.add(getVariables(configuration, true, false));
|
||||
buildPathVars.synchronize(cr,configuration);
|
||||
|
@ -370,44 +331,44 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables of the specified type
|
||||
* for the given configuration given the set of the variables
|
||||
* defined for this configuration.
|
||||
* 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);
|
||||
if(buildPathVars == null)
|
||||
if (buildPathVars == null)
|
||||
return;
|
||||
if(buildPathVars.checkBuildPathChange(varSet,configuration)){
|
||||
if (buildPathVars.checkBuildPathChange(varSet,configuration)) {
|
||||
notifyListeners(configuration, buildPathType);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 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 ?
|
||||
getStoredLibraryBuildPathVariables() :
|
||||
getStoredIncludeBuildPathVariables();
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns the container of the Include path variables
|
||||
*/
|
||||
protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables(){
|
||||
if(fIncludeStoredBuildPathVariables == null)
|
||||
protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables() {
|
||||
if (fIncludeStoredBuildPathVariables == null)
|
||||
fIncludeStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_INCLUDE);
|
||||
return fIncludeStoredBuildPathVariables;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns the container of the Library path variables
|
||||
*/
|
||||
protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables(){
|
||||
if(fLibraryStoredBuildPathVariables == null)
|
||||
protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables() {
|
||||
if (fLibraryStoredBuildPathVariables == null)
|
||||
fLibraryStoredBuildPathVariables = new StoredBuildPathEnvironmentContainer(IEnvVarBuildPath.BUILDPATH_LIBRARY);
|
||||
return fLibraryStoredBuildPathVariables;
|
||||
}
|
||||
|
|
|
@ -605,6 +605,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
* Implementers are expected to add their variables to the end of the list.
|
||||
*
|
||||
* @return list of environment variables.
|
||||
* @since 8.2
|
||||
*/
|
||||
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
||||
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||
|
|
|
@ -48,6 +48,9 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
|||
new MacroOptionParser("#define\\s+(\\S*)\\s*(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||
};
|
||||
|
||||
/**
|
||||
* @since 8.2
|
||||
*/
|
||||
@Override
|
||||
public String getToolchainId() {
|
||||
return GCC_TOOLCHAIN_ID;
|
||||
|
|
|
@ -50,6 +50,7 @@ public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecs
|
|||
*
|
||||
* Tool-chain id must be supplied for global providers where we don't
|
||||
* have configuration description to figure that out programmatically.
|
||||
* @since 8.2
|
||||
*/
|
||||
public abstract String getToolchainId();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
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-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.managedbuilder.gnu.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -19,7 +19,9 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.IBuildPathResolver;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
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.core.runtime.IPath;
|
||||
|
||||
|
||||
/**
|
||||
* @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 CYGWIN_SPECIAL = "cygwin "; //$NON-NLS-1$
|
||||
|
||||
private static boolean checked = false;
|
||||
private static String envPathValueCached = null;
|
||||
private static String binCygwin = null;
|
||||
private static String rootCygwin = 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
|
||||
public String[] resolveBuildPaths(int pathType, String variableName,
|
||||
String variableValue, IConfiguration configuration) {
|
||||
|
||||
if(!isWindows()){
|
||||
public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
|
||||
if(!isWindows()) {
|
||||
return variableValue.split(DELIMITER_UNIX);
|
||||
} else if(isMinGW(configuration)){
|
||||
} else if(isMinGW(configuration)) {
|
||||
return variableValue.split(DELIMITER_WIN);
|
||||
}
|
||||
|
||||
|
@ -92,27 +88,37 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
if (!checked) findPaths();
|
||||
findPaths();
|
||||
return etcCygwin;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 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() {
|
||||
if (!checked) findPaths();
|
||||
findPaths();
|
||||
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() {
|
||||
if (!checked) findPaths();
|
||||
findPaths();
|
||||
return rootCygwin;
|
||||
}
|
||||
|
||||
|
@ -140,6 +146,7 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute path of the pattern by
|
||||
* 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
|
||||
*/
|
||||
private static String findRoot() {
|
||||
private static String findRoot(String paths) {
|
||||
String rootValue = null;
|
||||
|
||||
// 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) {
|
||||
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() {
|
||||
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;
|
||||
binCygwin = 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
|
||||
etcCygwin = getValueFromRoot(ETCPATTERN);
|
||||
|
@ -226,14 +242,14 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
if(binCygwin == null)
|
||||
binCygwin = readValueFromRegistry(REGISTRY_KEY_MOUNTS + BINPATTERN, PATH_NAME);
|
||||
|
||||
checked = true;
|
||||
envPathValueCached = envPathValue;
|
||||
}
|
||||
|
||||
private static String[] exec(String cmd, IConfiguration cfg) {
|
||||
try {
|
||||
IEnvironmentVariable vars[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,true);
|
||||
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$
|
||||
String value = vars[i].getValue();
|
||||
if(value != null)
|
||||
|
@ -258,10 +274,10 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean isMinGW(IConfiguration cfg){
|
||||
public static boolean isMinGW(IConfiguration cfg) {
|
||||
String versionInfo[] = exec(GCC_VERSION_CMD, cfg);
|
||||
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)
|
||||
return true;
|
||||
else if(versionInfo[i].indexOf(CYGWIN_SPECIAL) != -1)
|
||||
|
|
|
@ -16,13 +16,10 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
|
|||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
|
||||
|
||||
|
||||
/**
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class GnuCygwinConfigurationEnvironmentSupplier implements
|
||||
IConfigurationEnvironmentVariableSupplier {
|
||||
|
||||
public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
|
||||
private static final String PATH = "PATH"; //$NON-NLS-1$
|
||||
private static final String DELIMITER_UNIX = ":"; //$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_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
|
||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
|
||||
if (variableName == null)
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
if (variableName == 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;
|
||||
}
|
||||
|
||||
if (variableName.equalsIgnoreCase(PATH)) {
|
||||
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));
|
||||
}
|
||||
} else if (variableName.equalsIgnoreCase(LANG)) {
|
||||
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
|
||||
String langValue = System.getenv(LANG);
|
||||
if (langValue == null || langValue.length() == 0)
|
||||
if (langValue == null || langValue.length() == 0) {
|
||||
langValue = System.getenv(LC_ALL);
|
||||
if (langValue == null || langValue.length() == 0)
|
||||
}
|
||||
if (langValue == null || langValue.length() == 0) {
|
||||
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"
|
||||
// we replace codeset with Latin1 as CDT console garbles UTF
|
||||
// and ignore modifier which is not used by LANG
|
||||
langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
else
|
||||
} else {
|
||||
langValue = "C.ISO-8859-1"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return new BuildEnvVar(LANG, langValue);
|
||||
}
|
||||
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
|
||||
public IBuildEnvironmentVariable[] getVariables(
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
|
||||
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider);
|
||||
IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
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.IToolChain;
|
||||
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.
|
||||
*/
|
||||
public class IsGnuCygwinToolChainSupported implements
|
||||
IManagedIsToolChainSupported {
|
||||
public class IsGnuCygwinToolChainSupported implements 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
|
||||
*/
|
||||
@Override
|
||||
public boolean isSupported(IToolChain toolChain, Version version, String instance) {
|
||||
|
||||
if (suppChecked) return toolchainIsSupported;
|
||||
|
||||
String etcCygwin = CygwinPathResolver.getEtcPath();
|
||||
if (etcCygwin != null) {
|
||||
toolchainIsSupported = arePackagesInstalled(etcCygwin);
|
||||
if (CDataUtil.objectsEqual(etcCygwin, etcCygwinCached)) {
|
||||
return toolchainIsSupported;
|
||||
}
|
||||
|
||||
suppChecked = true;
|
||||
toolchainIsSupported = etcCygwin != null && arePackagesInstalled(etcCygwin);
|
||||
etcCygwinCached = etcCygwin;
|
||||
|
||||
return toolchainIsSupported;
|
||||
}
|
||||
|
@ -80,7 +73,9 @@ public class IsGnuCygwinToolChainSupported implements
|
|||
String s;
|
||||
while ((s = data.readLine()) != null ) {
|
||||
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;
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
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.envvar.IBuildEnvironmentVariable;
|
||||
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.
|
||||
*/
|
||||
public class MingwEnvironmentVariableSupplier implements
|
||||
IConfigurationEnvironmentVariableSupplier {
|
||||
public class MingwEnvironmentVariableSupplier implements 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 msysBinDir = null;
|
||||
|
||||
private static class MingwBuildEnvironmentVariable implements IBuildEnvironmentVariable {
|
||||
private static final String PATH_SEPARATOR = ";"; //$NON-NLS-1$
|
||||
private final String name;
|
||||
private final String value;
|
||||
private final int operation;
|
||||
|
@ -59,94 +65,131 @@ public class MingwEnvironmentVariableSupplier implements
|
|||
|
||||
@Override
|
||||
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() {
|
||||
if (!checked) {
|
||||
binDir = findBinDir();
|
||||
checked = true;
|
||||
}
|
||||
locateMingw();
|
||||
return binDir;
|
||||
}
|
||||
|
||||
private static IPath findBinDir() {
|
||||
// Try in MinGW home
|
||||
String mingwHome = System.getenv("MINGW_HOME"); //$NON-NLS-1$
|
||||
IPath mingwBinDir = new Path(mingwHome + "\\bin"); //$NON-NLS-1$
|
||||
if (mingwBinDir.toFile().isDirectory())
|
||||
/**
|
||||
* @return location of $MINGW_HOME/msys/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 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;
|
||||
}
|
||||
|
||||
// Try the mingw directory in the platform install directory
|
||||
// CDT distributions like Wascana may distribute MinGW like that
|
||||
IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
|
||||
mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$
|
||||
if (mingwBinDir.toFile().isDirectory())
|
||||
if (mingwBinDir.toFile().isDirectory()) {
|
||||
return mingwBinDir;
|
||||
}
|
||||
|
||||
// Look in PATH values. Look for mingw32-gcc.exe
|
||||
// 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.
|
||||
IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe"); //$NON-NLS-1$
|
||||
if (gccLoc != null)
|
||||
// AG: Because otherwise the toolchain won't be shown in the list of "supported" toolchains in UI
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Try the default MinGW install dir
|
||||
mingwBinDir = new Path("C:\\MinGW\\bin"); //$NON-NLS-1$
|
||||
if (mingwBinDir.toFile().isDirectory())
|
||||
if (mingwBinDir.toFile().isDirectory()) {
|
||||
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;
|
||||
}
|
||||
|
||||
public MingwEnvironmentVariableSupplier() {
|
||||
IPath binPath = getBinDir();
|
||||
private static IPath locateMsysBinDir(IPath binPath) {
|
||||
if (binPath != null) {
|
||||
String pathStr = binPath.toOSString();
|
||||
IPath msysBinPath = getMsysBinDir();
|
||||
if (msysBinPath != null)
|
||||
pathStr += ';' + msysBinPath.toOSString();
|
||||
// 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;
|
||||
}
|
||||
|
||||
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
|
||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
if (path != null && variableName.equals(path.getName()))
|
||||
return path;
|
||||
else
|
||||
return null;
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
if (variableName.equals(ENV_PATH)) {
|
||||
locateMingw();
|
||||
if (binDir != null) {
|
||||
String pathStr = binDir.toOSString();
|
||||
if (msysBinDir != null) {
|
||||
pathStr += MingwBuildEnvironmentVariable.PATH_SEPARATOR + msysBinDir.toOSString();
|
||||
}
|
||||
return new MingwBuildEnvironmentVariable(ENV_PATH, pathStr, IBuildEnvironmentVariable.ENVVAR_PREPEND);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBuildEnvironmentVariable[] getVariables(
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
IBuildEnvironmentVariable path = getVariable(ENV_PATH, configuration, provider);
|
||||
return path != null
|
||||
? new IBuildEnvironmentVariable[] { path }
|
||||
: new IBuildEnvironmentVariable[0];
|
||||
|
|
|
@ -21,17 +21,10 @@ import org.osgi.framework.Version;
|
|||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Managed Build UI Tests Plug-in
|
||||
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-Vendor: Eclipse CDT
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.managedbuilder.ui.tests</artifactId>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
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-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.managedbuilder.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -89,8 +89,6 @@ import org.eclipse.swt.widgets.Listener;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
import org.eclipse.ui.dialogs.FilteredTree;
|
||||
import org.eclipse.ui.dialogs.PatternFilter;
|
||||
|
||||
|
@ -522,25 +520,17 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
*/
|
||||
private class CustomFieldEditorDescriptor
|
||||
{
|
||||
private final String editorClassName;
|
||||
private final String bundleName;
|
||||
private final IConfigurationElement element;
|
||||
|
||||
CustomFieldEditorDescriptor(String editorClassName, String bundleName) {
|
||||
this.editorClassName = editorClassName;
|
||||
this.bundleName = bundleName;
|
||||
public CustomFieldEditorDescriptor(IConfigurationElement providerElement) {
|
||||
this.element = providerElement;
|
||||
}
|
||||
|
||||
FieldEditor createEditor() {
|
||||
try {
|
||||
Bundle bundle = Platform.getBundle(this.bundleName);
|
||||
if(bundle != null) {
|
||||
Class<?> editorClass = bundle.loadClass(this.editorClassName);
|
||||
if(editorClass != null) {
|
||||
Object editor = editorClass.newInstance();
|
||||
if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
|
||||
return (FieldEditor)editor;
|
||||
}
|
||||
}
|
||||
Object editor = element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
if(editor instanceof FieldEditor && editor instanceof ICustomBuildOptionEditor) {
|
||||
return (FieldEditor)editor;
|
||||
}
|
||||
}
|
||||
catch(Exception x) {
|
||||
|
@ -567,11 +557,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
for(IExtension e : ep.getExtensions()) {
|
||||
for(IConfigurationElement providerElement : e.getConfigurationElements()) {
|
||||
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(editorClassName, bundleName));
|
||||
this.customFieldEditorDescriptorIndex.put(editorId, new CustomFieldEditorDescriptor(providerElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.checkers.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.checkers</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
|
||||
class OnEachClass extends ASTVisitor {
|
||||
// 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();
|
||||
|
||||
OnEachClass() {
|
||||
|
@ -110,13 +110,13 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
if (skipConstructorsWithFCalls && !constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
|
||||
Set<IField> actualConstructorFields = constructorsStack.peek();
|
||||
if (!actualConstructorFields.isEmpty()) {
|
||||
IASTFunctionCallExpression fCall = (IASTFunctionCallExpression)expression;
|
||||
IASTFunctionCallExpression fCall = (IASTFunctionCallExpression) expression;
|
||||
IASTExpression fNameExp = fCall.getFunctionNameExpression();
|
||||
if (fNameExp instanceof IASTIdExpression) {
|
||||
IASTIdExpression fName = (IASTIdExpression)fNameExp;
|
||||
IASTIdExpression fName = (IASTIdExpression) fNameExp;
|
||||
IBinding fBinding = fName.getName().resolveBinding();
|
||||
if (fBinding instanceof ICPPMethod) {
|
||||
ICPPMethod method = (ICPPMethod)fBinding;
|
||||
ICPPMethod method = (ICPPMethod) fBinding;
|
||||
ICompositeType constructorOwner = actualConstructorFields.iterator().next().getCompositeTypeOwner();
|
||||
if (constructorOwner.equals(method.getClassOwner()) && !method.getType().isConst()) {
|
||||
skipCurrentConstructor = true;
|
||||
|
@ -152,12 +152,12 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
*/
|
||||
public boolean referencesThis(IASTNode expr) {
|
||||
if (expr instanceof IASTLiteralExpression) {
|
||||
IASTLiteralExpression litArg = (IASTLiteralExpression)expr;
|
||||
IASTLiteralExpression litArg = (IASTLiteralExpression) expr;
|
||||
if (litArg.getKind() == IASTLiteralExpression.lk_this) {
|
||||
return true;
|
||||
}
|
||||
} else if (expr instanceof ICPPASTUnaryExpression) {
|
||||
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr;
|
||||
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression) expr;
|
||||
switch (unExpr.getOperator()) {
|
||||
case IASTUnaryExpression.op_amper:
|
||||
case IASTUnaryExpression.op_star:
|
||||
|
@ -239,7 +239,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
type instanceof IPointerType ||
|
||||
type instanceof IEnumeration ||
|
||||
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
|
||||
|
@ -247,11 +247,13 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
|||
*/
|
||||
private ICPPConstructor getConstructor(IASTDeclaration decl) {
|
||||
if (decl instanceof ICPPASTFunctionDefinition) {
|
||||
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition)decl;
|
||||
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl;
|
||||
if (functionDefinition.isDeleted())
|
||||
return null;
|
||||
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
|
||||
if (binding instanceof ICPPConstructor) {
|
||||
ICPPConstructor constructor = (ICPPConstructor) binding;
|
||||
if (constructor.getClassOwner().getKey()!=ICompositeType.k_union) {
|
||||
if (constructor.getClassOwner().getKey() != ICompositeType.k_union) {
|
||||
return constructor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.cdt.core,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.core.cxx</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.cdt.codan.checkers;bundle-version="1.0.0",
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.core.test</artifactId>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
|
||||
|
|
|
@ -314,6 +314,16 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
|||
checkNoErrors();
|
||||
}
|
||||
|
||||
// class C {
|
||||
// public:
|
||||
// C(const C& c) = delete;
|
||||
// int i1, i2;
|
||||
// };
|
||||
public void testNoErrorsOnDeletedConstructor() {
|
||||
loadCodeAndRun(getAboveComment());
|
||||
checkNoErrors();
|
||||
}
|
||||
|
||||
// void func(int & a) { a = 0; }
|
||||
// class C {
|
||||
// C() { func(i); } // No warnings.
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.core</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Control Flow Graph
|
||||
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-Vendor: Eclipse CDT
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.ui.cxx</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
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-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.codan.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -514,9 +514,13 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
protected boolean isCPP;
|
||||
|
||||
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.isCPP= isCPP;
|
||||
this.tu= parse(contents, isCPP ? ParserLanguage.CPP : ParserLanguage.C, true, false);
|
||||
this.isCPP= lang.isCPP();
|
||||
this.tu= parse(contents, lang, true, false);
|
||||
}
|
||||
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
|
|
|
@ -4706,8 +4706,9 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
}
|
||||
|
||||
// template<typename T>
|
||||
// class basic_string {
|
||||
// struct basic_string {
|
||||
// basic_string& operator+=(const T* s);
|
||||
// basic_string& append(const T* s);
|
||||
// };
|
||||
//
|
||||
// template<typename T>
|
||||
|
@ -4721,8 +4722,9 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
// void test(const string& s) {
|
||||
// auto s1 = "" + s + "";
|
||||
// auto s2 = s1 += "";
|
||||
// auto s3 = s2.append("foo");
|
||||
// }
|
||||
public void testTypedefPreservation_380498() throws Exception {
|
||||
public void testTypedefPreservation_380498_1() throws Exception {
|
||||
BindingAssertionHelper ba= getAssertionHelper();
|
||||
ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class);
|
||||
assertTrue(s1.getType() instanceof ITypedef);
|
||||
|
@ -4730,6 +4732,25 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
ICPPVariable s2 = ba.assertNonProblem("s2", ICPPVariable.class);
|
||||
assertTrue(s2.getType() instanceof ITypedef);
|
||||
assertEquals("string", ((ITypedef) s2.getType()).getName());
|
||||
ICPPVariable s3 = ba.assertNonProblem("s3", ICPPVariable.class);
|
||||
assertTrue(s3.getType() instanceof ITypedef);
|
||||
assertEquals("string", ((ITypedef) s3.getType()).getName());
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct vector {
|
||||
// typedef T* const_iterator;
|
||||
// const_iterator begin() const;
|
||||
// };
|
||||
//
|
||||
// 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() {
|
||||
|
|
|
@ -155,7 +155,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPField t2 = (ICPPField) col.getName(5).resolveBinding();
|
||||
|
||||
assertSame(t1.getType(), T);
|
||||
assertSame(((IPointerType)t2.getType()).getType(), T);
|
||||
assertSame(((IPointerType) t2.getType()).getType(), T);
|
||||
|
||||
ICPPVariable a = (ICPPVariable) col.getName(9).resolveBinding();
|
||||
|
||||
|
@ -170,20 +170,20 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPField t = (ICPPField) col.getName(11).resolveBinding();
|
||||
assertTrue(t instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t1);
|
||||
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t1);
|
||||
assertSame(t.getScope(), A_int_Scope);
|
||||
IType type = t.getType();
|
||||
assertTrue(type instanceof IBasicType);
|
||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||
|
||||
t = (ICPPField) col.getName(13).resolveBinding();
|
||||
assertTrue(t instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t2);
|
||||
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t2);
|
||||
assertSame(t.getScope(), A_int_Scope);
|
||||
type = t.getType();
|
||||
assertTrue(type instanceof IPointerType);
|
||||
assertTrue(((IPointerType)type).getType() instanceof IBasicType);
|
||||
assertEquals(((IBasicType)((IPointerType)type).getType()).getType(), IBasicType.t_int);
|
||||
assertTrue(((IPointerType) type).getType() instanceof IBasicType);
|
||||
assertEquals(((IBasicType) ((IPointerType) type).getType()).getType(), IBasicType.t_int);
|
||||
}
|
||||
|
||||
// template < class T > class A {
|
||||
|
@ -204,7 +204,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
IFunctionType ft = f.getType();
|
||||
|
||||
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();
|
||||
assertTrue(A_int instanceof ICPPTemplateInstance);
|
||||
|
@ -212,10 +212,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPMethod f_int = (ICPPMethod) col.getName(11).resolveBinding();
|
||||
assertTrue(f_int instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)f_int).getSpecializedBinding(), f);
|
||||
assertSame(((ICPPSpecialization) f_int).getSpecializedBinding(), f);
|
||||
ft = f_int.getType();
|
||||
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);
|
||||
|
@ -246,7 +246,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPFunction f3 = (ICPPFunction) col.getName(11).resolveBinding();
|
||||
assertTrue(f3 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f3).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) f3).getTemplateDefinition(), f);
|
||||
|
||||
assertInstances(col, T, 5);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
// the instantiation of A<T> has to be deferred.
|
||||
assertInstance(b0, ICPPUnknownBinding.class);
|
||||
final ICPPBinding parent = ((ICPPInternalUnknownScope)b0.getScope()).getScopeBinding();
|
||||
final ICPPBinding parent = ((ICPPInternalUnknownScope) b0.getScope()).getScopeBinding();
|
||||
assertInstance(parent, ICPPDeferredClassInstance.class);
|
||||
assertSame(((ICPPDeferredClassInstance) parent).getSpecializedBinding(), A);
|
||||
|
||||
|
@ -360,7 +360,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
IFunction f2 = (IFunction) col.getName(5).resolveBinding();
|
||||
|
||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1);
|
||||
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
|
||||
}
|
||||
|
||||
// template < class T > void f(T); // #1
|
||||
|
@ -385,7 +385,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
IFunction f = (IFunction) col.getName(14).resolveBinding();
|
||||
assertTrue(f instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f).getTemplateDefinition(), f3);
|
||||
assertSame(((ICPPTemplateInstance) f).getTemplateDefinition(), f3);
|
||||
}
|
||||
|
||||
// template < class T > void f(T); // #1
|
||||
|
@ -459,11 +459,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPVariable a2 = (ICPPVariable) col.getName(15).resolveBinding();
|
||||
assertTrue(a2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
|
||||
IType at = a2.getType();
|
||||
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
|
||||
|
@ -546,7 +546,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||
}
|
||||
|
||||
// template<class T> void f(T);
|
||||
|
@ -560,7 +560,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||
}
|
||||
|
||||
// template<class X, class Y> X f(Y);
|
||||
|
@ -591,7 +591,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding();
|
||||
ICPPFunction ref = (ICPPFunction) col.getName(5).resolveBinding();
|
||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||
}
|
||||
|
||||
// template<class T> void f(T); // #1
|
||||
|
@ -640,7 +640,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPClassType x2 = (ICPPClassType) col.getName(4).resolveBinding();
|
||||
|
||||
assertTrue(x1 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)x1).getTemplateDefinition(), X);
|
||||
assertSame(((ICPPTemplateInstance) x1).getTemplateDefinition(), X);
|
||||
|
||||
assertSame(x1, x2);
|
||||
}
|
||||
|
@ -663,19 +663,19 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
assertNotSame(f1, f2);
|
||||
assertTrue(f1 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f1).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) f1).getTemplateDefinition(), f);
|
||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f);
|
||||
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f);
|
||||
|
||||
IType fr1 = f1.getType().getReturnType();
|
||||
IType fr2 = f2.getType().getReturnType();
|
||||
|
||||
assertTrue(fr1 instanceof IBasicType);
|
||||
assertEquals(((IBasicType)fr1).getType(), IBasicType.t_int);
|
||||
assertEquals(((IBasicType) fr1).getType(), IBasicType.t_int);
|
||||
|
||||
assertTrue(fr2 instanceof IPointerType);
|
||||
assertTrue(((IPointerType)fr2).getType() instanceof IBasicType);
|
||||
assertEquals(((IBasicType) ((IPointerType)fr2).getType()).getType(), IBasicType.t_char);
|
||||
assertTrue(((IPointerType) fr2).getType() instanceof IBasicType);
|
||||
assertEquals(((IBasicType) ((IPointerType) fr2).getType()).getType(), IBasicType.t_char);
|
||||
}
|
||||
|
||||
// template<class T> void f(T) { }
|
||||
|
@ -696,10 +696,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
assertSame(f2.getSpecializedBinding(), f1);
|
||||
assertSame(g2.getSpecializedBinding(), g1);
|
||||
|
||||
assertFalse(((ICPPFunction)f1).isInline());
|
||||
assertTrue(((ICPPFunction)g1).isInline());
|
||||
assertTrue(((ICPPFunction)f2).isInline());
|
||||
assertFalse(((ICPPFunction)g2).isInline());
|
||||
assertFalse(((ICPPFunction) f1).isInline());
|
||||
assertTrue(((ICPPFunction) g1).isInline());
|
||||
assertTrue(((ICPPFunction) f2).isInline());
|
||||
assertFalse(((ICPPFunction) g2).isInline());
|
||||
}
|
||||
|
||||
// template<class T> class X {
|
||||
|
@ -732,10 +732,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
assertTrue(a2 instanceof ICPPSpecialization);
|
||||
assertTrue(a3 instanceof ICPPSpecialization);
|
||||
assertTrue(a4 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)a1).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization)a3).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization)a4).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization) a1).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization) a3).getSpecializedBinding(), a);
|
||||
assertSame(((ICPPSpecialization) a4).getSpecializedBinding(), a);
|
||||
}
|
||||
|
||||
// template<class T> class Y;
|
||||
|
@ -759,7 +759,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPClassType y2 = (ICPPClassType) col.getName(6).resolveBinding();
|
||||
assertTrue(y2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)y2).getTemplateDefinition(), Y);
|
||||
assertSame(((ICPPTemplateInstance) y2).getTemplateDefinition(), Y);
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1);
|
||||
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
|
||||
assertSame(g1, g2);
|
||||
}
|
||||
|
||||
|
@ -809,11 +809,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPField u2 = (ICPPField) col.getName(11).resolveBinding();
|
||||
assertTrue(u2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)u2).getSpecializedBinding(), u1);
|
||||
assertSame(((ICPPSpecialization) u2).getSpecializedBinding(), u1);
|
||||
|
||||
IType type = u2.getType();
|
||||
assertTrue(type instanceof IBasicType);
|
||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||
}
|
||||
|
||||
// template < class T > class A {
|
||||
|
@ -878,18 +878,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPField pA2 = (ICPPField) col.getName(17).resolveBinding();
|
||||
|
||||
assertTrue(f2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
||||
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||
assertTrue(pA2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)pA2).getSpecializedBinding(), pA);
|
||||
assertSame(((ICPPSpecialization) pA2).getSpecializedBinding(), pA);
|
||||
|
||||
IType paT = pA2.getType();
|
||||
assertTrue(paT instanceof IPointerType);
|
||||
assertSame(((IPointerType)paT).getType(), AI);
|
||||
assertSame(((IPointerType) paT).getType(), AI);
|
||||
|
||||
IParameter p = f2.getParameters()[0];
|
||||
IType pT = p.getType();
|
||||
assertTrue(pT instanceof IPointerType);
|
||||
assertSame(((IPointerType)pT).getType(), AI);
|
||||
assertSame(((IPointerType) pT).getType(), AI);
|
||||
}
|
||||
|
||||
// template <class T> struct A {
|
||||
|
@ -916,7 +916,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPMethod f1_2 = (ICPPMethod) col.getName(11).resolveBinding();
|
||||
assertNotSame(f1, f1_2);
|
||||
assertTrue(f1_2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)f1_2).getSpecializedBinding(), f1);
|
||||
assertSame(((ICPPSpecialization) f1_2).getSpecializedBinding(), f1);
|
||||
|
||||
ICPPClassType A2 = (ICPPClassType) col.getName(9).resolveBinding();
|
||||
assertTrue(A2 instanceof ICPPTemplateInstance);
|
||||
|
@ -924,9 +924,9 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPMethod f2_2 = (ICPPMethod) col.getName(16).resolveBinding();
|
||||
assertTrue(f2_2 instanceof ICPPSpecialization);
|
||||
IBinding speced = ((ICPPSpecialization)f2_2).getSpecializedBinding();
|
||||
IBinding speced = ((ICPPSpecialization) f2_2).getSpecializedBinding();
|
||||
assertTrue(speced instanceof ICPPFunctionTemplate && speced instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)speced).getSpecializedBinding(), f2);
|
||||
assertSame(((ICPPSpecialization) speced).getSpecializedBinding(), f2);
|
||||
|
||||
ICPPClassType A3 = (ICPPClassType) col.getName(14).resolveBinding();
|
||||
assertSame(A2, A3);
|
||||
|
@ -940,7 +940,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
assertSame(r1, f1_2);
|
||||
assertTrue(r2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)r2).getTemplateDefinition(), speced);
|
||||
assertSame(((ICPPTemplateInstance) r2).getTemplateDefinition(), speced);
|
||||
assertSame(r3, f2_2);
|
||||
}
|
||||
|
||||
|
@ -963,7 +963,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPClassType r2 = (ICPPClassType) col.getName(7).resolveBinding();
|
||||
|
||||
assertTrue(r1 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)r1).getTemplateDefinition(), A1);
|
||||
assertSame(((ICPPTemplateInstance) r1).getTemplateDefinition(), A1);
|
||||
assertSame(r2, A2);
|
||||
}
|
||||
|
||||
|
@ -1039,14 +1039,14 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPMethod f1 = (ICPPMethod) col.getName(20).resolveBinding();
|
||||
assertTrue(f1 instanceof ICPPSpecialization);
|
||||
assertTrue(((ICPPSpecialization)f1).getSpecializedBinding() instanceof ICPPMethod);
|
||||
ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization)f1).getSpecializedBinding();
|
||||
assertTrue(((ICPPSpecialization) f1).getSpecializedBinding() instanceof ICPPMethod);
|
||||
ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization) f1).getSpecializedBinding();
|
||||
assertTrue(f2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
||||
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||
|
||||
IFunctionType ft = f1.getType();
|
||||
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);
|
||||
}
|
||||
|
@ -1109,23 +1109,23 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPField y2 = (ICPPField) col.getName(23).resolveBinding();
|
||||
assertTrue(y2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)y2).getSpecializedBinding(), y);
|
||||
assertSame(((ICPPSpecialization) y2).getSpecializedBinding(), y);
|
||||
IType t = y2.getType();
|
||||
assertTrue(t instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A1);
|
||||
assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A1);
|
||||
ICPPField x3 = (ICPPField) col.getName(24).resolveBinding();
|
||||
assertTrue(x3 instanceof ICPPSpecialization);
|
||||
assertEquals(((ICPPSpecialization)x3).getSpecializedBinding(), x1);
|
||||
assertEquals(((ICPPSpecialization) x3).getSpecializedBinding(), x1);
|
||||
|
||||
ICPPField z2 = (ICPPField) col.getName(26).resolveBinding();
|
||||
assertTrue(z2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)z2).getSpecializedBinding(), z);
|
||||
assertSame(((ICPPSpecialization) z2).getSpecializedBinding(), z);
|
||||
t = z2.getType();
|
||||
assertTrue(t instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A2);
|
||||
assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A2);
|
||||
ICPPField x4 = (ICPPField) col.getName(27).resolveBinding();
|
||||
assertTrue(x4 instanceof ICPPSpecialization);
|
||||
assertEquals(((ICPPSpecialization)x4).getSpecializedBinding(), x2);
|
||||
assertEquals(((ICPPSpecialization) x4).getSpecializedBinding(), x2);
|
||||
}
|
||||
|
||||
// template <class T> class A {
|
||||
|
@ -1150,16 +1150,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPField t2 = (ICPPField) col.getName(11).resolveBinding();
|
||||
assertTrue(t2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t);
|
||||
assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
|
||||
|
||||
IType type = t2.getType();
|
||||
assertTrue(type instanceof ITypedef);
|
||||
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);
|
||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||
}
|
||||
|
||||
// template <class T> class A {
|
||||
|
@ -1186,16 +1186,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPField t2 = (ICPPField) col.getName(13).resolveBinding();
|
||||
|
||||
assertTrue(b2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)b2).getSpecializedBinding(), b);
|
||||
assertSame(((ICPPSpecialization) b2).getSpecializedBinding(), b);
|
||||
|
||||
IType type = b2.getType();
|
||||
assertTrue(type instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), B);
|
||||
assertSame(((ICPPSpecialization) type).getSpecializedBinding(), B);
|
||||
|
||||
assertTrue(t2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t);
|
||||
assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
|
||||
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 {
|
||||
|
@ -1239,18 +1239,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPField s2 = (ICPPField) col.getName(21).resolveBinding();
|
||||
assertTrue(s2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)s2).getSpecializedBinding(), s);
|
||||
assertSame(((ICPPSpecialization) s2).getSpecializedBinding(), s);
|
||||
|
||||
IType t = s2.getType();
|
||||
// assertTrue(t instanceof ITypedef);
|
||||
// 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);
|
||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), X2);
|
||||
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), X2);
|
||||
|
||||
t = ((ITypedef)t).getType();
|
||||
t = ((ITypedef) t).getType();
|
||||
assertSame(t, B);
|
||||
}
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
assertSame(((ICPPTemplateInstance)A2).getTemplateDefinition(), A);
|
||||
ICPPMethod f2 = (ICPPMethod) col.getName(17).resolveBinding();
|
||||
assertTrue(f2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
||||
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||
|
||||
ICPPTemplateParameter TR = (ICPPTemplateParameter) col.getName(19).resolveBinding();
|
||||
assertSame(T, TR);
|
||||
|
@ -1492,7 +1492,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPMethod h2 = (ICPPMethod) col.getName(54).resolveBinding();
|
||||
assertTrue(h2 instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)h2).getSpecializedBinding(), h);
|
||||
assertSame(((ICPPSpecialization) h2).getSpecializedBinding(), h);
|
||||
}
|
||||
|
||||
// namespace N {
|
||||
|
@ -1551,7 +1551,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPFunction s2 = (ICPPFunction) col.getName(8).resolveBinding();
|
||||
assertTrue(s2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s);
|
||||
assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s);
|
||||
|
||||
ICPPClassType A3 = (ICPPClassType) col.getName(10).resolveBinding();
|
||||
assertTrue(A3 instanceof ICPPTemplateInstance);
|
||||
|
@ -1576,7 +1576,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPFunctionTemplate s1 = (ICPPFunctionTemplate) col.getName(5).resolveBinding();
|
||||
ICPPFunction s2 = (ICPPFunction) col.getName(10).resolveBinding();
|
||||
assertTrue(s2 instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s1);
|
||||
assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s1);
|
||||
|
||||
ICPPClassType A3 = (ICPPClassType) col.getName(11).resolveBinding();
|
||||
assertSame(A2, A3);
|
||||
|
@ -1595,7 +1595,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
IASTName f = col.getName(6);
|
||||
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();
|
||||
|
||||
assertTrue(type.isSameType(p.getType()));
|
||||
|
@ -1662,11 +1662,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
IBinding r = col.getName(33).resolveBinding();
|
||||
assertTrue(r instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), begin);
|
||||
assertSame(((ICPPSpecialization) r).getSpecializedBinding(), begin);
|
||||
|
||||
r = col.getName(36).resolveBinding();
|
||||
assertTrue(r instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), end);
|
||||
assertSame(((ICPPSpecialization) r).getSpecializedBinding(), end);
|
||||
|
||||
assertSame(foo, col.getName(39).resolveBinding());
|
||||
assertSame(foo, col.getName(41).resolveBinding());
|
||||
|
@ -1692,8 +1692,8 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
IType type = t.getType();
|
||||
assertTrue(type instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), _T);
|
||||
assertSame(((IPointerType)((ITypedef)type).getType()).getType(), B);
|
||||
assertSame(((ICPPSpecialization) type).getSpecializedBinding(), _T);
|
||||
assertSame(((IPointerType) ((ITypedef) type).getType()).getType(), B);
|
||||
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
|
||||
assertTrue(b instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)b).getSpecializedBinding(), f1);
|
||||
assertSame(((ICPPTemplateInstance) b).getSpecializedBinding(), f1);
|
||||
assertSame(f1, col.getName(10).resolveBinding());
|
||||
|
||||
|
||||
|
@ -1885,7 +1885,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
|
||||
ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding();
|
||||
assertTrue(a instanceof ICPPTemplateInstance);
|
||||
assertSame(((ICPPTemplateInstance)a).getTemplateDefinition(), A);
|
||||
assertSame(((ICPPTemplateInstance) a).getTemplateDefinition(), A);
|
||||
assertSame(local, col.getName(7).resolveBinding());
|
||||
}
|
||||
|
||||
|
@ -1928,7 +1928,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPClassTemplate complex = (ICPPClassTemplate) col.getName(1).resolveBinding();
|
||||
ICPPClassType cspec = (ICPPClassType) col.getName(2).resolveBinding();
|
||||
assertTrue(cspec instanceof ICPPSpecialization);
|
||||
assertSame(((ICPPSpecialization)cspec).getSpecializedBinding(), complex);
|
||||
assertSame(((ICPPSpecialization) cspec).getSpecializedBinding(), complex);
|
||||
|
||||
assertSame(complex, col.getName(5).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(), ICPPConstructor.class); // *D<int>*(5, 6)
|
||||
|
||||
IBinding tidSpc= ((ICPPTemplateInstance)tid.resolveBinding()).getSpecializedBinding();
|
||||
IBinding tidSpc= ((ICPPTemplateInstance) tid.resolveBinding()).getSpecializedBinding();
|
||||
assertInstance(tidSpc, ICPPConstructor.class);
|
||||
assertInstance(tidSpc, ICPPSpecialization.class);
|
||||
assertInstance(tidSpc, ICPPFunctionTemplate.class);
|
||||
|
@ -2807,7 +2807,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
tu.accept(col);
|
||||
|
||||
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 {};
|
||||
|
@ -5256,7 +5256,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
// void test() {
|
||||
// P(C());
|
||||
// }
|
||||
public void _testFunctionInstanceAsTemplateArg_Bug334472() throws Exception {
|
||||
public void testFunctionInstanceAsTemplateArg_Bug334472() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -125,7 +125,7 @@ import org.eclipse.cdt.internal.core.model.ASTStringUtil;
|
|||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
/**
|
||||
* Testcases on the AST.
|
||||
* Test cases on the AST.
|
||||
*/
|
||||
public class AST2Tests extends AST2BaseTest {
|
||||
private static final int NUM_TESTS = 3;
|
||||
|
@ -4866,10 +4866,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// myUnionPointer->bar=4;
|
||||
// }
|
||||
public void testBug228504_nonExistingMembers() throws Exception {
|
||||
boolean[] isCpps= {true, false};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp);
|
||||
for (int i=1; i < 5; i++) {
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang);
|
||||
for (int i= 1; i < 5; i++) {
|
||||
ba.assertNonProblem("foo=" + i, 3);
|
||||
ba.assertProblem("bar=" + i, 3);
|
||||
}
|
||||
|
@ -4912,10 +4911,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// function1(); // ref
|
||||
// }
|
||||
public void testOutOfOrderResolution_Bug232300() throws Exception {
|
||||
final boolean[] isCpps= {false, true};
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
|
||||
IBinding b1= ba.assertNonProblem("function1(); // decl", 9);
|
||||
IBinding b2= ba.assertNonProblem("function1() {", 9);
|
||||
IBinding b3= ba.assertNonProblem("function1(); // ref", 9);
|
||||
|
@ -4927,10 +4925,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// #define foo __typeof__((int*)0 - (int*)0)
|
||||
// typedef foo ptrdiff_t;
|
||||
public void testRedefinePtrdiff_Bug230895() throws Exception {
|
||||
final boolean[] isCpps= {false, true};
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
|
||||
IBinding b1= ba.assertNonProblem("ptrdiff_t", 9);
|
||||
assertInstance(b1, ITypedef.class);
|
||||
ITypedef td= (ITypedef) b1;
|
||||
|
@ -4944,10 +4941,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// struct S;
|
||||
// typedef struct S S; // td
|
||||
public void testRedefineStructInScopeThatIsFullyResolved() throws Exception {
|
||||
final boolean[] isCpps= {false, true};
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
|
||||
ba.assertNonProblem("a; // ref", 1);
|
||||
// now scope is fully resolved
|
||||
ICompositeType ct= ba.assertNonProblem("S;", 1, ICompositeType.class);
|
||||
|
@ -4972,10 +4968,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// VOID func(VOID) {
|
||||
// }
|
||||
public void testTypedefVoid_Bug221567() throws Exception {
|
||||
final boolean[] isCpps= { false, true };
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
|
||||
ITypedef td= ba.assertNonProblem("VOID;", 4, ITypedef.class);
|
||||
IBinding ref= ba.assertNonProblem("VOID)", 4);
|
||||
assertSame(td, ref);
|
||||
|
@ -5021,9 +5016,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// int f5(int *(tint[10]));
|
||||
public void testParamWithFunctionType_Bug84242() throws Exception {
|
||||
final String comment= getAboveComment();
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
|
||||
|
||||
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
|
||||
isTypeEqual(f.getType(), "int (int (*)(int))");
|
||||
|
@ -5055,9 +5049,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// int (*f1 (int par))[5];
|
||||
public void testFunctionReturningPtrToArray_Bug216609() throws Exception {
|
||||
final String comment= getAboveComment();
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang);
|
||||
|
||||
IFunction f= ba.assertNonProblem("f1", 2, IFunction.class);
|
||||
isTypeEqual(f.getType(), "int (* (int))[5]");
|
||||
|
@ -5077,7 +5070,6 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// void ((f4)());
|
||||
public void testNestedFunctionDeclarators() throws Exception {
|
||||
final String comment= getAboveComment();
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
IASTTranslationUnit tu= parseAndCheckBindings(comment, lang);
|
||||
IASTFunctionDefinition fdef= getDeclaration(tu, 0);
|
||||
|
@ -5133,8 +5125,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testLocalVariableResolution_Bug235831() throws Exception {
|
||||
final String comment= getAboveComment();
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
|
||||
|
||||
ba.assertNonProblem("b; a", 1, IVariable.class); // fill cache of inner block
|
||||
IVariable v3= ba.assertNonProblem("a; }", 1, IVariable.class);
|
||||
|
@ -5148,9 +5140,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// int foo(int (*ptr) (int, int));
|
||||
public void testComplexParameterBinding_Bug214482() throws Exception {
|
||||
final String comment= getAboveComment();
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang);
|
||||
IParameter p= ba.assertNonProblem("ptr", 3, IParameter.class);
|
||||
assertEquals("ptr", p.getName());
|
||||
}
|
||||
|
@ -5519,8 +5510,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// }
|
||||
public void testAnonymousUnionMember() throws Exception {
|
||||
final boolean[] isCpps= {false, true};
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), lang);
|
||||
bh.assertNonProblem("a1=", 2);
|
||||
bh.assertProblem("a2=", 2);
|
||||
bh.assertNonProblem("a3=", 2);
|
||||
|
@ -5794,9 +5785,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// enum X {e0, e4=4, e5, e2=2, e3};
|
||||
public void testValues() throws Exception {
|
||||
final String code= getAboveComment();
|
||||
boolean isCpp= false;
|
||||
do {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, false);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, lang);
|
||||
IVariable v= (IVariable) bh.assertNonProblem("a=", 1);
|
||||
checkValue(v.getInitialValue(), -4);
|
||||
v= (IVariable) bh.assertNonProblem("b=", 1);
|
||||
|
@ -5814,8 +5804,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
checkValue(e.getValue(), 4);
|
||||
e= (IEnumerator) bh.assertNonProblem("e5", 2);
|
||||
checkValue(e.getValue(), 5);
|
||||
isCpp= !isCpp;
|
||||
} while (isCpp);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkValue(IValue initialValue, int i) {
|
||||
|
@ -6088,11 +6077,10 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// size_t x = a + 5;
|
||||
// size_t y = 2 + a;
|
||||
// size_t y = a * 2;
|
||||
public void testTypeOfExpressionWithTypedef_380498() throws Exception {
|
||||
final boolean[] isCpps= { false, true };
|
||||
public void testTypeOfExpressionWithTypedef_380498_1() throws Exception {
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
for (ParserLanguage lang: ParserLanguage.values()) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, lang);
|
||||
IASTExpression exp = ba.assertNode("a + 5", IASTExpression.class);
|
||||
assertTrue(exp.getExpressionType() instanceof ITypedef);
|
||||
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;
|
||||
// int a= TInt; //ref
|
||||
public void testTypeAsExpressionIsProblem_261175() throws Exception {
|
||||
|
@ -7038,7 +7041,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// newArray var5;
|
||||
//
|
||||
// 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
|
||||
// */
|
||||
// var1[1].a = 1;
|
||||
|
|
|
@ -17,6 +17,7 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
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.Kind;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -1544,19 +1545,19 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
|
||||
// CT<int> v1;
|
||||
public void testUniqueInstance_Bug241641() throws Exception {
|
||||
IASTName name= findName("v1", 2);
|
||||
ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class);
|
||||
ICPPVariable v2= getBindingFromASTName("v1", 2, ICPPVariable.class);
|
||||
|
||||
IType t1= v1.getType();
|
||||
assertInstance(t1, ICPPTemplateInstance.class);
|
||||
|
||||
ICPPTemplateInstance inst= (ICPPTemplateInstance) t1;
|
||||
final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition();
|
||||
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments());
|
||||
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), name);
|
||||
assertSame(inst, inst2);
|
||||
|
||||
IBinding charInst1= 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))});
|
||||
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))}, name);
|
||||
assertSame(charInst1, charInst2);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>org.eclipse.cdt.feature.group</artifactId>
|
||||
<version>8.1.0.${buildQualifier}</version>
|
||||
<version>8.2.0.${buildQualifier}</version>
|
||||
<type>p2-installable-unit</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -6,6 +6,10 @@ int Hallo;
|
|||
//%CPP
|
||||
int TestClass::Hallo;
|
||||
|
||||
//!FullyQualifiedName
|
||||
//%CPP
|
||||
int ::name;
|
||||
|
||||
//!OperatorName
|
||||
//%CPP
|
||||
class Foo
|
||||
|
|
|
@ -2978,6 +2978,7 @@ class test
|
|||
|
||||
//=
|
||||
=>leading
|
||||
#ifndef TEST_H_ = //TEST
|
||||
=>trailing
|
||||
=>freestanding
|
||||
|
||||
|
@ -2999,6 +3000,9 @@ class test
|
|||
|
||||
//=
|
||||
=>leading
|
||||
#ifndef TEST_H_ = /*
|
||||
* Licence information...
|
||||
*/
|
||||
=>trailing
|
||||
=>freestanding
|
||||
|
||||
|
@ -3021,6 +3025,9 @@ class test
|
|||
|
||||
//=
|
||||
=>leading
|
||||
#ifndef TEST_H_ = /*
|
||||
* Licence information...
|
||||
*/
|
||||
class test
|
||||
{
|
||||
}; = //test
|
||||
|
@ -3054,7 +3061,11 @@ private:
|
|||
|
||||
//=
|
||||
=>leading
|
||||
#ifndef HIDEMETHOD_H_ = /*
|
||||
* HideMethod.h
|
||||
*/
|
||||
=>trailing
|
||||
#endif = /* HIDEMETHOD_H_ */
|
||||
=>freestanding
|
||||
|
||||
//!CommentRecognition Bug 233438
|
||||
|
@ -3077,6 +3088,7 @@ private:
|
|||
//=
|
||||
=>leading
|
||||
=>trailing
|
||||
#endif = /* HIDEMETHOD_H_ */
|
||||
=>freestanding
|
||||
|
||||
//@test.cpp
|
||||
|
@ -3122,6 +3134,7 @@ private:
|
|||
//=
|
||||
=>leading
|
||||
=>trailing
|
||||
#endif = /* HIDEMETHOD_H_ */
|
||||
=>freestanding
|
||||
|
||||
//@test.cpp
|
||||
|
@ -3145,4 +3158,44 @@ int HideMethod::methode2(){
|
|||
=>trailing
|
||||
i++; = //comment
|
||||
=>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
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.utils.ByteUtilsTest;
|
|||
import org.eclipse.cdt.utils.CdtVariableResolverTest;
|
||||
import org.eclipse.cdt.utils.CommandLineUtilTest;
|
||||
import org.eclipse.cdt.utils.FindProgramLocationTest;
|
||||
import org.eclipse.cdt.utils.StorableCdtVariablesTest;
|
||||
import org.eclipse.cdt.utils.WeakHashSetTest;
|
||||
|
||||
/**
|
||||
|
@ -76,6 +77,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
suite.addTest(AllLanguageTests.suite());
|
||||
suite.addTest(RewriteTests.suite());
|
||||
suite.addTest(CdtVariableResolverTest.suite());
|
||||
suite.addTest(StorableCdtVariablesTest.suite());
|
||||
suite.addTest(CommandLineUtilTest.suite());
|
||||
suite.addTest(WeakHashSetTest.suite());
|
||||
suite.addTest(FindProgramLocationTest.suite());
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.eclipse.cdt</groupId>
|
||||
<artifactId>cdt-parent</artifactId>
|
||||
<version>8.1.0-SNAPSHOT</version>
|
||||
<version>8.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -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<?>, 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<?>, 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<?>, 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<?>, 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<?>, 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<?>, 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<RefreshExclusion>)"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
<filter id="338792546">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.core.resources.RefreshScopeManager"/>
|
||||
<message_argument value="setResourcesToRefresh(IProject, List<IResource>)"/>
|
||||
</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>
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
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-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.model.ext;
|
||||
|
||||
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
|
||||
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
|
||||
|
||||
private ASTAccessVisibility fVisibility;
|
||||
private String fTypeName;
|
||||
private boolean fIsStatic;
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Rational Software - initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -350,7 +351,8 @@ public class ASTTypeUtil {
|
|||
result.append(Keywords.ENUM);
|
||||
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) {
|
||||
// 101114 fix, do not display class, and for consistency don't display struct/union as well
|
||||
appendNameCheckAnonymous((ICompositeType) type, result);
|
||||
|
@ -469,13 +471,13 @@ public class ASTTypeUtil {
|
|||
public static void appendType(IType type, boolean normalize, StringBuilder result) {
|
||||
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;
|
||||
IQualifierType cvq= null;
|
||||
ICPPReferenceType ref= null;
|
||||
while (type != null && ++i < 100) {
|
||||
if (type instanceof ITypedef) {
|
||||
if (normalize || type instanceof ICPPSpecialization) {
|
||||
if (normalize) {
|
||||
// Skip the typedef and proceed with its target type.
|
||||
} else {
|
||||
// Output reference, qualifier and typedef, then stop.
|
||||
|
@ -608,18 +610,14 @@ public class ASTTypeUtil {
|
|||
IBinding binding = declarator.getName().resolveBinding();
|
||||
IType type = null;
|
||||
|
||||
try {
|
||||
if (binding instanceof IEnumerator) {
|
||||
type = ((IEnumerator) binding).getType();
|
||||
} else if (binding instanceof IFunction) {
|
||||
type = ((IFunction) binding).getType();
|
||||
} else if (binding instanceof ITypedef) {
|
||||
type = ((ITypedef) binding).getType();
|
||||
} else if (binding instanceof IVariable) {
|
||||
type = ((IVariable) binding).getType();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return EMPTY_STRING;
|
||||
if (binding instanceof IEnumerator) {
|
||||
type = ((IEnumerator)binding).getType();
|
||||
} else if (binding instanceof IFunction) {
|
||||
type = ((IFunction)binding).getType();
|
||||
} else if (binding instanceof ITypedef) {
|
||||
type = ((ITypedef)binding).getType();
|
||||
} else if (binding instanceof IVariable) {
|
||||
type = ((IVariable)binding).getType();
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
@ -142,7 +142,8 @@ public interface IASTUnaryExpression extends IASTExpression {
|
|||
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
|
||||
* 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.
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface IEnumerator extends IBinding {
|
|||
*
|
||||
* @return the type of the enumeration
|
||||
*/
|
||||
public IType getType() throws DOMException;
|
||||
public IType getType();
|
||||
|
||||
/**
|
||||
* Returns the value assigned to this enumerator.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
|
||||
/**
|
||||
|
@ -87,34 +88,106 @@ public interface IScope {
|
|||
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
|
||||
* 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 Use {@link #getBindings(ScopeLookupData)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
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
|
||||
* 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
|
||||
* @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
|
||||
* @since 5.5
|
||||
*/
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings);
|
||||
public IBinding[] getBindings(ScopeLookupData lookup);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpression, IASTImplicitNameOwner {
|
||||
public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpression, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
|
||||
@Override
|
||||
public ICPPASTArraySubscriptExpression copy();
|
||||
|
@ -29,4 +29,16 @@ public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpre
|
|||
*/
|
||||
@Override
|
||||
public ICPPASTArraySubscriptExpression copy(CopyStyle style);
|
||||
|
||||
/**
|
||||
* @since 5.5
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTExpression getArrayExpression();
|
||||
|
||||
/**
|
||||
* @since 5.5
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTInitializerClause getArgument();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTBinaryExpression extends IASTBinaryExpression, IASTImplicitNameOwner {
|
||||
public interface ICPPASTBinaryExpression extends IASTBinaryExpression, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
/**
|
||||
* <code>op_pmdot</code> pointer-to-member field dereference.
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
|||
* @noextend This interface is not intended to be extended 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.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTDeleteExpression extends IASTExpression, IASTImplicitNameOwner {
|
||||
public interface ICPPASTDeleteExpression extends ICPPASTExpression, IASTImplicitNameOwner {
|
||||
/**
|
||||
* <code>OPERAND</code> is the expression representing the pointer being
|
||||
* deleted.
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTExpressionList extends IASTExpressionList, IASTImplicitNameOwner {
|
||||
public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
|
||||
@Override
|
||||
public ICPPASTExpressionList copy();
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
* @noextend This interface is not intended to be extended 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?
|
||||
*/
|
||||
|
@ -52,4 +52,10 @@ public interface ICPPASTFieldReference extends IASTFieldReference, IASTImplicitN
|
|||
* @since 5.4
|
||||
*/
|
||||
public IType getFieldOwnerType();
|
||||
|
||||
/**
|
||||
* @since 5.5
|
||||
*/
|
||||
@Override
|
||||
public ICPPASTExpression getFieldOwner();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTFunctionCallExpression extends IASTFunctionCallExpression, IASTImplicitNameOwner {
|
||||
public interface ICPPASTFunctionCallExpression extends IASTFunctionCallExpression, ICPPASTExpression, IASTImplicitNameOwner {
|
||||
|
||||
@Override
|
||||
ICPPASTFunctionCallExpression copy();
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
|||
* @noextend This interface is not intended to be extended 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
|
||||
ICPPASTInitializerList copy();
|
||||
|
|
|
@ -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.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||
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.
|
||||
* @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 DECLARATOR = new ASTNodeProperty("ICPPASTLambdaExpression - DECLARATOR [ICPPASTFunctionDeclarator]"); //$NON-NLS-1$
|
||||
ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTLambdaExpression - BODY [IASTCompoundStatement]"); //$NON-NLS-1$
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
|||
* @noextend This interface is not intended to be extended 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.
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
|||
* @noextend This interface is not intended to be extended 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(
|
||||
"ICPPASTNewExpression.NEW_PLACEMENT [IASTExpression]"); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @since 5.2
|
||||
*/
|
||||
public interface ICPPASTPackExpansionExpression extends IASTExpression {
|
||||
public interface ICPPASTPackExpansionExpression extends ICPPASTExpression {
|
||||
|
||||
/**
|
||||
* Represents the relationship between a pack-expansion and its pattern.
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
|||
* @noextend This interface is not intended to be extended 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
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
|||
* @noextend This interface is not intended to be extended 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;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
|||
* @noextend This interface is not intended to be extended 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
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue