1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Added IIndexFile.toDebugString method.

This commit is contained in:
Sergey Prigogin 2012-04-27 18:33:31 -07:00
parent cf5d550888
commit e1b227f338
2 changed files with 38 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
* 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
@ -98,4 +98,10 @@ public interface IIndexFile extends IFileNomination {
* @since 5.0 * @since 5.0
*/ */
int getLinkageID() throws CoreException; int getLinkageID() throws CoreException;
/**
* Returns detailed information about the file. For debugging only.
* @since 5.4
*/
String toDebugString();
} }

View file

@ -938,4 +938,35 @@ public class PDOMFile implements IIndexFragmentFile {
} }
return loc != null ? loc.toString() : super.toString(); return loc != null ? loc.toString() : super.toString();
} }
@Override
public String toDebugString() {
StringBuilder buf = new StringBuilder();
try {
buf.append("location: "); //$NON-NLS-1$
buf.append(getLocation());
buf.append(", timestamp: "); //$NON-NLS-1$
buf.append(getTimestamp());
buf.append(", linkageID: "); //$NON-NLS-1$
buf.append(getLinkageID());
buf.append(", contentsHash: "); //$NON-NLS-1$
buf.append(getContentsHash());
IIndexInclude parsedInContext = getParsedInContext();
if (parsedInContext != null) {
buf.append(", parsedInContext: "); //$NON-NLS-1$
buf.append(parsedInContext.getIncludedBy());
}
buf.append(", significantMacros: "); //$NON-NLS-1$
buf.append(getSignificantMacros());
buf.append(", names: "); //$NON-NLS-1$
buf.append(findNames(0, Integer.MAX_VALUE).length);
buf.append(", macros: "); //$NON-NLS-1$
buf.append(getMacros().length);
buf.append(", includes: "); //$NON-NLS-1$
buf.append(getIncludes().length);
} catch (CoreException e) {
buf.append(" (incomplete due to " + e.getClass().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
return buf.toString();
}
} }