mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Code formatting.
This commit is contained in:
parent
d33651d578
commit
b45aa845c2
1 changed files with 45 additions and 49 deletions
|
@ -180,24 +180,23 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
IScannerInfo scanInfo, int options, IProgressMonitor pm) throws CoreException {
|
||||
if (fCodeReaderFactory == null) {
|
||||
if (fIsFastIndexer) {
|
||||
fCodeReaderFactory= new IndexBasedCodeReaderFactory(fIndex, createIncludeHeuristics(), fResolver, language.getLinkageID(), createReaderFactory(), this);
|
||||
}
|
||||
else {
|
||||
fCodeReaderFactory= new IndexBasedCodeReaderFactory(fIndex, createIncludeHeuristics(),
|
||||
fResolver, language.getLinkageID(), createReaderFactory(), this);
|
||||
} else {
|
||||
fCodeReaderFactory= createReaderFactory();
|
||||
}
|
||||
}
|
||||
else if (fIsFastIndexer) {
|
||||
} else if (fIsFastIndexer) {
|
||||
((IndexBasedCodeReaderFactory) fCodeReaderFactory).setLinkage(language.getLinkageID());
|
||||
}
|
||||
|
||||
try {
|
||||
IASTTranslationUnit ast= language.getASTTranslationUnit(codeReader, scanInfo, fCodeReaderFactory, fIndex, options, getLogService());
|
||||
IASTTranslationUnit ast= language.getASTTranslationUnit(codeReader, scanInfo, fCodeReaderFactory,
|
||||
fIndex, options, getLogService());
|
||||
if (pm.isCanceled()) {
|
||||
return null;
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (fIsFastIndexer) {
|
||||
((IndexBasedCodeReaderFactory) fCodeReaderFactory).cleanupAfterTranslationUnit();
|
||||
}
|
||||
|
@ -242,20 +241,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
parseLinkage(ILinkage.CPP_LINKAGE_ID, files, monitor);
|
||||
parseLinkage(ILinkage.C_LINKAGE_ID, files, monitor);
|
||||
parseLinkage(ILinkage.FORTRAN_LINKAGE_ID, files, monitor);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
fIndex.flush();
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
fIndex.releaseReadLock();
|
||||
}
|
||||
}
|
||||
|
||||
private void extractFiles(Map<Integer, List<Object>> files, List<IIndexFragmentFile> iFilesToRemove, IProgressMonitor monitor) throws CoreException {
|
||||
private void extractFiles(Map<Integer, List<Object>> files, List<IIndexFragmentFile> iFilesToRemove,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
final boolean forceAll= (fUpdateFlags & IIndexManager.UPDATE_ALL) != 0;
|
||||
final boolean checkTimestamps= (fUpdateFlags & IIndexManager.UPDATE_CHECK_TIMESTAMPS) != 0;
|
||||
final boolean checkConfig= (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONFIGURATION) != 0;
|
||||
|
@ -285,8 +282,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
store(tu, linkageID, isSourceUnit, files);
|
||||
requestUpdate(linkageID, ifl, null);
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
takeFile(ifile, indexFiles);
|
||||
boolean update= false;
|
||||
if (checkConfig) {
|
||||
|
@ -309,8 +305,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
if (ctx == null) {
|
||||
iFilesToRemove.add(ifile);
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
boolean update= false;
|
||||
if (checkConfig && ifile.getParsedInContext() != null) {
|
||||
update= isHeaderConfigChange(tu, ifile);
|
||||
|
@ -403,7 +398,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
return key;
|
||||
}
|
||||
|
||||
private void removeFilesInIndex(List<Object> filesToRemove, List<IIndexFragmentFile> ifilesToRemove, IProgressMonitor monitor) throws InterruptedException, CoreException {
|
||||
private void removeFilesInIndex(List<Object> filesToRemove, List<IIndexFragmentFile> ifilesToRemove,
|
||||
IProgressMonitor monitor) throws InterruptedException, CoreException {
|
||||
if (!filesToRemove.isEmpty() || !ifilesToRemove.isEmpty()) {
|
||||
fIndex.acquireWriteLock(1);
|
||||
try {
|
||||
|
@ -470,15 +466,15 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
swallowError(path, e);
|
||||
}
|
||||
}
|
||||
fFilesUpFront.clear();
|
||||
}
|
||||
|
||||
private void parseLinkage(int linkageID, Map<Integer, List<Object>> fileListMap, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||
private void parseLinkage(int linkageID, Map<Integer, List<Object>> fileListMap, IProgressMonitor monitor)
|
||||
throws CoreException, InterruptedException {
|
||||
// sources
|
||||
List<Object> files= fileListMap.get(getFileListKey(linkageID, true));
|
||||
if (files != null) {
|
||||
|
@ -524,8 +520,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// file was already parsed.
|
||||
iter.remove();
|
||||
}
|
||||
|
@ -581,7 +576,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void parseFile(Object tu, int linkageID, IIndexFileLocation ifl, IScannerInfo scanInfo, IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||
private void parseFile(Object tu, int linkageID, IIndexFileLocation ifl, IScannerInfo scanInfo,
|
||||
IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||
IPath path= getPathForLabel(ifl);
|
||||
AbstractLanguage[] langs= fResolver.getLanguages(tu);
|
||||
AbstractLanguage lang= null;
|
||||
|
@ -619,7 +615,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
} catch (Error e) {
|
||||
try {
|
||||
swallowError(path, e);
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
if (th != null) {
|
||||
|
@ -627,7 +624,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
|
||||
private void writeToIndex(final int linkageID, IASTTranslationUnit ast, int configHash, IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||
private void writeToIndex(final int linkageID, IASTTranslationUnit ast, int configHash,
|
||||
IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||
HashSet<IIndexFileLocation> enteredFiles= new HashSet<IIndexFileLocation>();
|
||||
ArrayList<IIndexFileLocation> orderedIFLs= new ArrayList<IIndexFileLocation>();
|
||||
|
||||
|
@ -647,8 +645,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
IIndexFileLocation[] ifls= orderedIFLs.toArray(new IIndexFileLocation[orderedIFLs.size()]);
|
||||
try {
|
||||
addSymbols(ast, ifls, fIndex, 1, false, configHash, fTodoTaskUpdater, pm);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
// mark as updated in any case, to avoid parsing files that caused an exception to be thrown.
|
||||
for (IIndexFileLocation ifl : ifls) {
|
||||
info= getFileInfo(linkageID, ifl);
|
||||
|
@ -658,7 +655,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
|
||||
private void collectOrderedIFLs(final int linkageID, IASTInclusionNode inclusion, HashSet<IIndexFileLocation> enteredFiles, ArrayList<IIndexFileLocation> orderedIFLs) throws CoreException {
|
||||
private void collectOrderedIFLs(final int linkageID, IASTInclusionNode inclusion,
|
||||
HashSet<IIndexFileLocation> enteredFiles, ArrayList<IIndexFileLocation> orderedIFLs) throws CoreException {
|
||||
final IASTPreprocessorIncludeStatement id= inclusion.getIncludeDirective();
|
||||
if (id.isActive() && id.isResolved()) {
|
||||
final IIndexFileLocation ifl= fResolver.resolveASTPath(id.getPath());
|
||||
|
@ -679,8 +677,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
IIndexFile ifile= null;
|
||||
if (fResolver.canBePartOfSDK(ifl)) {
|
||||
ifile= fIndex.getFile(linkageID, ifl);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
IIndexFragmentFile fragFile= fIndex.getWritableFile(linkageID, ifl);
|
||||
if (fragFile != null && fragFile.hasContent()) {
|
||||
ifile= fragFile;
|
||||
|
@ -720,8 +717,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
if (s.getException() == null) {
|
||||
s= new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
s= CCorePlugin.createStatus(getMessage(MessageKind.errorWhileParsing, file), e);
|
||||
}
|
||||
logError(s);
|
||||
|
|
Loading…
Add table
Reference in a new issue