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