mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
- Files with empty scanner info are not indexed anymore. Info problem marker is created for each such file.
- Fix for resolving header file name for #include "..." preprocessor statements. - Fix for updating Discovered scanner info container when discovered scanner info changes.
This commit is contained in:
parent
90f44f3db4
commit
6f27d5a71c
7 changed files with 189 additions and 188 deletions
|
@ -1,85 +0,0 @@
|
||||||
/***********************************************************************
|
|
||||||
* Copyright (c) 2004 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.internal.core.scannerconfig;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
public abstract class AbstractDiscoveredPathContainer implements IPathEntryContainer {
|
|
||||||
public static final IPath CONTAINER_ID = new Path("org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
protected final IProject fProject;
|
|
||||||
|
|
||||||
public AbstractDiscoveredPathContainer(IProject project) {
|
|
||||||
fProject = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPathEntry[] getPathEntries() {
|
|
||||||
IPathEntry[] fPathEntries;
|
|
||||||
try {
|
|
||||||
fPathEntries = getPathEntries(getPathEntryMap(), fProject);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
MakeCorePlugin.log(e);
|
|
||||||
return new IPathEntry[0];
|
|
||||||
}
|
|
||||||
return fPathEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected Map getPathEntryMap();
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPath getPath() {
|
|
||||||
return CONTAINER_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IPathEntry[] getPathEntries(Map pathEntryMap, IProject project) throws CoreException {
|
|
||||||
IPathEntry[] entries = (IPathEntry[])pathEntryMap.get(project);
|
|
||||||
if (entries == null) {
|
|
||||||
entries = computeNewPathEntries(project);
|
|
||||||
pathEntryMap.put(project, entries);
|
|
||||||
}
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IPathEntry[] computeNewPathEntries(IProject project) throws CoreException {
|
|
||||||
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project);
|
|
||||||
IPath[] includes = info.getIncludePaths();
|
|
||||||
Map syms = info.getSymbols();
|
|
||||||
List entries = new ArrayList(includes.length + syms.size());
|
|
||||||
for (int i = 0; i < includes.length; i++) {
|
|
||||||
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, includes[i], true)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
|
||||||
Iterator iter = syms.entrySet().iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Entry entry = (Entry)iter.next();
|
|
||||||
entries.add(CoreModel.newMacroEntry(Path.EMPTY, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,53 +8,80 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig;
|
package org.eclipse.cdt.make.internal.core.scannerconfig;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
public class DiscoveredPathContainer extends AbstractDiscoveredPathContainer {
|
public class DiscoveredPathContainer implements IPathEntryContainer {
|
||||||
static Map fgPathEntries;
|
public static final IPath CONTAINER_ID = new Path("org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"); //$NON-NLS-1$
|
||||||
|
|
||||||
public DiscoveredPathContainer(IProject project) {
|
protected final IProject fProject;
|
||||||
super(project);
|
private IPathEntry[] fPathEntries;
|
||||||
initialize();
|
|
||||||
|
public DiscoveredPathContainer(IProject project) {
|
||||||
|
fProject = project;
|
||||||
|
fPathEntries = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initialize() {
|
// public IPathEntry[] getPathEntries() {
|
||||||
if (fgPathEntries == null) {
|
// IPathEntry[] fPathEntries;
|
||||||
fgPathEntries = new HashMap(10);
|
// try {
|
||||||
|
// fPathEntries = getPathEntries(getPathEntryMap());
|
||||||
|
// } catch (CoreException e) {
|
||||||
|
// MakeCorePlugin.log(e);
|
||||||
|
// return new IPathEntry[0];
|
||||||
|
// }
|
||||||
|
// return fPathEntries;
|
||||||
|
// }
|
||||||
|
|
||||||
IDiscoveredInfoListener listener = new IDiscoveredInfoListener() {
|
public String getDescription() {
|
||||||
|
return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
public void infoRemoved(IDiscoveredPathInfo info) {
|
public IPath getPath() {
|
||||||
if (info != null &&
|
return CONTAINER_ID;
|
||||||
info instanceof IPerProjectDiscoveredPathInfo) {
|
}
|
||||||
fgPathEntries.remove(info.getProject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void infoChanged(IDiscoveredPathInfo info) {
|
public IPathEntry[] getPathEntries() {
|
||||||
if (info != null &&
|
if (fPathEntries == null) {
|
||||||
info instanceof IPerProjectDiscoveredPathInfo) {
|
try {
|
||||||
fgPathEntries.remove(info.getProject());
|
fPathEntries = computeNewPathEntries();
|
||||||
}
|
}
|
||||||
}
|
catch (CoreException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
};
|
return new IPathEntry[0];
|
||||||
MakeCorePlugin.getDefault().getDiscoveryManager().addDiscoveredInfoListener(listener);
|
}
|
||||||
}
|
}
|
||||||
|
return fPathEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private IPathEntry[] computeNewPathEntries() throws CoreException {
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.AbstractDiscoveredPathContainer#getPathEntryMap()
|
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
|
||||||
*/
|
IPath[] includes = info.getIncludePaths();
|
||||||
protected Map getPathEntryMap() {
|
Map syms = info.getSymbols();
|
||||||
return fgPathEntries;
|
List entries = new ArrayList(includes.length + syms.size());
|
||||||
|
for (int i = 0; i < includes.length; i++) {
|
||||||
|
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, includes[i], true)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
Iterator iter = syms.entrySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Entry entry = (Entry)iter.next();
|
||||||
|
entries.add(CoreModel.newMacroEntry(Path.EMPTY, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig;
|
package org.eclipse.cdt.make.internal.core.scannerconfig;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -20,7 +19,6 @@ import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
|
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
|
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -28,39 +26,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContainer
|
public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
||||||
implements IPathEntryContainerExtension {
|
implements IPathEntryContainerExtension {
|
||||||
|
|
||||||
static Map fgPathEntries;
|
|
||||||
|
|
||||||
public PerFileDiscoveredPathContainer(IProject project) {
|
public PerFileDiscoveredPathContainer(IProject project) {
|
||||||
super(project);
|
super(project);
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initialize() {
|
|
||||||
if (fgPathEntries == null) {
|
|
||||||
fgPathEntries = new HashMap(10);
|
|
||||||
|
|
||||||
IDiscoveredInfoListener listener = new IDiscoveredInfoListener() {
|
|
||||||
|
|
||||||
public void infoRemoved(IDiscoveredPathInfo info) {
|
|
||||||
if (info != null &&
|
|
||||||
info instanceof IPerFileDiscoveredPathInfo) {
|
|
||||||
fgPathEntries.remove(info.getProject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void infoChanged(IDiscoveredPathInfo info) {
|
|
||||||
if (info != null &&
|
|
||||||
info instanceof IPerFileDiscoveredPathInfo) {
|
|
||||||
fgPathEntries.remove(info.getProject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
MakeCorePlugin.getDefault().getDiscoveryManager().addDiscoveredInfoListener(listener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -112,11 +82,4 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
|
||||||
return (IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]);
|
return (IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.AbstractDiscoveredPathContainer#getPathEntryMap()
|
|
||||||
*/
|
|
||||||
protected Map getPathEntryMap() {
|
|
||||||
return fgPathEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
2005-05-13 Vladimir Hirsl
|
||||||
|
Files with empty scanner info are not indexed anymore.
|
||||||
|
Info problem marker is created for each such file.
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java
|
||||||
|
* src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
|
||||||
|
|
||||||
|
Fix for resolving header file name for #include "..." preprocessor statements.
|
||||||
|
(Should use both local and system include paths)
|
||||||
|
* parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java
|
||||||
|
|
||||||
2005-05-12 Alain Magloire
|
2005-05-12 Alain Magloire
|
||||||
For the per file container, make sure we clean the project info.
|
For the per file container, make sure we clean the project info.
|
||||||
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
||||||
|
|
|
@ -34,6 +34,9 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit.IDependencyTree.IASTIncl
|
||||||
import org.eclipse.cdt.core.index.IIndexDelta;
|
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
|
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||||
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.cdt.core.parser.ParseError;
|
import org.eclipse.cdt.core.parser.ParseError;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
|
@ -76,15 +79,22 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void indexFile(IFile file) throws IOException {
|
protected void indexFile(IFile file) throws IOException {
|
||||||
// Add the name of the file to the index
|
|
||||||
output.addIndexedFile(file.getFullPath().toString());
|
|
||||||
|
|
||||||
int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
|
int problems = indexer.indexProblemsEnabled(resourceFile.getProject());
|
||||||
// enable inclusion problem markers
|
// enable inclusion problem markers
|
||||||
problems |= SourceIndexer.INCLUSION_PROBLEMS_BIT;
|
problems |= SourceIndexer.INCLUSION_PROBLEMS_BIT;
|
||||||
setProblemMarkersEnabled(problems);
|
setProblemMarkersEnabled(problems);
|
||||||
requestRemoveMarkers(resourceFile, null);
|
requestRemoveMarkers(resourceFile, null);
|
||||||
|
|
||||||
|
// do not index the file if there is no scanner info
|
||||||
|
if (isScannerInfoEmpty(resourceFile)) {
|
||||||
|
// generate info marker - file is not indexed
|
||||||
|
addInfoMarker(resourceFile, CCorePlugin.getResourceString("DOMIndexerMarker.EmptyScannerInfo")); //$NON-NLS-1$
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the name of the file to the index
|
||||||
|
output.addIndexedFile(file.getFullPath().toString());
|
||||||
|
|
||||||
//C or CPP?
|
//C or CPP?
|
||||||
ParserLanguage language = CoreModel.hasCCNature(resourceFile.getProject()) ?
|
ParserLanguage language = CoreModel.hasCCNature(resourceFile.getProject()) ?
|
||||||
ParserLanguage.CPP : ParserLanguage.C;
|
ParserLanguage.CPP : ParserLanguage.C;
|
||||||
|
@ -135,30 +145,30 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
throw (IOException) ex;
|
throw (IOException) ex;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (AbstractIndexer.TIMING) {
|
if (AbstractIndexer.TIMING) {
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
errorCount++;
|
errorCount++;
|
||||||
System.out.print(error + ':' + resourceFile.getName() + ':');
|
System.out.print(error + ':' + resourceFile.getName() + ':');
|
||||||
if (!errors.containsKey(error)) {
|
if (!errors.containsKey(error)) {
|
||||||
errors.put(error, new Integer(0));
|
errors.put(error, new Integer(0));
|
||||||
}
|
}
|
||||||
errors.put(error, new Integer(((Integer) errors.get(error)).intValue()+1));
|
errors.put(error, new Integer(((Integer) errors.get(error)).intValue()+1));
|
||||||
}
|
}
|
||||||
System.out.println("DOM Indexer - Total Parse Time for " + resourceFile.getName() + ": " + (parseTime - startTime)); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println("DOM Indexer - Total Parse Time for " + resourceFile.getName() + ": " + (parseTime - startTime)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
System.out.println("DOM Indexer - Total Visit Time for " + resourceFile.getName() + ": " + (endTime - parseTime)); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println("DOM Indexer - Total Visit Time for " + resourceFile.getName() + ": " + (endTime - parseTime)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
totalParseTime += parseTime - startTime;
|
totalParseTime += parseTime - startTime;
|
||||||
totalVisitTime += endTime - parseTime;
|
totalVisitTime += endTime - parseTime;
|
||||||
long currentTime = endTime - startTime;
|
long currentTime = endTime - startTime;
|
||||||
System.out.println("DOM Indexer - Total Index Time for " + resourceFile.getName() + ": " + currentTime); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println("DOM Indexer - Total Index Time for " + resourceFile.getName() + ": " + currentTime); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
long tempTotaltime = indexer.getTotalIndexTime() + currentTime;
|
long tempTotaltime = indexer.getTotalIndexTime() + currentTime;
|
||||||
indexer.setTotalIndexTime(tempTotaltime);
|
indexer.setTotalIndexTime(tempTotaltime);
|
||||||
System.out.println("DOM Indexer - Overall Index Time: " + tempTotaltime + "(" + totalParseTime + ", " + totalVisitTime + ") " + errorCount + " errors"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
System.out.println("DOM Indexer - Overall Index Time: " + tempTotaltime + "(" + totalParseTime + ", " + totalVisitTime + ") " + errorCount + " errors"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
}
|
}
|
||||||
if (AbstractIndexer.VERBOSE){
|
if (AbstractIndexer.VERBOSE){
|
||||||
AbstractIndexer.verbose("DOM AST TRAVERSAL FINISHED " + resourceFile.getName().toString()); //$NON-NLS-1$
|
AbstractIndexer.verbose("DOM AST TRAVERSAL FINISHED " + resourceFile.getName().toString()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// if the user disable problem reporting since we last checked, don't report the collected problems
|
// if the user disable problem reporting since we last checked, don't report the collected problems
|
||||||
if (areProblemMarkersEnabled()) {
|
if (areProblemMarkersEnabled()) {
|
||||||
reportProblems();
|
reportProblems();
|
||||||
|
@ -174,6 +184,46 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param IFile
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private boolean isScannerInfoEmpty(IFile file) {
|
||||||
|
boolean rc = true;
|
||||||
|
IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(file.getProject());
|
||||||
|
if (provider != null){
|
||||||
|
IScannerInfo scanInfo = provider.getScannerInformation(file);
|
||||||
|
if (scanInfo != null) {
|
||||||
|
if (!scanInfo.getDefinedSymbols().isEmpty() ||
|
||||||
|
scanInfo.getIncludePaths().length > 0) {
|
||||||
|
rc = false;
|
||||||
|
}
|
||||||
|
if (scanInfo instanceof IExtendedScannerInfo) {
|
||||||
|
IExtendedScannerInfo extScanInfo = (IExtendedScannerInfo) scanInfo;
|
||||||
|
if (extScanInfo.getLocalIncludePath().length > 0)
|
||||||
|
rc = false;
|
||||||
|
if (extScanInfo.getIncludeFiles().length > 0) {
|
||||||
|
rc = false;
|
||||||
|
for (int i = 0; i < extScanInfo.getIncludeFiles().length; i++) {
|
||||||
|
String includeFile = extScanInfo.getIncludeFiles()[i];
|
||||||
|
/* See if this file has been encountered before */
|
||||||
|
indexer.haveEncounteredHeader(resourceFile.getProject().getFullPath(), new Path(includeFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (extScanInfo.getMacroFiles().length > 0) {
|
||||||
|
rc = false;
|
||||||
|
for (int i = 0; i < extScanInfo.getIncludeFiles().length; i++) {
|
||||||
|
String macrosFile = extScanInfo.getMacroFiles()[i];
|
||||||
|
/* See if this file has been encountered before */
|
||||||
|
indexer.haveEncounteredHeader(resourceFile.getProject().getFullPath(), new Path(macrosFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tree
|
* @param tree
|
||||||
*/
|
*/
|
||||||
|
@ -364,6 +414,38 @@ public class DOMSourceIndexerRunner extends AbstractIndexer {
|
||||||
return (getProblemMarkersEnabled() & SourceIndexer.SEMANTIC_PROBLEMS_BIT) != 0;
|
return (getProblemMarkersEnabled() & SourceIndexer.SEMANTIC_PROBLEMS_BIT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param file
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void addInfoMarker(IFile file, String message) {
|
||||||
|
try {
|
||||||
|
IMarker[] markers = file.findMarkers(ICModelMarker.INDEXER_MARKER, true, IResource.DEPTH_ZERO);
|
||||||
|
|
||||||
|
boolean newProblem = true;
|
||||||
|
|
||||||
|
if (markers.length > 0) {
|
||||||
|
IMarker tempMarker = null;
|
||||||
|
String tempMsgString = null;
|
||||||
|
|
||||||
|
for (int i=0; i<markers.length; i++) {
|
||||||
|
tempMarker = markers[i];
|
||||||
|
tempMsgString = (String) tempMarker.getAttribute(IMarker.MESSAGE);
|
||||||
|
if (tempMsgString.equalsIgnoreCase( message )) {
|
||||||
|
newProblem = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newProblem){
|
||||||
|
IMarker marker = file.createMarker(ICModelMarker.INDEXER_MARKER);
|
||||||
|
marker.setAttribute(IMarker.MESSAGE, message);
|
||||||
|
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2865,8 +2865,11 @@ abstract class BaseScanner implements IScanner {
|
||||||
// current directory
|
// current directory
|
||||||
|
|
||||||
String [] includePathsToUse = stdIncludePaths;
|
String [] includePathsToUse = stdIncludePaths;
|
||||||
if( local && locIncludePaths != null && locIncludePaths.length > 0 )
|
if( local && locIncludePaths != null && locIncludePaths.length > 0 ) {
|
||||||
includePathsToUse = locIncludePaths;
|
includePathsToUse = new String[locIncludePaths.length + stdIncludePaths.length];
|
||||||
|
System.arraycopy(locIncludePaths, 0, includePathsToUse, 0, locIncludePaths.length);
|
||||||
|
System.arraycopy(stdIncludePaths, 0, includePathsToUse, locIncludePaths.length, stdIncludePaths.length);
|
||||||
|
}
|
||||||
|
|
||||||
if (includePathsToUse != null ) {
|
if (includePathsToUse != null ) {
|
||||||
int startpos = 0;
|
int startpos = 0;
|
||||||
|
|
|
@ -67,3 +67,4 @@ PathEntryVariableResolver.0=CDT PathEntry variable not specified
|
||||||
|
|
||||||
CTagsIndexMarker.fileMissing=CTags output file missing
|
CTagsIndexMarker.fileMissing=CTags output file missing
|
||||||
CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
|
CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
|
||||||
|
DOMIndexerMarker.EmptyScannerInfo=File not indexed because it was not built
|
||||||
|
|
Loading…
Add table
Reference in a new issue