1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2009-07-18 18:59:11 +00:00
parent b358f1f6d0
commit 2f0264aa6b

View file

@ -139,8 +139,8 @@ abstract public class PDOMWriter {
* @since 4.0 * @since 4.0
*/ */
public void addSymbols(IASTTranslationUnit ast, IIndexFileLocation[] ifls, IWritableIndex index, public void addSymbols(IASTTranslationUnit ast, IIndexFileLocation[] ifls, IWritableIndex index,
int readlockCount, boolean flushIndex, int configHash, ITodoTaskUpdater taskUpdater, IProgressMonitor pm) int readlockCount, boolean flushIndex, int configHash, ITodoTaskUpdater taskUpdater,
throws InterruptedException, CoreException { IProgressMonitor pm) throws InterruptedException, CoreException {
if (fShowProblems) { if (fShowProblems) {
fShowInclusionProblems= true; fShowInclusionProblems= true;
fShowScannerProblems= true; fShowScannerProblems= true;
@ -159,7 +159,8 @@ abstract public class PDOMWriter {
resolveNames(symbolMap, ifls, stati, pm); resolveNames(symbolMap, ifls, stati, pm);
// index update // index update
storeSymbolsInIndex(symbolMap, ifls, ast.getLinkage().getLinkageID(), configHash, contextIncludes, index, readlockCount, flushIndex, stati, pm); storeSymbolsInIndex(symbolMap, ifls, ast.getLinkage().getLinkageID(), configHash, contextIncludes,
index, readlockCount, flushIndex, stati, pm);
if (taskUpdater != null) { if (taskUpdater != null) {
taskUpdater.updateTasks(ast.getComments(), ifls); taskUpdater.updateTasks(ast.getComments(), ifls);
@ -186,13 +187,14 @@ abstract public class PDOMWriter {
} }
} }
private void storeSymbolsInIndex(final Map<IIndexFileLocation, Symbols> symbolMap, IIndexFileLocation[] ifls, int linkageID, int configHash, private void storeSymbolsInIndex(final Map<IIndexFileLocation, Symbols> symbolMap, IIndexFileLocation[] ifls,
HashSet<IASTPreprocessorIncludeStatement> contextIncludes, IWritableIndex index, int readlockCount, boolean flushIndex, int linkageID, int configHash, HashSet<IASTPreprocessorIncludeStatement> contextIncludes,
IWritableIndex index, int readlockCount, boolean flushIndex,
ArrayList<IStatus> stati, IProgressMonitor pm) throws InterruptedException, CoreException { ArrayList<IStatus> stati, IProgressMonitor pm) throws InterruptedException, CoreException {
index.acquireWriteLock(readlockCount); index.acquireWriteLock(readlockCount);
long start= System.currentTimeMillis(); long start= System.currentTimeMillis();
try { try {
for (int i=0; i<ifls.length; i++) { for (int i= 0; i < ifls.length; i++) {
if (pm.isCanceled()) if (pm.isCanceled())
return; return;
@ -212,9 +214,10 @@ abstract public class PDOMWriter {
th= e; th= e;
} }
if (th != null) { if (th != null) {
stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath()), th)); stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing,
ifl.getURI().getPath()), th));
} }
if (i<ifls.length-1) { if (i < ifls.length - 1) {
updateFileCount(0, 0, 1); // update header count updateFileCount(0, 0, 1); // update header count
} }
} }
@ -225,7 +228,8 @@ abstract public class PDOMWriter {
fStatistics.fAddToIndexTime+= System.currentTimeMillis()-start; fStatistics.fAddToIndexTime+= System.currentTimeMillis()-start;
} }
private void resolveNames(final Map<IIndexFileLocation, Symbols> symbolMap, IIndexFileLocation[] ifls, ArrayList<IStatus> stati, IProgressMonitor pm) { private void resolveNames(final Map<IIndexFileLocation, Symbols> symbolMap, IIndexFileLocation[] ifls,
ArrayList<IStatus> stati, IProgressMonitor pm) {
long start= System.currentTimeMillis(); long start= System.currentTimeMillis();
for (IIndexFileLocation path : ifls) { for (IIndexFileLocation path : ifls) {
if (pm.isCanceled()) { if (pm.isCanceled()) {
@ -253,7 +257,8 @@ abstract public class PDOMWriter {
} else if (name.isReference()) { } else if (name.isReference()) {
if (binding instanceof ICPPTemplateParameter || if (binding instanceof ICPPTemplateParameter ||
binding instanceof ICPPUnknownBinding || binding instanceof ICPPUnknownBinding ||
((fSkipReferences & SKIP_TYPE_REFERENCES) != 0 && isTypeReferenceBinding(binding))) { ((fSkipReferences & SKIP_TYPE_REFERENCES) != 0 &&
isTypeReferenceBinding(binding))) {
if (!isRequiredReference(name)) { if (!isRequiredReference(name)) {
na[0]= null; na[0]= null;
} else { } else {
@ -274,8 +279,8 @@ abstract public class PDOMWriter {
} }
if (th != null) { if (th != null) {
if (!reported) { if (!reported) {
stati.add(CCorePlugin.createStatus( stati.add(CCorePlugin.createStatus(NLS.bind(Messages.PDOMWriter_errorResolvingName,
NLS.bind(Messages.PDOMWriter_errorResolvingName, name.toString(), path.getURI().getPath()), th)); name.toString(), path.getURI().getPath()), th));
} }
reported= true; reported= true;
j.remove(); j.remove();
@ -286,8 +291,8 @@ abstract public class PDOMWriter {
fStatistics.fResolutionTime += System.currentTimeMillis()-start; fStatistics.fResolutionTime += System.currentTimeMillis()-start;
} }
private void extractSymbols(IASTTranslationUnit ast, final Map<IIndexFileLocation, Symbols> symbolMap, Collection<IASTPreprocessorIncludeStatement> contextIncludes) throws CoreException { private void extractSymbols(IASTTranslationUnit ast, final Map<IIndexFileLocation, Symbols> symbolMap,
Collection<IASTPreprocessorIncludeStatement> contextIncludes) throws CoreException {
final HashSet<IIndexFileLocation> contextIFLs= new HashSet<IIndexFileLocation>(); final HashSet<IIndexFileLocation> contextIFLs= new HashSet<IIndexFileLocation>();
final IIndexFileLocation astIFL = fResolver.resolveASTPath(ast.getFilePath()); final IIndexFileLocation astIFL = fResolver.resolveASTPath(ast.getFilePath());
@ -307,8 +312,7 @@ abstract public class PDOMWriter {
if (include.isActive()) { if (include.isActive()) {
if (!include.isResolved()) { if (!include.isResolved()) {
unresolvedIncludes++; unresolvedIncludes++;
} } else if (updateSource) {
else if (updateSource) {
// the include was parsed, check if we want to update the included file in the index // the include was parsed, check if we want to update the included file in the index
final IIndexFileLocation targetIFL= fResolver.resolveASTPath(include.getPath()); final IIndexFileLocation targetIFL= fResolver.resolveASTPath(include.getPath());
if (symbolMap.containsKey(targetIFL) && contextIFLs.add(targetIFL)) { if (symbolMap.containsKey(targetIFL) && contextIFLs.add(targetIFL)) {
@ -421,13 +425,15 @@ abstract public class PDOMWriter {
lists.fNames.add(thing); lists.fNames.add(thing);
} }
private void addToMap(Map<IIndexFileLocation, Symbols> map, IIndexFileLocation location, IASTPreprocessorIncludeStatement thing) { private void addToMap(Map<IIndexFileLocation, Symbols> map, IIndexFileLocation location,
IASTPreprocessorIncludeStatement thing) {
Symbols lists= map.get(location); Symbols lists= map.get(location);
if (lists != null) if (lists != null)
lists.fIncludes.add(thing); lists.fIncludes.add(thing);
} }
private void addToMap(Map<IIndexFileLocation, Symbols> map, IIndexFileLocation location, IASTPreprocessorStatement thing) { private void addToMap(Map<IIndexFileLocation, Symbols> map, IIndexFileLocation location,
IASTPreprocessorStatement thing) {
Symbols lists= map.get(location); Symbols lists= map.get(location);
if (lists != null) if (lists != null)
lists.fMacros.add(thing); lists.fMacros.add(thing);
@ -440,8 +446,9 @@ abstract public class PDOMWriter {
return false; return false;
} }
private IIndexFragmentFile storeFileInIndex(IWritableIndex index, IIndexFileLocation location, Map<IIndexFileLocation, Symbols> symbolMap, private IIndexFragmentFile storeFileInIndex(IWritableIndex index, IIndexFileLocation location,
int linkageID, int configHash, Set<IASTPreprocessorIncludeStatement> contextIncludes) throws CoreException { Map<IIndexFileLocation, Symbols> symbolMap, int linkageID, int configHash,
Set<IASTPreprocessorIncludeStatement> contextIncludes) throws CoreException {
Set<IIndexFileLocation> clearedContexts= Collections.emptySet(); Set<IIndexFileLocation> clearedContexts= Collections.emptySet();
IIndexFragmentFile file= index.getWritableFile(linkageID, location); IIndexFragmentFile file= index.getWritableFile(linkageID, location);
if (file != null) { if (file != null) {
@ -464,7 +471,7 @@ abstract public class PDOMWriter {
} }
IncludeInformation[] includeInfos= new IncludeInformation[lists.fIncludes.size()]; IncludeInformation[] includeInfos= new IncludeInformation[lists.fIncludes.size()];
for (int i=0; i<lists.fIncludes.size(); i++) { for (int i= 0; i < lists.fIncludes.size(); i++) {
final IASTPreprocessorIncludeStatement include = lists.fIncludes.get(i); final IASTPreprocessorIncludeStatement include = lists.fIncludes.get(i);
final IncludeInformation info= includeInfos[i]= new IncludeInformation(); final IncludeInformation info= includeInfos[i]= new IncludeInformation();
info.fStatement= include; info.fStatement= include;
@ -494,9 +501,9 @@ abstract public class PDOMWriter {
*/ */
protected final void updateFileCount(int sources, int primaryHeader, int header) { protected final void updateFileCount(int sources, int primaryHeader, int header) {
synchronized(fInfo) { synchronized(fInfo) {
fInfo.fCompletedSources+= sources; fInfo.fCompletedSources += sources;
fInfo.fPrimaryHeaderCount+= primaryHeader; fInfo.fPrimaryHeaderCount += primaryHeader;
fInfo.fCompletedHeaders+= header; fInfo.fCompletedHeaders += header;
} }
} }
@ -520,7 +527,7 @@ abstract public class PDOMWriter {
msg+= "; " + problem.getMessage(); //$NON-NLS-1$ msg+= "; " + problem.getMessage(); //$NON-NLS-1$
System.out.println(msg); System.out.println(msg);
} }
private void reportProblem(IASTProblem problem) { private void reportProblem(IASTProblem problem) {
String msg= "Indexer: " + problem.getMessageWithLocation(); //$NON-NLS-1$ String msg= "Indexer: " + problem.getMessageWithLocation(); //$NON-NLS-1$
System.out.println(msg); System.out.println(msg);
@ -533,5 +540,4 @@ abstract public class PDOMWriter {
protected IStatus createStatus(String msg, Throwable e) { protected IStatus createStatus(String msg, Throwable e) {
return CCorePlugin.createStatus(msg, e); return CCorePlugin.createStatus(msg, e);
} }
} }