mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for PR 94500: [Path Entry] Problem marker: Invalid project path: DISCOVERED_SCANNER_INFO
Fix for infinite loop in LocationMap.createSoleLocation(..). Courtesy of John C.
This commit is contained in:
parent
540081b263
commit
51467c7d3c
14 changed files with 209 additions and 109 deletions
|
@ -42,26 +42,4 @@ public interface IScannerInfoCollector2 extends IScannerInfoCollector {
|
||||||
*/
|
*/
|
||||||
public IDiscoveredPathInfo createPathInfoObject();
|
public IDiscoveredPathInfo createPathInfoObject();
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Answers a map of collected defines that the the compiler uses by default.
|
|
||||||
// * The symbols are defined in the map as a (macro, value) pair as follows
|
|
||||||
// * <p><p><code>-DFOO</code> will be stored as ("FOO","")
|
|
||||||
// * <p><code>-DFOO=BAR</code> will be stored as ("FOO","BAR")
|
|
||||||
// * <p><p>Duplicates will not be stored in the map and any whitespaces in
|
|
||||||
// * the macro or value will be trimmed out.
|
|
||||||
// *
|
|
||||||
// * @return a <code>Map</code> of defined symbols and values
|
|
||||||
// */
|
|
||||||
// public Map getDefinedSymbols();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Answers a <code>List</code> of unique built-in includes paths that have been
|
|
||||||
// * collected for the receiver. The paths are stored as <code>String</code> in the proper
|
|
||||||
// * format for the host tools.
|
|
||||||
// *
|
|
||||||
// * @return a <code>List</code> of built-in compiler include search paths.
|
|
||||||
// */
|
|
||||||
// public List getIncludePaths();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,12 @@ package org.eclipse.cdt.make.core.scannerconfig;
|
||||||
*/
|
*/
|
||||||
public class ScannerInfoTypes {
|
public class ScannerInfoTypes {
|
||||||
public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
|
public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
|
||||||
public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(2);
|
public static final ScannerInfoTypes UNDISCOVERED_COMPILER_COMMAND = new ScannerInfoTypes(2); // CCommandDSC whose SI has not been resolved
|
||||||
public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(3);
|
public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(10);
|
||||||
public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(4);
|
public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(11);
|
||||||
public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(5) ;
|
public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(12);
|
||||||
public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(6);
|
public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(13) ;
|
||||||
|
public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(14);
|
||||||
|
|
||||||
private final int _enum;
|
private final int _enum;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
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.ScannerConfigProfileManager;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
|
@ -170,7 +171,8 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
||||||
if (changedResources != null) {
|
if (changedResources != null) {
|
||||||
List changeDelta = new ArrayList(changedResources.size());
|
List changeDelta = new ArrayList(changedResources.size());
|
||||||
for (Iterator i = changedResources.iterator(); i.hasNext(); ) {
|
for (Iterator i = changedResources.iterator(); i.hasNext(); ) {
|
||||||
IPath path = (IPath) i.next();
|
IFile file = (IFile) i.next();
|
||||||
|
IPath path = file.getFullPath();
|
||||||
changeDelta.add(new PathEntryContainerChanged(path, 3)); // both include paths and symbols changed
|
changeDelta.add(new PathEntryContainerChanged(path, 3)); // both include paths and symbols changed
|
||||||
}
|
}
|
||||||
CoreModel.pathEntryContainerUpdates(container,
|
CoreModel.pathEntryContainerUpdates(container,
|
||||||
|
|
|
@ -61,7 +61,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
||||||
bMultiline = false;
|
bMultiline = false;
|
||||||
sMultiline = ""; //$NON-NLS-1$
|
sMultiline = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
TraceUtil.outputTrace("AbstractGCCBOPConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
TraceUtil.outputTrace("AbstractGCCBOPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// make\[[0-9]*\]: error_desc
|
// make\[[0-9]*\]: error_desc
|
||||||
int firstColon= line.indexOf(':');
|
int firstColon= line.indexOf(':');
|
||||||
String make = line.substring(0, firstColon + 1);
|
String make = line.substring(0, firstColon + 1);
|
||||||
|
|
|
@ -123,18 +123,18 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
}
|
}
|
||||||
if (fUtil != null) {
|
if (fUtil != null) {
|
||||||
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
||||||
String longFileName = pFilePath.toString();
|
|
||||||
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
||||||
String genericLine = line.replaceAll(filePath, "LONG_NAME"); //$NON-NLS-1$
|
String genericLine = line.replaceAll(filePath, "LONG_NAME"); //$NON-NLS-1$
|
||||||
genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\."); //$NON-NLS-1$ //$NON-NLS-2$
|
genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine, extensionsIndex > 0);
|
CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine, extensionsIndex > 0);
|
||||||
List cmdList = new ArrayList();
|
|
||||||
cmdList.add(cmd);
|
|
||||||
Map sc = new HashMap(1);
|
|
||||||
sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
|
|
||||||
if (getProject().getLocation().isPrefixOf(pFilePath)) {
|
if (getProject().getLocation().isPrefixOf(pFilePath)) {
|
||||||
IPath relPath = pFilePath.removeFirstSegments(getProject().getLocation().segmentCount());
|
List cmdList = new ArrayList();
|
||||||
|
cmdList.add(cmd);
|
||||||
|
Map sc = new HashMap(1);
|
||||||
|
sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
|
||||||
|
|
||||||
|
IPath relPath = pFilePath.removeFirstSegments(getProject().getLocation().segmentCount());
|
||||||
IFile file = getProject().getFile(relPath);
|
IFile file = getProject().getFile(relPath);
|
||||||
getCollector().contributeToScannerConfig(file, sc);
|
getCollector().contributeToScannerConfig(file, sc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
||||||
private final static int QUOTE_INCLUDES = 1;
|
private final static int QUOTE_INCLUDES = 1;
|
||||||
private final static int INCLUDES = 2;
|
private final static int INCLUDES = 2;
|
||||||
|
|
||||||
private IProject fProject = null;
|
|
||||||
private IScannerInfoCollector fCollector = null;
|
private IScannerInfoCollector fCollector = null;
|
||||||
|
|
||||||
private int expectingIncludes = NO_INCLUDES;
|
private int expectingIncludes = NO_INCLUDES;
|
||||||
|
@ -52,7 +51,6 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
||||||
*/
|
*/
|
||||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||||
this.fProject = project;
|
|
||||||
this.fCollector = collector;
|
this.fCollector = collector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
||||||
*/
|
*/
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
|
||||||
if (line.startsWith(COMMAND_ID_BEGIN)) {
|
if (line.startsWith(COMMAND_ID_BEGIN)) {
|
||||||
commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
|
commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
*/
|
*/
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// contribution of -dD option
|
// contribution of -dD option
|
||||||
if (line.startsWith(DEFINE)) {
|
if (line.startsWith(DEFINE)) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TraceUtil {
|
||||||
|
|
||||||
public static void outputTrace(String prefix, String msg, String postfix) {
|
public static void outputTrace(String prefix, String msg, String postfix) {
|
||||||
if (isTracing()) {
|
if (isTracing()) {
|
||||||
System.out.println();
|
//System.out.println();
|
||||||
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class TraceUtil {
|
||||||
*/
|
*/
|
||||||
public static void outputTrace(String title, String subtitle1, List item1, List item1new, String subtitle2, List item2) {
|
public static void outputTrace(String title, String subtitle1, List item1, List item1new, String subtitle2, List item2) {
|
||||||
if (isTracing()) {
|
if (isTracing()) {
|
||||||
System.out.println();
|
//System.out.println();
|
||||||
System.out.println(title);
|
System.out.println(title);
|
||||||
final String prefix = " "; //$NON-NLS-1$
|
final String prefix = " "; //$NON-NLS-1$
|
||||||
final String doublePrefix = " "; //$NON-NLS-1$
|
final String doublePrefix = " "; //$NON-NLS-1$
|
||||||
|
|
|
@ -123,6 +123,7 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
IFile file = project.getFile(fileName);
|
IFile file = project.getFile(fileName);
|
||||||
addCompilerCommand(file, command);
|
addCompilerCommand(file, command);
|
||||||
}
|
}
|
||||||
|
applyFileDeltas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +150,9 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
|
|
||||||
private ScannerInfoData sid; // scanner info data
|
private ScannerInfoData sid; // scanner info data
|
||||||
|
|
||||||
private List siChangedForFileList; // list of files for which scanner info has changed
|
// private List siChangedForFileList; // list of files for which scanner info has changed
|
||||||
|
private Map siChangedForFileMap; // (file, comandId) map for deltas
|
||||||
|
private List siChangedForCommandIdList; // list of command ids for which scanner info has changed
|
||||||
|
|
||||||
private SortedSet freeCommandIdPool; // sorted set of free command ids
|
private SortedSet freeCommandIdPool; // sorted set of free command ids
|
||||||
private int commandIdCounter = 0;
|
private int commandIdCounter = 0;
|
||||||
|
@ -162,8 +165,10 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
public PerFileSICollector() {
|
public PerFileSICollector() {
|
||||||
sid = new ScannerInfoData();
|
sid = new ScannerInfoData();
|
||||||
|
|
||||||
siChangedForFileList = new ArrayList();
|
// siChangedForFileList = new ArrayList();
|
||||||
|
siChangedForFileMap = new HashMap();
|
||||||
|
siChangedForCommandIdList = new ArrayList();
|
||||||
|
|
||||||
freeCommandIdPool = new TreeSet();
|
freeCommandIdPool = new TreeSet();
|
||||||
siAvailable = false;
|
siAvailable = false;
|
||||||
}
|
}
|
||||||
|
@ -267,38 +272,103 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
cmd.setCommandId(commandId);
|
cmd.setCommandId(commandId);
|
||||||
sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
|
sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
|
||||||
}
|
}
|
||||||
Integer commandId = cmd.getCommandIdAsInteger();
|
|
||||||
// update sid.commandIdToFilesMap
|
generateFileDelta(file, cmd);
|
||||||
Set fileSet = (Set) sid.commandIdToFilesMap.get(commandId);
|
// updateFileForCommand(file, cmd);
|
||||||
if (fileSet == null) {
|
|
||||||
fileSet = new HashSet();
|
|
||||||
sid.commandIdToFilesMap.put(commandId, fileSet);
|
// Integer commandId = cmd.getCommandIdAsInteger();
|
||||||
}
|
// // update sid.commandIdToFilesMap
|
||||||
if (fileSet.add(file)) {
|
// Set fileSet = (Set) sid.commandIdToFilesMap.get(commandId);
|
||||||
// update fileToCommandIdsMap
|
// if (fileSet == null) {
|
||||||
boolean change = true;
|
// fileSet = new HashSet();
|
||||||
Integer oldCommandId = (Integer) sid.fileToCommandIdMap.get(file);
|
// sid.commandIdToFilesMap.put(commandId, fileSet);
|
||||||
if (oldCommandId != null) {
|
// }
|
||||||
if (oldCommandId.equals(commandId)) {
|
// if (fileSet.add(file)) {
|
||||||
change = false;
|
// // update fileToCommandIdsMap
|
||||||
}
|
// boolean change = true;
|
||||||
else {
|
// Integer oldCommandId = (Integer) sid.fileToCommandIdMap.get(file);
|
||||||
Set oldFileSet = (Set) sid.commandIdToFilesMap.get(oldCommandId);
|
// if (oldCommandId != null) {
|
||||||
oldFileSet.remove(file);
|
// if (oldCommandId.equals(commandId)) {
|
||||||
}
|
// change = false;
|
||||||
}
|
// }
|
||||||
if (change) {
|
// else {
|
||||||
sid.fileToCommandIdMap.put(file, commandId);
|
// Set oldFileSet = (Set) sid.commandIdToFilesMap.get(oldCommandId);
|
||||||
// TODO generate change event for this resource
|
// oldFileSet.remove(file);
|
||||||
IPath path = file.getFullPath();
|
// }
|
||||||
if (!siChangedForFileList.contains(path)) {
|
// }
|
||||||
siChangedForFileList.add(path);
|
// 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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeUnusedCommands() {
|
/**
|
||||||
|
* @param file
|
||||||
|
* @param cmd
|
||||||
|
*/
|
||||||
|
private void generateFileDelta(IFile file, CCommandDSC cmd) {
|
||||||
|
Integer commandId = cmd.getCommandIdAsInteger();
|
||||||
|
Integer oldCommandId = (Integer) 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param file
|
||||||
|
* @param cmd
|
||||||
|
*/
|
||||||
|
private void applyFileDeltas() {
|
||||||
|
for (Iterator i = siChangedForFileMap.keySet().iterator(); i.hasNext(); ) {
|
||||||
|
IFile file = (IFile) i.next();
|
||||||
|
Integer commandId = (Integer) siChangedForFileMap.get(file);
|
||||||
|
if (commandId != null) {
|
||||||
|
|
||||||
|
// update sid.commandIdToFilesMap
|
||||||
|
Set fileSet = (Set) sid.commandIdToFilesMap.get(commandId);
|
||||||
|
if (fileSet == null) {
|
||||||
|
fileSet = new HashSet();
|
||||||
|
sid.commandIdToFilesMap.put(commandId, fileSet);
|
||||||
|
}
|
||||||
|
if (fileSet.add(file)) {
|
||||||
|
// update fileToCommandIdsMap
|
||||||
|
boolean change = true;
|
||||||
|
Integer oldCommandId = (Integer) sid.fileToCommandIdMap.get(file);
|
||||||
|
if (oldCommandId != null) {
|
||||||
|
if (oldCommandId.equals(commandId)) {
|
||||||
|
change = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Set oldFileSet = (Set) sid.commandIdToFilesMap.get(oldCommandId);
|
||||||
|
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);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeUnusedCommands() {
|
||||||
for (Iterator i = sid.commandIdToFilesMap.entrySet().iterator(); i.hasNext(); ) {
|
for (Iterator i = sid.commandIdToFilesMap.entrySet().iterator(); i.hasNext(); ) {
|
||||||
Entry entry = (Entry) i.next();
|
Entry entry = (Entry) i.next();
|
||||||
Integer cmdId = (Integer) entry.getKey();
|
Integer cmdId = (Integer) entry.getKey();
|
||||||
|
@ -341,25 +411,29 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
|
||||||
removeUnusedCommands();
|
// removeUnusedCommands();
|
||||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
|
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
|
||||||
if (!siChangedForFileList.isEmpty()) {
|
if (scannerInfoChanged()) {
|
||||||
// MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project);
|
applyFileDeltas();
|
||||||
// DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, this);
|
removeUnusedCommands();
|
||||||
monitor.worked(50);
|
monitor.worked(50);
|
||||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
|
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
// update scanner configuration
|
// update scanner configuration
|
||||||
|
// MakeCorePlugin.getDefault().getDiscoveryManager().
|
||||||
|
// updateDiscoveredInfo(createPathInfoObject(), siChangedForFileList);
|
||||||
MakeCorePlugin.getDefault().getDiscoveryManager().
|
MakeCorePlugin.getDefault().getDiscoveryManager().
|
||||||
updateDiscoveredInfo(createPathInfoObject(), siChangedForFileList);
|
updateDiscoveredInfo(createPathInfoObject(), new ArrayList(siChangedForFileMap.keySet()));
|
||||||
// DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, this);
|
|
||||||
monitor.worked(50);
|
monitor.worked(50);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
siChangedForFileList.clear();
|
|
||||||
}
|
}
|
||||||
monitor.done();
|
// siChangedForFileList.clear();
|
||||||
|
siChangedForFileMap.clear();
|
||||||
|
siChangedForCommandIdList.clear();
|
||||||
|
|
||||||
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -369,11 +443,16 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
return new PerFileDiscoveredPathInfo();
|
return new PerFileDiscoveredPathInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean scannerInfoChanged() {
|
||||||
|
// return !siChangedForFileList.isEmpty();
|
||||||
|
return !siChangedForFileMap.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||||
*/
|
*/
|
||||||
public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||||
List rv = null;
|
List rv = new ArrayList();
|
||||||
// check the resource
|
// check the resource
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
|
@ -394,7 +473,6 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
}
|
}
|
||||||
else if (project.equals(((IResource)resource).getProject())) {
|
else if (project.equals(((IResource)resource).getProject())) {
|
||||||
if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
|
if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
|
||||||
rv = new ArrayList();
|
|
||||||
for (Iterator i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext(); ) {
|
for (Iterator i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext(); ) {
|
||||||
Integer cmdId = (Integer) i.next();
|
Integer cmdId = (Integer) i.next();
|
||||||
Set fileSet = (Set) sid.commandIdToFilesMap.get(cmdId);
|
Set fileSet = (Set) sid.commandIdToFilesMap.get(cmdId);
|
||||||
|
@ -403,6 +481,30 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (type.equals(ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND)) {
|
||||||
|
// if (!siChangedForFileList.isEmpty()) {
|
||||||
|
if (scannerInfoChanged()) {
|
||||||
|
if (siChangedForCommandIdList.isEmpty()) {
|
||||||
|
// for (Iterator i = siChangedForFileList.iterator(); i.hasNext(); ) {
|
||||||
|
for (Iterator i = siChangedForFileMap.keySet().iterator(); i.hasNext(); ) {
|
||||||
|
// IPath path = (IPath) i.next();
|
||||||
|
IFile file = (IFile) i.next();
|
||||||
|
Integer cmdId = (Integer) siChangedForFileMap.get(file);
|
||||||
|
if (cmdId != null) {
|
||||||
|
if (!siChangedForCommandIdList.contains(cmdId)) {
|
||||||
|
siChangedForCommandIdList.add(cmdId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(siChangedForCommandIdList);
|
||||||
|
for (Iterator i = siChangedForCommandIdList.iterator(); i.hasNext(); ) {
|
||||||
|
Integer cmdId = (Integer) i.next();
|
||||||
|
CCommandDSC command = (CCommandDSC) sid.commandIdCommandMap.get(cmdId);
|
||||||
|
rv.add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -444,17 +546,20 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
*/
|
*/
|
||||||
public void deleteAll(IResource resource) {
|
public void deleteAll(IResource resource) {
|
||||||
if (resource.equals(project)) {
|
if (resource.equals(project)) {
|
||||||
siChangedForFileList = new ArrayList();
|
// siChangedForFileList = new ArrayList();
|
||||||
|
siChangedForFileMap.clear();
|
||||||
Set changedFiles = sid.fileToCommandIdMap.keySet();
|
Set changedFiles = sid.fileToCommandIdMap.keySet();
|
||||||
for (Iterator i = changedFiles.iterator(); i.hasNext(); ) {
|
for (Iterator i = changedFiles.iterator(); i.hasNext(); ) {
|
||||||
IFile file = (IFile) i.next();
|
IFile file = (IFile) i.next();
|
||||||
IPath path = file.getFullPath();
|
// IPath path = file.getFullPath();
|
||||||
siChangedForFileList.add(path);
|
// siChangedForFileList.add(path);
|
||||||
|
siChangedForFileMap.put(file, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
sid = new ScannerInfoData();
|
sid = new ScannerInfoData();
|
||||||
|
|
||||||
freeCommandIdPool = new TreeSet();
|
commandIdCounter = 0;
|
||||||
|
freeCommandIdPool.clear();
|
||||||
siAvailable = false;
|
siAvailable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,23 +726,27 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
}
|
||||||
* @param path
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private CCommandDSC getCommand(IPath path) {
|
|
||||||
CCommandDSC cmd = null;
|
|
||||||
IFile file = project.getWorkspace().getRoot().getFile(path);
|
|
||||||
if (file != null) {
|
|
||||||
Integer cmdId = (Integer) sid.fileToCommandIdMap.get(file);
|
|
||||||
if (cmdId != null) {
|
|
||||||
// get the command
|
|
||||||
cmd = (CCommandDSC) sid.commandIdCommandMap.get(cmdId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private CCommandDSC getCommand(IPath path) {
|
||||||
|
IFile file = project.getWorkspace().getRoot().getFile(path);
|
||||||
|
return getCommand(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CCommandDSC getCommand(IFile file) {
|
||||||
|
CCommandDSC cmd = null;
|
||||||
|
if (file != null) {
|
||||||
|
Integer cmdId = (Integer) sid.fileToCommandIdMap.get(file);
|
||||||
|
if (cmdId != null) {
|
||||||
|
// get the command
|
||||||
|
cmd = (CCommandDSC) sid.commandIdCommandMap.get(cmdId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
||||||
if (collector instanceof IScannerInfoCollector2) {
|
if (collector instanceof IScannerInfoCollector2) {
|
||||||
IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
||||||
List commands = collector2.getCollectedScannerInfo(
|
List commands = collector2.getCollectedScannerInfo(
|
||||||
resource.getProject(), ScannerInfoTypes.COMPILER_COMMAND);
|
resource.getProject(), ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND);
|
||||||
if (commands != null && commands.size() > 0) {
|
if (commands != null && commands.size() > 0) {
|
||||||
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
|
@ -279,7 +279,9 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
}
|
}
|
||||||
getBuildInfo().save();
|
getBuildInfo().save();
|
||||||
if (isProfileDifferentThenPersisted()) {
|
if (isProfileDifferentThenPersisted()) {
|
||||||
changeDiscoveryContainer(project);
|
if (project != null) {
|
||||||
|
changeDiscoveryContainer(project);
|
||||||
|
}
|
||||||
updatePersistedProfile();
|
updatePersistedProfile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
2005-05-10 Vladimir Hirsl
|
||||||
|
Fix for PR 94500: [Path Entry] Problem marker: Invalid project path: DISCOVERED_SCANNER_INFO
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
|
||||||
|
|
||||||
|
Fix for infinite loop in LocationMap.createSoleLocation(..). Courtesy of John C.
|
||||||
|
|
||||||
|
* parser/org/eclipse/cdt/internal/core/parser/scanner2/LoactionMap.java
|
||||||
|
|
||||||
2005-05-02 Vladimir Hirsl
|
2005-05-02 Vladimir Hirsl
|
||||||
Fix for PR 92599: [Indexer] Remove annotation markers preference from DOMIndexer & friends
|
Fix for PR 92599: [Indexer] Remove annotation markers preference from DOMIndexer & friends
|
||||||
Removed indexer problem markers property page block for DOMIndexer.
|
Removed indexer problem markers property page block for DOMIndexer.
|
||||||
|
|
|
@ -424,7 +424,8 @@ public class PathEntryUtil {
|
||||||
boolean recurseInContainers) {
|
boolean recurseInContainers) {
|
||||||
IProject project = cProject.getProject();
|
IProject project = cProject.getProject();
|
||||||
IPath path = entry.getPath();
|
IPath path = entry.getPath();
|
||||||
if (entry.getEntryKind() != IPathEntry.CDT_PROJECT) {
|
if (entry.getEntryKind() != IPathEntry.CDT_PROJECT &&
|
||||||
|
entry.getEntryKind() != IPathEntry.CDT_CONTAINER) {
|
||||||
if (!isValidWorkspacePath(project, path)) {
|
if (!isValidWorkspacePath(project, path)) {
|
||||||
return new CModelStatus(
|
return new CModelStatus(
|
||||||
ICModelStatusConstants.INVALID_PATHENTRY,
|
ICModelStatusConstants.INVALID_PATHENTRY,
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
if (c.containsInDirective(offset, length)) {
|
if (c.containsInDirective(offset, length)) {
|
||||||
_CompositeContext parent = c.parent;
|
_CompositeContext parent = c.parent;
|
||||||
while (!(parent instanceof _CompositeFileContext))
|
while (!(parent instanceof _CompositeFileContext))
|
||||||
parent = c.parent;
|
parent = parent.parent;
|
||||||
_CompositeFileContext fc = (_CompositeFileContext) parent;
|
_CompositeFileContext fc = (_CompositeFileContext) parent;
|
||||||
return new FileLocation(fc.reader.filename, reconcileOffset(fc,
|
return new FileLocation(fc.reader.filename, reconcileOffset(fc,
|
||||||
c, offset), length);
|
c, offset), length);
|
||||||
|
@ -1758,7 +1758,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
{
|
{
|
||||||
_CompositeContext parent = c.parent;
|
_CompositeContext parent = c.parent;
|
||||||
while (!(parent instanceof _CompositeFileContext))
|
while (!(parent instanceof _CompositeFileContext))
|
||||||
parent = c.parent;
|
parent = parent.parent;
|
||||||
_CompositeFileContext fc = (_CompositeFileContext) parent;
|
_CompositeFileContext fc = (_CompositeFileContext) parent;
|
||||||
return new FileLocation(fc.reader.filename, reconcileOffset(fc,
|
return new FileLocation(fc.reader.filename, reconcileOffset(fc,
|
||||||
c, offset), length);
|
c, offset), length);
|
||||||
|
|
Loading…
Add table
Reference in a new issue