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

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-09-04 22:45:37 -04:00
commit e7468a6b26
16 changed files with 152 additions and 208 deletions

View file

@ -1,3 +1,9 @@
2012-08-29 Jeff Johnston <jjohnstn@redhat.com>
Resolves: bug #381291
* plugin.xml: Add other types of binary parsers for Autotools target since it can apply to
non-ELF OSes.
2012-08-29 Jeff Johnston <jjohnstn@redhat.com> 2012-08-29 Jeff Johnston <jjohnstn@redhat.com>
Resolves: bug #388354 Resolves: bug #388354

View file

@ -379,7 +379,7 @@
</tool> </tool>
<targetPlatform <targetPlatform
archList="all" archList="all"
binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.PE;org.eclipse.cdt.core.Cygwin_PE"
id="org.eclipse.linuxtools.cdt.autotools.core.targetPlatform" id="org.eclipse.linuxtools.cdt.autotools.core.targetPlatform"
isAbstract="false" isAbstract="false"
name="%Autotools.targetplatform.name"/> name="%Autotools.targetplatform.name"/>

View file

@ -1,13 +1,13 @@
/******************************************************************************* ################################################################################
* Copyright (c) 2009, 2011 Red Hat, Inc. # Copyright (c) 2009, 2011, 2012 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html # http://www.eclipse.org/legal/epl-v10.html
* #
* Contributors: # Contributors:
* Red Hat Incorporated - initial API and implementation # Red Hat Incorporated - initial API and implementation
*******************************************************************************/ ################################################################################
Option.configure.configure=configure Option.configure.configure=configure
Option.configure.general=General Option.configure.general=General
Option.configure.builddir=Build directory Option.configure.builddir=Build directory

View file

@ -1,4 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?> <?xml version='1.0' encoding='utf-8' ?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc topic="CDT/Autotools/User_Guide/User-Guide.html" label="Autotools Plug-in User Guide"> <toc topic="CDT/Autotools/User_Guide/User-Guide.html" label="Autotools Plug-in User Guide">
<topic href="CDT/Autotools/User_Guide/User-Guide.html" label="Autotools Plug-in User Guide"> <topic href="CDT/Autotools/User_Guide/User-Guide.html" label="Autotools Plug-in User Guide">
<topic href="CDT/Autotools/User_Guide/User-Guide.html" label="Introduction"></topic> <topic href="CDT/Autotools/User_Guide/User-Guide.html" label="Introduction"></topic>

View file

@ -1,5 +1,5 @@
################################################################################# #################################################################################
# Copyright (c) 2006, 2008, 2009 Red Hat, Inc. # Copyright (c) 2006, 2008, 2009, 2012 Red Hat, Inc.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -60,85 +60,6 @@ ShowTooltip.description=Shows the tooltip description for the element at the cur
ACeditor.scope.name=Autoconf Editor ACeditor.scope.name=Autoconf Editor
ACeditor.scope.description=Editor for Autoconf Configuration Source Files ACeditor.scope.description=Editor for Autoconf Configuration Source Files
Tool.configure=configure
OptionCategory.configure.general=General
Option.configure.name=Name
Option.configure.builddir=Build directory
Option.configure.builddir.tip=Subdirectory off of project where build will occur
Option.configure.configdir=Configure tool directory
Option.configure.configdir.tip=Subdirectory off of project containing configure scripts
Option.configure.cache_file=Name of configuration cache file (--cache-file)
Option.configure.cache_file.tip=Specify the name of the configuration cache file [config.cache]
Option.configure.no_create=Turn off file creation <not advised> (--no-create)
Option.configure.no_create.tip=This tells configuration not to generate the output files as part of configuration
Option.configure.quiet=Turn off checking messages (--quiet)
Option.configure.quiet.tip=This turns off "checking ..." style messages from the configuration console output
Option.configure.help=Display help contents of top-level configuration (--help)
Option.configure.help.tip=Ask configuration file to display its help documentation
Option.configure.version=Display version of autotools used to create configuration (--version)
Option.configure.version.tip=This outputs the version of the Autotools used to create the configuration files
OptionCategory.configure.platform=Platform Specifiers
Option.configure.host=Host platform (--host)
Option.configure.host.tip=Platform that project will run on
Option.configure.target=Target platform (--target)
Option.configure.target.tip=Platform that project will target output for
Option.configure.build=Build platform (--build)
Option.configure.build.tip=Platform where project is being built
OptionCategory.configure.directories=Directory specifiers
Option.configure.prefix=Arch-independent install directory (--prefix)
Option.configure.prefix.tip=Place where architecture-independent files are installed [/usr/local]
Option.configure.exec_prefix=Arch-dependent install directory (--exec-prefix)
Option.configure.exec_prefix.tip=Place where architecture-dependent files are installed [PREFIX]
Option.configure.libdir=Object code library directory (--libdir)
Option.configure.libdir.tip=Place where object code libraries are installed [EPREFIX/lib]
Option.configure.bindir=User executable directory (--bindir)
Option.configure.bindir.tip=Place where binary executables are installed [EPREFIX/bin]
Option.configure.sbindir=System admin executable directory (--sbindir)
Option.configure.sbindir.tip=Place where system admin executables are installed [EPREFIX/sbin]
Option.configure.includedir=C Header file directory (--includdir)
Option.configure.includedir.tip=Place where header files will be installed [PREFIX/include]
Option.configure.datadir=Read-only architecture-independent data (--datadir)
Option.configure.datadir.tip=Place where read-only architecture-independent data is installed [PREFIX/share]
Option.configure.sysconfdir=Read-only single-machine data directory (--syconfdir)
Option.configure.sysconfdir.tip=Place where read-only single-machine data is stored [PREFIX/etc]
Option.configure.infodir=Info file documentation directory (--infodir)
Option.configure.infodir.tip=Place where info files are installed [PREFIX/info]
Option.configure.mandir=Man file documentation directory (--mandir)
Option.configure.mandir.tip=Place where man file documentation is installed [PREFIX/man]
Option.configure.srcdir=Sources directory (--srcdir)
Option.configure.srcdir.tip=Place where configure can find sources [configure directory or ..]
Option.configure.localstatedir=Modifiable single-machine data directory (--localstatedir)
Option.configure.localstatedir.tip=Place where modifiable single-machine data is installed [PREFIX/var]
Option.configure.sharedstatedir=Modifiable architecture-independent data directory (--sharedstatedir)
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com]
Option.configure.libexecdir=Program executable directory (--libexecdir)
Option.configure.libexecdir=Place where program executables will be installed [EPREFIX/libexec]
Option.configure.oldincludedir=Non-gcc C header file directory (--oldincludedir)
Option.configure.oldincludedir.tip=Place where non-gcc C header files are installed [/usr/include]
OptionCategory.configure.filenames=File-name transformations
Option.configure.program_prefix=Installed program prefix (--program-prefix)
Option.configure.program_prefix.tip=Prepend PREFIX to the beginning of installed program names
Option.configure.program_suffix=Installed program suffix (--program-suffix)
Option.configure.program_suffix.tip=Append SUFFIX to the end of installed program names
Option.configure.program_transform_name=Installed program name transform (--program-transform-name)
Option.configure.program_transform_name.tip=A sed string used to transform installed program names
OptionCategory.configure.features=Features and packages
Option.configure.enable_maintainer_mode=Enable maintainer mode (--enable-maintainer-mode)
Option.configure.enable_maintainer_mode.tip=Specify this to have Makefiles generated with checks for Autotool configuration file changes
Option.configure.user=User-specified configuration options
Option.configure.user.tip=Specify one or more configuration options (e.g. --enable-FEATURE, --disable-FEATURE, or --with-PACKAGE)
Tool.autogen = autogen.sh
OptionCategory.autogen.general=Options
Option.autogen.user=Command line options
Option.autogen.user.tip=Specify options to pass to the top-level autogen.sh script
RedHatVendor.name = Red Hat RedHatVendor.name = Red Hat
Bundle-Name.0 = Autotools UI Plug-in Bundle-Name.0 = Autotools UI Plug-in
provider=Eclipse CDT provider=Eclipse CDT

View file

@ -74,17 +74,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
public static enum UnusedHeaderStrategy { skip, useC, useCPP, useDefaultLanguage, useBoth } public static enum UnusedHeaderStrategy { skip, useC, useCPP, useDefaultLanguage, useBoth }
private static final int MAX_ERRORS = 500; private static final int MAX_ERRORS = 500;
// Order of constants is important. Stronger update types have to precede the weaker ones.
private static enum UpdateKind { REQUIRED_SOURCE, REQUIRED_HEADER, ONE_LINKAGE_HEADER, OTHER_HEADER } private static enum UpdateKind { REQUIRED_SOURCE, REQUIRED_HEADER, ONE_LINKAGE_HEADER, OTHER_HEADER }
private static class LinkageTask { private static class LinkageTask {
final int fLinkageID; final int fLinkageID;
private final Map<IIndexFileLocation, LocationTask> fLocationTasks; private final Map<IIndexFileLocation, LocationTask> fLocationTasks;
LinkageTask(int linkageID) { LinkageTask(int linkageID) {
fLinkageID= linkageID; fLinkageID= linkageID;
fLocationTasks= new HashMap<IIndexFileLocation, LocationTask>(); fLocationTasks= new HashMap<IIndexFileLocation, LocationTask>();
} }
boolean requestUpdate(IIndexFileLocation ifl, IIndexFragmentFile ifile, Object tu, boolean requestUpdate(IIndexFileLocation ifl, IIndexFragmentFile ifile, Object tu,
UpdateKind kind, Map<IIndexFileLocation, LocationTask> oneLinkageTasks) { UpdateKind kind, Map<IIndexFileLocation, LocationTask> oneLinkageTasks) {
LocationTask locTask= fLocationTasks.get(ifl); LocationTask locTask= fLocationTasks.get(ifl);
@ -93,11 +94,11 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fLocationTasks.put(ifl, locTask); fLocationTasks.put(ifl, locTask);
} }
boolean result = locTask.requestUpdate(ifile, tu, kind); boolean result = locTask.requestUpdate(ifile, tu, kind);
// Store one-linkage tasks. // Store one-linkage tasks.
if (kind == UpdateKind.ONE_LINKAGE_HEADER && locTask.fVersionTasks.isEmpty()) if (kind == UpdateKind.ONE_LINKAGE_HEADER && locTask.fVersionTasks.isEmpty())
oneLinkageTasks.put(ifl, locTask); oneLinkageTasks.put(ifl, locTask);
return result; return result;
} }
@ -119,9 +120,10 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
boolean requestUpdate(IIndexFragmentFile ifile, Object tu, UpdateKind kind) { boolean requestUpdate(IIndexFragmentFile ifile, Object tu, UpdateKind kind) {
if (tu != null) if (tu != null)
fTu= tu; fTu= tu;
if (kind != null) // Change fKind only if it becomes stronger as a result.
if (fKind == null || (kind != null && kind.compareTo(fKind) < 0))
fKind= kind; fKind= kind;
if (ifile == null) { if (ifile == null) {
assert fVersionTasks.isEmpty(); assert fVersionTasks.isEmpty();
final boolean countRequest= !fCountedUnknownVersion; final boolean countRequest= !fCountedUnknownVersion;
@ -137,7 +139,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
*/ */
private boolean addVersionTask(IIndexFragmentFile ifile) { private boolean addVersionTask(IIndexFragmentFile ifile) {
FileVersionTask fc= findVersion(ifile); FileVersionTask fc= findVersion(ifile);
if (fc != null) if (fc != null)
return false; return false;
fc= new FileVersionTask(ifile); fc= new FileVersionTask(ifile);
@ -163,7 +165,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
return countRequest; return countRequest;
} }
void removeVersionTask(Iterator<FileVersionTask> it) { void removeVersionTask(Iterator<FileVersionTask> it) {
if (fVersionTasks.size() == 1) { if (fVersionTasks.size() == 1) {
fVersionTasks= Collections.emptyList(); fVersionTasks= Collections.emptyList();
@ -195,7 +197,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
if (fKind == UpdateKind.OTHER_HEADER) if (fKind == UpdateKind.OTHER_HEADER)
return true; return true;
return fStoredAVersion; return fStoredAVersion;
} }
@ -215,12 +217,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fIndexFile= file; fIndexFile= file;
fOutdated= true; fOutdated= true;
} }
void setUpdated() { void setUpdated() {
fOutdated= false; fOutdated= false;
} }
} }
public static class IndexFileContent { public static class IndexFileContent {
private Object[] fPreprocessingDirectives; private Object[] fPreprocessingDirectives;
private ICPPUsingDirective[] fDirectives; private ICPPUsingDirective[] fDirectives;
@ -233,7 +235,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
public Object[] getPreprocessingDirectives() throws CoreException { public Object[] getPreprocessingDirectives() throws CoreException {
return fPreprocessingDirectives; return fPreprocessingDirectives;
} }
public ICPPUsingDirective[] getUsingDirectives() throws CoreException { public ICPPUsingDirective[] getUsingDirectives() throws CoreException {
return fDirectives; return fDirectives;
} }
@ -278,9 +280,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
} }
protected enum MessageKind { parsingFileTask, errorWhileParsing, tooManyIndexProblems } protected enum MessageKind { parsingFileTask, errorWhileParsing, tooManyIndexProblems }
private int fUpdateFlags= IIndexManager.UPDATE_ALL; private int fUpdateFlags= IIndexManager.UPDATE_ALL;
private UnusedHeaderStrategy fIndexHeadersWithoutContext= UnusedHeaderStrategy.useDefaultLanguage; private UnusedHeaderStrategy fIndexHeadersWithoutContext= UnusedHeaderStrategy.useDefaultLanguage;
private boolean fIndexFilesWithoutConfiguration= true; private boolean fIndexFilesWithoutConfiguration= true;
@ -288,12 +290,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private Map<IIndexFile, IndexFileContent> fIndexContentCache= new LRUCache<IIndexFile, IndexFileContent>(500); private Map<IIndexFile, IndexFileContent> fIndexContentCache= new LRUCache<IIndexFile, IndexFileContent>(500);
private Map<IIndexFileLocation, IIndexFragmentFile[]> fIndexFilesCache= new LRUCache<IIndexFileLocation, IIndexFragmentFile[]>(5000); private Map<IIndexFileLocation, IIndexFragmentFile[]> fIndexFilesCache= new LRUCache<IIndexFileLocation, IIndexFragmentFile[]>(5000);
private Map<IIndexFileLocation, LocationTask> fOneLinkageTasks= new HashMap<IIndexFileLocation, AbstractIndexerTask.LocationTask>(); private Map<IIndexFileLocation, LocationTask> fOneLinkageTasks= new HashMap<IIndexFileLocation, AbstractIndexerTask.LocationTask>();
private Object[] fFilesToUpdate; private Object[] fFilesToUpdate;
private List<Object> fFilesToRemove = new ArrayList<Object>(); private List<Object> fFilesToRemove = new ArrayList<Object>();
private int fASTOptions; private int fASTOptions;
private int fForceNumberFiles= 0; private int fForceNumberFiles= 0;
protected IWritableIndex fIndex; protected IWritableIndex fIndex;
private ITodoTaskUpdater fTodoTaskUpdater; private ITodoTaskUpdater fTodoTaskUpdater;
private final boolean fIsFastIndexer; private final boolean fIsFastIndexer;
@ -302,7 +304,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private int fSwallowOutOfMemoryError= 5; private int fSwallowOutOfMemoryError= 5;
/** /**
* A queue of urgent indexing tasks that contribute additional files to this task. * A queue of urgent indexing tasks that contribute additional files to this task.
* The files from the urgent tasks are indexed before all not yet processed files. * The files from the urgent tasks are indexed before all not yet processed files.
*/ */
private final LinkedList<AbstractIndexerTask> fUrgentTasks; private final LinkedList<AbstractIndexerTask> fUrgentTasks;
boolean fTaskCompleted; boolean fTaskCompleted;
@ -317,7 +319,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
incrementRequestedFilesCount(fFilesToUpdate.length + fFilesToRemove.size()); incrementRequestedFilesCount(fFilesToUpdate.length + fFilesToRemove.size());
fUrgentTasks = new LinkedList<AbstractIndexerTask>(); fUrgentTasks = new LinkedList<AbstractIndexerTask>();
} }
public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) { public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) {
fIndexHeadersWithoutContext= mode; fIndexHeadersWithoutContext= mode;
} }
@ -353,7 +355,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (!(urgentTask instanceof AbstractIndexerTask)) { if (!(urgentTask instanceof AbstractIndexerTask)) {
return false; return false;
} }
AbstractIndexerTask task = (AbstractIndexerTask) urgentTask; AbstractIndexerTask task = (AbstractIndexerTask) urgentTask;
if (task.fIsFastIndexer != fIsFastIndexer || if (task.fIsFastIndexer != fIsFastIndexer ||
task.fIndexFilesWithoutConfiguration != fIndexFilesWithoutConfiguration || task.fIndexFilesWithoutConfiguration != fIndexFilesWithoutConfiguration ||
(fIndexFilesWithoutConfiguration && task.fIndexHeadersWithoutContext != fIndexHeadersWithoutContext) || (fIndexFilesWithoutConfiguration && task.fIndexHeadersWithoutContext != fIndexHeadersWithoutContext) ||
@ -369,7 +371,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fUrgentTasks.add(task); fUrgentTasks.add(task);
return true; return true;
} }
private synchronized boolean hasUrgentTasks() { private synchronized boolean hasUrgentTasks() {
return !fUrgentTasks.isEmpty(); return !fUrgentTasks.isEmpty();
} }
@ -389,7 +391,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
protected ITodoTaskUpdater createTodoTaskUpdater() { protected ITodoTaskUpdater createTodoTaskUpdater() {
return null; return null;
} }
/** /**
* @return array of linkage IDs that shall be parsed * @return array of linkage IDs that shall be parsed
*/ */
@ -443,7 +445,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fInfo.fCompletedHeaders += header; fInfo.fCompletedHeaders += header;
} }
} }
private final void reportFile(boolean wasCounted, UpdateKind kind) { private final void reportFile(boolean wasCounted, UpdateKind kind) {
if (wasCounted) { if (wasCounted) {
if (kind == UpdateKind.REQUIRED_SOURCE) { if (kind == UpdateKind.REQUIRED_SOURCE) {
@ -470,13 +472,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (!fIndexFilesWithoutConfiguration) { if (!fIndexFilesWithoutConfiguration) {
fIndexHeadersWithoutContext= UnusedHeaderStrategy.skip; fIndexHeadersWithoutContext= UnusedHeaderStrategy.skip;
} }
fIndex= createIndex(); fIndex= createIndex();
if (fIndex == null) { if (fIndex == null) {
return; return;
} }
fTodoTaskUpdater= createTodoTaskUpdater(); fTodoTaskUpdater= createTodoTaskUpdater();
fASTOptions= ILanguage.OPTION_NO_IMAGE_LOCATIONS fASTOptions= ILanguage.OPTION_NO_IMAGE_LOCATIONS
| ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS; | ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS;
if (getSkipReferences() == SKIP_ALL_REFERENCES) { if (getSkipReferences() == SKIP_ALL_REFERENCES) {
@ -485,16 +487,16 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fIndex.resetCacheCounters(); fIndex.resetCacheCounters();
fIndex.acquireReadLock(); fIndex.acquireReadLock();
try { try {
try { try {
// Split into sources and headers, remove excluded sources. // Split into sources and headers, remove excluded sources.
HashMap<Integer, List<IIndexFileLocation>> files= new HashMap<Integer, List<IIndexFileLocation>>(); HashMap<Integer, List<IIndexFileLocation>> files= new HashMap<Integer, List<IIndexFileLocation>>();
final ArrayList<IIndexFragmentFile> indexFilesToRemove= new ArrayList<IIndexFragmentFile>(); final ArrayList<IIndexFragmentFile> indexFilesToRemove= new ArrayList<IIndexFragmentFile>();
extractFiles(files, indexFilesToRemove, monitor); extractFiles(files, indexFilesToRemove, monitor);
setResume(true); setResume(true);
// Remove files from index // Remove files from index
removeFilesInIndex(fFilesToRemove, indexFilesToRemove, monitor); removeFilesInIndex(fFilesToRemove, indexFilesToRemove, monitor);
@ -540,7 +542,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} else { } else {
list.addAll(0, entry.getValue()); list.addAll(0, entry.getValue());
} }
} }
} }
// Extract files from the urgent task. // Extract files from the urgent task.
files = new HashMap<Integer, List<IIndexFileLocation>>(); files = new HashMap<Integer, List<IIndexFileLocation>>();
@ -573,7 +575,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private void setResume(boolean value) throws InterruptedException, CoreException { private void setResume(boolean value) throws InterruptedException, CoreException {
fIndex.acquireWriteLock(); fIndex.acquireWriteLock();
try { try {
fIndex.getWritableFragment().setProperty(IIndexFragment.PROPERTY_RESUME_INDEXER, String.valueOf(value)); fIndex.getWritableFragment().setProperty(IIndexFragment.PROPERTY_RESUME_INDEXER, String.valueOf(value));
} finally { } finally {
fIndex.releaseWriteLock(); fIndex.releaseWriteLock();
} }
@ -597,7 +599,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final IIndexFileLocation ifl= fResolver.resolveFile(tu); final IIndexFileLocation ifl= fResolver.resolveFile(tu);
if (ifl == null) if (ifl == null)
continue; continue;
final IIndexFragmentFile[] indexFiles= fIndex.getWritableFiles(ifl); final IIndexFragmentFile[] indexFiles= fIndex.getWritableFiles(ifl);
final boolean isSourceUnit= fResolver.isSourceUnit(tu); final boolean isSourceUnit= fResolver.isSourceUnit(tu);
linkages.clear(); linkages.clear();
@ -605,7 +607,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final boolean indexedUnconditionally = fResolver.isIndexedUnconditionally(ifl); final boolean indexedUnconditionally = fResolver.isIndexedUnconditionally(ifl);
if (regularContent || indexedUnconditionally) { if (regularContent || indexedUnconditionally) {
// Headers or sources required with a specific linkage // Headers or sources required with a specific linkage
final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE
: regularContent && both ? UpdateKind.REQUIRED_HEADER : UpdateKind.ONE_LINKAGE_HEADER; : regularContent && both ? UpdateKind.REQUIRED_HEADER : UpdateKind.ONE_LINKAGE_HEADER;
if (regularContent || indexFiles.length == 0) { if (regularContent || indexFiles.length == 0) {
AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext); AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext);
@ -633,12 +635,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
} }
// Handle other files present in index. // Handle other files present in index.
for (IIndexFragmentFile ifile : indexFiles) { for (IIndexFragmentFile ifile : indexFiles) {
if (ifile != null) { if (ifile != null) {
IIndexInclude ctx= ifile.getParsedInContext(); IIndexInclude ctx= ifile.getParsedInContext();
if (ctx == null && !indexedUnconditionally) { if (ctx == null && !indexedUnconditionally && ifile.hasContent()) {
iFilesToRemove.add(ifile); iFilesToRemove.add(ifile);
count++; count++;
} else { } else {
@ -674,13 +676,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private boolean isRequiredInIndex(Object tu, IIndexFileLocation ifl, boolean isSourceUnit) { private boolean isRequiredInIndex(Object tu, IIndexFileLocation ifl, boolean isSourceUnit) {
// External files are never required // External files are never required
if (fResolver.isIndexedOnlyIfIncluded(tu)) if (fResolver.isIndexedOnlyIfIncluded(tu))
return false; return false;
// User preference to require all // User preference to require all
if (fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip) if (fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip)
return true; return true;
// Source file // Source file
if (isSourceUnit) { if (isSourceUnit) {
if (fIndexFilesWithoutConfiguration || fResolver.isFileBuildConfigured(tu)) if (fIndexFilesWithoutConfiguration || fResolver.isFileBuildConfigured(tu))
@ -692,7 +694,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private boolean isModified(boolean checkTimestamps, boolean checkFileContentsHash, IIndexFileLocation ifl, private boolean isModified(boolean checkTimestamps, boolean checkFileContentsHash, IIndexFileLocation ifl,
Object tu, IIndexFragmentFile file) throws CoreException { Object tu, IIndexFragmentFile file) throws CoreException {
if (checkTimestamps) { if (checkTimestamps) {
if (fResolver.getLastModified(ifl) != file.getTimestamp() || if (fResolver.getLastModified(ifl) != file.getTimestamp() ||
computeFileSizeAndEncodingHashcode(ifl) != file.getSizeAndEncodingHashcode()) { computeFileSizeAndEncodingHashcode(ifl) != file.getSizeAndEncodingHashcode()) {
if (checkFileContentsHash && computeFileContentsHash(tu) == file.getContentsHash()) { if (checkFileContentsHash && computeFileContentsHash(tu) == file.getContentsHash()) {
return false; return false;
@ -712,7 +714,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
LinkageTask fileMap= createRequestMap(linkageID); LinkageTask fileMap= createRequestMap(linkageID);
return fileMap.requestUpdate(ifl, ifile, tu, kind, fOneLinkageTasks); return fileMap.requestUpdate(ifl, ifile, tu, kind, fOneLinkageTasks);
} }
private LinkageTask createRequestMap(int linkageID) { private LinkageTask createRequestMap(int linkageID) {
LinkageTask map= findRequestMap(linkageID); LinkageTask map= findRequestMap(linkageID);
if (map == null) { if (map == null) {
@ -729,7 +731,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
return null; return null;
} }
@Override @Override
protected void reportFileWrittenToIndex(FileInAST file, IIndexFragmentFile ifile) throws CoreException { protected void reportFileWrittenToIndex(FileInAST file, IIndexFragmentFile ifile) throws CoreException {
final FileContentKey fck = file.fileContentKey; final FileContentKey fck = file.fileContentKey;
@ -756,7 +758,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
fIndexContentCache.remove(ifile); fIndexContentCache.remove(ifile);
fIndexFilesCache.remove(file.fileContentKey.getLocation()); fIndexFilesCache.remove(file.fileContentKey.getLocation());
LocationTask task= fOneLinkageTasks.remove(location); LocationTask task= fOneLinkageTasks.remove(location);
if (task != null && task != locTask) { if (task != null && task != locTask) {
if (task.fKind == UpdateKind.ONE_LINKAGE_HEADER && !task.isCompleted()) { if (task.fKind == UpdateKind.ONE_LINKAGE_HEADER && !task.isCompleted()) {
@ -805,13 +807,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
filesToRemove.clear(); filesToRemove.clear();
} }
private void parseLinkage(int linkageID, List<IIndexFileLocation> files, IProgressMonitor monitor) private void parseLinkage(int linkageID, List<IIndexFileLocation> files, IProgressMonitor monitor)
throws CoreException, InterruptedException { throws CoreException, InterruptedException {
LinkageTask map = findRequestMap(linkageID); LinkageTask map = findRequestMap(linkageID);
if (map == null || files == null || files.isEmpty()) if (map == null || files == null || files.isEmpty())
return; return;
// First parse the required sources // First parse the required sources
for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) { for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) {
IIndexFileLocation ifl= it.next(); IIndexFileLocation ifl= it.next();
@ -826,7 +828,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor); parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor);
} }
} }
// Files with context // Files with context
for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) { for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) {
IIndexFileLocation ifl= it.next(); IIndexFileLocation ifl= it.next();
@ -844,7 +846,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
} }
// Files without context // Files without context
for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) { for (Iterator<IIndexFileLocation> it= files.iterator(); it.hasNext();) {
IIndexFileLocation ifl= it.next(); IIndexFileLocation ifl= it.next();
@ -860,7 +862,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor); parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor);
if (locTask.isCompleted()) if (locTask.isCompleted())
it.remove(); it.remove();
} }
} }
} }
@ -874,7 +876,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (!locTask.needsVersion()) { if (!locTask.needsVersion()) {
if (monitor.isCanceled() || hasUrgentTasks()) if (monitor.isCanceled() || hasUrgentTasks())
return; return;
Iterator<FileVersionTask> it= locTask.fVersionTasks.iterator(); Iterator<FileVersionTask> it= locTask.fVersionTasks.iterator();
while (it.hasNext()) { while (it.hasNext()) {
FileVersionTask v = it.next(); FileVersionTask v = it.next();
if (v.fOutdated) { if (v.fOutdated) {
@ -897,18 +899,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final FileVersionTask versionTask, Object tu, LinkedHashSet<IIndexFile> safeGuard, final FileVersionTask versionTask, Object tu, LinkedHashSet<IIndexFile> safeGuard,
IProgressMonitor monitor) throws CoreException, InterruptedException { IProgressMonitor monitor) throws CoreException, InterruptedException {
final IIndexFragmentFile headerFile = versionTask.fIndexFile; final IIndexFragmentFile headerFile = versionTask.fIndexFile;
final int safeguardSize= safeGuard.size(); final int safeguardSize= safeGuard.size();
for(;;) { while (true) {
// Look for a context and parse the file // Look for a context and parse the file
IIndexFragmentFile ctxFile = findContextFile(linkageID, map, versionTask, safeGuard, monitor); IIndexFragmentFile ctxFile = findContextFile(linkageID, map, versionTask, safeGuard, monitor);
if (ctxFile == null || ctxFile == headerFile) if (ctxFile == null || ctxFile == headerFile)
return; return;
Object contextTu= fResolver.getInputFile(ctxFile.getLocation()); Object contextTu= fResolver.getInputFile(ctxFile.getLocation());
if (contextTu == null) if (contextTu == null)
return; return;
final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu); final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu);
final AbstractLanguage language = getLanguage(contextTu, linkageID); final AbstractLanguage language = getLanguage(contextTu, linkageID);
final FileContext ctx= new FileContext(ctxFile, headerFile); final FileContext ctx= new FileContext(ctxFile, headerFile);
@ -926,14 +928,14 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null) if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null)
done= false; done= false;
} }
} }
} }
if (!ctx.fLostPragmaOnceSemantics) if (!ctx.fLostPragmaOnceSemantics)
return; return;
// Try the next context // Try the next context
restoreSet(safeGuard, safeguardSize); restoreSet(safeGuard, safeguardSize);
} }
} }
private void restoreSet(LinkedHashSet<?> set, int restoreSize) { private void restoreSet(LinkedHashSet<?> set, int restoreSize) {
@ -943,7 +945,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
it.remove(); it.remove();
} else { } else {
restoreSize--; restoreSize--;
} }
} }
} }
@ -951,19 +953,19 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final FileVersionTask versionTask, LinkedHashSet<IIndexFile> safeGuard, IProgressMonitor monitor) final FileVersionTask versionTask, LinkedHashSet<IIndexFile> safeGuard, IProgressMonitor monitor)
throws CoreException, InterruptedException { throws CoreException, InterruptedException {
IIndexFragmentFile ctxFile= versionTask.fIndexFile; IIndexFragmentFile ctxFile= versionTask.fIndexFile;
for(;;) { while (true) {
IIndexInclude ctxInclude= ctxFile.getParsedInContext(); IIndexInclude ctxInclude= ctxFile.getParsedInContext();
if (ctxInclude == null) if (ctxInclude == null)
return ctxFile; return ctxFile;
IIndexFragmentFile nextCtx= (IIndexFragmentFile) ctxInclude.getIncludedBy(); IIndexFragmentFile nextCtx= (IIndexFragmentFile) ctxInclude.getIncludedBy();
if (nextCtx == null) if (nextCtx == null)
return nextCtx; return nextCtx;
// Found a recursion // Found a recursion.
if (!safeGuard.add(nextCtx)) if (!safeGuard.add(nextCtx))
return null; return null;
final IIndexFileLocation ctxIfl = nextCtx.getLocation(); final IIndexFileLocation ctxIfl = nextCtx.getLocation();
LocationTask ctxTask= map.find(ctxIfl); LocationTask ctxTask= map.find(ctxIfl);
if (ctxTask != null) { if (ctxTask != null) {
@ -984,7 +986,6 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
private DependsOnOutdatedFileException parseFile(Object tu, AbstractLanguage lang, private DependsOnOutdatedFileException parseFile(Object tu, AbstractLanguage lang,
IIndexFileLocation ifl, IScannerInfo scanInfo, FileContext ctx, IProgressMonitor pm) IIndexFileLocation ifl, IScannerInfo scanInfo, FileContext ctx, IProgressMonitor pm)
throws CoreException, InterruptedException { throws CoreException, InterruptedException {
@ -1035,7 +1036,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
return null; return null;
} }
private IPath getLabel(IIndexFileLocation ifl) { private IPath getLabel(IIndexFileLocation ifl) {
String fullPath= ifl.getFullPath(); String fullPath= ifl.getFullPath();
if (fullPath != null) { if (fullPath != null) {
@ -1061,7 +1062,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin())) if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin()))
throw (CoreException) e; throw (CoreException) e;
} }
// mask errors in order to avoid dialog from platform // mask errors in order to avoid dialog from platform
Throwable exception = s.getException(); Throwable exception = s.getException();
if (exception != null) { if (exception != null) {
@ -1070,7 +1071,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
e= masked; e= masked;
exception= null; exception= null;
} }
} }
if (exception == null) { if (exception == null) {
s= new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e); s= new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e);
} }
@ -1102,7 +1103,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) { if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) {
if (fShowActivity) { if (fShowActivity) {
trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$ trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$
} }
return null; return null;
} }
@ -1124,7 +1125,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
ibfcp.setContextToHeaderGap(ctx2header); ibfcp.setContextToHeaderGap(ctx2header);
ibfcp.setLinkage(language.getLinkageID()); ibfcp.setLinkage(language.getLinkageID());
} }
IASTTranslationUnit ast= language.getASTTranslationUnit(codeReader, scanInfo, fCodeReaderFactory, IASTTranslationUnit ast= language.getASTTranslationUnit(codeReader, scanInfo, fCodeReaderFactory,
fIndex, options, getLogService()); fIndex, options, getLogService());
if (pm.isCanceled()) { if (pm.isCanceled()) {
@ -1137,7 +1138,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final IncludeFileContentProvider fileContentProvider = createReaderFactory(); final IncludeFileContentProvider fileContentProvider = createReaderFactory();
if (fileContentProvider instanceof InternalFileContentProvider) if (fileContentProvider instanceof InternalFileContentProvider)
return (InternalFileContentProvider) fileContentProvider; return (InternalFileContentProvider) fileContentProvider;
throw new IllegalArgumentException("Invalid file content provider"); //$NON-NLS-1$ throw new IllegalArgumentException("Invalid file content provider"); //$NON-NLS-1$
} }
@ -1145,7 +1146,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException { FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException {
HashSet<FileContentKey> enteredFiles= new HashSet<FileContentKey>(); HashSet<FileContentKey> enteredFiles= new HashSet<FileContentKey>();
ArrayList<FileInAST> orderedFileKeys= new ArrayList<FileInAST>(); ArrayList<FileInAST> orderedFileKeys= new ArrayList<FileInAST>();
final IIndexFileLocation topIfl = fResolver.resolveASTPath(ast.getFilePath()); final IIndexFileLocation topIfl = fResolver.resolveASTPath(ast.getFilePath());
FileContentKey topKey = new FileContentKey(linkageID, topIfl, ast.getSignificantMacros()); FileContentKey topKey = new FileContentKey(linkageID, topIfl, ast.getSignificantMacros());
enteredFiles.add(topKey); enteredFiles.add(topKey);
@ -1154,7 +1155,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
for (IASTInclusionNode inclusion : inclusions) { for (IASTInclusionNode inclusion : inclusions) {
collectOrderedFileKeys(linkageID, inclusion, enteredFiles, orderedFileKeys); collectOrderedFileKeys(linkageID, inclusion, enteredFiles, orderedFileKeys);
} }
IIndexFragmentFile newFile= selectIndexFile(linkageID, topIfl, ast.getSignificantMacros()); IIndexFragmentFile newFile= selectIndexFile(linkageID, topIfl, ast.getSignificantMacros());
if (ctx != null) { if (ctx != null) {
orderedFileKeys.add(new FileInAST(topKey, codeReader)); orderedFileKeys.add(new FileInAST(topKey, codeReader));
@ -1163,7 +1164,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} else if (newFile == null) { } else if (newFile == null) {
orderedFileKeys.add(new FileInAST(topKey, codeReader)); orderedFileKeys.add(new FileInAST(topKey, codeReader));
} }
FileInAST[] fileKeys= orderedFileKeys.toArray(new FileInAST[orderedFileKeys.size()]); FileInAST[] fileKeys= orderedFileKeys.toArray(new FileInAST[orderedFileKeys.size()]);
try { try {
addSymbols(ast, fileKeys, fIndex, false, ctx, fTodoTaskUpdater, pm); addSymbols(ast, fileKeys, fIndex, false, ctx, fTodoTaskUpdater, pm);
@ -1237,7 +1238,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
return fc; return fc;
} }
IIndexFragmentFile selectIndexFile(int linkageID, IIndexFileLocation ifl, ISignificantMacros sigMacros) throws CoreException { IIndexFragmentFile selectIndexFile(int linkageID, IIndexFileLocation ifl, ISignificantMacros sigMacros) throws CoreException {
LinkageTask map = findRequestMap(linkageID); LinkageTask map = findRequestMap(linkageID);
if (map != null) { if (map != null) {
@ -1249,7 +1250,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
} }
IIndexFragmentFile[] files = getAvailableIndexFiles(linkageID, ifl); IIndexFragmentFile[] files = getAvailableIndexFiles(linkageID, ifl);
for (IIndexFragmentFile file : files) { for (IIndexFragmentFile file : files) {
if (sigMacros.equals(file.getSignificantMacros())) if (sigMacros.equals(file.getSignificantMacros()))
@ -1273,7 +1274,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
} }
IIndexFile[] files = getAvailableIndexFiles(linkageID, ifl); IIndexFile[] files = getAvailableIndexFiles(linkageID, ifl);
for (IIndexFile indexFile : files) { for (IIndexFile indexFile : files) {
if (md.satisfies(indexFile.getSignificantMacros())) { if (md.satisfies(indexFile.getSignificantMacros())) {
@ -1301,7 +1302,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} else { } else {
files= new IIndexFragmentFile[j]; files= new IIndexFragmentFile[j];
System.arraycopy(fragFiles, 0, files, 0, j); System.arraycopy(fragFiles, 0, files, 0, j);
} }
fIndexFilesCache.put(ifl, files); fIndexFilesCache.put(ifl, files);
} }
return files; return files;

View file

@ -38,7 +38,7 @@ public class PDOMSetupJob extends Job {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$ monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
while(true) { while (true) {
ICProject cproject= fManager.getNextProject(); ICProject cproject= fManager.getNextProject();
if (cproject == null) if (cproject == null)
return Status.OK_STATUS; return Status.OK_STATUS;

View file

@ -107,13 +107,13 @@ abstract public class PDOMWriter {
return fileContentKey.toString(); return fileContentKey.toString();
} }
} }
public static class FileContext { public static class FileContext {
final IIndexFragmentFile fContext; final IIndexFragmentFile fContext;
final IIndexFragmentFile fOldFile; final IIndexFragmentFile fOldFile;
IIndexFragmentFile fNewFile; IIndexFragmentFile fNewFile;
public boolean fLostPragmaOnceSemantics; public boolean fLostPragmaOnceSemantics;
public FileContext(IIndexFragmentFile context, IIndexFragmentFile oldFile) { public FileContext(IIndexFragmentFile context, IIndexFragmentFile oldFile) {
fContext= context; fContext= context;
fOldFile= oldFile; fOldFile= oldFile;
@ -132,7 +132,7 @@ abstract public class PDOMWriter {
final ArrayList<IASTPreprocessorStatement> fMacros= new ArrayList<IASTPreprocessorStatement>(); final ArrayList<IASTPreprocessorStatement> fMacros= new ArrayList<IASTPreprocessorStatement>();
final ArrayList<IASTPreprocessorIncludeStatement> fIncludes= new ArrayList<IASTPreprocessorIncludeStatement>(); final ArrayList<IASTPreprocessorIncludeStatement> fIncludes= new ArrayList<IASTPreprocessorIncludeStatement>();
} }
private static class Data { private static class Data {
final IASTTranslationUnit fAST; final IASTTranslationUnit fAST;
final FileInAST[] fSelectedFiles; final FileInAST[] fSelectedFiles;
@ -140,7 +140,7 @@ abstract public class PDOMWriter {
final Map<IASTPreprocessorIncludeStatement, Symbols> fSymbolMap = new HashMap<IASTPreprocessorIncludeStatement, Symbols>(); final Map<IASTPreprocessorIncludeStatement, Symbols> fSymbolMap = new HashMap<IASTPreprocessorIncludeStatement, Symbols>();
final Set<IASTPreprocessorIncludeStatement> fContextIncludes = new HashSet<IASTPreprocessorIncludeStatement>(); final Set<IASTPreprocessorIncludeStatement> fContextIncludes = new HashSet<IASTPreprocessorIncludeStatement>();
final List<IStatus> fStati= new ArrayList<IStatus>(); final List<IStatus> fStati= new ArrayList<IStatus>();
public Data(IASTTranslationUnit ast, FileInAST[] selectedFiles, IWritableIndex index) { public Data(IASTTranslationUnit ast, FileInAST[] selectedFiles, IWritableIndex index) {
fAST= ast; fAST= ast;
fSelectedFiles= selectedFiles; fSelectedFiles= selectedFiles;
@ -202,8 +202,8 @@ abstract public class PDOMWriter {
/** /**
* Extracts symbols from the given AST and adds them to the index. * Extracts symbols from the given AST and adds them to the index.
* *
* When flushIndex is set to <code>false</code>, you must make sure to flush * When flushIndex is set to <code>false</code>, you must make sure to flush
* the index after your last write operation. * the index after your last write operation.
*/ */
final protected void addSymbols(IASTTranslationUnit ast, FileInAST[] selectedFiles, final protected void addSymbols(IASTTranslationUnit ast, FileInAST[] selectedFiles,
@ -215,23 +215,22 @@ abstract public class PDOMWriter {
fShowScannerProblems= true; fShowScannerProblems= true;
fShowSyntaxProblems= true; fShowSyntaxProblems= true;
} }
Data data= new Data(ast, selectedFiles, index); Data data= new Data(ast, selectedFiles, index);
for (FileInAST file : selectedFiles) { for (FileInAST file : selectedFiles) {
data.fSymbolMap.put(file.includeStatement, new Symbols()); data.fSymbolMap.put(file.includeStatement, new Symbols());
} }
// Extract symbols from AST // Extract symbols from AST.
extractSymbols(data); extractSymbols(data);
// Name resolution // Name resolution.
resolveNames(data, pm); resolveNames(data, pm);
// Index update // Index update.
storeSymbolsInIndex(data, ctx, flushIndex, pm); storeSymbolsInIndex(data, ctx, flushIndex, pm);
// Tasks update // Tasks update.
if (taskUpdater != null) { if (taskUpdater != null) {
Set<IIndexFileLocation> locations= new HashSet<IIndexFileLocation>(); Set<IIndexFileLocation> locations= new HashSet<IIndexFileLocation>();
for (FileInAST file : selectedFiles) { for (FileInAST file : selectedFiles) {
@ -283,8 +282,8 @@ abstract public class PDOMWriter {
if (!isReplacement || newFile == null) { if (!isReplacement || newFile == null) {
ifile= storeFileInIndex(data, fileInAST, linkageID, lock); ifile= storeFileInIndex(data, fileInAST, linkageID, lock);
reportFileWrittenToIndex(fileInAST, ifile); reportFileWrittenToIndex(fileInAST, ifile);
} }
if (isReplacement) { if (isReplacement) {
if (ifile == null) if (ifile == null)
ifile= newFile; ifile= newFile;
@ -297,7 +296,7 @@ abstract public class PDOMWriter {
data.fIndex.transferIncluders(ctx.fOldFile, ifile); data.fIndex.transferIncluders(ctx.fOldFile, ifile);
} }
} }
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
th= e; th= e;
} catch (StackOverflowError e) { } catch (StackOverflowError e) {
@ -538,13 +537,13 @@ abstract public class PDOMWriter {
// if another thread is waiting for a read lock. // if another thread is waiting for a read lock.
final FileContentKey fileKey = astFile.fileContentKey; final FileContentKey fileKey = astFile.fileContentKey;
final IASTPreprocessorIncludeStatement owner= astFile.includeStatement; final IASTPreprocessorIncludeStatement owner= astFile.includeStatement;
IIndexFileLocation location = fileKey.getLocation(); IIndexFileLocation location = fileKey.getLocation();
ISignificantMacros significantMacros = fileKey.getSignificantMacros(); ISignificantMacros significantMacros = fileKey.getSignificantMacros();
IIndexFragmentFile oldFile = index.getWritableFile(linkageID, location, significantMacros); IIndexFragmentFile oldFile = index.getWritableFile(linkageID, location, significantMacros);
file= index.addUncommittedFile(linkageID, location, significantMacros); file= index.addUncommittedFile(linkageID, location, significantMacros);
try { try {
boolean pragmaOnce= owner != null ? owner.hasPragmaOnceSemantics() : data.fAST.hasPragmaOnceSemantics(); boolean pragmaOnce= owner != null ? owner.hasPragmaOnceSemantics() : data.fAST.hasPragmaOnceSemantics();
file.setPragmaOnceSemantics(pragmaOnce); file.setPragmaOnceSemantics(pragmaOnce);
Symbols lists= data.fSymbolMap.get(owner); Symbols lists= data.fSymbolMap.get(owner);
@ -571,7 +570,7 @@ abstract public class PDOMWriter {
includeInfos.add(new IncludeInformation(stmt, targetLoc, sig, false)); includeInfos.add(new IncludeInformation(stmt, targetLoc, sig, false));
} }
} }
final boolean isContext = stmt.isActive() && stmt.isResolved() && final boolean isContext = stmt.isActive() && stmt.isResolved() &&
(data.fContextIncludes.contains(stmt) || isContextFor(oldFile, stmt)); (data.fContextIncludes.contains(stmt) || isContextFor(oldFile, stmt));
includeInfos.add(new IncludeInformation(stmt, targetLoc, mainSig, isContext)); includeInfos.add(new IncludeInformation(stmt, targetLoc, mainSig, isContext));
} }

View file

@ -200,6 +200,7 @@ import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable; import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
import org.eclipse.cdt.internal.corext.util.CModelUtil;
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
@ -1286,11 +1287,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
try { try {
IIndexManager indexManager = CCorePlugin.getIndexManager(); IIndexManager indexManager = CCorePlugin.getIndexManager();
if (tuToReset != null) { if (tuToReset != null) {
indexManager.update(new ICElement[] { tuToReset }, indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToReset) },
IIndexManager.RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS); IIndexManager.RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
} }
if (tuToAdd != null) { if (tuToAdd != null) {
indexManager.update(new ICElement[] { tuToAdd }, indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToAdd) },
IIndexManager.FORCE_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS); IIndexManager.FORCE_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
} }
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.ui.breakpointactions;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.StringReader; import java.io.StringReader;
import com.ibm.icu.text.MessageFormat;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
@ -31,22 +30,46 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.ui.progress.WorkbenchJob;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import com.ibm.icu.text.MessageFormat;
public class ExternalToolAction extends AbstractBreakpointAction { public class ExternalToolAction extends AbstractBreakpointAction {
private String externalToolName = ""; //$NON-NLS-1$ private String externalToolName = ""; //$NON-NLS-1$
@Override @Override
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) { public IStatus execute(final IBreakpoint breakpoint, final IAdaptable context, final IProgressMonitor monitor) {
Job uiJob = new WorkbenchJob("ExternalToolAction") { //$NON-NLS-1$
{
setPriority(INTERACTIVE);
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
return executeInUIThread(breakpoint, context, monitor);
}
};
uiJob.schedule();
try {
uiJob.join();
} catch (InterruptedException e) {
return Status.CANCEL_STATUS;
}
return uiJob.getResult();
}
private IStatus executeInUIThread(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
IStatus errorStatus = null; IStatus errorStatus = null;
ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager(); ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager();
try { try {

View file

@ -50,7 +50,7 @@ public abstract class AbstractBreakpointVMNode extends AbstractVMNode {
/** /**
* Class that creates the element object for the corresponding breakpoints. * Class that creates the element object for the corresponding breakpoints.
* This element object will be populated in the breakpoitns view to represent * This element object will be populated in the breakpoints view to represent
* the given breakpoint. * the given breakpoint.
*/ */
abstract protected Object createBreakpiontElement(IBreakpoint bp); abstract protected Object createBreakpiontElement(IBreakpoint bp);

View file

@ -31,7 +31,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IMemento; import org.eclipse.ui.IMemento;
/** /**
* Breakpiont VM Node which uses VM Contexts to populate breakpoint elements * Breakpoint VM Node which uses VM Contexts to populate breakpoint elements
* in the view. Any actions or other selection listeners which depend on the * in the view. Any actions or other selection listeners which depend on the
* breakpoint object will not work with these elements unless they use the * breakpoint object will not work with these elements unless they use the
* adapter mechanism to obtain the breakpoints. * adapter mechanism to obtain the breakpoints.

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.IExpressionVMNode;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter; import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
@ -58,15 +57,8 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
/** /**
* The expression provider is used to populate the contents of the expressions * The breakpoint provider is used to populate the contents of the breakpoints
* view. The node hierarchy in this view is a little different than in a typical * view.
* provider: the expression manager node should be registered as the single child
* of the root node and no nodes should be registered as children of expression node.
* Instead the top level expression nodes should be registered with a call to
* {@link #setExpressionNodes(IExpressionVMNode[])}. And each expression node can
* have its own sub-hierarchy of elements as needed. However all nodes configured
* with this provider (with the exception of the root and the expression manager)
* should implement {@link IExpressionVMNode}.
* *
* @since 2.1 * @since 2.1
*/ */

View file

@ -98,7 +98,7 @@ abstract class DataCache<V> {
} }
/** /**
* Request data from the cache. The cache is valid, it will complete the * Request data from the cache. If the cache is valid, it will complete the
* request immediately, otherwise data will first be retrieved from the * request immediately, otherwise data will first be retrieved from the
* source. * source.
* @param req * @param req

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
/** /**
* Breakpoint node which uses raw breakpiont objects (without a wrapper) as * Breakpoint node which uses raw breakpoint objects (without a wrapper) as
* elements which are populated into the view. The breakpoint objects are * elements which are populated into the view. The breakpoint objects are
* responsible for supplying their own label and memento providers, as well * responsible for supplying their own label and memento providers, as well
* as content provider for any children. * as content provider for any children.

View file

@ -34,7 +34,7 @@ public interface IBreakpointsExtension extends IBreakpoints {
} }
/** /**
* If a given execution context was suspended due hitting a breakpoint, * If a given execution context was suspended due to hitting a breakpoint,
* this method should return the breakpoints which caused the thread or * this method should return the breakpoints which caused the thread or
* container to suspend. * container to suspend.
* <p> * <p>