mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
Cosmetics.
This commit is contained in:
parent
2ac9121791
commit
51e56e5a8b
9 changed files with 40 additions and 35 deletions
|
@ -11,14 +11,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.testplugin;
|
package org.eclipse.cdt.core.testplugin;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||||
|
|
||||||
public class TestScannerInfo implements IExtendedScannerInfo {
|
public class TestScannerInfo implements IExtendedScannerInfo {
|
||||||
private static final String[] EMPTY = new String[0];
|
private static final String[] EMPTY = {};
|
||||||
private static final Map EMPTY_MAP = new HashMap(0);
|
|
||||||
private String[] fIncludes;
|
private String[] fIncludes;
|
||||||
private String[] fIncludeFiles;
|
private String[] fIncludeFiles;
|
||||||
private String[] fMacroFiles;
|
private String[] fMacroFiles;
|
||||||
|
@ -28,23 +27,27 @@ public class TestScannerInfo implements IExtendedScannerInfo {
|
||||||
fIncludeFiles= includeFiles;
|
fIncludeFiles= includeFiles;
|
||||||
fMacroFiles= macroFiles;
|
fMacroFiles= macroFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map getDefinedSymbols() {
|
public Map getDefinedSymbols() {
|
||||||
return EMPTY_MAP;
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getIncludePaths() {
|
public String[] getIncludePaths() {
|
||||||
return fIncludes == null ? EMPTY : fIncludes;
|
return fIncludes == null ? EMPTY : fIncludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getIncludeFiles() {
|
public String[] getIncludeFiles() {
|
||||||
return fIncludeFiles == null ? EMPTY: fIncludeFiles;
|
return fIncludeFiles == null ? EMPTY: fIncludeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getLocalIncludePath() {
|
public String[] getLocalIncludePath() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getMacroFiles() {
|
public String[] getMacroFiles() {
|
||||||
return fMacroFiles == null ? EMPTY: fMacroFiles;
|
return fMacroFiles == null ? EMPTY: fMacroFiles;
|
||||||
|
|
|
@ -18,10 +18,9 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
public class TestScannerProvider extends AbstractCExtension implements IScannerInfoProvider {
|
public class TestScannerProvider extends AbstractCExtension implements IScannerInfoProvider {
|
||||||
|
public static String[] sIncludes;
|
||||||
public static String[] sIncludes= null;
|
public static String[] sIncludeFiles;
|
||||||
public static String[] sIncludeFiles= null;
|
public static String[] sMacroFiles;
|
||||||
public static String[] sMacroFiles= null;
|
|
||||||
public final static String SCANNER_ID = CTestPlugin.PLUGIN_ID + ".TestScanner";
|
public final static String SCANNER_ID = CTestPlugin.PLUGIN_ID + ".TestScanner";
|
||||||
|
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
|
|
|
@ -153,16 +153,16 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public IASTCompletionNode getCompletionNode(org.eclipse.cdt.core.parser.CodeReader reader,
|
public IASTCompletionNode getCompletionNode(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator,
|
||||||
IParserLogService log, int offset) throws CoreException {
|
IIndex index, IParserLogService log, int offset) throws CoreException {
|
||||||
return getCompletionNode(FileContent.adapt(reader), scanInfo, IncludeFileContentProvider
|
return getCompletionNode(FileContent.adapt(reader), scanInfo,
|
||||||
.adapt(fileCreator), index, log, offset);
|
IncludeFileContentProvider.adapt(fileCreator), index, log, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTCompletionNode getCompletionNode(FileContent reader, IScannerInfo scanInfo,
|
public IASTCompletionNode getCompletionNode(FileContent reader, IScannerInfo scanInfo,
|
||||||
IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset) throws CoreException {
|
IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset)
|
||||||
|
throws CoreException {
|
||||||
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
|
||||||
scanner.setContentAssistMode(offset);
|
scanner.setContentAssistMode(offset);
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
||||||
// use default model builder
|
// Use default model builder.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,16 @@ import java.net.URI;
|
||||||
*/
|
*/
|
||||||
public interface IIndexFileLocation {
|
public interface IIndexFileLocation {
|
||||||
/**
|
/**
|
||||||
* The URI of the indexed file
|
* The URI of the indexed file.
|
||||||
* @return the URI of the indexed file (non-null)
|
*
|
||||||
|
* @return the URI of the indexed file (non-{@code null})
|
||||||
*/
|
*/
|
||||||
public URI getURI();
|
public URI getURI();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the workspace relative path of the indexed file or null if the file
|
* Returns the workspace relative path of the indexed file or {@code null} if the file
|
||||||
* is not in the workspace
|
* is not in the workspace.
|
||||||
|
*
|
||||||
* @return the workspace relative path of the file in the index, or null if the
|
* @return the workspace relative path of the file in the index, or null if the
|
||||||
* file is not in the workspace
|
* file is not in the workspace
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ public interface IIndexFragmentInclude extends IIndexInclude {
|
||||||
IIndexFragment getFragment();
|
IIndexFragment getFragment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file that is included by this include. May return <code>null</code> in case
|
* Returns the file that is included by this include. May return {@code null} in case
|
||||||
* the included file is not part of this fragment.
|
* the included file is not part of this fragment.
|
||||||
*/
|
*/
|
||||||
IIndexFragmentFile getIncludes() throws CoreException;
|
IIndexFragmentFile getIncludes() throws CoreException;
|
||||||
|
|
|
@ -130,7 +130,8 @@ abstract class LocationCtx implements ILocationCtx {
|
||||||
* Returns the sequence of file locations spanning the given range.
|
* Returns the sequence of file locations spanning the given range.
|
||||||
* Assumes that the range starts within this context.
|
* Assumes that the range starts within this context.
|
||||||
*/
|
*/
|
||||||
public abstract void collectLocations(int sequenceNumber, int length, ArrayList<IASTNodeLocation> sofar);
|
public abstract void collectLocations(int sequenceNumber, int length,
|
||||||
|
ArrayList<IASTNodeLocation> sofar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for the dependency tree, add inclusion statements found in this context.
|
* Support for the dependency tree, add inclusion statements found in this context.
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all location contexts that can contain children.
|
* Base class for all location contexts that can contain children.
|
||||||
* <p>
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
class LocationCtxContainer extends LocationCtx {
|
class LocationCtxContainer extends LocationCtx {
|
||||||
|
@ -76,7 +76,7 @@ class LocationCtxContainer extends LocationCtx {
|
||||||
if (checkChildren && fChildren != null) {
|
if (checkChildren && fChildren != null) {
|
||||||
for (int i= fChildren.size() - 1; i >= 0; i--) {
|
for (int i= fChildren.size() - 1; i >= 0; i--) {
|
||||||
final LocationCtx child= fChildren.get(i);
|
final LocationCtx child= fChildren.get(i);
|
||||||
if (child.fEndOffsetInParent > offset) { // child was inserted behind the offset, adjust sequence number
|
if (child.fEndOffsetInParent > offset) { // Child was inserted behind the offset, adjust sequence number
|
||||||
result -= child.getSequenceLength();
|
result -= child.getSequenceLength();
|
||||||
} else {
|
} else {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class IndexerInputAdapter extends ASTFilePathResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given file should be indexed unconditionally.
|
* Checks whether the given file should be indexed unconditionally.
|
||||||
* @param location The Location of the file.
|
* @param location the location of the file.
|
||||||
* @return {@code true} if the file should be indexed unconditionally.
|
* @return {@code true} if the file should be indexed unconditionally.
|
||||||
*/
|
*/
|
||||||
public abstract boolean isIndexedUnconditionally(IIndexFileLocation location);
|
public abstract boolean isIndexedUnconditionally(IIndexFileLocation location);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -20,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.internal.core.CharOperation;
|
import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
|
|
||||||
public class TodoTaskParser {
|
public class TodoTaskParser {
|
||||||
private static final Task[] EMPTY_TASK_ARRAY = new Task[0];
|
private static final Task[] EMPTY_TASK_ARRAY = {};
|
||||||
|
|
||||||
private final char[][] tags;
|
private final char[][] tags;
|
||||||
private final int[] priorities;
|
private final int[] priorities;
|
||||||
|
@ -58,11 +57,12 @@ public class TodoTaskParser {
|
||||||
List<Task> tasks = new ArrayList<Task>();
|
List<Task> tasks = new ArrayList<Task>();
|
||||||
for (IASTComment comment : comments) {
|
for (IASTComment comment : comments) {
|
||||||
IASTFileLocation location = comment.getFileLocation();
|
IASTFileLocation location = comment.getFileLocation();
|
||||||
if (location != null) { // be defensive, bug 213307
|
if (location != null) { // Be defensive, bug 213307
|
||||||
final String fileName = location.getFileName();
|
final String fileName = location.getFileName();
|
||||||
final int nodeOffset = location.getNodeOffset();
|
final int nodeOffset = location.getNodeOffset();
|
||||||
final String key= fileName + ':' + nodeOffset;
|
final String key= fileName + ':' + nodeOffset;
|
||||||
// full indexer can yield duplicate comments, make sure to handle each comment only once (bug 287181)
|
// Full indexer can yield duplicate comments, make sure to handle each comment only
|
||||||
|
// once (bug 287181).
|
||||||
if (locKeys.add(key)) {
|
if (locKeys.add(key)) {
|
||||||
parse(comment.getComment(), fileName, nodeOffset,
|
parse(comment.getComment(), fileName, nodeOffset,
|
||||||
location.getStartingLineNumber(), tasks);
|
location.getStartingLineNumber(), tasks);
|
||||||
|
|
Loading…
Add table
Reference in a new issue