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

llvm: Cosmetics (trailing whitespace)

Also set some project specific preferences for save actions.

Change-Id: I8d9c68fd8f7e4a6e9e874e60c12796e2b9b783bf
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
Marc-Andre Laperle 2017-02-14 09:45:59 -05:00 committed by Marc-André Laperle
parent 8a079c6639
commit 5fc81ecaf5
26 changed files with 412 additions and 284 deletions

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n

View file

@ -2,10 +2,14 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
@ -49,12 +53,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
@ -84,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error

View file

@ -0,0 +1,117 @@
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=false
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=false
cleanup.format_source_code=false
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.organize_imports=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=false
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=false
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=false
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=org.eclipse.jdt.ui.default.eclipse_clean_up_profile
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=false
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=false
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=false
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=true
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=true
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -30,7 +30,7 @@ public class LlvmDependencyCalculator2 extends DefaultGCCDependencyCalculator2 {
ITool tool, IPath topBuildDirectory) {
return new LlvmDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath,
* org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -20,8 +20,8 @@ import org.eclipse.core.runtime.IPath;
public class LlvmDependencyCalculator2Commands extends
DefaultGCCDependencyCalculator2Commands {
/**
/**
* @param source IPath
* @param resource IResource
* @param buildContext IBuildObject
@ -50,9 +50,9 @@ public class LlvmDependencyCalculator2Commands extends
@Override
public String[] getDependencyCommandOptions() {
String[] options = new String[2];
// -MMD
// -MMD
options[0] = "-MMD"; //$NON-NLS-1$
// -MP
// -MP
options[1] = "-MP"; //$NON-NLS-1$
// TODO: Check if -MF and/or -MT supported or needed with Clang
return options;

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -15,7 +15,7 @@ import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
/**
* Implemented type that contains BuildEnvironmentalVariables.
*
*
*/
public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
@ -25,7 +25,7 @@ public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
/**
* Constructor.
*
*
* @param name Name for the environment variable
* @param value Value for the environment variable
* @param operation Operation of the environment variable
@ -39,12 +39,12 @@ public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
/*
* (non-Javadoc)
*
*
* @seeorg.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getDelimiter()
*/
/**
* Get a delimiter.
*
*
* @return String delimiter
*/
@Override
@ -54,13 +54,13 @@ public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getName()
*/
/**
* Get name of the llvm environment variable.
*
*
* @return name The name of the llvm environment variable
*/
@Override
@ -70,12 +70,12 @@ public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
/*
* (non-Javadoc)
*
*
* @seeorg.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getOperation()
*/
/**
* Get operation of the llvm environment variable.
*
*
* @return operation The operation of the llvm environment variable
*/
@Override
@ -85,18 +85,18 @@ public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getValue()
*/
/**
* Get value of the llvm environment variable.
*
*
* @return value The value of the llvm environment variable.
*/
@Override
public String getValue() {
return this.value;
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -30,14 +30,14 @@ import org.eclipse.core.runtime.Path;
/**
* Contains LLVM environment variables.
*
*
* @noextend This class is not intended to be subclassed by clients.
*/
public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
// toggle for preference changes
private static boolean preferencesChanged = true;
// LLVM environment variable data structure
private static HashMap<String, LlvmBuildEnvironmentVariable> llvmEnvironmentVariables =
private static HashMap<String, LlvmBuildEnvironmentVariable> llvmEnvironmentVariables =
new HashMap<>(6);
// Environment variables for HashMap usage
private static final String ENV_VAR_NAME_LLVM_BIN = "LLVM_BIN_PATH"; //$NON-NLS-1$
@ -46,7 +46,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$
private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$
private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$
/**
* Initializes llvm environment variable paths from the system environment variables.
*/
@ -68,7 +68,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
// if path is empty
if (envPath == null) {
// try to find mingw path from MingwEnvironmentVariableSupplier
IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
new MingwEnvironmentVariableSupplier();
mingwPath = mingwEnvironmentVariables.getVariable(
ENV_VAR_NAME_PATH, null, null);
@ -103,10 +103,10 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
preferencesChanged = false;
}
}
/**
* Returns LLVM bin path
*
*
* @return LLVM bin path
*/
public static String getBinPath() {
@ -115,7 +115,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns LLVM include paths
*
*
* @return LLVM include paths
*/
public static String getIncludePath() {
@ -124,7 +124,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns LLVM library paths
*
*
* @return LLVM library paths
*/
public static String getLibraryPath() {
@ -133,61 +133,61 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns LLVM libraries
*
*
* @return LLVM libraries
*/
public static String getLibraries() {
return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES).getValue();
}
/**
* Sets path to LLVM bin.
*
*
* @param path Path to LLVM bin location.
*/
public static void setBinPath(String path) {
setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, path);
}
/**
* Appends a new include path.
*
*
* @param path Include path
*/
public static void addIncludePath(String path) {
String existingIncPaths = getIncludePath();
//add the include path only if it doesn't already exists
if (!existingIncPaths.contains(path)) {
appendLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, existingIncPaths, path);
appendLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, existingIncPaths, path);
}
}
/**
* Appends a new library path.
*
*
* @param path Library path
*/
public static void addLibraryPath(String path) {
String existingLibPaths = getLibraryPath();
//add the library path only if it doesn't already exists
if (!existingLibPaths.contains(path)) {
appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, existingLibPaths, path);
appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, existingLibPaths, path);
}
}
/**
* Appends a new library.
*
*
* @param lib Library file
*/
public static void addLibrary(String lib) {
String existingLibs = getLibraries();
//add the library only if it doesn't already exists
if (!existingLibs.contains(lib)) {
appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, existingLibs, lib);
appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, existingLibs, lib);
}
}
/**
* This is to be called if some of the preference paths have changed.
*/
@ -197,7 +197,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns a specific path for given parameters.
*
*
* @param pathKey Path for specific location
* @param subDirName Additional sub-path
* @return bin path
@ -205,7 +205,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
private static String findBinDir(String pathKey, String subDirName) {
String resultPath = null;
// If preferences haven't been changed, try to find the bin path from the LLVM environment
// variable map.
// variable map.
if (!preferencesChanged) { //TODO: Change
//get current path
LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables.get(pathKey);
@ -248,14 +248,14 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
}
// return found path
return resultPath;
return resultPath;
}
return null;
}
/**
* Returns LLVM executable path.
*
*
* @param candidatePath Suggestion for LLVM executable path
* @param subPath Additional sub-path for LLVM executable path
* @return Full path for LLVM executable if valid, otherwise null
@ -278,7 +278,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns the full path for llvm executable if the bin path given
* as a parameter is found and executable exists in that path.
*
*
* @param binPathTemp User provided bin directory path
* @return bin path where llvm-ar is located if executable exists
*/
@ -298,10 +298,10 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
// Return path where llvm-ar exists.
return binPathTemp;
}
}
}
return null;
}
/**
* @return location of $MINGW_HOME/bin folder on the file-system.
* @deprecated. Deprecated as of CDT 8.2. Note that MinGW root path in general may depend on configuration.
@ -321,7 +321,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
* Returns stdc++ library path located in MinGW installation.
*
*
* @return stdc++ library path for MinGW
*/
public static String getMinGWStdLib() {
@ -346,23 +346,23 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
}
}
return null;
}
/**
*
*
* Returns LLVM environment variable.
*
*
* @param envName Name of the environment variable
*/
public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(String envName) {
return llvmEnvironmentVariables.get(envName);
}
/**
* Sets LLVM environment variable.
*
*
* @param name Name for the environment variable
* @param path Path for the environment variable
*/
@ -372,10 +372,10 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
name, path, IBuildEnvironmentVariable.ENVVAR_APPEND));
}
/**
* Sets LLVM environment variable by replacing the existing paths.
*
*
* @param name Name for the environment variable
* @param path Path for the environment variable
*/
@ -384,10 +384,10 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
name, path, IBuildEnvironmentVariable.ENVVAR_REPLACE));
}
/**
* Appends a new LLVM environment variable to existing list.
*
*
* @param name Name of the preference
* @param oldPath Old paths/preference values
* @param path New path to be added to the environment variable
@ -412,7 +412,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
}
if (!ok) {
newPath=path;
newPath=path;
}
// Set new path to the HashMap that contains the specific LLVM environment variable
// if newPath exists.
@ -421,14 +421,14 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
if (!newPath.trim().isEmpty()) {
// add new values to the LLVM environment variable
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(name, newPath,
IBuildEnvironmentVariable.ENVVAR_APPEND));
IBuildEnvironmentVariable.ENVVAR_APPEND));
}
}
}
/**
* Returns a system environment variable path
*
*
* @param envName Environment variable name
* @return system environment variable path
*/
@ -439,7 +439,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
return ""; //$NON-NLS-1$
}
@Override
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) {

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -17,12 +17,12 @@ import org.osgi.framework.Version;
/**
* Based on MingwIsToolChainSupported.
*
*
*/
public class LlvmIsToolChainSupported implements IManagedIsToolChainSupported {
private final boolean supported;
/**
* Constructor.
* LLVM Toolchain is supported if binary path for LLVM Tools can be found.

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -17,7 +17,7 @@ import org.eclipse.core.runtime.CoreException;
/**
* Implements project nature for LLVM projects.
*
*
*/
public class LlvmProjectNature implements IProjectNature {
@ -43,7 +43,7 @@ public class LlvmProjectNature implements IProjectNature {
/**
* Return the project.
*
*
* @return IProject
*/
@Override
@ -53,7 +53,7 @@ public class LlvmProjectNature implements IProjectNature {
/**
* Set the project.
*
*
* @param proj IProject
*/
@Override

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -31,31 +31,31 @@ import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle.
* The main plugin class to be used in the desktop.
*
*
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This class is not intended to be instantiated by clients.
*/
public class LlvmUIPlugin extends AbstractUIPlugin {
public class LlvmUIPlugin extends AbstractUIPlugin {
//The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.llvm.ui"; //$NON-NLS-1$
//The shared instance
private static LlvmUIPlugin plugin;
//Resource bundle
private ResourceBundle resourceBundle;
//Name for the properties file
private final static String PROPERTIES = "plugin.properties"; //$NON-NLS-1$
//Property Resource bundle
private PropertyResourceBundle properties;
//Resource listeners
private IResourceChangeListener listener = new LlvmResourceListener();
private IResourceChangeListener listener2 = new LlvmResourceListener();
/**
* Constructor.
*/
@ -128,7 +128,7 @@ public class LlvmUIPlugin extends AbstractUIPlugin {
/**
* Log error.
*
*
* @param e
*/
public void log(Throwable e) {
@ -137,16 +137,16 @@ public class LlvmUIPlugin extends AbstractUIPlugin {
/**
* Log status.
*
*
* @param status
*/
public void log(IStatus status) {
getLog().log(status);
}
/**
* Get plugin.properties
*
*
* @return PropertyResourceBundle
*/
public PropertyResourceBundle getProperties(){
@ -161,11 +161,11 @@ public class LlvmUIPlugin extends AbstractUIPlugin {
}
}
return this.properties;
}
}
/**
* Get String from the plugin.properties file
*
*
* @param var Variable name wanted as a String e.g. "ToolName.assembler.llvm"
* @return String e.g. LLVM assembler
*/

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -20,13 +20,13 @@ import org.eclipse.swt.widgets.List;
/**
* New implementation of LlvmListEditor.
* Used to select an include path from the dialog.
*
*
*/
public class IncludePathListEditor extends LlvmListEditor {
/**
* Constructor.
*
*
* @param name the name of the preference this field editor works on
* @param labelText the label text of the field editor
* @param parent the parent of the field editor's control
@ -34,7 +34,7 @@ public class IncludePathListEditor extends LlvmListEditor {
IncludePathListEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
@Override
/**
* Functionality for New button.
@ -60,7 +60,7 @@ public class IncludePathListEditor extends LlvmListEditor {
if (item.equalsIgnoreCase(dir)) {
return null;
}
}
}
}
//add a new include path to LLVM preference store
LlvmPreferenceStore.appendIncludePath(dir);
@ -92,5 +92,5 @@ public class IncludePathListEditor extends LlvmListEditor {
selectionChanged();
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -22,13 +22,13 @@ import org.eclipse.swt.widgets.Text;
/**
* New implementation of LlvmListEditor.
* Used to select a library file from the dialog.
*
*
*/
public class LibraryListEditor extends LlvmListEditor {
/**
* Constructor.
*
*
* @param name
* @param labelText
* @param parent
@ -36,7 +36,7 @@ public class LibraryListEditor extends LlvmListEditor {
LibraryListEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
@Override
/**
* Functionality for New button.
@ -46,7 +46,7 @@ public class LibraryListEditor extends LlvmListEditor {
FileDialog dlg = new FileDialog(getShell());
final Text text = new Text(getShell(), SWT.BORDER);
dlg.setFilterPath(text.getText());
dlg.setText(Messages.LibraryListEditor_0);
dlg.setText(Messages.LibraryListEditor_0);
dlg.open();
String file = dlg.getFileName();
if(file == null) {
@ -93,5 +93,5 @@ public class LibraryListEditor extends LlvmListEditor {
selectionChanged();
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -22,13 +22,13 @@ import org.eclipse.swt.widgets.Text;
/**
* New implementation of LlvmListEditor.
* Used to select a library path from the dialog.
*
*
*/
public class LibraryPathListEditor extends LlvmListEditor {
/**
* Constructor.
*
*
* @param name the name of the preference this field editor works on
* @param labelText the label text of the field editor
* @param parent the parent of the field editor's control
@ -36,7 +36,7 @@ public class LibraryPathListEditor extends LlvmListEditor {
LibraryPathListEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
@Override
/**
* Functionality for New button.
@ -46,8 +46,8 @@ public class LibraryPathListEditor extends LlvmListEditor {
DirectoryDialog dlg = new DirectoryDialog(getShell());
final Text text = new Text(getShell(), SWT.BORDER);
dlg.setFilterPath(text.getText());
dlg.setText(Messages.LibraryPathListEditor_0);
dlg.setMessage(Messages.LibraryPathListEditor_1);
dlg.setText(Messages.LibraryPathListEditor_0);
dlg.setMessage(Messages.LibraryPathListEditor_1);
String dir = dlg.open();
if(dir == null) {
return null;
@ -64,7 +64,7 @@ public class LibraryPathListEditor extends LlvmListEditor {
if (item.equalsIgnoreCase(dir)) {
return null;
}
}
}
}
//add a new library search path to LLVM preference store
LlvmPreferenceStore.appendLibraryPath(dir);
@ -96,5 +96,5 @@ public class LibraryPathListEditor extends LlvmListEditor {
selectionChanged();
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Widget;
* An abstract list editor that manages a list of input values.
* The editor displays a list containing the values, buttons for adding and removing
* values, and Up and Down buttons to adjust the order of elements in the list.
*
*
*/
public abstract class LlvmListEditor extends ListEditor {
@ -79,7 +79,7 @@ public abstract class LlvmListEditor extends ListEditor {
/**
* Creates a list field editor.
*
*
* @param name the name of the preference this field editor works on
* @param labelText the label text of the field editor
* @param parent the parent of the field editor's control
@ -87,11 +87,11 @@ public abstract class LlvmListEditor extends ListEditor {
protected LlvmListEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
@Override
/**
* Combines the given list of items into a single String.
* This method is the converse of parseString.
* This method is the converse of parseString.
*/
protected String createList(String[] items) {
StringBuilder stringBuilder = new StringBuilder();
@ -129,7 +129,7 @@ public abstract class LlvmListEditor extends ListEditor {
/**
* Helper method to create a push button.
*
*
* @param parent the parent control
* @param key the resource name used to supply the button's label text
* @return Button
@ -244,13 +244,13 @@ public abstract class LlvmListEditor extends ListEditor {
/**
* Invoked when the selection in the list has changed.
*
*
* <p>
* The default implementation of this method utilizes the selection index
* and the size of the list to toggle the enablement of the up, down and
* remove buttons.
* </p>
*
*
*/
@Override
protected void selectionChanged() {
@ -299,7 +299,7 @@ public abstract class LlvmListEditor extends ListEditor {
}
return this.addButton.getShell();
}
/**
* Notifies that the Add button has been pressed.
*/
@ -317,12 +317,12 @@ public abstract class LlvmListEditor extends ListEditor {
selectionChanged();
}
}
/**
* Notifies that the Remove button has been pressed.
*/
protected abstract void removePressed();
/**
* Notifies that the Up button has been pressed.
*/
@ -336,5 +336,5 @@ public abstract class LlvmListEditor extends ListEditor {
void downPressed() {
swap(false);
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -20,17 +20,17 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
/**
* This class represents a preference page that
* is contributed to the Preferences dialog. By
* is contributed to the Preferences dialog. By
* subclassing <samp>FieldEditorPreferencePage</samp>, we
* can use the field support built into JFace that allows
* us to create a page that is small and knows how to
* us to create a page that is small and knows how to
* save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They
* are stored in the preference store that belongs to
* the main plug-in class. That way, preferences can
* be accessed directly via the preference store.
*
*
*/
public class LlvmPreferencePage
extends FieldEditorPreferencePage
@ -60,28 +60,28 @@ public class LlvmPreferencePage
public String getDescription() {
return null;
}
// @Override
// public boolean performOk() {
// //rebuilt the index of all projects
// //rebuilt the index of all projects
// IProject[] projects = LlvmToolOptionPathUtil.getProjectsInWorkspace();
// for (IProject proj : projects) {
// ProjectIndex.rebuiltIndex(proj);
// }
// return true;
// }
@Override
/**
* Creates field editors for the preference page.
*/
protected void createFieldEditors() {
//field for installation path
addField(new DirectoryFieldEditor(PreferenceConstants.P_LLVM_PATH,
Messages.LlvmPreferencePage_1, getFieldEditorParent()));
addField(new DirectoryFieldEditor(PreferenceConstants.P_LLVM_PATH,
Messages.LlvmPreferencePage_1, getFieldEditorParent()));
//list editor for include paths
IncludePathListEditor includePathListEditor = new IncludePathListEditor(
PreferenceConstants.P_LLVM_INCLUDE_PATH, Messages.LlvmPreferencePage_2,
PreferenceConstants.P_LLVM_INCLUDE_PATH, Messages.LlvmPreferencePage_2,
getFieldEditorParent());
addField(includePathListEditor);
//list editor for libraries
@ -95,5 +95,5 @@ public class LlvmPreferencePage
getFieldEditorParent());
addField(libraryPathListEditor);
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -21,92 +21,92 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
/**
* Class used to access the LLVM Preference store values.
*
*
* This class is not intended to be subclassed by clients.
*/
public class LlvmPreferenceStore {
/**
* Get the LLVM Preference store.
*
*
* @return LLVM Preference store.
*/
public static IEclipsePreferences getPreferenceStore() {
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(LlvmUIPlugin.PLUGIN_ID);
return prefs;
}
/**
* Get a value from the LLVM Preference store.
*
*
* @param name the name of the preference
* @return the string-valued preference
*/
public static String getPreferenceStoreValue(String name) {
return getPreferenceStore().get(name, ""); //$NON-NLS-1$
}
/**
* Get the LLVM bin path value from the LLVM Preference store.
*
*
* @return the LLVM bin path value.
*/
public static String getBinPath() {
return getPreferenceStoreValue(PreferenceConstants.P_LLVM_PATH);
}
/**
* Get the LLVM include path value from the LLVM Preference store.
*
*
* @return the LLVM include path value.
*/
public static String getIncludePath() {
return getPreferenceStoreValue(PreferenceConstants.P_LLVM_INCLUDE_PATH);
}
/**
* Get the LLVM library path value from the LLVM Preference Store.
*
*
* @return the LLVM library path value.
*/
public static String getLibraryPath() {
return getPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARY_PATH);
}
/**
* Get the LLVM library from the LLVM Preference store.
*
*
* @return the LLVM library value.
*/
public static String getLibraries() {
return getPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARIES);
}
}
/**
* Get values from the LLVM Preference store as a String array.
* Used to get Preference store values which consist of multiple paths
* separated by a path separator.
*
*
* @param name the name of the preference
* @return A String array containing all Preference store values
*/
public static String[] getPreferenceStoreValueAsArray(String name) {
return LlvmToolOptionPathUtil.stringToArray(name);
}
/**
* Set LLVM Preference store value.
*
*
* @param name the name of the preference
* @param value the string-valued preference
*/
public static void setPreferenceStoreValue(String name, String value) {
getPreferenceStore().put(name, value);
}
/**
* Set LLVM bin path to the LLVM Preference store.
*
*
* @param path the path to the LLVM bin path.
*/
public static void setBinPath(String path) {
@ -115,16 +115,16 @@ public class LlvmPreferenceStore {
/**
* Set LLVM include path to the LLVM Preference store.
*
*
* @param path LLVM include path.
*/
public static void setIncludePath(String path) {
setPreferenceStoreValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
}
/**
* Set LLVM library path to the LLVM Preference store.
*
*
* @param path LLVM library path.
*/
public static void setLibraryPath(String path) {
@ -133,18 +133,18 @@ public class LlvmPreferenceStore {
/**
* Set LLVM library to the LLVM Preference store.
*
*
* @param lib LLVM library.
*/
public static void setLibrary(String lib) {
setPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARIES, lib);
}
/**
* Get existing paths from the Preference store.
*
*
* @param name the name of the preference
* @return paths
* @return paths
*/
private static String getExistingPaths(String name) {
String paths = ""; //$NON-NLS-1$
@ -154,13 +154,13 @@ public class LlvmPreferenceStore {
paths = getLibraryPath();
} else if (name.equals(PreferenceConstants.P_LLVM_LIBRARIES)) {
paths = getLibraries();
}
}
return paths;
}
/**
* Append a new value to the Preference store if it doesn't already exists.
*
*
* @param name the name of the preference
* @param value the string-valued preference
*/
@ -183,7 +183,7 @@ public class LlvmPreferenceStore {
}
//append the new value to end of the list
sB.append(value);
}
}
}
} else { //no existing values
//if the value is reasonable
@ -195,40 +195,40 @@ public class LlvmPreferenceStore {
String newValues = sB.toString();
if (newValues.length()!=0) {
//set the new preference store value
setPreferenceStoreValue(name, newValues);
setPreferenceStoreValue(name, newValues);
}
}
/**
* Append an include path to the LLVM Preference store.
*
*
* @param path the LLVM include path.
*/
public static void appendIncludePath(String path) {
appendValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
}
/**
* Append a library path to the LLVM Preference store.
*
*
* @param path the LLVM library path.
*/
public static void appendLibraryPath(String path) {
appendValue(PreferenceConstants.P_LLVM_LIBRARY_PATH, path);
}
/**
* Append a library to the LLVM Preference store.
*
*
* @param lib the LLVM library.
*/
public static void appendLibrary(String lib) {
appendValue(PreferenceConstants.P_LLVM_LIBRARIES, lib);
}
/**
* Remove a value from the LLVM preference store.
*
*
* @param name Name of the preference
* @param value Value to remove from the preference store
*/
@ -263,7 +263,7 @@ public class LlvmPreferenceStore {
} else { //only one value with a path separator at the end
newValue = ""; //$NON-NLS-1$
}
} else { //only value without a path separator at the end
newValue = ""; //$NON-NLS-1$
}
@ -271,28 +271,28 @@ public class LlvmPreferenceStore {
setPreferenceStoreValue(name, newValue);
}
}
/**
* Remove a include path from the LLVM preference store.
*
*
* @param path The include path to be removed from the LLVM preference store.
*/
public static void removeIncludePath(String path) {
removeValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
}
/**
* Remove a library path from the LLVM preference store.
*
*
* @param path The library path to be removed from the LLVM preference store.
*/
public static void removeLibraryPath(String path) {
removeValue(PreferenceConstants.P_LLVM_LIBRARY_PATH, path);
}
/**
* Remove a library from the LLVM preference store.
*
* Remove a library from the LLVM preference store.
*
* @param lib The library to be removed from the LLVM preference store.
*/
public static void removeLibrary(String lib) {
@ -308,7 +308,7 @@ public class LlvmPreferenceStore {
appendLibrary("stdc++"); //$NON-NLS-1$
}
}
public static void addStdLibUnix() {
String path = FindStdLibPath.find();
String lib = "stdc++"; //$NON-NLS-1$
@ -319,5 +319,5 @@ public class LlvmPreferenceStore {
appendLibrary(lib);
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -14,7 +14,7 @@ package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"; //$NON-NLS-1$
public static String IncludePathListEditor_0;
public static String IncludePathListEditor_1;
@ -26,7 +26,7 @@ public class Messages extends NLS {
public static String LlvmPreferencePage_2;
public static String LlvmPreferencePage_3;
public static String LlvmPreferencePage_4;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
@ -34,5 +34,5 @@ public class Messages extends NLS {
private Messages() {
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
/**
* Constant definitions for plug-in preferences
*
*
*/
public class PreferenceConstants {
@ -21,5 +21,5 @@ public class PreferenceConstants {
public static final String P_LLVM_INCLUDE_PATH = "Include path used in LLVM compilations"; //$NON-NLS-1$
public static final String P_LLVM_LIBRARY_PATH = "Library path used in LLVM builds"; //$NON-NLS-1$
public static final String P_LLVM_LIBRARIES = "Libraries used in LLVM builds"; //$NON-NLS-1$
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Leo Hippelainen - Initial implementation
@ -18,13 +18,13 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
/**
* Class used to initialize the default preference values.
*
*
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
@Override

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -18,7 +18,7 @@ public class FileUtil {
/**
* Searches cpp and cc file types recursively and returns true if
* the directory tree contains at least one instance of them.
*
*
* @param directory
* @param filter
* @return
@ -40,5 +40,5 @@ public class FileUtil {
}
return false;
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -18,7 +18,7 @@ import java.io.InputStreamReader;
/**
* The purpose is to find a path where stdc++ library is located.
* Currently the shell script is only for Linux.
*
*
* TODO: It might not be able to execute scripts therefore place the command into a variable.
*/
public class FindStdLibPath {
@ -27,10 +27,10 @@ public class FindStdLibPath {
private static final String STD_LIB = "libstdc++.a"; //$NON-NLS-1$
private static final String UNIX_SCRIPT = " echo `locate libstdc++.a | sort -r | head -1 | sed \"s/libstdc++.a$//\"` "; //$NON-NLS-1$
private static final String MAC_SCRIPT = " echo `locate libstdc++.dylib | sort -r | head -1 | sed \"s/libstdc++.dylib$//\"` "; //$NON-NLS-1$
/**
* Find stdc++ library path.
*
*
* @return Stdc++ library path.
*/
public static String find() {
@ -60,5 +60,5 @@ public class FindStdLibPath {
}
return null;
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -23,7 +23,7 @@ public class LlvmResourceListener implements IResourceChangeListener {
/**
* Defines what happens when resources have changed.
*
*
* @param event IResourceChangeEvent
*/
@Override
@ -58,7 +58,7 @@ public class LlvmResourceListener implements IResourceChangeListener {
} else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0 /*|| os.indexOf( "mac") >=0 */) { //$NON-NLS-1$ //$NON-NLS-2$
LlvmPreferenceStore.addStdLibUnix();
}
/*
* try to add values (include and library paths and libraries) to
* projects's build configurations to ensure that newly added projects

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -42,7 +42,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
* for LLVM compiler and linker Tools which are added in Preferences->LLVM to all projects
* and build configurations that use LLVM ToolChain. Values added in Preferences->LLVM will
* show in Project->Properties->C/C++ General->Paths and Symbols tabs.
*
*
*/
public class LlvmToolOptionPathUtil {
@ -56,9 +56,9 @@ public class LlvmToolOptionPathUtil {
/**
* Adds new include path to LLVM front-end's Include path option for every project
* in the workspace that uses LLVM Toolchain and for for every build configuration.
*
* @param includePath Include path for LLVM front-end's Include Option
* in the workspace that uses LLVM Toolchain and for for every build configuration.
*
* @param includePath Include path for LLVM front-end's Include Option
*/
public static void addLlvmIncludePath(String includePath) {
addPathToToolOption(includePath, INCLUDE);
@ -66,9 +66,9 @@ public class LlvmToolOptionPathUtil {
/**
* Removes an include path from LLVM front-end's Include path option for every project
* in the workspace that uses LLVM Toolchain and for for every build configuration.
*
* @param includePath Include path for LLVM front-end's Include Option
* in the workspace that uses LLVM Toolchain and for for every build configuration.
*
* @param includePath Include path for LLVM front-end's Include Option
*/
public static void removeLlvmIncludePath(String includePath) {
removePathFromToolOption(includePath, INCLUDE);
@ -77,7 +77,7 @@ public class LlvmToolOptionPathUtil {
/**
* Adds a new Library to LLVM linker's Libraries Option for every project
* in the workspace that use LLVM Toolchain and for for every build configuration.
*
*
* @param lib Library name for the LLVM linker's Libraries Option
*/
public static void addLlvmLib(String lib) {
@ -87,7 +87,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes a Library to LLVM linker's Libraries Option for every project
* in the workspace that use LLVM Toolchain and for for every build configuration.
*
*
* @param lib Library name for the LLVM linker's Libraries Option
*/
public static void removeLlvmLib(String lib) {
@ -98,7 +98,7 @@ public class LlvmToolOptionPathUtil {
* Adds a new Library search path directory to LLVM linker's Library search path Option
* for every project in the workspace that use LLVM Toolchain and for for every
* build configuration.
*
*
* @param libDir Library search path directory for LLVM linker's Library search path Option
*/
public static void addLlvmLibraryPath(String libDir) {
@ -109,16 +109,16 @@ public class LlvmToolOptionPathUtil {
* Removes a Library search path directory from LLVM linker's Library search path Option
* for every project in the workspace that use LLVM Toolchain and for for every
* build configuration.
*
*
* @param libDir Library search path directory for LLVM linker's Library search path Option
*/
*/
public static void removeLlvmLibraryPath(String libDir) {
removePathFromToolOption(libDir, LIB_PATH);
}
/**
* Adds a path to Tool option.
*
*
* @param path Path to add to Tool option
* @param var Tool option's value
*/
@ -130,7 +130,7 @@ public class LlvmToolOptionPathUtil {
IProject[] projects = getProjectsInWorkspace();
IConfiguration[] configs;
for (IProject proj : projects) {
//get all build configurations of the IProject
configs = getAllBuildConfigs(proj);
//if build configurations found
@ -146,16 +146,16 @@ public class LlvmToolOptionPathUtil {
//if the path was added successfully
if (success) {
//save project build info
ManagedBuildManager.saveBuildInfo(proj, true);
ManagedBuildManager.saveBuildInfo(proj, true);
}
}
}
}
}
}
/**
* Adds a path to Tool option. Only for C++ projects.
*
*
* @param path Path to add to Tool option
* @param var Tool option's value
*/
@ -187,7 +187,7 @@ public class LlvmToolOptionPathUtil {
//if the path was added successfully
if (success) {
//save project build info
ManagedBuildManager.saveBuildInfo(proj, true);
ManagedBuildManager.saveBuildInfo(proj, true);
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(proj);
try {
CoreModel.getDefault().setProjectDescription(proj, projectDescription);
@ -208,13 +208,13 @@ public class LlvmToolOptionPathUtil {
}
}
}
}
}
}
}
/**
* Removes a path from Tool option.
*
*
* @param path Path to remove from Tool option
* @param var Tool option's value
*/
@ -241,16 +241,16 @@ public class LlvmToolOptionPathUtil {
//if the path was removed successfully
if (success) {
//save project build info
ManagedBuildManager.saveBuildInfo(proj, true);
ManagedBuildManager.saveBuildInfo(proj, true);
}
}
}
}
}
}
/**
* Add a path to specific build configuration's Tool option.
*
* Add a path to specific build configuration's Tool option.
*
* @param cf Build configuration
* @param path Path or file name to add
* @param var Value of the option type
@ -270,8 +270,8 @@ public class LlvmToolOptionPathUtil {
}
/**
* Removes a path from specific build configuration's Tool option.
*
* Removes a path from specific build configuration's Tool option.
*
* @param cf Build configuration
* @param path Path or file name to remove
* @param var Value of the option type
@ -292,7 +292,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns all projects in the workspace.
*
*
* @return IProject[]
*/
public static IProject[] getProjectsInWorkspace() {
@ -304,7 +304,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns all build configurations of the project.
*
*
* @param proj IProject Project
* @return IConfiguration[] Build configurations
*/
@ -334,7 +334,7 @@ public class LlvmToolOptionPathUtil {
/**
* Adds an include path to LLVM front-end's include path option.
*
*
* @param cf IConfiguration Build configuration
* @param newIncludePath Include path to be added to LLVM front-end's Include path option
*/
@ -348,13 +348,13 @@ public class LlvmToolOptionPathUtil {
//add a new include path to front-end's Include paths option.
boolean val = addIncludePathToToolOption(cf, llvmFrontEnd, llvmFrontEndIncPathOption, newIncludePath);
return val;
}
}
return false;
}
/**
* Removes an include path from LLVM front-end's include path option.
*
*
* @param cf IConfiguration Build configuration
* @param removeIncludePath Include path to be removed from LLVM front-end's Include path option
*/
@ -368,13 +368,13 @@ public class LlvmToolOptionPathUtil {
//remove an include path from front-end's Include paths option.
removeIncludePathFromToolOption(cf, llvmFrontEnd, llvmFrontEndIncPathOption, removeIncludePath);
return true;
}
}
return false;
}
/**
* Adds a Library to LLVM linker's Libraries Option.
*
*
* @param cf IConfiguration Build configuration
* @param lib Library name
* @return boolean Returns true if Library Option was added successfully for the LLVM Linker.
@ -389,14 +389,14 @@ public class LlvmToolOptionPathUtil {
//add library to LLVM linker's Libraries Option type
boolean val = addLibraryToToolOption(cf, llvmLinker, librariesOption, lib);
return val;
}
}
//adding the library failed
return false;
}
/**
* Removes a Library from LLVM linker's Libraries Option.
*
*
* @param cf IConfiguration Build configuration
* @param removeLib Library name
* @return boolean Returns true if Library Option was removed successfully from the LLVM Linker.
@ -411,14 +411,14 @@ public class LlvmToolOptionPathUtil {
//remove a library from LLVM linker's Libraries Option type
removeLibraryFromToolOption(cf, llvmLinker, librariesOption, removeLib);
return true;
}
}
//removing the library failed
return false;
}
/**
* Adds a Library search path to LLVM linker's Library search path Option.
*
*
* @param cf IConfiguration Build configuration
* @param libDir Library search path
* @return boolean Returns true if Library search path Option was added successfully for the LLVM Linker.
@ -433,14 +433,14 @@ public class LlvmToolOptionPathUtil {
//add library search path to LLVM linker's Library Search Path Option type
boolean val = addLibrarySearchPathToToolOption(cf, llvmLinker, libDirOption, libDir);
return val;
}
}
//adding library failed
return false;
}
/**
* Removes a Library search path from LLVM linker's Library search path Option.
*
*
* @param cf IConfiguration Build configuration
* @param removeLibDir Library search path
* @return boolean Returns true if Library search path Option was removed successfully from the LLVM Linker.
@ -455,14 +455,14 @@ public class LlvmToolOptionPathUtil {
//remove a library search path from LLVM linker's Library Search Path Option type
removeLibrarySearchPathFromToolOption(cf, llvmLinker, libDirOption, removeLibDir);
return true;
}
}
//removing the library search path failed
return false;
}
/**
* Adds include path for given Build configuration's Tool's Include path Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -488,7 +488,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes an include path from given Build configuration's Tool's Include path Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -506,7 +506,7 @@ public class LlvmToolOptionPathUtil {
/**
* Adds new Library for the Linker's Libraries Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -534,7 +534,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes a new Library from the Linker's Libraries Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -553,7 +553,7 @@ public class LlvmToolOptionPathUtil {
//Works only if Eclipse Bugzilla Bug 321040 fix is applied
/**
* Adds new Library search path for the Linker's Library search path Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -582,7 +582,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes a Library search path from the Linker's Library search path Option.
* Since CDT 8.0 (Bugzilla Bug 321040)
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -600,7 +600,7 @@ public class LlvmToolOptionPathUtil {
/**
* Adds a new value to specific Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -622,7 +622,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes a value from a specific Option.
*
*
* @param cf IConfiguration Build configuration
* @param cfTool ITool Tool
* @param option Tool Option type
@ -663,7 +663,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns LLVM linker.
*
*
* @param cf IConfiguration Build configuration
* @return ITool LLVM linker
*/
@ -674,7 +674,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns ITool associated with the input extension.
*
*
* @param cf IConfiguration Build configuration
* @param ext input extension associated with ITool
* @return ITool Tool that matches input extension
@ -686,7 +686,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns LLVM front-end Include path Option type.
*
*
* @param cf IConfiguration Project build configuration
* @return IOption Tool option type
*/
@ -700,7 +700,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns LLVM Linker Libraries Option type.
*
*
* @param cf IConfiguration Project build configuration
* @return IOption Tool option type
*/
@ -714,7 +714,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns LLVM Linker Library search path Option type.
*
*
* @param cf IConfiguration Project build configuration
* @return IOption Tool option type
*/
@ -728,7 +728,7 @@ public class LlvmToolOptionPathUtil {
/**
* Returns Tool's option id.
*
*
* @param cfTool ITool Tool
* @param optionValueType Option's value type.
* @return optionId Tool's option id.
@ -748,13 +748,13 @@ public class LlvmToolOptionPathUtil {
} catch (BuildException e) {
//log error
}
}
}
return optionId;
}
/**
* Returns Tool's Option type by Id.
*
*
* @param cfTool ITool Tool
* @param optionId String Tool option type id
* @return IOption Tool option type
@ -766,9 +766,9 @@ public class LlvmToolOptionPathUtil {
/**
* Adds one or more paths to the list of paths.
*
*
* @param existingPaths Existing list of paths to add to
* @param newPath New path to add. May include multiple directories with a path delimiter java.io.File.pathSeparator
* @param newPath New path to add. May include multiple directories with a path delimiter java.io.File.pathSeparator
* (usually semicolon (Win) or colon (Linux/Mac), OS specific)
* @return String[] List that includes existing paths as well as new paths.
*/
@ -794,7 +794,7 @@ public class LlvmToolOptionPathUtil {
/**
* Removes one path from the list of paths.
*
*
* @param existingPaths Existing list of paths to remove from
* @param removePath Path to be removed.
* @return String[] List that includes existing paths without the path that was removed.
@ -815,7 +815,7 @@ public class LlvmToolOptionPathUtil {
/**
* Split paths to a String array.
*
*
* @param str String of paths separated by a path separator.
* @return String array containing multiple paths.
*/
@ -825,26 +825,26 @@ public class LlvmToolOptionPathUtil {
/**
* Append an array of Strings to a String separated by a path separator.
*
*
* @param array An array of Strings.
* @return string which contains all indexes of
* a String array separated by a path separator.
*/
public static String arrayToString(String[] array) {
StringBuilder sB = new StringBuilder();
//if array isn't empty and doesn't contain an empty String
//if array isn't empty and doesn't contain an empty String
if (array.length>0 /*&& !array[0].isEmpty()*/) {
for (String i : array) {
sB.append(i);
sB.append(System.getProperty("path.separator")); //$NON-NLS-1$
}
}
}
return sB.toString();
}
/**
* Checks if a file path exists.
*
*
* @return boolean True if the file exists.
*/
private static boolean pathExists(String path) {
@ -854,7 +854,7 @@ public class LlvmToolOptionPathUtil {
/**
* Get all include paths in a String array.
*
*
* @return String[] A String array of include paths
*/
private static String[] getAllIncludePaths() {
@ -867,7 +867,7 @@ public class LlvmToolOptionPathUtil {
/**
* Get all libraries in a String array.
*
*
* @return String[] A String array of libraries
*/
private static String[] getAllLibraries() {
@ -880,7 +880,7 @@ public class LlvmToolOptionPathUtil {
/**
* Get all library paths in a String array.
*
*
* @return String[] A String array of library paths
*/
private static String[] getAllLibraryPaths() {
@ -890,7 +890,7 @@ public class LlvmToolOptionPathUtil {
String[] libPaths = libPathList.split(Separators.getPathSeparator());
return libPaths;
}
/**
* Add all include paths found in LLVM preference page to
* every project's build configurations.
@ -898,10 +898,10 @@ public class LlvmToolOptionPathUtil {
public static void addAllIncludesToBuildConf() {
String[] includes = getAllIncludePaths();
for(String inc : includes) {
addLlvmIncludePath(inc);
addLlvmIncludePath(inc);
}
}
/**
* Add all libraries found in LLVM preference page to
* every project's build configurations.
@ -914,16 +914,16 @@ public class LlvmToolOptionPathUtil {
// }
}
}
/**
* Add all library paths found in LLVM preference page to
* every project's build configurations.
* every project's build configurations.
*/
public static void addAllLibPathsToBuildConf() {
String[] libPaths = getAllLibraryPaths();
for(String libPath : libPaths) {
// if (!libPath.equalsIgnoreCase(LlvmEnvironmentVariableSupplier.getMinGWStdLib())) { //C++ specific
addLlvmLibraryPath(libPath);
addLlvmLibraryPath(libPath);
// }
}
}
@ -931,7 +931,7 @@ public class LlvmToolOptionPathUtil {
//temporary hack until scanner discovery works
public static void addMissingCppIncludesForMingw() {
//try to find mingw path from MingwEnvironmentVariableSupplier
IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
new MingwEnvironmentVariableSupplier();
IBuildEnvironmentVariable mingwPath = mingwEnvironmentVariables.getVariable(
"PATH", null, null); //$NON-NLS-1$
@ -976,5 +976,5 @@ public class LlvmToolOptionPathUtil {
LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -25,5 +25,5 @@ public class ProjectIndex {
ICProject cproject = CoreModel.getDefault().getCModel().getCProject(proj.getName());
CCorePlugin.getIndexManager().reindex(cproject);
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Nokia Siemens Networks - initial implementation
* Petri Tuononen - Initial implementation
@ -13,29 +13,29 @@ package org.eclipse.cdt.managedbuilder.llvm.util;
/**
* Provides different separators such as file and path separators.
*
*
*/
public class Separators {
private static final String pathSeparator = System.getProperty("path.separator"); //$NON-NLS-1$
private static final String fileSeparator = System.getProperty("file.separator"); //$NON-NLS-1$
/**
* Get path separator.
*
*
* @return path separator
*/
public static String getPathSeparator() {
return pathSeparator;
}
/**
* Get file separator.
*
*
* @return file separator
*/
public static String getFileSeparator() {
return fileSeparator;
}
}