Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2010-05-11 18:50:20 -0400
committerChris Recoskie2010-05-11 18:50:20 -0400
commit947eedd5bc0599f5cc39c7646cca25e656169621 (patch)
tree81a4d4d2c0adc5afea2f132034f8fea0cd8f1b7c
parenta9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0 (diff)
downloadorg.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.tar.gz
org.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.tar.xz
org.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.zip
- Merged changes from cdt_5_0 to HEAD. Too many to mention individually.
- Reworked IFileSystem utility so that now it is noimplement/noextend. Clients should now extend from concrete class FileSystemUtility instead to better insulate them from future API changes. - Reworked the resulting concurrency fixes - indexing and scanner discovery now synchronize on the project root as a scheduling rule. Original HEAD behaviour was to synch on the project's .settings folder for indexing, but that deadlocked with scanner discovery. - Fixed remote indexing. Changes on HEAD that deprecated CodeReader broke the ability for remote translation units to provide the path to load the file content from. Added API to ITranslationUnit for this purpose.
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java45
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java38
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java82
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java58
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties2
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters13
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF5
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java13
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java2
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java7
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java10
-rw-r--r--core/org.eclipse.cdt.core/plugin.xml1
-rw-r--r--core/org.eclipse.cdt.core/schema/FileSystemUtility.exsd114
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java15
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java24
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/FileSystemUtility.java77
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java66
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java177
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java28
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF2
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs303
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/META-INF/MANIFEST.MF5
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java70
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.java32
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.properties4
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java415
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java1665
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java (renamed from xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java)5
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java712
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java136
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java179
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java44
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java52
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml4
41 files changed, 4067 insertions, 392 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
index df1a9d2a37..d9ca8d3b44 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig;
@@ -247,11 +248,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
fireUpdate(INFO_CHANGED, info);
if(updateContainer){
-// ICProject cProject = CoreModel.getDefault().create(info.getProject());
-// if (cProject != null) {
-// CoreModel.setPathEntryContainer(new ICProject[]{cProject},
-// new DiscoveredPathContainer(info.getProject()), null);
-// }
+
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
String profileId = buildInfo.getSelectedProfileId();
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
@@ -265,6 +262,44 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
}
}
}
+
+ /**
+ * Allows one to update the discovered information for a particular scanner discovery profile ID.
+ * TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from.
+ *
+ * @param context
+ * @param info
+ * @param updateContainer
+ * @param changedResources
+ * @param profileId
+ * @throws CoreException
+ */
+ public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources, String profileId) throws CoreException {
+ DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
+ IDiscoveredPathInfo oldInfo = holder.getInfo(context);
+ if (oldInfo != null) {
+ IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
+ if (serializable != null) {
+ holder.setInfo(context, info);
+ IProject project = info.getProject();
+ DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
+ fireUpdate(INFO_CHANGED, info);
+
+ if(updateContainer){
+
+ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+
+ ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
+ getSCProfileConfiguration(profileId).getProfileScope();
+ changeDiscoveredContainer(project, profileScope, changedResources);
+ }
+ }
+ else {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
+ }
+ }
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 1210a94d4d..5174c9d274 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,25 +34,25 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class CCommandDSC {
- private final static String SINGLE_SPACE = " "; //$NON-NLS-1$
- private final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
- private final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
- private final static String OPTION_ELEM = "option"; //$NON-NLS-1$
- private final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
- private final static String KEY_ATTR = "key"; //$NON-NLS-1$
- private final static String VALUE_ATTR = "value"; //$NON-NLS-1$
- private final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
- private final static String KIND_ATTR = "kind"; //$NON-NLS-1$
+ protected final static String SINGLE_SPACE = " "; //$NON-NLS-1$
+ protected final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
+ protected final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
+ protected final static String OPTION_ELEM = "option"; //$NON-NLS-1$
+ protected final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
+ protected final static String KEY_ATTR = "key"; //$NON-NLS-1$
+ protected final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ protected final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
+ protected final static String KIND_ATTR = "kind"; //$NON-NLS-1$
- private int commandId;
- private List<KVStringPair> compilerCommand; // members are KVStringPair objects
- private boolean discovered;
- private boolean cppFileType; // C or C++ file type
- private IProject project;
+ protected int commandId;
+ protected List<KVStringPair> compilerCommand; // members are KVStringPair objects
+ protected boolean discovered;
+ protected boolean cppFileType; // C or C++ file type
+ protected IProject project;
- private List<String> symbols;
- private List<String> includes;
- private List<String> quoteIncludes;
+ protected List<String> symbols;
+ protected List<String> includes;
+ protected List<String> quoteIncludes;
public CCommandDSC(boolean cppFileType) {
this(cppFileType, null);
@@ -394,7 +394,7 @@ public class CCommandDSC {
return path;
}
- private static IResource findResource(IProject project, IPath path) {
+ protected static IResource findResource(IProject project, IPath path) {
IResource resource = project.findMember(path, false);
if (resource == null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index bde4988df1..61ee97fa0f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -60,15 +60,15 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
- private static final int INCLUDE_PATH = 1;
- private static final int QUOTE_INCLUDE_PATH = 2;
- private static final int INCLUDE_FILE = 3;
- private static final int MACROS_FILE = 4;
+ protected static final int INCLUDE_PATH = 1;
+ protected static final int QUOTE_INCLUDE_PATH = 2;
+ protected static final int INCLUDE_FILE = 3;
+ protected static final int MACROS_FILE = 4;
- private class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
- private final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
- private final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
- private final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
+ protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
+ protected final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
+ protected final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
+ protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
public ScannerInfoData() {
commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
@@ -150,7 +150,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
- private static class ProjectScannerInfo {
+ protected static class ProjectScannerInfo {
IPath[] includePaths;
IPath[] quoteIncludePaths;
IPath[] includeFiles;
@@ -166,28 +166,28 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$
- private static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
- private static final String ID_ATTR = "id"; //$NON-NLS-1$
- private static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
- private static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
- private static final String FILE_ELEM = "file"; //$NON-NLS-1$
- private static final String PATH_ATTR = "path"; //$NON-NLS-1$
+ protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
+ protected static final String ID_ATTR = "id"; //$NON-NLS-1$
+ protected static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
+ protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
+ protected static final String FILE_ELEM = "file"; //$NON-NLS-1$
+ protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
- private IProject project;
- private InfoContext context;
+ protected IProject project;
+ protected InfoContext context;
- private ScannerInfoData sid; // scanner info data
- private ProjectScannerInfo psi = null; // sum of all scanner info
+ protected ScannerInfoData sid; // scanner info data
+ protected ProjectScannerInfo psi = null; // sum of all scanner info
-// private List siChangedForFileList; // list of files for which scanner info has changed
- private final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
- private final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
+// protected List siChangedForFileList; // list of files for which scanner info has changed
+ protected final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
+ protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
- private final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
- private int commandIdCounter = 0;
+ protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
+ protected int commandIdCounter = 0;
/** monitor for data access */
- private final Object fLock = new Object();
+ protected final Object fLock = new Object();
/**
*
@@ -277,7 +277,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
+ protected void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
assert Thread.holdsLock(fLock);
CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
if (cmd != null) {
@@ -296,7 +296,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addCompilerCommand(IFile file, CCommandDSC cmd) {
+ protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values());
int index = existingCommands.indexOf(cmd);
@@ -320,7 +320,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
generateFileDelta(file, cmd);
}
- private void generateFileDelta(IFile file, CCommandDSC cmd) {
+ protected void generateFileDelta(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
Integer commandId = cmd.getCommandIdAsInteger();
Integer oldCommandId = sid.fileToCommandIdMap.get(file);
@@ -335,7 +335,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void applyFileDeltas() {
+ protected void applyFileDeltas() {
assert Thread.holdsLock(fLock);
Set<IFile> resources = siChangedForFileMap.keySet();
for (IFile file : resources) {
@@ -381,7 +381,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
generateProjectScannerInfo();
}
- private void generateProjectScannerInfo() {
+ protected void generateProjectScannerInfo() {
assert Thread.holdsLock(fLock);
psi = new ProjectScannerInfo();
psi.includePaths = getAllIncludePaths(INCLUDE_PATH);
@@ -391,7 +391,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
psi.definedSymbols = getAllSymbols();
}
- private void removeUnusedCommands() {
+ protected void removeUnusedCommands() {
assert Thread.holdsLock(fLock);
Set<Entry<Integer, Set<IFile>>> entrySet = sid.commandIdToFilesMap.entrySet();
for (Entry<Integer, Set<IFile>> entry : entrySet) {
@@ -417,7 +417,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
+ protected void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
// TODO Auto-generated method stub
}
@@ -467,7 +467,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return new PerFileDiscoveredPathInfo();
}
- private boolean scannerInfoChanged() {
+ protected boolean scannerInfoChanged() {
assert Thread.holdsLock(fLock);
// return !siChangedForFileList.isEmpty();
return !siChangedForFileMap.isEmpty();
@@ -597,7 +597,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
*
* @author vhirsl
*/
- private class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
+ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
*/
@@ -772,7 +772,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
- private Map<IResource, PathInfo> calculatePathInfoMap(){
+ protected Map<IResource, PathInfo> calculatePathInfoMap(){
assert Thread.holdsLock(fLock);
Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
@@ -800,7 +800,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return map;
}
- private static PathInfo createFilePathInfo(CCommandDSC cmd){
+ protected static PathInfo createFilePathInfo(CCommandDSC cmd){
IPath[] includes = stringListToPathArray(cmd.getIncludes());
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
@@ -816,7 +816,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
}
- private CCommandDSC getCommand(IPath path) {
+ protected CCommandDSC getCommand(IPath path) {
try {
IFile file = project.getWorkspace().getRoot().getFile(path);
return getCommand(file);
@@ -826,7 +826,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private CCommandDSC getCommand(IFile file) {
+ protected CCommandDSC getCommand(IFile file) {
CCommandDSC cmd = null;
if (file != null) {
Integer cmdId = sid.fileToCommandIdMap.get(file);
@@ -847,7 +847,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
*
* @return list of IPath(s).
*/
- private IPath[] getAllIncludePaths(int type) {
+ protected IPath[] getAllIncludePaths(int type) {
List<String> allIncludes = new ArrayList<String>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
for (Integer cmdId : cmdIds) {
@@ -884,7 +884,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return stringListToPathArray(allIncludes);
}
- private static IPath[] stringListToPathArray(List<String> discovered) {
+ protected static IPath[] stringListToPathArray(List<String> discovered) {
List<Path> allIncludes = new ArrayList<Path>(discovered.size());
for (String include : discovered) {
if (!allIncludes.contains(include)) {
@@ -894,7 +894,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return allIncludes.toArray(new IPath[allIncludes.size()]);
}
- private Map<String, String> getAllSymbols() {
+ protected Map<String, String> getAllSymbols() {
assert Thread.holdsLock(fLock);
Map<String, String> symbols = new HashMap<String, String>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
index 21a9d6bf69..8f624530cc 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig2;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -44,6 +45,10 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -280,8 +285,27 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
newPersistedIncludes.put(include, persistedIncludes.get(include));
}
else {
- newPersistedIncludes.put(include,
- ((new Path(include)).toFile().exists()) ? Boolean.FALSE : Boolean.TRUE);
+ // the paths may be on EFS resources, not local
+ Boolean includePathExists = true;
+ URI projectLocationURI = discPathInfo.getProject().getLocationURI();
+
+ // use the project's location... create a URI that uses the same provider but that points to the include path
+ URI includeURI = FileSystemUtilityManager.getDefault().replacePath(projectLocationURI, include);
+
+ // ask EFS if the path exists
+ try {
+ IFileStore fileStore = EFS.getStore(includeURI);
+ IFileInfo info = fileStore.fetchInfo();
+ if(!info.exists()) {
+ includePathExists = false;
+ }
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+
+ // if the include path doesn't exist, then we tell the scanner config system that the folder
+ // has been "removed", and thus it won't show up in the UI
+ newPersistedIncludes.put(include, !includePathExists);
}
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
index 0750897a3b..356bc1ab26 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
@@ -199,7 +199,9 @@ public class ScannerConfigBuilder extends ACBuilder {
// update and persist scanner configuration
CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30));
- CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
+ // this erroneously removes the infor right after it gets created... bad
+ //CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
+
if((flags & PERFORM_CORE_UPDATE) != 0)
CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg});
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
index 15295bbf6f..cd32ab4447 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Intel Corporation and others.
+ * Copyright (c) 2007, 2010 Intel 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.build.internal.core.scannerconfig;
@@ -59,6 +60,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
public class CfgDiscoveredPathManager implements IResourceChangeListener {
@@ -67,6 +69,39 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
private IDiscoveredPathManager fBaseMngr;
+
+ private class GetDiscoveredInfoRunnable implements IWorkspaceRunnable {
+
+ private PathInfo fPathInfo;
+ private ContextInfo fContextInfo;
+ private IProject fProject;
+ private CfgInfoContext fContext;
+
+ public GetDiscoveredInfoRunnable(ContextInfo cInfo, IProject project, CfgInfoContext context) {
+ fContextInfo = cInfo;
+ fProject = project;
+ fContext = context;
+ }
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+
+ fPathInfo = getCachedPathInfo(fContextInfo);
+
+ if(fPathInfo == null){
+ IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(fProject, fContext.getConfiguration(), fContextInfo);
+
+ fPathInfo = resolveCacheBaseDiscoveredInfo(fContextInfo, baseInfo);
+ }
+
+ }
+
+ public PathInfo getPathInfo() {
+ return fPathInfo;
+ }
+
+ };
+
+
private static class ContextInfo {
public ContextInfo() {
@@ -161,21 +196,16 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
PathInfo info = getCachedPathInfo(cInfo);
if (info == null) {
- synchronized (this) {
- info = getCachedPathInfo(cInfo);
+ // Change synchronization to be a lock on the project, otherwise
+ // if the project description is queried from a project change listener, it will deadlock
+
+ GetDiscoveredInfoRunnable runnable = new GetDiscoveredInfoRunnable(cInfo, project, context);
+ ISchedulingRule rule = project;
- if(info == null){
- IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(project, context.getConfiguration(), cInfo);
-
- info = resolveCacheBaseDiscoveredInfo(cInfo, baseInfo);
- }
- }
+ ResourcesPlugin.getWorkspace().run(runnable, rule, IWorkspace.AVOID_UPDATE, null);
+
+ info = runnable.getPathInfo();
-// setCachedPathInfo(context, info);
-// if(info instanceof DiscoveredPathInfo && !((DiscoveredPathInfo)info).isLoadded()){
-// info = createPathInfo(project, context);
-// setCachedPathInfo(context, info);
-// }
}
return info;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index f08762cb4d..cb4ff40b0b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2002, 2007 Rational Software Corporation and others.
+# Copyright (c) 2002, 2010 Rational Software 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
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
index 2aae30a070..8f12862a69 100644
--- a/core/org.eclipse.cdt.core/.settings/.api_filters
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.cdt.core" version="2">
+<?xml version="1.0" encoding="UTF-8"?><component id="org.eclipse.cdt.core" version="2">
<resource path="parser/org/eclipse/cdt/core/dom/ast/IASTImplicitName.java" type="org.eclipse.cdt.core.dom.ast.IASTImplicitName">
<filter id="403853384">
<message_arguments>
@@ -42,4 +41,12 @@
</message_arguments>
</filter>
</resource>
-</component>
+ <resource path="src/org/eclipse/cdt/core/IFilesystemUtility.java" type="org.eclipse.cdt.core.IFilesystemUtility">
+ <filter id="1109393411">
+ <message_arguments>
+ <message_argument value="5.0.3"/>
+ <message_argument value="org.eclipse.cdt.core.IFilesystemUtility"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component> \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index cae7f8ed7f..93d2674b71 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -52,8 +52,12 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.dom.rewrite.astwriter;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;x-internal:=true,
org.eclipse.cdt.internal.core.dom.rewrite.commenthandler;x-internal:=true,
+ org.eclipse.cdt.internal.core.dom.rewrite.util;x-internal:=true,
org.eclipse.cdt.internal.core.envvar;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.index;x-friends:="org.eclipse.cdt.ui",
+ org.eclipse.cdt.internal.core.index.composite;x-internal:=true,
+ org.eclipse.cdt.internal.core.index.composite.c;x-internal:=true,
+ org.eclipse.cdt.internal.core.index.composite.cpp;x-internal:=true,
org.eclipse.cdt.internal.core.index.provider;x-internal:=true,
org.eclipse.cdt.internal.core.indexer;x-internal:=true,
org.eclipse.cdt.internal.core.language;x-friends:="org.eclipse.cdt.ui",
@@ -72,6 +76,7 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.pdom.export;x-internal:=true,
org.eclipse.cdt.internal.core.pdom.indexer;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.resources;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.make.core",
+ org.eclipse.cdt.internal.core.settings.model;x-internal:=true,
org.eclipse.cdt.internal.core.util;x-internal:=true,
org.eclipse.cdt.internal.errorparsers;x-internal:=true,
org.eclipse.cdt.internal.formatter;x-internal:=true,
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
index a548cc9b98..2c577cad3a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 QNX Software Systems and others.
+ * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.core.model;
@@ -486,5 +487,15 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
@Deprecated
org.eclipse.cdt.core.parser.CodeReader getCodeReader();
+ /**
+ * Returns the path to the file that should be used by the parser to access the file contents.
+ * For local translation units, this will return the equivalent to <code>getLocation().toOSString()</code>
+ *
+ * @since 5.2
+ * @return String representing the path that should be used to obtain the file content.
+ * @see FileContent
+ */
+ String getPathForFileContent();
+
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
index 0216511fc4..7aa40bf402 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
+ * Copyright (c) 2002, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
index edb4515f44..61bd7407e7 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
@@ -1133,4 +1133,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public IWorkingCopy getSharedWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException {
return CModelManager.getDefault().getSharedWorkingCopy(factory, this, null, monitor);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ITranslationUnit#getPathForFileContent()
+ */
+ public String getPathForFileContent() {
+ return getLocation().toOSString();
+ }
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java
index 056faacb59..fb3146d492 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/DescriptionScannerInfoProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Intel Corporation and others.
+ * Copyright (c) 2007, 2010 Intel 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
@@ -247,7 +247,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
path = projLocation.append(path);
}
if(path != null)
- values[num++] = path.toOSString();
+ values[num++] = p;
}
if(num < pathEntries.length){
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
index fc66524d4d..33bf8905e5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2010 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
@@ -8,6 +8,7 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.core.parser;
@@ -56,7 +57,7 @@ public abstract class FileContent {
public static FileContent create(ITranslationUnit tu) {
IPath location= tu.getLocation();
if (location == null)
- return create(tu.getElementName(), tu.getContents());
+ return create(tu.getPathForFileContent(), tu.getContents());
if (tu.isWorkingCopy()) {
return create(location.toOSString(), tu.getContents());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
index 1088c5fe61..acf9cf12ed 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
@@ -53,6 +53,7 @@ import org.eclipse.cdt.internal.core.index.IndexBasedFileContentProvider;
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider;
import org.eclipse.cdt.internal.core.parser.scanner.StreamHasher;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -854,7 +855,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
return path;
}
URI uri= ifl.getURI();
- return new Path(uri.getPath());
+ return new Path(FileSystemUtilityManager.getDefault().getPathFromURI(uri));
}
private void swallowError(IPath file, Throwable e) throws CoreException {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
index ee843c5601..b2e32261b2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 QNX Software Systems and others.
+ * Copyright (c) 2005, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
* Sergey Prigogin (Google)
* Tim Kelly (Nokia)
* Anna Dushistova (MontaVista)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;
@@ -752,7 +753,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
// in case a team provider does not implement a rule-factory, the
// platform makes a pessimistic choice and locks the workspace. We
// have to check for that.
- ISchedulingRule rule= project.getWorkspace().getRuleFactory().refreshRule(project.getFolder(SETTINGS_FOLDER_NAME));
+
+ // Unfortunately, updating the project description, which can be
+ // caused by accessing the scanner info if it's not already created,
+ // requires a project level lock.
+ //ISchedulingRule rule= project.getWorkspace().getRuleFactory().refreshRule(project.getFolder(SETTINGS_FOLDER_NAME));
+ ISchedulingRule rule= project;
if (project.contains(rule)) {
rule= MultiRule.combine(project, INIT_INDEXER_SCHEDULING_RULE);
}
diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml
index cb746c7150..bb9cc5c5f0 100644
--- a/core/org.eclipse.cdt.core/plugin.xml
+++ b/core/org.eclipse.cdt.core/plugin.xml
@@ -628,6 +628,7 @@
<extension-point id="templateProcessTypes" name="%templateProcessTypes.name" schema="schema/templateProcessTypes.exsd"/>
<extension-point id="templateAssociations" name="%templateAssociations.name" schema="schema/templateAssociations.exsd"/>
<extension-point id="ScannerInfoProvider2" name="%scannerInfoProvider2.name" schema="schema/ScannerInfoProvider2.exsd"/>
+ <extension-point id="FileSystemUtility" name="File System Utility" schema="schema/FileSystemUtility.exsd"/>
<extension
point="org.eclipse.cdt.core.templateProcessTypes">
diff --git a/core/org.eclipse.cdt.core/schema/FileSystemUtility.exsd b/core/org.eclipse.cdt.core/schema/FileSystemUtility.exsd
new file mode 100644
index 0000000000..82a2499a7e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/schema/FileSystemUtility.exsd
@@ -0,0 +1,114 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.core" id="FileSystemUtility" name="Filesystem Utility"/>
+ </appInfo>
+ <documentation>
+ This extension point allows one to contribute a so-called &quot;Filesystem Utility&quot; class that can manipulate resources in a given EFS filesystem, and extract meaningful information from the filesystem and its resources.
+ </documentation>
+ </annotation>
+
+ <element name="FileSystemUtility">
+ <annotation>
+ <documentation>
+ An instance of a File System Utility. File System Utilities are mapped to a URI scheme corresponding to an EFS filesystem for which they provide support. These extensions are consulted by CDT in order to extract path information from the filesystem and manipulate filesystem resources.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="scheme" type="string" use="required">
+ <annotation>
+ <documentation>
+ The URI scheme of an EFS filesystem this utility provides support for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Java class which implements org.eclipse.cdt.core.IFilesystemUtility to provide support for the filesystem.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.cdt.core.IFilesystemUtility"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="FileSystemUtility"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 5.0.3
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ None.
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
index b10e84902d..53632d51c3 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CProjectNature.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
+ * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.core;
@@ -75,9 +76,15 @@ public class CProjectNature implements IProjectNature {
newNatures[prevNatures.length] = natureId;
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
- } finally {
- monitor.done();
- }
+ }
+
+ catch (CoreException e) {
+ CCorePlugin.log(e);
+ }
+
+ finally {
+ monitor.done();
+ }
}
/**
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
index d3cdc18c4d..5088966355 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
@@ -17,7 +17,6 @@ package org.eclipse.cdt.core;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -30,6 +29,7 @@ import org.eclipse.cdt.internal.core.IErrorMarkeredOutputStream;
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
import org.eclipse.cdt.internal.errorparsers.ErrorParserExtensionManager;
import org.eclipse.cdt.utils.CygPath;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -456,8 +456,13 @@ outer:
*/
protected IFile findFileInWorkspace(IPath path) {
URI uri;
- if (!path.isAbsolute())
- uri = URIUtil.append(getWorkingDirectoryURI(), path.toString());
+ if (!path.isAbsolute()) {
+ URI workingDirectoryURI = getWorkingDirectoryURI();
+ String workingDirPath = FileSystemUtilityManager.getDefault().getPathFromURI(workingDirectoryURI);
+ IPath newPath = new Path(workingDirPath).append(path);
+ uri = FileSystemUtilityManager.getDefault().replacePath(workingDirectoryURI, newPath.toString());
+ //uri = URIUtil.append(getWorkingDirectoryURI(), path.toString());
+ }
else {
uri = toURI(path);
if (uri == null) // Shouldn't happen; error logged
@@ -699,22 +704,15 @@ outer:
* @since 5.1
*/
private URI toURI(IPath path) {
- try {
+// try {
URI baseURI = getWorkingDirectoryURI();
String uriString = path.toString();
// On Windows "C:/folder/" -> "/C:/folder/"
if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR)
uriString = IPath.SEPARATOR + uriString;
-
- return new URI(baseURI.getScheme(), baseURI.getUserInfo(),
- baseURI.getHost(), baseURI.getPort(),
- uriString, null, null);
- } catch (URISyntaxException e) {
- String message = "Problem converting path to URI [" + path.toString() + "]"; //$NON-NLS-1$//$NON-NLS-2$
- CCorePlugin.log(message, e);
- }
- return null;
+
+ return FileSystemUtilityManager.getDefault().replacePath(baseURI, uriString);
}
/**
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/FileSystemUtility.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/FileSystemUtility.java
new file mode 100644
index 0000000000..dc2d652296
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/FileSystemUtility.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Abstract class providing the basis for utility classes that can extract meaningful information from EFS filesystems.
+ * Provides a default implementation that assumes that URIs for the given filesystem map directly to resources
+ * in the physical filesystem, and that the path component of the URI is a direct representation of the absolute path to
+ * the file in the physical filesystem.
+ *
+ * Clients wishing to support a filesystem with different behaviour should extend this class and override its methods where
+ * appropriate.
+ *
+ * Clients should not typically call methods on this class or its descendants directly. Instead, they should call the approrpriate method
+ * in FileSystemUtilityManager so that said manager can properly route calls to the proper utility, depending on the filesystem.
+ *
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is no guarantee that this API will work or
+ * that it will remain the same. Please do not use this API without consulting
+ * with the CDT team.
+ *
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ *
+ * @author crecoskie
+ * @since 5.2
+ *
+ */
+public class FileSystemUtility implements IFilesystemUtility {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.IFilesystemUtility#getPathFromURI(java.net.URI)
+ */
+ public String getPathFromURI(URI locationURI) {
+ return locationURI.getPath();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.IFilesystemUtility#getBaseURI(java.net.URI)
+ */
+ public URI getBaseURI(URI locationURI) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.IFilesystemUtility#replacePathInURI(java.net.URI, java.lang.String)
+ */
+ public URI replacePathInURI(URI locationOnSameFilesystem, String path) {
+ URI uri = locationOnSameFilesystem;
+ try {
+ return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
+ path, // replaced!
+ uri.getQuery(),uri.getFragment());
+ } catch (URISyntaxException e) {
+ CCorePlugin.log(e);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.IFilesystemUtility#getMappedPath(java.net.URI)
+ */
+ public String getMappedPath(URI locationURI) {
+ return getPathFromURI(locationURI);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java
new file mode 100644
index 0000000000..059a68115e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core;
+
+import java.net.URI;
+
+/**
+ * An interface for utility classes that can extract meaningful information from EFS filesystems.
+ *
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is no guarantee that this API will work or
+ * that it will remain the same. Please do not use this API without consulting
+ * with the CDT team.
+ *
+ * @author crecoskie
+ * @since 5.0.3
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ *
+ */
+public interface IFilesystemUtility {
+ /**
+ * Gets the path corresponding to the underlying file as the operating system on the target machine would see it.
+ * In the future, it would be better if EFS had an API for this.
+ *
+ * @param locationURI
+ * @return String representing the path, or <code>null</code> if there is an error or if there is no such physical file.
+ */
+ public String getPathFromURI(URI locationURI);
+
+ /**
+ * In the case of a managed (linked) filesystem, returns the URI that this URI ultimately will
+ * point to.
+ *
+ * @param locationURI
+ * @return A uri corresponding to the linked store, or <code>null</code> if no such link exists.
+ */
+ public URI getBaseURI(URI locationURI);
+
+
+ /**
+ * Creates a new URI on the same filesystem as another URI, but with a different path.
+ *
+ * @param locationOnSameFilesystem A URI pointing to another resource on the same filesystem that this resource
+ * should be on.
+ * @param path The absolute path to the resource.
+ * @return URI
+ */
+ public URI replacePathInURI(URI locationOnSameFilesystem, String path);
+
+ /**
+ * Gets the path for this file as it appears when it is mapped into the filesystem. For
+ * unmapped filesystems, this would return the same path as getPathFromURI(URI locationURI)
+ *
+ * @return String representing the path, or <code>null</code> on error.
+ */
+ public String getMappedPath(URI locationURI);
+}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java
new file mode 100644
index 0000000000..5c34719735
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.utils;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IFilesystemUtility;
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Manager class that consults contributors to the FileSystemUtility extension point to perform operations corresponding to those filesystems.
+ *
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is no guarantee that this API will work or
+ * that it will remain the same. Please do not use this API without consulting
+ * with the CDT team.
+ *
+ * @author crecoskie
+ * @noextend This class is not intended to be extended by clients.
+ * @since 5.2
+ */
+public class FileSystemUtilityManager {
+
+ private static FileSystemUtilityManager instance;
+
+ private Map<String, IFilesystemUtility> fSchemeToUtilityImplementerMap;
+
+ private static String EXTENSION_ID = "FileSystemUtility"; //$NON-NLS-1$
+
+ private FileSystemUtilityManager() {
+ fSchemeToUtilityImplementerMap = new HashMap<String, IFilesystemUtility>();
+ loadExtensions();
+ }
+
+ private void loadExtensions() {
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
+ EXTENSION_ID);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < configElements.length; j++) {
+
+ String scheme = configElements[j].getAttribute("scheme"); //$NON-NLS-1$
+ String utility = configElements[j].getAttribute("class"); //$NON-NLS-1$
+
+ if (utility != null) {
+ try {
+ Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ if (execExt instanceof IFilesystemUtility) {
+ fSchemeToUtilityImplementerMap.put(scheme, (IFilesystemUtility) execExt);
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ }
+ }
+
+ }
+ }
+ }
+
+ }
+
+ public synchronized static FileSystemUtilityManager getDefault() {
+ if(instance == null) {
+ instance = new FileSystemUtilityManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Gets the path out of a URI. Right now this is hardcoded to deal with a select few filesystems.
+ * In the future, it would be better if EFS had an API for this.
+ *
+ * @param locationURI
+ * @return String representing the path.
+ */
+ public String getPathFromURI(URI locationURI) {
+ IFilesystemUtility utility = fSchemeToUtilityImplementerMap.get(locationURI.getScheme());
+
+ if(utility == null) {
+ return locationURI.getPath();
+ }
+
+ else {
+ return utility.getPathFromURI(locationURI);
+ }
+
+ }
+
+ /**
+ * In the case of a managed (linked) filesystem, returns the URI that this URI ultimately will
+ * point to. Otherwise, returns null.
+ *
+ * @param locationURI
+ * @return URI
+ */
+ public URI getManagedURI(URI locationURI) {
+ IFilesystemUtility utility = fSchemeToUtilityImplementerMap.get(locationURI.getScheme());
+
+ if(utility == null) {
+ return null;
+ }
+
+ else {
+ return utility.getBaseURI(locationURI);
+ }
+ }
+
+ /**
+ * Creates a new URI which clones the contents of the original URI, but with the path
+ * replaced by the given path. Returns null on error.
+ *
+ * @param uri
+ * @param path
+ * @return URI
+ */
+ public URI replacePath(URI uri, String path) {
+ IFilesystemUtility utility = fSchemeToUtilityImplementerMap.get(uri.getScheme());
+
+ if(utility == null) {
+ // if there is no corresponding utility, then assume we can just replace the path field
+
+ // Is it a local filesystem uri? Its URIs are a bit weird sometimes, so use URIUtil
+ if(uri.getScheme().equals("file")) { //$NON-NLS-1$
+ return URIUtil.toURI(path);
+ }
+
+ try {
+ return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
+ path, // replaced!
+ uri.getQuery(),uri.getFragment());
+ } catch (URISyntaxException e) {
+ String message = "Problem converting path to URI [" + path.toString() + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ CCorePlugin.log(message, e);
+ }
+
+ return null;
+ }
+
+ else {
+ return utility.replacePathInURI(uri, path);
+ }
+ }
+
+ public String getMappedPath(URI uri) {
+ IFilesystemUtility utility = fSchemeToUtilityImplementerMap.get(uri.getScheme());
+
+ if(utility == null) {
+ // if there is no corresponding utility, then assume it's just the path field
+ return uri.getPath();
+
+ }
+
+ else {
+ return utility.getMappedPath(uri);
+ }
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java
index 4c45c78271..033c1ed47c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.text.ISelectionValidator;
import org.eclipse.jface.text.ITextSelection;
@@ -55,15 +55,6 @@ public class SelectionListenerWithASTManager {
return fgDefault;
}
- private static class SingletonRule implements ISchedulingRule {
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
- }
-
private final static class PartListenerGroup {
private ITextEditor fPart;
private ISelectionListener fPostSelectionListener;
@@ -71,7 +62,7 @@ public class SelectionListenerWithASTManager {
private Job fCurrentJob;
private ListenerList fAstListeners;
/** Rule to make sure only one job is running at a time */
- private final ISchedulingRule fJobRule= new SingletonRule();
+ private final ILock fJobLock= Job.getJobManager().newLock();
private ISelectionValidator fValidator;
public PartListenerGroup(ITextEditor editorPart) {
@@ -144,15 +135,22 @@ public class SelectionListenerWithASTManager {
fCurrentJob= new Job(Messages.SelectionListenerWithASTManager_jobName) {
@Override
public IStatus run(IProgressMonitor monitor) {
- if (!monitor.isCanceled() && isSelectionValid(selection)) {
- return calculateASTandInform(workingCopy, selection, monitor);
+ try {
+ // Try to acquire the lock
+ while (!monitor.isCanceled() && !fJobLock.acquire(10)) {}
+ if (!monitor.isCanceled() && isSelectionValid(selection)) {
+ return calculateASTandInform(workingCopy, selection, monitor);
+ }
+ } catch (InterruptedException e) {
+ } finally {
+ if (fJobLock.getDepth() != 0)
+ fJobLock.release();
}
return Status.OK_STATUS;
}
};
fCurrentJob.setPriority(Job.DECORATE);
fCurrentJob.setSystem(true);
- fCurrentJob.setRule(fJobRule);
fCurrentJob.schedule();
}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
index a0af1819a5..7dfe41129f 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: xlC Error Parser Tests Plug-in
Bundle-SymbolicName: org.eclipse.cdt.errorparsers.xlc.tests;singleton:=true
-Bundle-Version: 1.0.0
+Bundle-Version: 5.0.100.qualifier
Bundle-Activator: org.eclipse.cdt.errorparsers.xlc.tests.TestsPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
index 1e6493a155..b5f30c715f 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
+++ b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,248 +1,63 @@
-#Thu Oct 04 14:01:28 BRT 2007
+#Mon Nov 23 16:55:49 EST 2009
eclipse.preferences.version=1
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=1
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.format_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
index cc1ab0b907..819de56145 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,5 +1,4 @@
-#Thu Oct 04 14:01:28 BRT 2007
+#Tue Sep 29 13:43:38 EDT 2009
eclipse.preferences.version=1
-formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
-formatter_settings_version=10
+formatter_settings_version=11
internal.default.compliance=default
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/META-INF/MANIFEST.MF b/xlc/org.eclipse.cdt.make.xlc.core/META-INF/MANIFEST.MF
index 642bef8d57..166d60c640 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/META-INF/MANIFEST.MF
+++ b/xlc/org.eclipse.cdt.make.xlc.core/META-INF/MANIFEST.MF
@@ -10,5 +10,8 @@ Require-Bundle: org.eclipse.cdt.make.core,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.cdt.managedbuilder.core
-Export-Package: org.eclipse.cdt.make.xlc.core.scannerconfig
+Export-Package: org.eclipse.cdt.make.xlc.core.activator,
+ org.eclipse.cdt.make.xlc.core.scannerconfig
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.cdt.make.xlc.core.activator.Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java
new file mode 100644
index 0000000000..7c510d2533
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/activator/Activator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.activator;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.cdt.make.xlc.core"; //$NON-NLS-1$
+ private static Activator fInstance;
+
+ /**
+ *
+ */
+ public Activator() {
+ super();
+ if(fInstance == null) {
+ fInstance = this;
+ }
+ }
+
+ public static void log(String e) {
+ log(createStatus(e));
+ }
+
+ public static void log(Throwable e) {
+ log("Error", e); //$NON-NLS-1$
+ }
+
+ public static void log(String message, Throwable e) {
+ Throwable nestedException;
+ if (e instanceof CModelException
+ && (nestedException = ((CModelException)e).getException()) != null) {
+ e = nestedException;
+ }
+ log(createStatus(message, e));
+ }
+
+ public static IStatus createStatus(String msg) {
+ return createStatus(msg, null);
+ }
+
+ public static IStatus createStatus(String msg, Throwable e) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, msg, e);
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ private static Plugin getDefault() {
+ return fInstance;
+ }
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.java
new file mode 100644
index 0000000000..fdbd306a40
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.make.xlc.core.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.make.xlc.core.messages.Messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.properties b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.properties
new file mode 100644
index 0000000000..ef61abc973
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/messages/Messages.properties
@@ -0,0 +1,4 @@
+PerFileXLCScannerInfoCollector.0=Updating discovered includes and macros
+PerFileXLCScannerInfoCollector.1=Error updating discovered info.
+ScannerInfoCollector.Processing=Processing discovered scanner configuration ...
+ScannerInfoCollector.Updating=Updating Scanner Configuration for project
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java
new file mode 100644
index 0000000000..949dba6798
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
+import org.eclipse.cdt.make.xlc.core.activator.Activator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.content.IContentTypeManager;
+
+/**
+ * @author crecoskie
+ *
+ */
+public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsoleParser {
+
+ protected static final String[] COMPILER_INVOCATION = { "xlc", "xlC"//$NON-NLS-1$ //$NON-NLS-2$
+ };
+ protected static final String DASHIDASH = "-I-"; //$NON-NLS-1$
+ protected static final String DASHI = "-I"; //$NON-NLS-1$
+ protected static final String DASHD = "-D"; //$NON-NLS-1$
+
+ protected IProject fProject;
+ protected IScannerInfoCollector fCollector;
+ protected IPath fWorkingDir;
+ protected IMarkerGenerator fMarkerGenerator;
+ protected XLCBuildOutputParserUtility fUtility;
+
+ protected boolean fBMultiline = false;
+ protected String fSMultiline = ""; //$NON-NLS-1$
+
+ protected String[] fCompilerCommands = { "xlc", "xlC" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * @return Returns the fProject.
+ */
+ protected IProject getProject() {
+ return fProject;
+ }
+
+ /**
+ * @return Returns the fCollector.
+ */
+ protected IScannerInfoCollector getCollector() {
+ return fCollector;
+ }
+
+ public void startup(IProject project, IScannerInfoCollector collector) {
+ fProject = project;
+ fCollector = collector;
+ fCompilerCommands = computeCompilerCommands();
+ }
+
+ /**
+ * Returns array of additional compiler commands to look for
+ *
+ * @return String[]
+ */
+ protected String[] computeCompilerCommands() {
+ if (fProject != null) {
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(
+ fProject, ScannerConfigProfileManager.NULL_PROFILE_ID);
+ BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
+ if (boProvider != null) {
+ String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
+ if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
+ String[] compilerCommands = compilerCommandsString.split(",\\s*"); //$NON-NLS-1$
+ if (compilerCommands.length > 0) {
+ String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
+ System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
+ System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length,
+ compilerCommands.length);
+ return compilerInvocation;
+ }
+ }
+ }
+ }
+ return COMPILER_INVOCATION;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine
+ * (java.lang.String)
+ */
+ public boolean processLine(String line) {
+ boolean rc = false;
+ int lineBreakPos = line.length() - 1;
+ char[] lineChars = line.toCharArray();
+ while (lineBreakPos >= 0 && Character.isWhitespace(lineChars[lineBreakPos])) {
+ lineBreakPos--;
+ }
+ if (lineBreakPos >= 0) {
+ if (lineChars[lineBreakPos] != '\\' || (lineBreakPos > 0 && lineChars[lineBreakPos - 1] == '\\')) {
+ lineBreakPos = -1;
+ }
+ }
+ // check for multiline commands (ends with '\')
+ if (lineBreakPos >= 0) {
+ fSMultiline += line.substring(0, lineBreakPos);
+ fBMultiline = true;
+ return rc;
+ }
+ if (fBMultiline) {
+ line = fSMultiline + line;
+ fBMultiline = false;
+ fSMultiline = ""; //$NON-NLS-1$
+ }
+ line = line.trim();
+ TraceUtil.outputTrace("XLCBuildOutputParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ // make\[[0-9]*\]: error_desc
+ int firstColon = line.indexOf(':');
+ String make = line.substring(0, firstColon + 1);
+ if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$
+ boolean enter = false;
+ String msg = line.substring(firstColon + 1).trim();
+ if ((enter = msg.startsWith("Entering directory")) || //$NON-NLS-1$
+ (msg.startsWith("Leaving directory"))) { //$NON-NLS-1$
+ int s = msg.indexOf('`');
+ int e = msg.indexOf('\'');
+ if (s != -1 && e != -1) {
+ String dir = msg.substring(s + 1, e);
+ if (getUtility() != null) {
+ getUtility().changeMakeDirectory(dir, getDirectoryLevel(line), enter);
+ }
+ return rc;
+ }
+ }
+ }
+ // call sublclass to process a single line
+ return processSingleLine(line.trim());
+ }
+
+ protected synchronized XLCBuildOutputParserUtility getUtility() {
+ if (fUtility == null)
+ fUtility = new XLCBuildOutputParserUtility(fProject, fWorkingDir, fMarkerGenerator);
+
+ return fUtility;
+ }
+
+ protected int getDirectoryLevel(String line) {
+ int s = line.indexOf('[');
+ int num = 0;
+ if (s != -1) {
+ int e = line.indexOf(']');
+ String number = line.substring(s + 1, e).trim();
+ try {
+ num = Integer.parseInt(number);
+ } catch (NumberFormatException exc) {
+ }
+ }
+ return num;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown
+ * ()
+ */
+ public void shutdown() {
+ if (getUtility() != null) {
+ getUtility().reportProblems();
+ }
+
+ if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
+ try {
+ collector.updateScannerConfiguration(null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ }
+
+ /**
+ * Tokenizes a line into an array of commands. Commands are separated by
+ * ';', '&&' or '||'. Tokens are separated by whitespace unless found inside
+ * of quotes, back-quotes, or double quotes. Outside of single-, double- or
+ * back-quotes a backslash escapes white-spaces, all quotes, the backslash,
+ * '&' and '|'. A backslash used for escaping is removed. Quotes other than
+ * the back-quote plus '&&', '||', ';' are removed, also.
+ *
+ * @param line
+ * to tokenize
+ * @return array of commands
+ */
+ protected String[][] tokenize(String line, boolean escapeInsideDoubleQuotes) {
+ ArrayList<String[]> commands = new ArrayList<String[]>();
+ ArrayList<String> tokens = new ArrayList<String>();
+ StringBuffer token = new StringBuffer();
+
+ final char[] input = line.toCharArray();
+ boolean nextEscaped = false;
+ char currentQuote = 0;
+ for (int i = 0; i < input.length; i++) {
+ final char c = input[i];
+ final boolean escaped = nextEscaped;
+ nextEscaped = false;
+
+ if (currentQuote != 0) {
+ if (c == currentQuote) {
+ if (escaped) {
+ token.append(c);
+ } else {
+ if (c == '`') {
+ token.append(c); // preserve back-quotes
+ }
+ currentQuote = 0;
+ }
+ } else {
+ if (escapeInsideDoubleQuotes && currentQuote == '"' && c == '\\') {
+ nextEscaped = !escaped;
+ if (escaped) {
+ token.append(c);
+ }
+ } else {
+ if (escaped) {
+ token.append('\\');
+ }
+ token.append(c);
+ }
+ }
+ } else {
+ switch (c) {
+ case '\\':
+ if (escaped) {
+ token.append(c);
+ } else {
+ nextEscaped = true;
+ }
+ break;
+ case '\'':
+ case '"':
+ case '`':
+ if (escaped) {
+ token.append(c);
+ } else {
+ if (c == '`') {
+ token.append(c);
+ }
+ currentQuote = c;
+ }
+ break;
+ case ';':
+ if (escaped) {
+ token.append(c);
+ } else {
+ endCommand(token, tokens, commands);
+ }
+ break;
+ case '&':
+ case '|':
+ if (escaped || i + 1 >= input.length || input[i + 1] != c) {
+ token.append(c);
+ } else {
+ i++;
+ endCommand(token, tokens, commands);
+ }
+ break;
+
+ default:
+ if (Character.isWhitespace(c)) {
+ if (escaped) {
+ token.append(c);
+ } else {
+ endToken(token, tokens);
+ }
+ } else {
+ if (escaped) {
+ token.append('\\'); // for windows put backslash
+ // back onto the token.
+ }
+ token.append(c);
+ }
+ }
+ }
+ }
+ endCommand(token, tokens, commands);
+ return commands.toArray(new String[commands.size()][]);
+ }
+
+ protected void endCommand(StringBuffer token, ArrayList<String> tokens, ArrayList<String[]> commands) {
+ endToken(token, tokens);
+ if (!tokens.isEmpty()) {
+ commands.add(tokens.toArray(new String[tokens.size()]));
+ tokens.clear();
+ }
+ }
+
+ protected void endToken(StringBuffer token, ArrayList<String> tokens) {
+ if (token.length() > 0) {
+ tokens.add(token.toString());
+ token.setLength(0);
+ }
+ }
+
+ protected boolean processSingleLine(String line) {
+ boolean rc = false;
+ String[][] tokens = tokenize(line, true);
+ for (int i = 0; i < tokens.length; i++) {
+ String[] command = tokens[i];
+ if (processCommand(command)) {
+ rc = true;
+ } else { // go inside quotes, if the compiler is called per wrapper
+ // or shell script
+ for (int j = 0; j < command.length; j++) {
+ String[][] subtokens = tokenize(command[j], true);
+ for (int k = 0; k < subtokens.length; k++) {
+ String[] subcommand = subtokens[k];
+ if (subcommand.length > 1) { // only proceed if there is
+ // any additional info
+ if (processCommand(subcommand)) {
+ rc = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return rc;
+ }
+
+ protected int findCompilerInvocation(String[] tokens) {
+ for (int i = 0; i < tokens.length; i++) {
+ final String token = tokens[i].toLowerCase();
+ final int searchFromOffset = Math.max(token.lastIndexOf('/'), token.lastIndexOf('\\')) + 1;
+ for (int j = 0; j < fCompilerCommands.length; j++) {
+ if (token.indexOf(fCompilerCommands[j], searchFromOffset) != -1) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
+ fProject = project;
+ fWorkingDir = workingDirectory;
+ fCollector = collector;
+ fMarkerGenerator = markerGenerator;
+
+ }
+
+ abstract protected boolean processCommand(String[] tokens);
+
+ protected List<String> getFileExtensionsList() {
+ IContentTypeManager manager = Platform.getContentTypeManager();
+ List<String> extensions = new LinkedList<String>();
+ IContentType cSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
+ IContentType cppSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
+
+ String[] cExtensions = cSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ String[] cppExtensions = cppSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+
+ for (int k = 0; k < cExtensions.length; k++) {
+ extensions.add("." + cExtensions[k]); //$NON-NLS-1$
+ }
+
+ for (int k = 0; k < cppExtensions.length; k++) {
+ extensions.add("." + cppExtensions[k]); //$NON-NLS-1$
+ }
+
+ return extensions;
+ }
+
+ protected String[] getFileExtensions() {
+ IContentTypeManager manager = Platform.getContentTypeManager();
+ List<String> extensions = new LinkedList<String>();
+ IContentType cSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
+ IContentType cppSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
+
+ String[] cExtensions = cSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ String[] cppExtensions = cppSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+
+ for (int k = 0; k < cExtensions.length; k++) {
+ extensions.add("." + cExtensions[k]); //$NON-NLS-1$
+ }
+
+ for (int k = 0; k < cppExtensions.length; k++) {
+ extensions.add("." + cppExtensions[k]); //$NON-NLS-1$
+ }
+
+ return extensions.toArray(new String[0]);
+ }
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
new file mode 100644
index 0000000000..69f62b6409
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
@@ -0,0 +1,1665 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
+import org.eclipse.cdt.core.settings.model.CMacroEntry;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
+import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
+import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
+import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathManager;
+import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
+import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector;
+import org.eclipse.cdt.make.xlc.core.activator.Activator;
+import org.eclipse.cdt.make.xlc.core.messages.Messages;
+import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IInputType;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, IManagedScannerInfoCollector {
+
+ protected class ScannerConfigUpdateJob extends Job {
+
+ private InfoContext fContext;
+ private IDiscoveredPathInfo fPathInfo;
+ private boolean fIsDefaultContext;
+ private List<IResource> fChangedResources;
+
+ public ScannerConfigUpdateJob(InfoContext context, IDiscoveredPathInfo pathInfo, boolean isDefaultContext, List<IResource> changedResources) {
+ super(Messages.getString("PerFileXLCScannerInfoCollector.0")); //$NON-NLS-1$);
+ fContext = context;
+ fPathInfo = pathInfo;
+ fIsDefaultContext = isDefaultContext;
+ fChangedResources = changedResources;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+
+ // get the scanner info profile ID
+
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration config = info.getDefaultConfiguration();
+
+ String profileID = config.getToolChain().getScannerConfigDiscoveryProfileId();
+ IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
+
+ if(manager instanceof DiscoveredPathManager) {
+ ((DiscoveredPathManager)manager).updateDiscoveredInfo(fContext, fPathInfo, fIsDefaultContext, fChangedResources, profileID);
+ }
+
+ // reload project description to hopefully get the data to take
+ ICProjectDescriptionManager descriptionManager = CoreModel.getDefault().getProjectDescriptionManager();
+ ICProjectDescription cProjectDescription = descriptionManager.getProjectDescription(project, true /* writable */);
+ ICConfigurationDescription configDes = cProjectDescription.getActiveConfiguration();
+
+ IToolChain toolchain = config.getToolChain();
+ for(ITool tool : toolchain.getTools()) {
+ for(IInputType inputType : tool.getInputTypes()) {
+ IContentType contentType = inputType.getSourceContentType();
+ if(contentType != null) {
+ for(IResource resource : fChangedResources) {
+ // get language settings for the resource
+ ICLanguageSetting langSetting = configDes.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
+
+ if(langSetting == null) {
+ continue;
+ }
+
+ // get content type IDs for the setting
+ String[] contentTypeIDs = langSetting.getSourceContentTypeIds();
+
+ // if the setting doesn't handle our content type ID, then go to the next resource
+ boolean found = false;
+ for(String id : contentTypeIDs) {
+ if(id.equals(contentType.getId())) {
+ found = true;
+ break;
+ }
+ }
+
+ if(!found) {
+ continue;
+ }
+
+ // update all the scanner config entries on the setting
+ updateIncludeSettings(langSetting);
+ updateMacroSettings(langSetting);
+
+ }
+ }
+
+ }
+ }
+
+ descriptionManager.setProjectDescription(project, cProjectDescription, true /* force */, monitor);
+
+ } catch (CoreException e) {
+ Activator.log(e);
+ return Activator.createStatus(Messages.getString("PerFileXLCScannerInfoCollector.1")); //$NON-NLS-1$
+ }
+ return Status.OK_STATUS;
+ }
+
+ private boolean updateMacroSettings(ICLanguageSetting langSetting) {
+ ICLanguageSettingEntry[] entries = langSetting.getSettingEntries(ICSettingEntry.MACRO);
+ List<ICLanguageSettingEntry> newEntries = new LinkedList<ICLanguageSettingEntry>();
+ for(ICLanguageSettingEntry entry : entries) {
+ newEntries.add(entry);
+ }
+
+
+ boolean entriesChanged = false;
+
+ // look for settings corresponding to each path we discovered
+ Map<String, String> discSymbols = fPathInfo.getSymbols();
+ for (String symbol : discSymbols.keySet()) {
+ boolean symbolFound = false;
+
+ for (ICLanguageSettingEntry entry : entries) {
+ if (((CMacroEntry) entry).getName().equals(symbol)) {
+ int flags = entry.getFlags();
+ symbolFound = true; // it's already there, so don't set it
+ break;
+ }
+ }
+
+ // if we didn't find the path, add it
+ if(!symbolFound) {
+ entriesChanged = true;
+ CMacroEntry newEntry = new CMacroEntry(symbol, discSymbols.get(symbol), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
+ newEntries.add(newEntry);
+ }
+ }
+
+ // if we changed the entries, then set the new ones
+ if(entriesChanged) {
+ langSetting.setSettingEntries(ICSettingEntry.MACRO, newEntries.toArray(new ICLanguageSettingEntry[0]));
+ }
+
+ return entriesChanged;
+ }
+
+ private boolean updateIncludeSettings(ICLanguageSetting langSetting) {
+ ICLanguageSettingEntry[] entries = langSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
+ List<ICLanguageSettingEntry> newEntries = new LinkedList<ICLanguageSettingEntry>();
+ for(ICLanguageSettingEntry entry : entries) {
+ newEntries.add(entry);
+ }
+
+
+ boolean entriesChanged = false;
+
+ // look for settings corresponding to each path we discovered
+ IPath[] discPaths = fPathInfo.getIncludePaths();
+ for (IPath path : discPaths) {
+ boolean pathFound = false;
+
+ for (ICLanguageSettingEntry entry : entries) {
+ if (((CIncludePathEntry) entry).getLocation().equals(path)) {
+ pathFound = true; // it's already there, so don't set it
+ break;
+ }
+ }
+
+ // if we didn't find the path, add it
+ if(!pathFound) {
+ entriesChanged = true;
+ CIncludePathEntry newEntry = new CIncludePathEntry(path, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
+ newEntries.add(newEntry);
+ }
+ }
+
+ // if we changed the entries, then set the new ones
+ if(entriesChanged) {
+ langSetting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, newEntries.toArray(new ICLanguageSettingEntry[0]));
+ }
+
+ return entriesChanged;
+ }
+ }
+
+ protected class MergedPerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
+ private IDiscoveredPathInfo fInfo1;
+ private IPerFileDiscoveredPathInfo2 fInfo2;
+
+ public MergedPerFileDiscoveredPathInfo(IDiscoveredPathInfo info1, IPerFileDiscoveredPathInfo2 info2) {
+ fInfo1 = info1;
+ fInfo2 = info2;
+ }
+
+ private IPerFileDiscoveredPathInfo2 getPerFileInfo1() {
+ if(fInfo1 instanceof IPerFileDiscoveredPathInfo2) {
+ return (IPerFileDiscoveredPathInfo2) fInfo1;
+ }
+
+ else {
+ return null;
+ }
+ }
+
+ public Map getPathInfoMap() {
+ synchronized (fLock) {
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ Map map = new HashMap();
+ map.putAll(info1.getPathInfoMap());
+ map.putAll(fInfo2.getPathInfoMap());
+ return map;
+ }
+
+ else {
+ return fInfo2.getPathInfoMap();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] getIncludeFiles(IPath path) {
+ synchronized (fLock) {
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ List<IPath> list = new LinkedList<IPath>();
+ for (IPath path1 : info1.getIncludeFiles(path)) {
+ list.add(path1);
+ }
+
+ for (IPath path1 : fInfo2.getIncludeFiles(path)) {
+ list.add(path1);
+ }
+ return list.toArray(new IPath[0]);
+ }
+
+ else {
+ return fInfo2.getIncludeFiles(path);
+ }
+ }
+ }
+
+ public IPath[] getIncludePaths(IPath path) {
+ synchronized (fLock) {
+
+ Set<IPath> pathSet = new HashSet<IPath>();
+
+ // add project level settings if other info is per project
+ if (fInfo1 instanceof DiscoveredPathInfo) {
+ for (IPath path1 : fInfo1.getIncludePaths()) {
+ pathSet.add(path1);
+ }
+ }
+
+ else {
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ // add file level settings
+ for (IPath path1 : info1.getIncludePaths(path)) {
+ pathSet.add(path1);
+ }
+ }
+ }
+
+ // add file level settings
+ for (IPath path2 : fInfo2.getIncludePaths(path)) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ public IPath[] getMacroFiles(IPath path) {
+ synchronized (fLock) {
+ Set<IPath> pathSet = new HashSet<IPath>();
+
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ // add file level settings
+ for (IPath path1 : info1.getMacroFiles(path)) {
+ pathSet.add(path1);
+ }
+ }
+
+ // add file level settings
+ for (IPath path2 : fInfo2.getMacroFiles(path)) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ public IPath[] getQuoteIncludePaths(IPath path) {
+ synchronized (fLock) {
+
+ Set<IPath> pathSet = new HashSet<IPath>();
+
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ // add file level settings
+ for (IPath path1 : info1.getQuoteIncludePaths(path)) {
+ pathSet.add(path1);
+ }
+ }
+
+ // add file level settings
+ for (IPath path2 : fInfo2.getQuoteIncludePaths(path)) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ public Map getSymbols(IPath path) {
+ synchronized (fLock) {
+
+ Map<String, String> symbols = new HashMap<String, String>();
+
+ // add project level settings
+ Map<String, String> projectSymbols = (Map<String, String>) fInfo1.getSymbols();
+ for (String symbol : projectSymbols.keySet()) {
+ symbols.put(symbol, projectSymbols.get(symbol));
+ }
+
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ // add file level settings
+ symbols.putAll(info1.getSymbols(path));
+ }
+
+ // add file level settings
+ symbols.putAll(fInfo2.getSymbols(path));
+
+ return symbols;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
+ */
+ public boolean isEmpty(IPath path) {
+ synchronized (fLock) {
+ boolean info1empty = false;
+
+ IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
+ if (info1 != null) {
+ info1empty = info1.isEmpty(path);
+ } else {
+ info1empty = fInfo1.getIncludePaths().length == 0 && fInfo1.getSymbols().size() == 0;
+ }
+
+ return fInfo2.isEmpty(path) && info1empty;
+ }
+ }
+
+ public IPath[] getIncludePaths() {
+ synchronized (fLock) {
+ return fInfo1.getIncludePaths();
+ }
+ }
+
+ public IProject getProject() {
+ return fInfo1.getProject();
+ }
+
+ public IDiscoveredScannerInfoSerializable getSerializable() {
+ return fInfo2.getSerializable();
+ }
+
+ public Map getSymbols() {
+ synchronized (fLock) {
+ return fInfo1.getSymbols();
+ }
+ }
+
+ }
+
+ /**
+ * Per file DPI object
+ *
+ * @author vhirsl
+ */
+ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] getIncludeFiles(IPath path) {
+ synchronized (fLock) {
+
+ Set<IPath> pathSet = new LinkedHashSet<IPath>();
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ IPath[] paths = stringListToPathArray(cmd.getIncludeFile());
+ pathSet.addAll(Arrays.asList(paths));
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ for(IPath path2 : psi.includeFiles) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
+ */
+ public IPath[] getIncludePaths() {
+ final IPath[] includepaths;
+ final IPath[] quotepaths;
+ synchronized (fLock) {
+// return new IPath[0];
+ includepaths = getAllIncludePaths(INCLUDE_PATH);
+ quotepaths = getAllIncludePaths(QUOTE_INCLUDE_PATH);
+ }
+ if (quotepaths == null || quotepaths.length == 0) {
+ return includepaths;
+ }
+ if (includepaths == null || includepaths.length == 0) {
+ return quotepaths;
+ }
+ ArrayList<IPath> result = new ArrayList<IPath>(includepaths.length + quotepaths.length);
+ result.addAll(Arrays.asList(includepaths));
+ result.addAll(Arrays.asList(quotepaths));
+ return result.toArray(new IPath[result.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] getIncludePaths(IPath path) {
+ synchronized (fLock) {
+ Set<IPath> pathSet = new LinkedHashSet<IPath>();
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ IPath[] paths = stringListToPathArray(cmd.getIncludes());
+ pathSet.addAll(Arrays.asList(paths));
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ for(IPath path2 : psi.includePaths) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] getMacroFiles(IPath path) {
+ synchronized (fLock) {
+ Set<IPath> pathSet = new LinkedHashSet<IPath>();
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ IPath[] paths = stringListToPathArray(cmd.getImacrosFile());
+ pathSet.addAll(Arrays.asList(paths));
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ for(IPath path2 : psi.macrosFiles) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ public Map<IResource, PathInfo> getPathInfoMap() {
+ synchronized (fLock) {
+ //TODO: do we need to cache this?
+ return calculatePathInfoMap();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] getQuoteIncludePaths(IPath path) {
+ synchronized (fLock) {
+ Set<IPath> pathSet = new LinkedHashSet<IPath>();
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ IPath[] paths = stringListToPathArray(cmd.getQuoteIncludes());
+ pathSet.addAll(Arrays.asList(paths));
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ for(IPath path2 : psi.quoteIncludePaths) {
+ pathSet.add(path2);
+ }
+
+ return pathSet.toArray(new IPath[0]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
+ */
+ public IDiscoveredScannerInfoSerializable getSerializable() {
+ synchronized (fLock) {
+ return sid;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
+ */
+ public Map<String, String> getSymbols() {
+// return new HashMap();
+ synchronized (fLock) {
+ return getAllSymbols();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.
+ * IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
+ */
+ public Map<String, String> getSymbols(IPath path) {
+ synchronized (fLock) {
+ Map<String, String> definedSymbols = new HashMap<String, String>();
+
+ // put project data in first so file level data can override it
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ definedSymbols.putAll(psi.definedSymbols);
+
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null && cmd.isDiscovered()) {
+ List symbols = cmd.getSymbols();
+ for (Iterator i = symbols.iterator(); i.hasNext();) {
+ String symbol = (String) i.next();
+ String key = ScannerConfigUtil.getSymbolKey(symbol);
+ String value = ScannerConfigUtil.getSymbolValue(symbol);
+ definedSymbols.put(key, value);
+ }
+
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ definedSymbols.putAll(psi.definedSymbols);
+ return definedSymbols;
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
+ */
+ public boolean isEmpty(IPath path) {
+ synchronized (fLock) {
+ boolean rc = true;
+ IResource resource = project.getWorkspace().getRoot().findMember(path);
+ if (resource != null) {
+ if (resource instanceof IFile) {
+ rc = (getCommand((IFile) resource) == null);
+ } else if (resource instanceof IProject) {
+ synchronized (fLock) {
+ rc = (psi == null || psi.isEmpty());
+ }
+ }
+ }
+ return rc;
+ }
+ }
+
+ }
+
+ public static class ProjectScannerInfo {
+ public Map<String, String> definedSymbols;
+ public IPath[] includeFiles;
+ public IPath[] includePaths;
+ public IPath[] macrosFiles;
+ public IPath[] quoteIncludePaths;
+ public boolean isEmpty() {
+ return (includePaths.length == 0 &&
+ quoteIncludePaths.length == 0 &&
+ includeFiles.length == 0 &&
+ macrosFiles.length == 0 &&
+ definedSymbols.size() == 0);
+ }
+ }
+
+ public class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
+ public static final String DEFINED_SYMBOL = "definedSymbol"; //$NON-NLS-1$
+ public static final String ID_ATTR = "id"; //$NON-NLS-1$
+ public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
+
+ private static final String NAME = "name"; //$NON-NLS-1$
+
+ public static final String PATH = "path"; //$NON-NLS-1$
+ private static final String PROJECT = "project"; //$NON-NLS-1$
+ public static final String REMOVED = "removed"; //$NON-NLS-1$
+ public static final String SYMBOL = "symbol"; //$NON-NLS-1$
+ public final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
+ public final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
+ public final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
+
+ public ScannerInfoData() {
+ commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
+ fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId]
+ commandIdToFilesMap = new HashMap<Integer, Set<IFile>>(); // [commandId, set of files]
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
+ */
+ public void deserialize(Element collectorElem) {
+ synchronized (fLock) {
+
+ for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if(child.getNodeName().equals(PROJECT)) {
+ Element projectElement = (Element) child;
+ String projectName = projectElement.getAttribute(NAME);
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+ Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
+
+ List<String> includes = new LinkedList<String>();
+ List<String> symbols = new LinkedList<String>();
+
+ // iterate over children
+ for(Node projectChild = projectElement.getFirstChild(); projectChild != null; projectChild = projectChild.getNextSibling()) {
+ if(projectChild.getNodeName().equals(INCLUDE_PATH)) {
+ Element childElem = (Element) projectChild;
+ String path = childElem.getAttribute(PATH);
+ if(path != null) {
+ includes.add(path);
+ }
+ }
+ else if(projectChild.getNodeName().equals(DEFINED_SYMBOL)) {
+ Element childElem = (Element) projectChild;
+ String symbol = childElem.getAttribute(SYMBOL);
+
+ if(symbol != null) {
+ symbols.add(symbol);
+ }
+ }
+ }
+
+ // add loaded scanner info to project settings for this collector
+ scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
+ scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ fProjectSettingsMap.put(project, scannerInfo);
+ }
+
+
+ else if (child.getNodeName().equals(CC_ELEM)) {
+ Element cmdElem = (Element) child;
+ boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
+ XLCCommandDSC command = new XLCCommandDSC(cppFileType, project);
+ command.setCommandId(Integer.parseInt(cmdElem.getAttribute(ID_ATTR)));
+ // deserialize command
+ command.deserialize(cmdElem);
+ // get set of files the command applies to
+ NodeList appliesList = cmdElem.getElementsByTagName(APPLIES_TO_ATTR);
+ if (appliesList.getLength() > 0) {
+ Element appliesElem = (Element) appliesList.item(0);
+ NodeList fileList = appliesElem.getElementsByTagName(FILE_ELEM);
+ for (int i = 0; i < fileList.getLength(); ++i) {
+ Element fileElem = (Element) fileList.item(i);
+ String fileName = fileElem.getAttribute(PATH_ATTR);
+ IFile file = project.getFile(fileName);
+ addCompilerCommand(file, command);
+ }
+ applyFileDeltas();
+ }
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
+ */
+ public String getCollectorId() {
+ return COLLECTOR_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
+ */
+ public void serialize(Element collectorElem) {
+ try {
+ synchronized (fLock) {
+ Document doc = collectorElem.getOwnerDocument();
+
+ // serialize project level info
+ for (IProject project : fProjectSettingsMap.keySet()) {
+ // create a project node
+ Element projectElement = doc.createElement(PROJECT);
+ projectElement.setAttribute(NAME, project.getName());
+
+ Map<ScannerInfoTypes, List<String>> scannerInfo = (Map<ScannerInfoTypes, List<String>>) fProjectSettingsMap.get(project);
+
+ List<String> includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
+ for(String include : includes) {
+ Element pathElement = doc.createElement(INCLUDE_PATH);
+ pathElement.setAttribute(PATH, include);
+ //Boolean removed = (Boolean) includes.contains(include);
+ //if (removed != null && removed.booleanValue() == true) {
+ // pathElement.setAttribute(REMOVED, "true"); //$NON-NLS-1$
+ //}
+ pathElement.setAttribute(REMOVED, "false"); //$NON-NLS-1$
+ projectElement.appendChild(pathElement);
+ }
+
+ // Now do the same for the symbols
+ List<String> symbols = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+
+ for(String symbol : symbols) {
+ Element symbolElement = doc.createElement(DEFINED_SYMBOL);
+ symbolElement.setAttribute(SYMBOL, symbol);
+ projectElement.appendChild(symbolElement);
+ }
+ collectorElem.appendChild(projectElement);
+ }
+
+ // serialize file level info
+ List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
+ Collections.sort(commandIds);
+ for (Iterator<Integer> i = commandIds.iterator(); i.hasNext(); ) {
+ Integer commandId = i.next();
+ CCommandDSC command = commandIdCommandMap.get(commandId);
+
+ Element cmdElem = doc.createElement(CC_ELEM);
+ collectorElem.appendChild(cmdElem);
+ cmdElem.setAttribute(ID_ATTR, commandId.toString());
+ cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
+ // write command and scanner info
+ command.serialize(cmdElem);
+ // write files command applies to
+ Element filesElem = doc.createElement(APPLIES_TO_ATTR);
+ cmdElem.appendChild(filesElem);
+ Set<IFile> files = commandIdToFilesMap.get(commandId);
+ if (files != null) {
+ for (Iterator<IFile> j = files.iterator(); j.hasNext(); ) {
+ Element fileElem = doc.createElement(FILE_ELEM);
+ IFile file = j.next();
+ IPath path = file.getProjectRelativePath();
+ fileElem.setAttribute(PATH_ATTR, path.toString());
+ filesElem.appendChild(fileElem);
+ }
+ }
+ }
+ }
+
+ }
+ catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
+
+ protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
+
+ public static final String COLLECTOR_ID = Activator.PLUGIN_ID + ".PerFileXLCScannerInfoCollector"; //$NON-NLS-1$
+
+ protected static final String FILE_ELEM = "file"; //$NON-NLS-1$
+
+ protected static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
+
+ protected static final String ID_ATTR = "id"; //$NON-NLS-1$
+
+ protected static final int INCLUDE_FILE = 3;
+
+ protected static final int INCLUDE_PATH = 1;
+
+
+
+ protected static final int MACROS_FILE = 4;
+
+ protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
+
+ protected static final int QUOTE_INCLUDE_PATH = 2;
+
+ protected static PathInfo createFilePathInfo(CCommandDSC cmd){
+ IPath[] includes = stringListToPathArray(cmd.getIncludes());
+ IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
+ IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
+ IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile());
+ List symbols = cmd.getSymbols();
+ Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
+ for (Iterator i = symbols.iterator(); i.hasNext(); ) {
+ String symbol = (String) i.next();
+ String key = ScannerConfigUtil.getSymbolKey(symbol);
+ String value = ScannerConfigUtil.getSymbolValue(symbol);
+ definedSymbols.put(key, value);
+ }
+
+ return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
+ }
+ /**
+ * @param discovered
+ * @param allIncludes
+ * @return
+ */
+ protected static IPath[] stringListToPathArray(List<String> discovered) {
+ List<Path> allIncludes = new ArrayList<Path>(discovered.size());
+ for (Iterator<String> j = discovered.iterator(); j.hasNext(); ) {
+ String include = j.next();
+ if (!allIncludes.contains(include)) {
+ allIncludes.add(new Path(include));
+ }
+ }
+ return allIncludes.toArray(new IPath[allIncludes.size()]);
+ }
+ protected int commandIdCounter = 0;
+ protected InfoContext context;
+
+ /** monitor for data access */
+ protected final Object fLock = new Object();
+
+ private Map<IProject, Map<?, ?>> fProjectSettingsMap = new HashMap<IProject, Map<?, ?>>();
+
+ protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
+ protected IProject project;
+ protected ProjectScannerInfo psi = null; // sum of all scanner info
+ protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
+ // protected List siChangedForFileList; // list of files for which scanner info has changed
+ protected final Map<IResource, Integer> siChangedForFileMap; // (file, comandId) map for deltas
+ protected ScannerInfoData sid; // scanner info data
+
+ /**
+ *
+ */
+ public PerFileXLCScannerInfoCollector() {
+ sid = new ScannerInfoData();
+
+// siChangedForFileList = new ArrayList();
+ siChangedForFileMap = new HashMap<IResource, Integer>();
+ siChangedForCommandIdList = new ArrayList<Integer>();
+
+ freeCommandIdPool = new TreeSet<Integer>();
+ }
+
+ /**
+ * @param file
+ * @param object
+ */
+ protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
+ synchronized (fLock) {
+ List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values());
+ int index = existingCommands.indexOf(cmd);
+ if (index != -1) {
+ cmd = existingCommands.get(index);
+ } else {
+ int commandId = -1;
+ if (!freeCommandIdPool.isEmpty()) {
+ Integer freeCommandId = freeCommandIdPool.first();
+ freeCommandIdPool.remove(freeCommandId);
+ commandId = freeCommandId.intValue();
+ } else {
+ commandId = ++commandIdCounter;
+ }
+ cmd.setCommandId(commandId);
+ sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
+ }
+
+ generateFileDelta(file, cmd);
+ }
+ }
+
+ /**
+ * @param commandId
+ * @param scannerInfo
+ */
+ protected void addScannerInfo(Integer commandId, Map scannerInfo) {
+ synchronized (fLock) {
+ CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
+ if (cmd != null) {
+ List<String> siItem = (List<String>) scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+ cmd.setSymbols(siItem);
+ siItem = (List<String>) scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
+ siItem = CygpathTranslator.translateIncludePaths(project, siItem);
+ siItem = CCommandDSC.makeRelative(project, siItem);
+ cmd.setIncludes(siItem);
+ siItem = (List<String>) scannerInfo.get(ScannerInfoTypes.QUOTE_INCLUDE_PATHS);
+ siItem = CygpathTranslator.translateIncludePaths(project, siItem);
+ siItem = CCommandDSC.makeRelative(project, siItem);
+ cmd.setQuoteIncludes(siItem);
+
+ cmd.setDiscovered(true);
+ }
+ }
+ }
+
+ /**
+ * @param type
+ * @param object
+ */
+ protected void addScannerInfo(ScannerInfoTypes type, List delta) {
+ // TODO Auto-generated method stub
+
+ }
+ /**
+ * @param file
+ * @param cmd
+ */
+ protected void applyFileDeltas() {
+ synchronized (fLock) {
+ for (Iterator<IResource> i = siChangedForFileMap.keySet().iterator(); i.hasNext();) {
+ IFile file = (IFile) i.next();
+ Integer commandId = siChangedForFileMap.get(file);
+ if (commandId != null) {
+
+ // update sid.commandIdToFilesMap
+ Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId);
+ if (fileSet == null) {
+ fileSet = new HashSet<IFile>();
+ sid.commandIdToFilesMap.put(commandId, fileSet);
+ CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
+ if (cmd != null) {
+ cmd.resolveOptions(project);
+ }
+ }
+ if (fileSet.add(file)) {
+ // update fileToCommandIdsMap
+ boolean change = true;
+ Integer oldCommandId = sid.fileToCommandIdMap.get(file);
+ if (oldCommandId != null) {
+ if (oldCommandId.equals(commandId)) {
+ change = false;
+ } else {
+ Set oldFileSet = sid.commandIdToFilesMap.get(oldCommandId);
+ if (oldFileSet != null) {
+ oldFileSet.remove(file);
+ }
+ }
+ }
+ if (change) {
+ sid.fileToCommandIdMap.put(file, commandId);
+ // TODO generate change event for this resource
+ // IPath path = file.getFullPath();
+ // if (!siChangedForFileList.contains(path)) {
+ // siChangedForFileList.add(path);
+ // }
+ }
+ }
+ }
+ }
+ generateProjectScannerInfo();
+ }
+ }
+
+
+ protected Map<IResource, PathInfo> calculatePathInfoMap() {
+ synchronized (fLock) {
+ Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
+ Map.Entry entry;
+ IFile file;
+ CCommandDSC cmd;
+ PathInfo fpi;
+ for (Iterator iter = sid.fileToCommandIdMap.entrySet().iterator(); iter.hasNext();) {
+ entry = (Map.Entry) iter.next();
+ file = (IFile) entry.getKey();
+ if (file != null) {
+ cmd = sid.commandIdCommandMap.get(entry.getValue());
+ if (cmd != null) {
+ fpi = createFilePathInfo(cmd);
+ map.put(file, fpi);
+ }
+ }
+ }
+
+ if (project != null) {
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles,
+ psi.macrosFiles);
+ map.put(project, fpi);
+ }
+
+ return map;
+ }
+ }
+
+ public void contributeToScannerConfig(Object resource, Map scannerInfo) {
+ // check the resource
+ String errorMessage = null;
+ if (resource == null) {
+ errorMessage = "resource is null";//$NON-NLS-1$
+ }
+ else if (resource instanceof Integer) {
+ synchronized (fLock) {
+ addScannerInfo(((Integer)resource), scannerInfo);
+ }
+ return;
+ }
+
+ if ((resource instanceof IFile)) {
+
+ if (((IFile) resource).getProject() == null) {
+ errorMessage = "project is null";//$NON-NLS-1$
+ } else if (!((IFile) resource).getProject().equals(project)) {
+ errorMessage = "wrong project";//$NON-NLS-1$
+ }
+ if (errorMessage != null) {
+ TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
+ return;
+ }
+
+ IFile file = (IFile) resource;
+
+ synchronized (fLock) {
+ for (Iterator i = scannerInfo.keySet().iterator(); i.hasNext();) {
+ ScannerInfoTypes type = (ScannerInfoTypes) i.next();
+ if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
+ List commands = (List) scannerInfo.get(type);
+ for (Iterator j = commands.iterator(); j.hasNext();) {
+ addCompilerCommand(file, (CCommandDSC) j.next());
+ }
+ } else {
+ addScannerInfo(type, (List) scannerInfo.get(type));
+ }
+ }
+ }
+ }
+
+ else if(resource instanceof IProject) {
+ // save to project level settings
+ synchronized (fLock) {
+ fProjectSettingsMap.put(((IProject) resource), scannerInfo);
+ }
+ }
+
+ else { // error
+ TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", "Not a project or file."); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
+ */
+ public IDiscoveredPathInfo createPathInfoObject() {
+ return new PerFileDiscoveredPathInfo();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAll(IResource resource) {
+ synchronized (fLock) {
+ if (resource instanceof IProject) {
+ fProjectSettingsMap.remove(((IProject) resource));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAll1(IResource resource) {
+ if (resource.equals(project)) {
+ synchronized (fLock) {
+// siChangedForFileList = new ArrayList();
+ siChangedForFileMap.clear();
+ Set<IFile> changedFiles = sid.fileToCommandIdMap.keySet();
+ for (Iterator<IFile> i = changedFiles.iterator(); i.hasNext(); ) {
+ IFile file = i.next();
+// IPath path = file.getFullPath();
+// siChangedForFileList.add(path);
+ siChangedForFileMap.put(file, null);
+ }
+
+ sid = new ScannerInfoData();
+ psi = null;
+
+ commandIdCounter = 0;
+ freeCommandIdPool.clear();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
+ * deleteAllPaths(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAllPaths(IResource resource) {
+ synchronized (fLock) {
+ if (resource instanceof IProject && fProjectSettingsMap != null) {
+ fProjectSettingsMap.remove(((IProject) resource));
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
+ * deleteAllSymbols(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAllSymbols(IResource resource) {
+ synchronized (fLock) {
+ if (resource instanceof IProject && fProjectSettingsMap != null) {
+ fProjectSettingsMap.remove(((IProject) resource));
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
+ * deletePath(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ public void deletePath(IResource resource, String path) {
+ synchronized (fLock) {
+ if (resource instanceof IProject && fProjectSettingsMap != null) {
+ fProjectSettingsMap.remove(((IProject) resource));
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
+ * deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ public void deleteSymbol(IResource resource, String symbol) {
+ synchronized (fLock) {
+ if (resource instanceof IProject && fProjectSettingsMap != null) {
+ fProjectSettingsMap.remove(((IProject) resource));
+ }
+ }
+ }
+
+ /**
+ * @param file
+ * @param cmd
+ */
+ protected void generateFileDelta(IFile file, CCommandDSC cmd) {
+ synchronized (fLock) {
+ Integer commandId = cmd.getCommandIdAsInteger();
+ Integer oldCommandId = sid.fileToCommandIdMap.get(file);
+
+ if (oldCommandId != null && oldCommandId.equals(commandId)) {
+ // already exists; remove form delta
+ siChangedForFileMap.remove(file);
+ } else {
+ // new (file, commandId) pair
+ siChangedForFileMap.put(file, commandId);
+ }
+ }
+ }
+
+ protected void generateProjectScannerInfo() {
+ synchronized (fLock) {
+ psi = new ProjectScannerInfo();
+ psi.includePaths = getAllIncludePaths(INCLUDE_PATH);
+ psi.quoteIncludePaths = getAllIncludePaths(QUOTE_INCLUDE_PATH);
+ psi.includeFiles = getAllIncludePaths(INCLUDE_FILE);
+ psi.macrosFiles = getAllIncludePaths(MACROS_FILE);
+ psi.definedSymbols = getAllSymbols();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#getAllIncludePaths(int)
+ */
+ protected IPath[] getAllIncludePaths(int type) {
+ synchronized (fLock) {
+ IProject project = this.getInfoContext().getProject();
+
+ Map projectScannerInfo = fProjectSettingsMap.get(project);
+ List<String> includes = null;
+
+ if (projectScannerInfo != null) {
+ includes = (List<String>) projectScannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
+ }
+
+ List<IPath> pathList = new LinkedList<IPath>();
+
+ if (includes != null) {
+ for (String include : includes) {
+ pathList.add(new Path(include));
+ }
+ }
+
+ IPath[] fileIncludes = getAllIncludePaths1(type);
+
+ for (IPath include : fileIncludes) {
+ pathList.add(include);
+ }
+
+ return pathList.toArray(new IPath[0]);
+ }
+ }
+
+ /**
+ * @param type can be one of the following:
+ * <li><code>INCLUDE_PATH</code>
+ * <li><code>QUOTE_INCLUDE_PATH</code>
+ * <li><code>INCLUDE_FILE</code>
+ * <li><code>MACROS_FILE</code>
+ *
+ * @return list of IPath(s).
+ */
+ protected IPath[] getAllIncludePaths1(int type) {
+ synchronized (fLock) {
+ List<String> allIncludes = new ArrayList<String>();
+ for (Iterator<Integer> i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext();) {
+ Integer cmdId = i.next();
+ CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
+ if (cmd.isDiscovered()) {
+ List<String> discovered = null;
+ switch (type) {
+ case INCLUDE_PATH:
+ discovered = cmd.getIncludes();
+ break;
+ case QUOTE_INCLUDE_PATH:
+ discovered = cmd.getQuoteIncludes();
+ break;
+ case INCLUDE_FILE:
+ discovered = cmd.getIncludeFile();
+ break;
+ case MACROS_FILE:
+ discovered = cmd.getImacrosFile();
+ break;
+ }
+ for (Iterator<String> j = discovered.iterator(); j.hasNext();) {
+ String include = j.next();
+ // the following line degrades perfomance
+ // see
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=189127
+ // it is not necessary for renaming projects anyway
+ // include = CCommandDSC.makeRelative(project, new
+ // Path(include)).toPortableString();
+ if (!allIncludes.contains(include)) {
+ allIncludes.add(include);
+ }
+ }
+ }
+ }
+ return stringListToPathArray(allIncludes);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector#
+ * getAllSymbols()
+ */
+ protected Map<String, String> getAllSymbols() {
+ synchronized (fLock) {
+ IProject project = this.getInfoContext().getProject();
+
+ Map projectScannerInfo = fProjectSettingsMap.get(project);
+
+ Map<String, String> symbols = new HashMap<String, String>();
+
+ if (projectScannerInfo != null) {
+ List<String> projectSymbols = (List<String>) projectScannerInfo
+ .get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+
+ for (String symbol : projectSymbols) {
+ symbols.put(symbol, "1"); //$NON-NLS-1$
+ }
+ }
+
+ Map<String, String> fileSymbols = getAllSymbols1();
+
+ symbols.putAll(fileSymbols);
+
+ return symbols;
+ }
+ }
+
+ /**
+ * @return
+ */
+ protected Map<String, String> getAllSymbols1() {
+ synchronized (fLock) {
+ Map<String, String> symbols = new HashMap<String, String>();
+ for (Iterator<Integer> i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext();) {
+ Integer cmdId = i.next();
+ CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
+ if (cmd.isDiscovered()) {
+ List discovered = cmd.getSymbols();
+ for (Iterator j = discovered.iterator(); j.hasNext();) {
+ String symbol = (String) j.next();
+ String key = ScannerConfigUtil.getSymbolKey(symbol);
+ String value = ScannerConfigUtil.getSymbolValue(symbol);
+ symbols.put(key, value);
+ }
+ }
+ }
+ return symbols;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
+ */
+ public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
+
+ List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
+ // check the resource
+ String errorMessage = null;
+ if (resource == null) {
+ errorMessage = "resource is null";//$NON-NLS-1$
+ }
+ else if (!(resource instanceof IResource)) {
+ errorMessage = "resource is not an IResource";//$NON-NLS-1$
+ }
+ else if (((IResource) resource).getProject() == null) {
+ errorMessage = "project is null";//$NON-NLS-1$
+ }
+ else if (((IResource) resource).getProject() != project) {
+ errorMessage = "wrong project";//$NON-NLS-1$
+ }
+
+ if (errorMessage != null) {
+ TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
+ return rv;
+ }
+ if (project.equals(((IResource)resource).getProject())) {
+ if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
+ synchronized (fLock) {
+ for (Iterator<Integer> i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext(); ) {
+ Integer cmdId = i.next();
+ Set<IFile> fileSet = sid.commandIdToFilesMap.get(cmdId);
+ if (fileSet != null && !fileSet.isEmpty()) {
+ rv.add(sid.commandIdCommandMap.get(cmdId));
+ }
+ }
+ }
+ }
+ else if (type.equals(ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND)) {
+// if (!siChangedForFileList.isEmpty()) {
+ synchronized (fLock) {
+ if (scannerInfoChanged()) {
+ if (siChangedForCommandIdList.isEmpty()) {
+// for (Iterator i = siChangedForFileList.iterator(); i.hasNext(); ) {
+ for (Iterator<IResource> i = siChangedForFileMap.keySet().iterator(); i.hasNext(); ) {
+// IPath path = (IPath) i.next();
+ IFile file = (IFile) i.next();
+ Integer cmdId = siChangedForFileMap.get(file);
+ if (cmdId != null) {
+ if (!siChangedForCommandIdList.contains(cmdId)) {
+ siChangedForCommandIdList.add(cmdId);
+ }
+ }
+ }
+ }
+ Collections.sort(siChangedForCommandIdList);
+ for (Iterator<Integer> i = siChangedForCommandIdList.iterator(); i.hasNext(); ) {
+ Integer cmdId = i.next();
+ CCommandDSC command = sid.commandIdCommandMap.get(cmdId);
+ rv.add(command);
+ }
+ }
+ }
+ }
+ }
+ return rv;
+ }
+
+ protected CCommandDSC getCommand(IFile file) {
+ synchronized (fLock) {
+ CCommandDSC cmd = null;
+ if (file != null) {
+ Integer cmdId = sid.fileToCommandIdMap.get(file);
+ if (cmdId != null) {
+ // get the command
+ cmd = sid.commandIdCommandMap.get(cmdId);
+ }
+ }
+ return cmd;
+ }
+ }
+
+ /**
+ * @param path
+ * @return
+ */
+ protected CCommandDSC getCommand(IPath path) {
+ synchronized (fLock) {
+ try {
+ IFile file = project.getWorkspace().getRoot().getFile(path);
+ return getCommand(file);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getDefinedSymbols()
+ */
+ public Map getDefinedSymbols() {
+ synchronized (fLock) {
+ return getAllSymbols();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths()
+ */
+ public List getIncludePaths() {
+ synchronized (fLock) {
+ List<String> pathStrings = new LinkedList<String>();
+
+ List<IPath> paths = Arrays.asList(getAllIncludePaths(INCLUDE_PATH));
+ paths.addAll(Arrays.asList(getAllIncludePaths(QUOTE_INCLUDE_PATH)));
+
+ for (IPath path : paths) {
+ pathStrings.add(path.toString());
+ }
+
+ return pathStrings;
+ }
+ }
+
+ protected InfoContext getInfoContext() {
+ return context;
+ }
+
+ protected void removeUnusedCommands() {
+ synchronized (fLock) {
+ for (Iterator i = sid.commandIdToFilesMap.entrySet().iterator(); i.hasNext();) {
+ Entry entry = (Entry) i.next();
+ Integer cmdId = (Integer) entry.getKey();
+ Set fileSet = (Set) entry.getValue();
+ if (fileSet.isEmpty()) {
+ // return cmdId to the free command id pool
+ freeCommandIdPool.add(cmdId);
+ }
+ }
+ for (Iterator<Integer> i = freeCommandIdPool.iterator(); i.hasNext();) {
+ Integer cmdId = i.next();
+ // the command does not have any files associated; remove
+ sid.commandIdCommandMap.remove(cmdId);
+ sid.commandIdToFilesMap.remove(cmdId);
+ }
+ while (!freeCommandIdPool.isEmpty()) {
+ Integer last = freeCommandIdPool.last();
+ if (last.intValue() == commandIdCounter) {
+ freeCommandIdPool.remove(last);
+ --commandIdCounter;
+ } else
+ break;
+ }
+ }
+ }
+
+ protected boolean scannerInfoChanged() {
+ synchronized (fLock) {
+ return (!fProjectSettingsMap.isEmpty()) || !siChangedForFileMap.isEmpty();
+ }
+ }
+
+ public void setInfoContext(InfoContext context) {
+ synchronized (fLock) {
+ this.project = context.getProject();
+ this.context = context;
+
+ try {
+ // deserialize from SI store
+ DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, sid);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ synchronized (fLock) {
+ setInfoContext(new InfoContext(project));
+ }
+ }
+
+ public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ monitor.beginTask(Messages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
+ monitor.subTask(Messages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
+ ArrayList<IResource> changedResources = new ArrayList<IResource>();
+ synchronized (fLock) {
+ if (scannerInfoChanged()) {
+ applyFileDeltas();
+ removeUnusedCommands();
+ changedResources.addAll(siChangedForFileMap.keySet());
+ siChangedForFileMap.clear();
+ }
+ siChangedForCommandIdList.clear();
+
+ // add in any projects that got project level info (from the specs provider)
+ changedResources.addAll(fProjectSettingsMap.keySet());
+
+ monitor.worked(50);
+ if (!changedResources.isEmpty()) {
+ // update outside monitor scope
+ try {
+ // update scanner configuration
+ monitor.subTask(Messages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
+ IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
+ //IDiscoveredPathInfo pathInfo = new PerFileDiscoveredPathInfo();
+ if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
+ pathInfo = createPathInfoObject();
+ }
+ else {
+ PerFileDiscoveredPathInfo perFilePathInfo = new PerFileDiscoveredPathInfo();
+
+ // merge them
+ if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
+ pathInfo = new MergedPerFileDiscoveredPathInfo(pathInfo, perFilePathInfo);
+ }
+ else {
+ pathInfo = perFilePathInfo;
+ }
+ }
+
+
+ Job job = new ScannerConfigUpdateJob(context, pathInfo, context.isDefaultContext(), changedResources);
+ ISchedulingRule rule = project;
+ job.setRule(rule);
+ job.schedule();
+
+
+
+// } finally {
+// manager.endRule(rule);
+// }
+
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+
+ catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ monitor.worked(50);
+ monitor.done();
+ }
+
+} \ No newline at end of file
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java
index d76fecee47..ed4a244bda 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@ import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
* @author laggarcia
*
*/
-public class DefaultXlCScannerInfoCollector extends PerProjectSICollector
+public class PerProjectXLCScannerInfoCollector extends PerProjectSICollector
implements IScannerInfoCollector3, IManagedScannerInfoCollector {
-
}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
new file mode 100644
index 0000000000..f6790d04cf
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
@@ -0,0 +1,712 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.ProblemMarkerInfo;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.internal.core.MakeMessages;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.SCDOptionsEnum;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCBuildOutputParserUtility {
+ protected class Problem {
+ protected String description;
+ protected IResource file;
+ protected int lineNumber;
+ protected int severity;
+ protected String variableName;
+
+ public Problem(IResource file, int lineNumber, String desciption, int severity, String variableName) {
+ this.file = file;
+ this.lineNumber = lineNumber;
+ this.description = desciption;
+ this.severity = severity;
+ this.variableName = variableName;
+ }
+ }
+ public static IPath convertCygpath(IPath path) {
+ if (path.segmentCount() > 1 && path.segment(0).equals("cygdrive")) { //$NON-NLS-1$
+ StringBuffer buf = new StringBuffer(2);
+ buf.append(Character.toUpperCase(path.segment(1).charAt(0)));
+ buf.append(':');
+ path = path.removeFirstSegments(2);
+ path = path.setDevice(buf.toString());
+ path = path.makeAbsolute();
+ }
+ return path;
+ }
+ private List commandsList2;
+ private int commandsN = 0;
+ private List compiledFileList;
+
+ private Map directoryCommandListMap;
+
+ private IPath fBaseDirectory;
+ private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$
+ private Vector<IPath> fDirectoryStack;
+ private ArrayList<Problem> fErrors;
+ private int filesN = 0;
+
+ private IMarkerGenerator fMarkerGenerator;
+
+ private IProject project;
+
+ private int workingDirsN = 0;
+
+ /*
+ * For tracking the location of files being compiled
+ */
+ private Map<String, IFile> fFilesInProject;
+ private List<String> fCollectedFiles;
+ private List<String> fNameConflicts;
+
+ /**
+ *
+ */
+ public XLCBuildOutputParserUtility(IProject project, IPath workingDirectory,
+ IMarkerGenerator markerGenerator) {
+ fDirectoryStack = new Vector<IPath>();
+ fErrors = new ArrayList<Problem>();
+ this.project = project;
+ fBaseDirectory = getPathForResource(project);
+ if (workingDirectory != null) {
+ pushDirectory(workingDirectory);
+ }
+ }
+
+ private IPath getPathForResource(IResource resource) {
+ // TODO: when the file system utility stuff is in, this will have to call it to get the path
+ // for now, get the path from the URI
+ URI locationURI = resource.getLocationURI();
+ IPath path = new Path(locationURI.getPath());
+ return path;
+ }
+
+ /**
+ * Adds a mapping filename, generic_command
+ * @param longFileName
+ * @param genericLine
+ */
+ void addGenericCommandForFile(String longFileName, String genericCommand) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
+
+ String workingDir = getWorkingDirectory().toString();
+ List directoryCommandList = (List) directoryCommandListMap.get(workingDir);
+ if (directoryCommandList == null) {
+ directoryCommandList = new ArrayList();
+ directoryCommandListMap.put(workingDir, directoryCommandList);
+ ++workingDirsN;
+ }
+ Map command21FileListMap = null;
+ for (Iterator i = directoryCommandList.iterator(); i.hasNext(); ) {
+ command21FileListMap = (Map) i.next();
+ List fileList = (List) command21FileListMap.get(genericCommand);
+ if (fileList != null) {
+ if (!fileList.contains(longFileName)) {
+ fileList.add(longFileName);
+ ++filesN;
+ }
+ return;
+ }
+ }
+ command21FileListMap = new HashMap(1);
+ directoryCommandList.add(command21FileListMap);
+ ++commandsN;
+ List fileList = new ArrayList();
+ command21FileListMap.put(genericCommand, fileList);
+ fileList.add(longFileName);
+ ++filesN;
+ }
+
+ /**
+ * Adds a mapping command line -> file, this time without a dir
+ * @param longFileName
+ * @param genericLine
+ */
+ void addGenericCommandForFile2(String longFileName, String genericLine) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
+
+ String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$
+ CCommandDSC command = getNewCCommandDSC(tokens, 0, false); // assume .c file type
+ int index = commandsList2.indexOf(command);
+ if (index == -1) {
+ commandsList2.add(command);
+ ++commandsN;
+ }
+ else {
+ command = (CCommandDSC) commandsList2.get(index);
+ }
+// // add a file
+// command.addFile(longFileName);
+// ++filesN;
+ }
+
+ public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
+ if (enterDir) {
+ /* Sometimes make screws up the output, so
+ * "leave" events can't be seen. Double-check level
+ * here.
+ */
+ for (int parseLevel = getDirectoryLevel(); dirLevel < parseLevel; parseLevel = getDirectoryLevel()) {
+ popDirectory();
+ }
+ pushDirectory(new Path(dir));
+ } else {
+ popDirectory();
+ /* Could check to see if they match */
+ }
+ }
+
+ /**
+ * Called by the console line parsers to generate a problem marker.
+ */
+ public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
+ // No need to collect markers if marker generator is not present
+ if (fMarkerGenerator != null) {
+ Problem problem = new Problem(file, lineNumber, desc, severity, varName);
+ fErrors.add(problem);
+ }
+ }
+
+ /**
+ *
+ */
+ void generateReport() {
+ TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
+ "Generic command: '", "' applicable for:", //$NON-NLS-1$ //$NON-NLS-2$
+ directoryCommandListMap);
+ TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
+ }
+
+ /**
+ * @param filePath : String
+ * @return filePath : IPath - not <code>null</code>
+ */
+ public IPath getAbsolutePath(String filePath) {
+ IPath pFilePath;
+ if (filePath.startsWith("/")) { //$NON-NLS-1$
+ return convertCygpath(new Path(filePath));
+ }
+ else if (filePath.startsWith("\\") || //$NON-NLS-1$
+ (!filePath.startsWith(".") && //$NON-NLS-1$
+ filePath.length() > 2 && filePath.charAt(1) == ':' &&
+ (filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
+ // absolute path
+ pFilePath = new Path(filePath);
+ }
+ else {
+ // relative path
+ IPath cwd = getWorkingDirectory();
+ if (!cwd.isAbsolute()) {
+ cwd = getBaseDirectory().append(cwd);
+ }
+ if (filePath.startsWith("`pwd`")) { //$NON-NLS-1$
+ if (filePath.length() > 5 && (filePath.charAt(5) == '/' || filePath.charAt(5) == '\\')) {
+ filePath = filePath.substring(6);
+ }
+ else {
+ filePath = filePath.substring(5);
+ }
+ }
+ pFilePath = cwd.append(filePath);
+ }
+ return pFilePath;
+ }
+ /**
+ * @return Returns the fBaseDirectory.
+ */
+ public IPath getBaseDirectory() {
+ return fBaseDirectory;
+ }
+
+ /**
+ * Returns all CCommandDSC collected so far.
+ * Currently this list is not filled, so it will always return an empty list.
+ * @return List of CCommandDSC
+ */
+ public List getCCommandDSCList() {
+ return new ArrayList(commandsList2);
+ }
+
+ protected int getDirectoryLevel() {
+ return fDirectoryStack.size();
+ }
+ /**
+ * @return Returns the fDirectoryStack.
+ */
+ protected Vector<IPath> getDirectoryStack() {
+ return fDirectoryStack;
+ }
+ /**
+ * @return Returns the fErrors.
+ */
+ protected ArrayList<Problem> getErrors() {
+ return fErrors;
+ }
+ /**
+ * @return Returns the fMarkerGenerator.
+ */
+ protected IMarkerGenerator getMarkerGenerator() {
+ return fMarkerGenerator;
+ }
+
+ /**
+ * @param genericLine
+ * @param cppFileType
+ * @return CCommandDSC compile command description
+ */
+ public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
+ ArrayList dirafter = new ArrayList();
+ ArrayList includes = new ArrayList();
+ XLCCommandDSC command = new XLCCommandDSC(cppFileType, getProject());
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
+ for (int i = idxOfCompilerCommand+1; i < tokens.length; ++i) {
+ String token = tokens[i];
+ //Target specific options: see GccScannerInfoConsoleParser
+ if (token.startsWith("-m") || //$NON-NLS-1$
+ token.equals("-ansi") || //$NON-NLS-1$
+ token.equals("-posix") || //$NON-NLS-1$
+ token.equals("-pthread") || //$NON-NLS-1$
+ token.startsWith("-O") || //$NON-NLS-1$
+ token.equals("-fno-inline") || //$NON-NLS-1$
+ token.startsWith("-finline") || //$NON-NLS-1$
+ token.equals("-fno-exceptions") || //$NON-NLS-1$
+ token.equals("-fexceptions") || //$NON-NLS-1$
+ token.equals("-fshort-wchar") || //$NON-NLS-1$
+ token.equals("-fshort-double") || //$NON-NLS-1$
+ token.equals("-fno-signed-char") || //$NON-NLS-1$
+ token.equals("-fsigned-char") || //$NON-NLS-1$
+ token.startsWith("-fabi-version=") //$NON-NLS-1$
+ ) {
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
+ continue;
+ }
+ for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) {
+ final SCDOptionsEnum optionKind = SCDOptionsEnum.getSCDOptionsEnum(j);
+ if (token.startsWith(optionKind.toString())) {
+ String option = token.substring(
+ optionKind.toString().length()).trim();
+ if (option.length() > 0) {
+ // ex. -I/dir
+ }
+ else if (optionKind.equals(SCDOptionsEnum.IDASH)) {
+ for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
+ option = (String)iter.next();
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
+ command.addSCOption(pair);
+ }
+ includes = new ArrayList();
+ // -I- has no parameter
+ }
+ else {
+ // ex. -I /dir
+ // take a next token
+ if (i+1 < tokens.length && !tokens[i+1].startsWith("-")) { //$NON-NLS-1$
+ option = tokens[++i];
+ }
+ else break;
+ }
+
+ if (option.length() > 0 && (
+ optionKind.equals(SCDOptionsEnum.INCLUDE) ||
+ optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) ||
+ optionKind.equals(SCDOptionsEnum.IMACROS_FILE) ||
+ optionKind.equals(SCDOptionsEnum.IDIRAFTER) ||
+ optionKind.equals(SCDOptionsEnum.ISYSTEM) ||
+ optionKind.equals(SCDOptionsEnum.IQUOTE) )) {
+ option = (getAbsolutePath(option)).toString();
+ }
+
+ if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ dirafter.add(pair);
+ }
+ else if (optionKind.equals(SCDOptionsEnum.INCLUDE)) {
+ includes.add(option);
+ }
+ else { // add the pair
+ if (optionKind.equals(SCDOptionsEnum.DEFINE)) {
+ if (option.indexOf('=') == -1) {
+ option += '='+ fDefaultMacroDefinitionValue;
+ }
+ }
+ KVStringPair pair = new KVStringPair(optionKind.toString(), option);
+ command.addSCOption(pair);
+ }
+ break;
+ }
+ }
+ }
+ String option;
+ for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
+ option = (String)iter.next();
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ command.addSCOption(pair);
+ }
+ for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) {
+ command.addSCOption((KVStringPair)iter.next());
+ }
+ return command;
+ }
+
+ /**
+ * @return Returns the project.
+ */
+ protected IProject getProject() {
+ return project;
+ }
+
+ public IPath getWorkingDirectory() {
+ if (fDirectoryStack.size() != 0) {
+ return fDirectoryStack.lastElement();
+ }
+ // Fallback to the Project Location
+ // FIXME: if the build did not start in the Project ?
+ return fBaseDirectory;
+ }
+
+ protected IPath popDirectory() {
+ int i = getDirectoryLevel();
+ if (i != 0) {
+ IPath dir = fDirectoryStack.lastElement();
+ fDirectoryStack.removeElementAt(i - 1);
+ return dir;
+ }
+ return new Path(""); //$NON-NLS-1$
+ }
+
+ protected void pushDirectory(IPath dir) {
+ if (dir != null) {
+ IPath pwd = null;
+ if (fBaseDirectory != null && fBaseDirectory.isPrefixOf(dir)) {
+ pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount());
+ } else {
+ // check if it is a cygpath
+ pwd= convertCygpath(dir);
+ }
+ fDirectoryStack.addElement(pwd);
+ }
+ }
+
+ public boolean reportProblems() {
+ boolean reset = false;
+ for (Iterator<Problem> iter = fErrors.iterator(); iter.hasNext(); ) {
+ Problem problem = iter.next();
+ if (problem.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
+ reset = true;
+ }
+ if (problem.file == null) {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(
+ project,
+ problem.lineNumber,
+ problem.description,
+ problem.severity,
+ problem.variableName));
+ } else {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(
+ problem.file,
+ problem.lineNumber,
+ problem.description,
+ problem.severity,
+ problem.variableName));
+ }
+ }
+ fErrors.clear();
+ return reset;
+ }
+
+ public void setDefaultMacroDefinitionValue(String val) {
+ if (val != null) {
+ fDefaultMacroDefinitionValue= val;
+ }
+ }
+
+ public String getDefaultMacroDefinitionValue() {
+ return fDefaultMacroDefinitionValue;
+ }
+
+ public String normalizePath(String path) {
+ int column = path.indexOf(':');
+ if (column > 0) {
+ char driveLetter = path.charAt(column - 1);
+ if (Character.isLowerCase(driveLetter)) {
+ StringBuffer sb = new StringBuffer();
+ if (column - 1 > 0) {
+ sb.append(path.substring(0, column-1));
+ }
+ sb.append(Character.toUpperCase(driveLetter));
+ sb.append(path.substring(column));
+ path = sb.toString();
+ }
+ }
+ if (path.indexOf('.') == -1 || path.equals(".")) { //$NON-NLS-1$
+ return (new Path(path)).toString(); // convert separators to '/'
+ }
+ // lose "./" segments since they confuse the Path normalization
+ StringBuffer buf = new StringBuffer(path);
+ int len = buf.length();
+ StringBuffer newBuf = new StringBuffer(buf.length());
+ int scp = 0; // starting copy point
+ int ssp = 0; // starting search point
+ int sdot;
+ boolean validPrefix;
+ while (ssp < len && (sdot = buf.indexOf(".", ssp)) != -1) { //$NON-NLS-1$
+ validPrefix = false;
+ int ddot = buf.indexOf("..", ssp);//$NON-NLS-1$
+ if (sdot < ddot || ddot == -1) {
+ newBuf.append(buf.substring(scp, sdot));
+ scp = sdot;
+ ssp = sdot + 1;
+ if (ssp < len) {
+ if (sdot == 0 || buf.charAt(sdot - 1) == '/' || buf.charAt(sdot - 1) == '\\') {
+ validPrefix = true;
+ }
+ char nextChar = buf.charAt(ssp);
+ if (validPrefix && nextChar == '/') {
+ ++ssp;
+ scp = ssp;
+ }
+ else if (validPrefix && nextChar == '\\') {
+ ++ssp;
+ if (ssp < len - 1 && buf.charAt(ssp) == '\\') {
+ ++ssp;
+ }
+ scp = ssp;
+ }
+ else {
+ // no path delimiter, must be '.' inside the path
+ scp = ssp - 1;
+ }
+ }
+ }
+ else if (sdot == ddot) {
+ ssp = sdot + 2;
+ }
+ }
+ newBuf.append(buf.substring(scp, len));
+
+ IPath orgPath = new Path(newBuf.toString());
+ return orgPath.toString();
+ }
+
+
+ /**
+ * Called by the console line parsers to find a file with a given name.
+ * @param fileName
+ * @return IFile or null
+ */
+ public IFile findFile(String fileName) {
+ IFile file = findFilePath(fileName);
+ if (file == null) {
+ // Try the project's map.
+ file = findFileName(fileName);
+ if (file != null) {
+ // If there is a conflict then try all files in the project.
+ if (isConflictingName(fileName)) {
+ file = null;
+
+ // Create a problem marker
+ final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, fileName);
+ generateMarker(getProject(), -1, error+fileName, IMarkerGenerator.SEVERITY_WARNING, null);
+ }
+ }
+ }
+ return file;
+ }
+
+ /**
+ * @param filePath
+ * @return
+ */
+ protected IFile findFilePath(String filePath) {
+ IPath path = null;
+ IPath fp = new Path(filePath);
+ if (fp.isAbsolute()) {
+ if (getBaseDirectory().isPrefixOf(fp)) {
+ int segments = getBaseDirectory().matchingFirstSegments(fp);
+ path = fp.removeFirstSegments(segments);
+ } else {
+ path = fp;
+ }
+ } else {
+ path = getWorkingDirectory().append(filePath);
+ }
+
+ IFile file = null;
+ // The workspace may throw an IllegalArgumentException
+ // Catch it and the parser should fallback to scan the entire project.
+ try {
+ file = findFileInWorkspace(path);
+ } catch (Exception e) {
+ }
+
+ // We have to do another try, on Windows for cases like "TEST.C" vs "test.c"
+ // We use the java.io.File canonical path.
+ if (file == null || !file.exists()) {
+ File f = path.toFile();
+ try {
+ String canon = f.getCanonicalPath();
+ path = new Path(canon);
+ file = findFileInWorkspace(path);
+ } catch (IOException e1) {
+ }
+ }
+ return (file != null && file.exists()) ? file : null;
+ }
+
+ /**
+ * @param fileName
+ * @return
+ */
+ protected IFile findFileName(String fileName) {
+ IPath path = new Path(fileName);
+ return (IFile) fFilesInProject.get(path.lastSegment());
+ }
+
+ protected IFile findFileInWorkspace(IPath path) {
+ IFile file = null;
+ if (path.isAbsolute()) {
+ IWorkspaceRoot root = getProject().getWorkspace().getRoot();
+
+ // construct a URI, based on the project's locationURI, that points
+ // to the given path
+ URI projectURI = project.getLocationURI();
+
+ URI newURI = FileSystemUtilityManager.getDefault().replacePath(projectURI, path.toString());
+
+ IFile[] files = root.findFilesForLocationURI(newURI);
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].getProject().equals(getProject())) {
+ file = files[i];
+ break;
+ }
+ }
+
+ } else {
+ file = getProject().getFile(path);
+ }
+ return file;
+ }
+
+ protected void collectFiles(IContainer parent, List result) {
+ try {
+ IResource[] resources = parent.members();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource instanceof IFile) {
+ result.add(resource);
+ } else if (resource instanceof IContainer) {
+ collectFiles((IContainer) resource, result);
+ }
+ }
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e.getStatus());
+ }
+ }
+
+ protected boolean isConflictingName(String fileName) {
+ IPath path = new Path(fileName);
+ return fNameConflicts.contains(path.lastSegment());
+ }
+
+ public List translateRelativePaths(IFile file, String fileName, List includes) {
+ List translatedIncludes = new ArrayList(includes.size());
+ for (Iterator i = includes.iterator(); i.hasNext(); ) {
+ String include = (String) i.next();
+ IPath includePath = new Path(include);
+ if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths
+ // First try the current working directory
+ IPath cwd = getWorkingDirectory();
+ if (!cwd.isAbsolute()) {
+ cwd = getBaseDirectory().append(cwd);
+ }
+
+ IPath filePath = new Path(fileName);
+ if (!filePath.isAbsolute()) {
+ // check if the cwd is the right one
+ // appending fileName to cwd should yield file path
+ filePath = cwd.append(fileName);
+ }
+ if (!filePath.toString().equalsIgnoreCase(file.getLocation().toString())) {
+ // must be the cwd is wrong
+ // check if file name starts with ".."
+ if (fileName.startsWith("..")) { //$NON-NLS-1$
+ // probably multiple choices for cwd, hopeless
+ final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, fileName);
+ generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ break;
+ }
+ else {
+ // remove common segments at the end
+ IPath tPath = new Path(fileName);
+ if (fileName.startsWith(".")) { //$NON-NLS-1$
+ tPath = tPath.removeFirstSegments(1);
+ }
+ // get the file path from the file
+ filePath = file.getLocation();
+ IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
+ if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) {
+ cwd = filePath.removeLastSegments(tPath.segmentCount());
+ }
+ }
+ }
+
+ IPath candidatePath = cwd.append(includePath);
+ File dir = candidatePath.toFile();
+ include = candidatePath.toString();
+ if (!dir.exists()) {
+ final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, include);
+// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ }
+ }
+ // TODO VMIR for now add unresolved paths as well
+ translatedIncludes.add(include);
+ }
+ return translatedIncludes;
+ }
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java
new file mode 100644
index 0000000000..32fced2edc
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.xlc.core.activator.Activator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
+ */
+ @Override
+ protected boolean processCommand(String[] tokens) {
+ try {
+
+ // GCC C/C++ compiler invocation
+ int compilerInvocationIndex = findCompilerInvocation(tokens);
+ if (compilerInvocationIndex < 0) {
+ return false;
+ }
+
+ // find a file name
+ int extensionsIndex = -1;
+ boolean found = false;
+ String filePath = null;
+ for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
+ String token = tokens[i];
+ int k = token.lastIndexOf('.');
+ if (k != -1 && (token.length() - k < 5)) {
+ String fileExtension = token.substring(k);
+ extensionsIndex = getFileExtensionsList().indexOf(fileExtension);
+ if (extensionsIndex != -1) {
+ filePath = token;
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ // sanity check
+ if (filePath.indexOf(getFileExtensions()[extensionsIndex]) == -1) {
+ TraceUtil.outputTrace("Error identifying file name :2", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ if (getUtility() != null) {
+ IPath pFilePath = fUtility.getAbsolutePath(filePath);
+ String shortFileName = pFilePath.removeFileExtension().lastSegment();
+
+ // generalize occurrences of the file name
+ for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
+ String token = tokens[i];
+ if (token.equals("-include")) { //$NON-NLS-1$
+ ++i;
+ } else if (token.equals("-imacros")) { //$NON-NLS-1$
+ ++i;
+ } else if (token.equals(filePath)) {
+ tokens[i] = "LONG_NAME"; //$NON-NLS-1$
+ } else if (token.startsWith(shortFileName)) {
+ tokens[i] = token.replaceFirst(shortFileName, "SHORT_NAME"); //$NON-NLS-1$
+ }
+ }
+
+ IFile file = null;
+ IPath baseDirectory = fUtility.getBaseDirectory();
+ if (baseDirectory.isPrefixOf(pFilePath)) {
+ IPath relPath = pFilePath.removeFirstSegments(baseDirectory.segmentCount());
+ // Note: We add the scanner-config even if the resource doesn't
+ // actually
+ // exist below this project (which may happen when reading
+ // existing
+ // build logs, because resources can be created as part of the
+ // build
+ // and may not exist at the time of analyzing the config but
+ // re-built
+ // later on.
+ // if (getProject().exists(relPath)) {
+ file = getProject().getFile(relPath);
+ } else {
+ file = getUtility().findFileInWorkspace(pFilePath);
+ }
+ if (file != null) {
+ CCommandDSC cmd = getUtility().getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0);
+ List<CCommandDSC> cmdList = new ArrayList<CCommandDSC>();
+ cmdList.add(cmd);
+ Map<ScannerInfoTypes, List<CCommandDSC>> sc = new HashMap<ScannerInfoTypes, List<CCommandDSC>>(1);
+ sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
+ getCollector().contributeToScannerConfig(file, sc);
+ if (fCollector != null && fCollector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
+ try {
+ collector.updateScannerConfiguration(null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ } else
+ TraceUtil.outputError("Build command for file outside project: " + pFilePath.toString(), tokens); //$NON-NLS-1$
+ }
+ return true;
+
+ }
+ catch(Throwable e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java
new file mode 100644
index 0000000000..cae37f6b94
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.MakeMessages;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.xlc.core.activator.Activator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCPerProjectBuildOutputParser extends
+ AbstractXLCBuildOutputParser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
+ */
+ @Override
+ protected boolean processCommand(String[] tokens) {
+ int compilerInvocationIdx= findCompilerInvocation(tokens);
+ if (compilerInvocationIdx<0) {
+ return false;
+ }
+
+ if (compilerInvocationIdx+1 >= tokens.length) {
+ return false;
+ }
+
+ // Recognized gcc or g++ compiler invocation
+ List<String> includes = new ArrayList<String>();
+ List<String> symbols = new ArrayList<String>();
+ List<String> targetSpecificOptions = new ArrayList<String>();
+
+ String fileName = null;
+ for (int j= compilerInvocationIdx+1; j < tokens.length; j++) {
+ String token = tokens[j];
+ if (token.equals(DASHIDASH)) {
+ }
+ else if (token.startsWith(DASHI)) {
+ String candidate= null;
+ if (token.length() > 2) {
+ candidate= token.substring(2).trim();
+ }
+ else if (j+1 < tokens.length) {
+ candidate= tokens[j+1];
+ if (candidate.startsWith("-")) { //$NON-NLS-1$
+ candidate= null;
+ }
+ else {
+ j++;
+ }
+ }
+ if (candidate != null && candidate.length() > 0) {
+ if (getUtility() != null) {
+ candidate= getUtility().normalizePath(candidate);
+ }
+ if (!includes.contains(candidate)) {
+ includes.add(candidate);
+ }
+ }
+ }
+ else if (token.startsWith(DASHD)) {
+ String candidate= null;
+ if (token.length() > 2) {
+ candidate= token.substring(2).trim();
+ }
+ else if (j+1 < tokens.length) {
+ candidate= tokens[j+1];
+ if (candidate.startsWith("-")) { //$NON-NLS-1$
+ candidate= null;
+ }
+ else {
+ j++;
+ }
+ }
+ if (candidate != null && candidate.length() > 0) {
+ if (candidate.indexOf('=') == -1) {
+ candidate+= '='+ getUtility().getDefaultMacroDefinitionValue();
+ }
+ if (!symbols.contains(candidate)) {
+ symbols.add(candidate);
+ }
+ }
+ }
+
+ else if (fileName == null) {
+ int extIndex = token.lastIndexOf('.');
+ String extension=null;
+
+ if(extIndex != -1)
+ extension = token.substring(extIndex);
+
+ List<String> extensions = getFileExtensionsList();
+ if(extension != null && extensions.contains(extension))
+ fileName = token;
+ }
+ }
+
+ if (fileName == null) {
+ return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
+ }
+
+ IProject project = getProject();
+ IFile file = null;
+ List<String> translatedIncludes = includes;
+ if (includes.size() > 0) {
+ if (fileName != null) {
+ if (getUtility() != null) {
+ file = getUtility().findFile(fileName);
+ if (file != null) {
+ project = file.getProject();
+ translatedIncludes = getUtility().translateRelativePaths(file, fileName, includes);
+ }
+ }
+ }
+ else {
+ StringBuffer line= new StringBuffer();
+ for (int j = 0; j < tokens.length; j++) {
+ line.append(tokens[j]);
+ line.append(' ');
+ }
+ final String error = MakeMessages.getString("ConsoleParser.Filename_Missing_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, line.toString());
+ if (getUtility() != null) {
+ getUtility().generateMarker(getProject(), -1, error + line.toString(), IMarkerGenerator.SEVERITY_WARNING, null);
+ }
+ }
+ if (file == null && getUtility() != null) { // real world case
+ // remove include paths since there was no chance to translate them
+ translatedIncludes.clear();
+ }
+ }
+ // Contribute discovered includes and symbols to the ScannerInfoCollector
+ if (translatedIncludes.size() > 0 || symbols.size() > 0) {
+ Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
+ scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludes);
+ scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions);
+ getCollector().contributeToScannerConfig(project, scannerInfo);
+ if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
+ try {
+ collector.updateScannerConfiguration(null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+
+ TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
+ "Include paths", includes, translatedIncludes, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return true;
+
+}
+
+
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java
index c1eaa1eb7a..1cc771126d 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XlCSpecsConsoleParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,11 +17,14 @@ import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.xlc.core.activator.Activator;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.cdt.core.IMarkerGenerator;
@@ -43,14 +46,22 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
// pattern for the includes arguments
final Pattern includePattern = Pattern
.compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
-
+
+ // xlC compiler constants
+ final static String [] compilerConstants = {
+ "__IBMCPP__", //$NON-NLS-1$
+ "__xlC__", //$NON-NLS-1$
+ "__IBMC__", //$NON-NLS-1$
+ "__xlc__" //$NON-NLS-1$
+ };
+
private IProject fProject = null;
private IScannerInfoCollector fCollector = null;
- private List symbols = new ArrayList();
+ private List<String> symbols = new ArrayList<String>();
- private List includes = new ArrayList();
+ private List<String> includes = new ArrayList<String>();
/*
* (non-Javadoc)
@@ -126,14 +137,31 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
* @since 1.0
*/
public void shutdown() {
- Map scannerInfo = new HashMap();
+ Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
+
+ // insert compiler constants, work around buggy xlC option for dumping symbols (it misses a few)
+ for (String constant : compilerConstants) {
+ if (!symbols.contains(constant))
+ symbols.add(constant);
+ }
+
+ // add the scanner info
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+
fCollector.contributeToScannerConfig(fProject, scannerInfo);
- TraceUtil
- .outputTrace(
+ if(fCollector != null && fCollector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector = (IScannerInfoCollector2) fCollector;
+ try {
+ collector.updateScannerConfiguration(null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ TraceUtil.outputTrace(
"Scanner info from \'specs\' file", //$NON-NLS-1$
- "Include paths", includes, new ArrayList(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
+ "Include paths", includes, new ArrayList<String>(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java
new file mode 100644
index 0000000000..f1bf2a7cca
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.make.xlc.core.scannerconfig.util;
+
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.SCDOptionsEnum;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Class that represents a XL C/C++ compiler command and related scanner configuration
+ */
+public class XLCCommandDSC extends CCommandDSC {
+
+ public XLCCommandDSC(boolean cppFileType) {
+ super(cppFileType);
+ }
+
+ public XLCCommandDSC(boolean cppFileType, IProject project) {
+ super(cppFileType, project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC#addSCOption(org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair)
+ */
+ @Override
+ public void addSCOption(KVStringPair option) {
+ if (project != null &&
+ (option.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.IQUOTE.toString())))
+ {
+ String value = option.getValue();
+ value = makeRelative(project, new Path(value)).toOSString();
+ option = new KVStringPair(option.getKey(), value);
+ }
+ compilerCommand.add(option);
+ }
+
+}
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.ui.prefs b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.ui.prefs
index 6d54498963..083396b5fc 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,6 +1,5 @@
-#Thu Oct 04 14:01:35 BRT 2007
+#Tue Sep 29 13:43:50 EDT 2009
eclipse.preferences.version=1
-formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
-formatter_settings_version=10
+formatter_settings_version=11
internal.default.compliance=default
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
index 625c844edc..37b503d103 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/plugin.xml
@@ -18,7 +18,7 @@
<!-- The ScannerInfoCollector manages the information generated by the Profile so that it can be easily accessed afterwards -->
<scannerInfoCollector
- class="org.eclipse.cdt.make.xlc.core.scannerconfig.DefaultXlCScannerInfoCollector"
+ class="org.eclipse.cdt.make.xlc.core.scannerconfig.PerFileXLCScannerInfoCollector"
scope="project">
</scannerInfoCollector>
@@ -55,7 +55,7 @@
<!-- The ScannerInfoCollector manages the information generated by the Profile so that it can be easily accessed afterwards -->
<scannerInfoCollector
- class="org.eclipse.cdt.make.xlc.core.scannerconfig.DefaultXlCScannerInfoCollector"
+ class="org.eclipse.cdt.make.xlc.core.scannerconfig.PerFileXLCScannerInfoCollector"
scope="project">
</scannerInfoCollector>

Back to the top