mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Cosmetics.
This commit is contained in:
parent
64bd893b0b
commit
fcaa09aaf8
11 changed files with 41 additions and 48 deletions
|
@ -21,7 +21,6 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for representing the content of a file.
|
* Abstract class for representing the content of a file.
|
||||||
* It serves as the input to the preprocessor.
|
* It serves as the input to the preprocessor.
|
||||||
|
@ -30,7 +29,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public abstract class FileContent {
|
public abstract class FileContent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the location of this file content as it will appear in {@link IASTFileLocation#getFileName()}
|
* Returns the location of this file content as it will appear in {@link IASTFileLocation#getFileName()}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
|
|
||||||
public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
||||||
|
|
||||||
public CPPBlockScope(IASTNode physicalNode) {
|
public CPPBlockScope(IASTNode physicalNode) {
|
||||||
super(physicalNode);
|
super(physicalNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
||||||
fInlineNamespaceDefinitions.add(nsDef);
|
fInlineNamespaceDefinitions.add(nsDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ICPPNamespaceScope[] computeEnclosingNamespaceSet(ICPPInternalNamespaceScope nsScope) {
|
public static ICPPNamespaceScope[] computeEnclosingNamespaceSet(ICPPInternalNamespaceScope nsScope) {
|
||||||
if (nsScope.isInlineNamepace()) {
|
if (nsScope.isInlineNamepace()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -42,9 +42,6 @@ public class CPPTemplateScope extends CPPScope implements ICPPTemplateScope {
|
||||||
return (ICPPASTTemplateDeclaration) getPhysicalNode();
|
return (ICPPASTTemplateDeclaration) getPhysicalNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
ICPPASTTemplateDeclaration template = (ICPPASTTemplateDeclaration) getPhysicalNode();
|
ICPPASTTemplateDeclaration template = (ICPPASTTemplateDeclaration) getPhysicalNode();
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
|
|
|
@ -92,7 +92,8 @@ public interface IWritableIndex extends IIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes an uncommitted file that was created earlier by calling
|
* Makes an uncommitted file that was created earlier by calling
|
||||||
* {@link #addUncommittedFile(int, IIndexFileLocation, ISignificantMacros)} method visible in the index.
|
* {@link #addUncommittedFile(int, IIndexFileLocation, ISignificantMacros)} method visible
|
||||||
|
* in the index.
|
||||||
*
|
*
|
||||||
* @return The file that was updated.
|
* @return The file that was updated.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
|
|
@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractCharArray {
|
public abstract class AbstractCharArray {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the length of this array or -1 if it is yet, unknown. This method may be called
|
* Returns the length of this array or -1 if it is yet, unknown. This method may be called
|
||||||
* before the array has been traversed.
|
* before the array has been traversed.
|
||||||
|
@ -25,8 +24,8 @@ public abstract class AbstractCharArray {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the length of the array. This method is called only after the lexer has worked its
|
* Returns the length of the array. This method is called only after the lexer has worked its
|
||||||
* way through the array. Therefore for subclasses it is efficient enough to read through to the
|
* way through the array. Therefore for subclasses it is efficient enough to read through to
|
||||||
* end of the array and provide the length.
|
* the end of the array and provide the length.
|
||||||
*/
|
*/
|
||||||
public abstract int getLength();
|
public abstract int getLength();
|
||||||
|
|
||||||
|
@ -37,8 +36,8 @@ public abstract class AbstractCharArray {
|
||||||
public abstract boolean isValidOffset(int offset);
|
public abstract boolean isValidOffset(int offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes 64-bit hash value of the character array. This method doesn't cause any I/O if called
|
* Computes 64-bit hash value of the character array. This method doesn't cause any I/O if
|
||||||
* after the array has been traversed.
|
* called after the array has been traversed.
|
||||||
* @return The hash value of the contents of the array.
|
* @return The hash value of the contents of the array.
|
||||||
*/
|
*/
|
||||||
public abstract long getContentsHash();
|
public abstract long getContentsHash();
|
||||||
|
|
|
@ -164,18 +164,20 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static class IncludeResolution {
|
private static class IncludeResolution {
|
||||||
String fLocation;
|
final String fLocation;
|
||||||
boolean fHeuristic;
|
final boolean fHeuristic;
|
||||||
|
|
||||||
|
IncludeResolution(String location, boolean heusistic) {
|
||||||
|
fLocation = location;
|
||||||
|
fHeuristic = heusistic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final private IIncludeFileTester<IncludeResolution> createPathTester= new IIncludeFileTester<IncludeResolution>() {
|
final private IIncludeFileTester<IncludeResolution> createPathTester= new IIncludeFileTester<IncludeResolution>() {
|
||||||
@Override
|
@Override
|
||||||
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
||||||
if (fFileContentProvider.getInclusionExists(path)) {
|
if (fFileContentProvider.getInclusionExists(path)) {
|
||||||
IncludeResolution res= new IncludeResolution();
|
return new IncludeResolution(path, isHeuristicMatch);
|
||||||
res.fHeuristic= isHeuristicMatch;
|
|
||||||
res.fLocation= path;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
* Wrapper around char[] to implement {@link AbstractCharArray}.
|
* Wrapper around char[] to implement {@link AbstractCharArray}.
|
||||||
*/
|
*/
|
||||||
public final class CharArray extends AbstractCharArray {
|
public final class CharArray extends AbstractCharArray {
|
||||||
|
|
||||||
private final char[] fArray;
|
private final char[] fArray;
|
||||||
private long hash64;
|
private long hash64;
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,13 @@ import java.nio.charset.CodingErrorAction;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of char array for a file referencing content via
|
* Implementation of char array for a file referencing content via soft references.
|
||||||
* soft references.
|
|
||||||
*/
|
*/
|
||||||
public class FileCharArray extends LazyCharArray {
|
public class FileCharArray extends LazyCharArray {
|
||||||
private static final String UTF8_CHARSET_NAME = "UTF-8"; //$NON-NLS-1$
|
private static final String UTF8_CHARSET_NAME = "UTF-8"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static AbstractCharArray create(String fileName, String charSet, InputStream in) throws IOException {
|
public static AbstractCharArray create(String fileName, String charSet, InputStream in) throws IOException {
|
||||||
// no support for non-local files
|
// No support for non-local files.
|
||||||
if (!(in instanceof FileInputStream)) {
|
if (!(in instanceof FileInputStream)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -84,10 +83,9 @@ public class FileCharArray extends LazyCharArray {
|
||||||
private String fFileName;
|
private String fFileName;
|
||||||
private String fCharSet;
|
private String fCharSet;
|
||||||
private FileChannel fChannel;
|
private FileChannel fChannel;
|
||||||
private long fNextFileOffset= 0;
|
private long fNextFileOffset;
|
||||||
private int fNextCharOffset= 0;
|
private int fNextCharOffset;
|
||||||
private boolean fReachedEOF= false;
|
private boolean fReachedEOF;
|
||||||
|
|
||||||
|
|
||||||
private FileCharArray(String fileName, String charSet) {
|
private FileCharArray(String fileName, String charSet) {
|
||||||
fFileName= fileName;
|
fFileName= fileName;
|
||||||
|
@ -192,7 +190,8 @@ public class FileCharArray extends LazyCharArray {
|
||||||
|
|
||||||
private void decode(FileChannel channel, long fileOffset, long fileEndOffset, CharBuffer dest) throws IOException {
|
private void decode(FileChannel channel, long fileOffset, long fileEndOffset, CharBuffer dest) throws IOException {
|
||||||
final Charset charset = Charset.forName(fCharSet);
|
final Charset charset = Charset.forName(fCharSet);
|
||||||
final CharsetDecoder decoder = charset.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
|
final CharsetDecoder decoder = charset.newDecoder()
|
||||||
|
.onMalformedInput(CodingErrorAction.REPLACE)
|
||||||
.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||||
|
|
||||||
final ByteBuffer in = ByteBuffer.allocate((int) (fileEndOffset - fileOffset));
|
final ByteBuffer in = ByteBuffer.allocate((int) (fileEndOffset - fileOffset));
|
||||||
|
|
|
@ -16,8 +16,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of char array for a file referencing content via
|
* Implementation of char array for a file referencing content via soft references.
|
||||||
* soft references.
|
|
||||||
* Because of bug 320157 we need to deal with chunks of different length.
|
* Because of bug 320157 we need to deal with chunks of different length.
|
||||||
*/
|
*/
|
||||||
public abstract class LazyCharArray extends AbstractCharArray {
|
public abstract class LazyCharArray extends AbstractCharArray {
|
||||||
|
|
Loading…
Add table
Reference in a new issue