Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'xlc/org.eclipse.cdt.managedbuilder.xlc.core')
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.properties5
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml19
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XlcBuiltinSpecsDetector.java86
3 files changed, 109 insertions, 1 deletions
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.properties b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.properties
index 9d000f2668..1f8857cdb4 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.properties
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.properties
@@ -16,4 +16,7 @@ providerName=Eclipse CDT
objectFileName=Object File
profileName=XL C managed make per project scanner discovery profile
-profileNameCPP=XL C++ managed make per project scanner discovery profile \ No newline at end of file
+profileNameCPP=XL C++ managed make per project scanner discovery profile
+
+XlcBuiltinSpecsDetectorName=CDT XLC Builtin Compiler Settings
+XlcBuildCommandParserName=CDT XLC Build Output Parser
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
index 9e58122462..dafa1c27d8 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
@@ -74,6 +74,25 @@
class="org.eclipse.cdt.make.xlc.core.scannerconfig.XlCSpecsConsoleParser">
</scannerInfoConsoleParser>
</scannerInfoProvider>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.core.LanguageSettingsProvider">
+ <provider
+ class="org.eclipse.cdt.managedbuilder.xlc.core.XlcBuiltinSpecsDetector"
+ id="org.eclipse.cdt.managedbuilder.xlc.core.XlcBuiltinSpecsDetector"
+ name="%XlcBuiltinSpecsDetectorName"
+ parameter="${COMMAND} -E -V -P -w ${INPUTS}">
+ <language-scope id="org.eclipse.cdt.core.gcc"/>
+ <language-scope id="org.eclipse.cdt.core.g++"/>
+ </provider>
+ <provider
+ class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser"
+ id="org.eclipse.cdt.managedbuilder.xlc.core.XlcBuildCommandParser"
+ name="%XlcBuildCommandParserName"
+ parameter="xl[cC]"
+ prefer-non-shared="true">
+ </provider>
</extension>
+
</plugin>
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XlcBuiltinSpecsDetector.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XlcBuiltinSpecsDetector.java
new file mode 100644
index 0000000000..fe92bbb583
--- /dev/null
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/src/org/eclipse/cdt/managedbuilder/xlc/core/XlcBuiltinSpecsDetector.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Andrew Gvozdev 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:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.managedbuilder.xlc.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditableProvider;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.cdt.managedbuilder.language.settings.providers.ToolchainBuiltinSpecsDetector;
+
+/**
+ * Language settings provider to detect built-in compiler settings for IBM XLC compiler.
+ */
+public class XlcBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector implements ILanguageSettingsEditableProvider {
+ // must match the toolchain definition in org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point
+ private static final String XLC_TOOLCHAIN_ID = "cdt.managedbuild.toolchain.xlc.exe.debug"; //$NON-NLS-1$
+
+ private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"']*(\\s*((\".*?\")|('.*?')|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$
+ private static final int OPTION_GROUP = 0;
+
+ /* Sample output:
+
+ > xlC -E -V -P -w ~/tmp/spec.C
+ export XL_CONFIG=/etc/vac.cfg:xlC
+ /usr/vac/exe/xlCcpp /home/me/tmp/spec.C - -qc++=/usr/vacpp/include -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_IBMR2 -D_POWER -E -P -w -qlanglvl=ansi -qansialias
+ rm /tmp/xlcW0lt4Jia
+ rm /tmp/xlcW1lt4Jib
+ rm /tmp/xlcW2lt4Jic
+ */
+ @SuppressWarnings("nls")
+ private static final AbstractOptionParser[] optionParsers = {
+ new IncludePathOptionParser("-I\\s*([\"'])(.*)\\1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.LOCAL),
+ new IncludePathOptionParser("-I\\s*([^\\s\"']*)", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ new IncludePathOptionParser("-qc\\+\\+=\\s*([^\\s\"']*)", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ new MacroOptionParser("-D\\s*([\"'])([^=]*)(=(.*))?\\1", "$2", "$4", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ new MacroOptionParser("-D\\s*([^\\s=\"']*)=(\\\\([\"']))(.*?)\\2", "$1", "$3$4$3", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ new MacroOptionParser("-D\\s*([^\\s=\"']*)=([\"'])(.*?)\\2", "$1", "$3", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ new MacroOptionParser("-D\\s*([^\\s=\"']*)(=([^\\s\"']*))?", "$1", "$3", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
+ };
+
+ @Override
+ protected String getToolchainId() {
+ return XLC_TOOLCHAIN_ID;
+ }
+
+ @Override
+ protected AbstractOptionParser[] getOptionParsers() {
+ return optionParsers;
+ }
+
+ @Override
+ protected List<String> parseOptions(String line) {
+ List<String> options = new ArrayList<String>();
+ Matcher optionMatcher = OPTIONS_PATTERN.matcher(line);
+ while (optionMatcher.find()) {
+ String option = optionMatcher.group(OPTION_GROUP);
+ if (option!=null) {
+ options.add(option);
+ }
+ }
+ return options;
+ }
+
+ @Override
+ public XlcBuiltinSpecsDetector cloneShallow() throws CloneNotSupportedException {
+ return (XlcBuiltinSpecsDetector) super.cloneShallow();
+ }
+
+ @Override
+ public XlcBuiltinSpecsDetector clone() throws CloneNotSupportedException {
+ return (XlcBuiltinSpecsDetector) super.clone();
+ }
+
+}

Back to the top