diff options
author | Sergey Prigogin | 2016-12-29 04:56:32 +0000 |
---|---|---|
committer | Sergey Prigogin | 2016-12-29 17:59:36 +0000 |
commit | 216bc162a4a40286abb2a131a62e8d65288a6050 (patch) | |
tree | 7a47ab44890547b405fb10aedeadc28252c7cf9c /core/org.eclipse.cdt.core | |
parent | 63d3ab9cbe4ee3aa1e81cf5ac691f5256fcb0e39 (diff) | |
download | org.eclipse.cdt-216bc162a4a40286abb2a131a62e8d65288a6050.tar.gz org.eclipse.cdt-216bc162a4a40286abb2a131a62e8d65288a6050.tar.xz org.eclipse.cdt-216bc162a4a40286abb2a131a62e8d65288a6050.zip |
Bug 509749 - Find References doesn't find a reference to a function
Change-Id: Id90a80e234638b590266a8671dd1bf13178e0f94
Diffstat (limited to 'core/org.eclipse.cdt.core')
14 files changed, 138 insertions, 80 deletions
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF index cfd08eca523..9187ac3c88a 100644 --- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true -Bundle-Version: 6.2.0.qualifier +Bundle-Version: 6.3.0.qualifier Bundle-Activator: org.eclipse.cdt.core.CCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILanguage.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILanguage.java index 2f07b1a22fb..c177b1f6c4c 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILanguage.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILanguage.java @@ -41,7 +41,7 @@ public interface ILanguage extends IAdaptable { public final static int OPTION_SKIP_FUNCTION_BODIES= 0x1; /** - * @deprecated, has no effect. + * @deprecated, Has no effect. * @noreference This field is not intended to be referenced by clients. */ @Deprecated @@ -55,10 +55,9 @@ public interface ILanguage extends IAdaptable { public final static int OPTION_NO_IMAGE_LOCATIONS= 0x4; /** - * Option for {@link #getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)} - * Marks the ast as being based on a source-file rather than a header-file. This makes a difference - * when bindings from the AST are used for searching the index, e.g. for static variables. + * @deprecated, Has no effect. */ + @Deprecated public final static int OPTION_IS_SOURCE_UNIT= 0x8; /** @@ -97,22 +96,20 @@ public interface ILanguage extends IAdaptable { public int getLinkageID(); /** - * @return the human readable name corresponding to this language, suitable for display. + * Returns the human readable name corresponding to this language, suitable for display. * @since 4.0 */ public String getName(); /** - * Construct an AST for the source code provided by <code>reader</code>. - * As an option you can supply + * Constructs an AST for the source code provided by <code>reader</code>. + * * @param content source code to be parsed. * @param scanInfo provides include paths and defined symbols. * @param fileCreator factory that provides file content for files included - * @param index (optional) index to use to lookup symbols external to the tu. - * @param options A combination of - * {@link #OPTION_SKIP_FUNCTION_BODIES}, - * {@link #OPTION_NO_IMAGE_LOCATIONS}, {@link #OPTION_IS_SOURCE_UNIT}, - * or <code>0</code>. + * @param index (optional) index to use to lookup symbols external to the translation unit. + * @param options A combination of {@link #OPTION_SKIP_FUNCTION_BODIES}, + * {@link #OPTION_NO_IMAGE_LOCATIONS}, or <code>0</code>. * @param log logger * @return an AST for the source code provided by reader. * @throws CoreException diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java index 5b5f0f99b89..43418911ebd 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java @@ -864,9 +864,6 @@ public class TranslationUnit extends Openable implements ITranslationUnit { if ((style & AST_PARSE_INACTIVE_CODE) != 0) { options |= ILanguage.OPTION_PARSE_INACTIVE_CODE; } - if (isSourceUnit()) { - options |= ILanguage.OPTION_IS_SOURCE_UNIT; - } final IParserLogService log; if (monitor instanceof ICanceler) { log= new ParserLogService(DebugLogConstants.PARSER, (ICanceler) monitor); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractCLikeLanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractCLikeLanguage.java index 15ee4e1d952..283398f2088 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractCLikeLanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractCLikeLanguage.java @@ -164,9 +164,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements try { // Parse - IASTTranslationUnit ast= parser.parse(); - ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0); - return ast; + return parser.parse(); } catch (ParseError e) { // Only the TOO_MANY_TOKENS error can be handled here. if (e.getErrorKind() != ParseErrorKind.TOO_MANY_TOKENS) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java index 8594ace9c3c..d8ec351a596 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java @@ -77,6 +77,7 @@ public abstract class FileContent { /** * Creates a file content object for a fixed buffer. + * * @param filePath the path of the file as it will appear in {@link IASTFileLocation#getFileName()} * @param contents the actual content. */ @@ -85,22 +86,44 @@ public abstract class FileContent { } /** + * Creates a file content object for a fixed buffer. + * + * @param filePath the path of the file as it will appear in {@link IASTFileLocation#getFileName()} + * @param contents the actual content. + * @since 6.3 + */ + public static FileContent create(String filePath, boolean isSource, char[] contents) { + InternalFileContent fileContent = new InternalFileContent(filePath, new CharArray(contents)); + fileContent.setIsSource(isSource); + return fileContent; + } + + /** * Creates a file content object for a translation-unit, which may be a working copy. */ public static FileContent create(ITranslationUnit tu) { + InternalFileContent fileContent; + IPath location= tu.getLocation(); - if (location == null) - return create(tu.getElementName(), tu.getContents()); - - if (tu.isWorkingCopy()) { - return create(location.toOSString(), tu.getContents()); + if (location == null) { + fileContent = new InternalFileContent(tu.getElementName(), new CharArray(tu.getContents())); + } else if (tu.isWorkingCopy()) { + fileContent = new InternalFileContent(location.toOSString(), new CharArray(tu.getContents())); + } else { + IResource res= tu.getResource(); + if (res instanceof IFile) { + fileContent = InternalParserUtil.createWorkspaceFileContent((IFile) res); + } else { + fileContent = InternalParserUtil.createExternalFileContent(location.toOSString(), + InternalParserUtil.SYSTEM_DEFAULT_ENCODING); + } } - - IResource res= tu.getResource(); - if (res instanceof IFile) { - return create((IFile) res); + + if (fileContent != null) { + fileContent.setTranslationUnit(tu); + fileContent.setIsSource(tu.isSourceUnit()); } - return createForExternalFileLocation(location.toOSString()); + return fileContent; } /** @@ -111,22 +134,37 @@ public abstract class FileContent { } /** - * Creates a file content for a workspace file + * Creates a file content for a workspace header file. */ public static FileContent create(IFile file) { return InternalParserUtil.createWorkspaceFileContent(file); } + /** + * Creates a file content object for a header file that is not part of the workspace. + */ public static FileContent createForExternalFileLocation(String fileLocation) { return createForExternalFileLocation(fileLocation, InternalParserUtil.SYSTEM_DEFAULT_ENCODING); } /** - * Creates a file content object for a file location that is not part of the workspace + * Creates a file content object for a header file that is not part of the workspace. * @since 5.3 */ public static FileContent createForExternalFileLocation(String fileLocation, String encoding) { - return InternalParserUtil.createExternalFileContent(fileLocation, encoding); + return createForExternalFileLocation(fileLocation, false, encoding); + } + + /** + * Creates a file content object for a header or a source file that is not part of the workspace. + * @since 6.3 + */ + public static FileContent createForExternalFileLocation(String fileLocation, boolean isSource, + String encoding) { + InternalFileContent fileContent = InternalParserUtil.createExternalFileContent(fileLocation, encoding); + if (fileContent != null) + fileContent.setIsSource(isSource); + return fileContent; } /** diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java index ecaf2757a1f..7d0baaca3ce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java @@ -19,7 +19,7 @@ import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver; import org.eclipse.cdt.internal.core.parser.scanner.Lexer; /** - * Interface between the parser and the preprocessor. + * Interface between the parser and the preprocessor. * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -27,7 +27,7 @@ import org.eclipse.cdt.internal.core.parser.scanner.Lexer; public interface IScanner { /** * Returns a map from {@link String} to {@link IMacroBinding} containing - * all the definitions that are defined at the current point in the + * all the definitions that are defined at the current point in the * process of scanning. */ public Map<String, IMacroBinding> getMacroDefinitions(); @@ -38,25 +38,27 @@ public interface IScanner { * @throws OffsetLimitReachedException see {@link Lexer}. */ public IToken nextToken() throws EndOfFileException; - + /** - * Returns <code>true</code>, whenever we are processing the outermost file of the translation unit. + * Returns {@code true}, whenever we are processing the outermost file of the translation unit. */ public boolean isOnTopContext(); - + /** * Attempts to cancel the scanner. */ public void cancel(); - + /** * Returns the location resolver associated with this scanner. + * * @noreference This method is not intended to be referenced by clients. */ public ILocationResolver getLocationResolver(); - + /** * Puts the scanner into content assist mode. + * * @noreference This method is not intended to be referenced by clients. */ public void setContentAssistMode(int offset); @@ -64,25 +66,26 @@ public interface IScanner { /** * Instructs the scanner to split tokens of kind {@link IToken#tSHIFTR} into two tokens of * kind {@link IToken#tGT_in_SHIFTR}. + * * @noreference This method is not intended to be referenced by clients. */ public void setSplitShiftROperator(boolean val); - + /** - * Turns on/off creation of image locations. + * Turns on/off creation of image locations. * @see org.eclipse.cdt.core.dom.ast.IASTName#getImageLocation() + * * @noreference This method is not intended to be referenced by clients. * @since 5.0 */ public void setComputeImageLocations(boolean val); /** - * Turns on/off tracking if exported included files. + * Turns on/off tracking if exported included files. * @see org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement#isIncludedFileExported() * @see IncludeExportPatterns * - * @param patterns if not {{@code null}, include export tracking is enabled, otherwise it is - * disabled + * @param patterns if not {@code null}, include export tracking is enabled, otherwise it is disabled * * @noreference This method is not intended to be referenced by clients. * @since 5.5 @@ -93,14 +96,16 @@ public interface IScanner { * Toggles generation of tokens for inactive code branches. When turned on, * each inactive code branch is preceded by a token of kind {@link IToken#tINACTIVE_CODE_START} and * succeeded by one of kind {@link IToken#tINACTIVE_CODE_END}. - * + * * @noreference This method is not intended to be referenced by clients. */ public void setProcessInactiveCode(boolean val); /** - * When in inactive code, skips all tokens up to the end of the inactive code section. - * <p> Note, token after calling this method may be another token of type {@link IToken#tINACTIVE_CODE_START}. + * When in inactive code, skips all tokens up to the end of the inactive code section. + * <p> Note, token after calling this method may be another token of type + * {@link IToken#tINACTIVE_CODE_START}. + * * @noreference This method is not intended to be referenced by clients. */ public void skipInactiveCode() throws OffsetLimitReachedException; @@ -109,21 +114,23 @@ public interface IScanner { * Returns the current nesting in code branches. * @see IInactiveCodeToken#getOldNesting() * @see IInactiveCodeToken#getNewNesting() + * * @noreference This method is not intended to be referenced by clients. */ public int getCodeBranchNesting(); - - /** - * @deprecated Has no effect. - * @noreference This method is not intended to be referenced by clients. - */ - @Deprecated - public void setScanComments(boolean val); - + /** * Returns a list of additional (compiler specific) suffixes which can * be placed on numbers. e.g. 'u' 'l' -> 1l or 1u. + * * @noreference This method is not intended to be referenced by clients. */ public char[] getAdditionalNumericLiteralSuffixes(); + + /** + * @deprecated Has no effect. + * @noreference This method is not intended to be referenced by clients. + */ + @Deprecated + public default void setScanComments(boolean val) {} } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java index 66f5668cb76..e0309e78031 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.dom.parser.c; import org.eclipse.cdt.core.dom.ILinkage; +import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; @@ -506,4 +507,14 @@ public class CFunction extends PlatformObject implements IFunction, ICInternalFu } return null; } + + /** For debugging only. */ + @Override + public String toString() { + StringBuilder result = new StringBuilder(); + result.append(getName()); + IFunctionType t = getType(); + result.append(t != null ? ASTTypeUtil.getParameterTypeStringAndQualifiers(t) : "()"); //$NON-NLS-1$ + return result.toString(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java index bfb27578ae8..4a81d8f03b4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java @@ -447,7 +447,10 @@ public class CNodeFactory extends NodeFactory implements ICNodeFactory { if (scanner != null) { tu.setLocationResolver(scanner.getLocationResolver()); if (scanner instanceof CPreprocessor) { - tu.setIsForContentAssist(((CPreprocessor) scanner).isContentAssistMode()); + CPreprocessor cPreprocessor = (CPreprocessor) scanner; + tu.setIsForContentAssist(cPreprocessor.isContentAssistMode()); + tu.setOriginatingTranslationUnit(cPreprocessor.getTranslationUnit()); + tu.setIsHeaderUnit(!cPreprocessor.isSource()); } } tu.setASTNodeFactory(this); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java index 3712859eaee..2492e217808 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java @@ -770,7 +770,10 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory { if (scanner != null) { tu.setLocationResolver(scanner.getLocationResolver()); if (scanner instanceof CPreprocessor) { - tu.setIsForContentAssist(((CPreprocessor) scanner).isContentAssistMode()); + CPreprocessor cPreprocessor = (CPreprocessor) scanner; + tu.setIsForContentAssist(cPreprocessor.isContentAssistMode()); + tu.setOriginatingTranslationUnit(cPreprocessor.getTranslationUnit()); + tu.setIsHeaderUnit(!cPreprocessor.isSource()); } } tu.setASTNodeFactory(this); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java index e38fe25da9a..201168d4062 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java @@ -166,18 +166,17 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter { String stu = tu.toString(); String fileEncoding = getFileEncoding(stu); - return FileContent.createForExternalFileLocation(stu, fileEncoding); + return FileContent.createForExternalFileLocation(stu, isSource(stu), fileEncoding); } public String getFileEncoding(String stu) { String fileEncoding = null; - // query file's encoding, if we find it and use it to create CodeReader + // Query file's encoding, if we find it and use it to create CodeReader FileEncodingRegistry fileEncodingRegistry = fIndexer.getFileEncodingRegistry(); - if(fileEncodingRegistry != null){ + if (fileEncodingRegistry != null) fileEncoding = fileEncodingRegistry.getFileEncoding(stu); - } if (fileEncoding == null) - return InternalParserUtil.SYSTEM_DEFAULT_ENCODING; + fileEncoding = InternalParserUtil.SYSTEM_DEFAULT_ENCODING; return fileEncoding; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java index ed9673134bc..9198bbbfbc9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java @@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.IFileNomination; import org.eclipse.cdt.core.dom.ast.IMacroBinding; import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration; import org.eclipse.cdt.core.index.IIndexMacro; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.parser.AbstractParserLogService; import org.eclipse.cdt.core.parser.EndOfFileException; import org.eclipse.cdt.core.parser.ExtendedScannerInfo; @@ -262,7 +263,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { private final ScannerContext fRootContext; protected ScannerContext fCurrentContext; - private boolean isCancelled= false; + private boolean isCancelled; private boolean fIsFirstFetchToken= true; private Token fPrefetchedTokens; @@ -273,8 +274,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { // Detection of include guards used around an include directive private char[] fExternIncludeGuard; - private Set<String> fTracedGuards; - + private Set<String> fTracedGuards; public CPreprocessor(FileContent fileContent, IScannerInfo info, ParserLanguage language, IParserLogService log, IScannerExtensionConfiguration configuration, @@ -386,8 +386,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable { fRootContext.setParseInactiveCode(val); } - @Override - public void setScanComments(boolean val) { + public ITranslationUnit getTranslationUnit() { + return fRootContent.getTranslationUnit(); + } + + public boolean isSource() { + return fRootContent.isSource(); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java index 77b0c0a27c6..798b4c1c545 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java @@ -16,6 +16,7 @@ import java.util.List; import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective; import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexMacro; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.parser.FileContent; import org.eclipse.cdt.core.parser.ISignificantMacros; @@ -56,6 +57,7 @@ public class InternalFileContent extends FileContent { private final List<FileVersion> fNonPragmaOnceFiles; private boolean fHeuristic; private boolean fIsSource; + private ITranslationUnit fTranslationUnit; private List<IIndexFile> fFiles; private IncludeSearchPathElement fFoundOnPath; private final long fTimestamp; @@ -246,6 +248,14 @@ public class InternalFileContent extends FileContent { fIsSource= isSource; } + public ITranslationUnit getTranslationUnit() { + return fTranslationUnit; + } + + public void setTranslationUnit(ITranslationUnit tu) { + fTranslationUnit = tu; + } + public IncludeSearchPathElement getFoundOnPath() { return fFoundOnPath; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index 95dcb4ad34f..a56cef418d7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -53,7 +53,6 @@ import org.eclipse.cdt.core.index.IPDOMASTProcessor; import org.eclipse.cdt.core.index.IndexLocationFactory; import org.eclipse.cdt.core.model.AbstractLanguage; import org.eclipse.cdt.core.model.ILanguage; -import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.parser.ExtendedScannerInfo; import org.eclipse.cdt.core.parser.FileContent; import org.eclipse.cdt.core.parser.IParserLogService; @@ -63,7 +62,6 @@ import org.eclipse.cdt.core.parser.ISignificantMacros; import org.eclipse.cdt.core.parser.IncludeExportPatterns; import org.eclipse.cdt.core.parser.IncludeFileContentProvider; import org.eclipse.cdt.internal.core.dom.IIncludeFileResolutionHeuristics; -import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit; import org.eclipse.cdt.internal.core.index.FileContentKey; import org.eclipse.cdt.internal.core.index.IIndexFragment; import org.eclipse.cdt.internal.core.index.IIndexFragmentFile; @@ -1088,19 +1086,15 @@ public abstract class AbstractIndexerTask extends PDOMWriter { progress.subTask(getMessage(MessageKind.parsingFileTask, path.lastSegment(), path.removeLastSegments(1).toString())); FileContent codeReader= fResolver.getCodeReader(tu); - final boolean isSource = fResolver.isSourceUnit(tu); long start= System.currentTimeMillis(); ASTTypeUtil.startTranslationUnit(); IASTTranslationUnit ast= - createAST(lang, codeReader, scanInfo, isSource, fASTOptions, ctx, progress.split(10)); + createAST(lang, codeReader, scanInfo, fASTOptions, ctx, progress.split(10)); fStatistics.fParsingTime += System.currentTimeMillis() - start; if (ast == null) { ++fStatistics.fTooManyTokensCount; } else { - // Give the new AST a chance to recognize its translation unit before it is written - // to the index. - ((ASTTranslationUnit) ast).setOriginatingTranslationUnit((ITranslationUnit) tu); writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, progress.split(10)); resultCacheCleared = true; // The cache was cleared while writing to the index. } @@ -1204,14 +1198,11 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } private final IASTTranslationUnit createAST(AbstractLanguage language, FileContent codeReader, - IScannerInfo scanInfo, boolean isSource, int options, - FileContext ctx, IProgressMonitor monitor) throws CoreException { + IScannerInfo scanInfo, int options, FileContext ctx, IProgressMonitor monitor) + throws CoreException { if (codeReader == null) { return null; } - if (isSource) { - options |= ILanguage.OPTION_IS_SOURCE_UNIT; - } if (fTranslationUnitSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fTranslationUnitSizeLimit) { if (fShowActivity) { trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/pom.xml b/core/org.eclipse.cdt.core/pom.xml index 5ae406875be..0204b6ad6eb 100644 --- a/core/org.eclipse.cdt.core/pom.xml +++ b/core/org.eclipse.cdt.core/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>6.2.0-SNAPSHOT</version> + <version>6.3.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.core</artifactId> <packaging>eclipse-plugin</packaging> </project> |