summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Ostroukhov2012-08-23 18:09:32 (EDT)
committer Sergey Prigogin2013-01-16 13:00:18 (EST)
commit86db9926861d03fa1b661faa70b597c653e4b63b (patch)
treeb394661662fa4bbffd045151c63fb7ebd89e3578
parent8f33175f15993fa11803cfc510fa76b18e08abea (diff)
downloadorg.eclipse.cdt-86db9926861d03fa1b661faa70b597c653e4b63b.zip
org.eclipse.cdt-86db9926861d03fa1b661faa70b597c653e4b63b.tar.gz
org.eclipse.cdt-86db9926861d03fa1b661faa70b597c653e4b63b.tar.bz2
Bug 387935 - Codan does not see symbols from pre-built indexes
This change fixes: 1. Codan no longer shows errors on symbols from pre-built indexes 2. Mark occurances in the editor no properly recognizes occurances of the same symbol. Change-Id: I1f3b347524a89f7a4c11b128f15f8fdcffe2afdf Reviewed-on: https://git.eclipse.org/r/7388 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTCache.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFactory.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java4
-rw-r--r--core/org.eclipse.cdt.core/schema/CIndex.exsd7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoringContext.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessor.java4
8 files changed, 32 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTCache.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTCache.java
index 8bfe0fd..9b6b627 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTCache.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTCache.java
@@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
@@ -204,7 +205,8 @@ public class ASTCache {
ASTRunnable astRunnable) {
IIndex index;
try {
- index = CCorePlugin.getIndexManager().getIndex(tUnit.getCProject());
+ index = CCorePlugin.getIndexManager().getIndex(tUnit.getCProject(),
+ IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
index.acquireReadLock();
} catch (CoreException e) {
return e.getStatus();
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
index 5f1c040..4768c48 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder2.java
@@ -121,7 +121,8 @@ public class CModelBuilder2 implements IContributedModelBuilder {
@Override
public void parse(boolean quickParseMode) throws Exception {
final IIndexManager indexManager= CCorePlugin.getIndexManager();
- IIndex index= indexManager.getIndex(fTranslationUnit.getCProject());
+ IIndex index = indexManager.getIndex(fTranslationUnit.getCProject(),
+ IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
try {
if (index != null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java
index ef65bc7..f8bf7b4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java
@@ -111,6 +111,15 @@ public interface IIndexManager extends IPDOMManager {
* @since 5.4
*/
public static final int ADD_EXTENSION_FRAGMENTS_SEARCH = 0x200;
+
+ /**
+ * Constant for passing to getIndex methods. This constant, when set, indicates that each index
+ * content provided via the ReadOnlyIndexFragmentProvider or ReadOnlyPDOMProvider, which is not
+ * disabled for the editor shall be included in the resulting index.
+ *
+ * @since 5.5
+ */
+ public static final int ADD_EXTENSION_FRAGMENTS_EDITOR = 0x400;
/**
* Constant for indicating that there is no time out period for joining the indexer job.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFactory.java
index d1bae72..24e520b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexFactory.java
@@ -47,7 +47,8 @@ public class IndexFactory {
private static final int ALL_FRAGMENT_OPTIONS = ADD_EXTENSION_FRAGMENTS_ADD_IMPORT
| ADD_EXTENSION_FRAGMENTS_CALL_HIERARCHY | ADD_EXTENSION_FRAGMENTS_CONTENT_ASSIST
| ADD_EXTENSION_FRAGMENTS_INCLUDE_BROWSER | ADD_EXTENSION_FRAGMENTS_NAVIGATION
- | ADD_EXTENSION_FRAGMENTS_SEARCH | ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY;
+ | ADD_EXTENSION_FRAGMENTS_SEARCH | ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY
+ | ADD_EXTENSION_FRAGMENTS_EDITOR;
private PDOMManager fPDOMManager;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java
index c073bc0..c8aceb7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java
@@ -76,7 +76,8 @@ public final class IndexProviderManager implements IElementChangedListener {
ATTRIBUTE_CALL_HIERARCHY = "call_hierarchy",
ATTRIBUTE_TYPE_HIERARCHY = "type_hierarchy",
ATTRIBUTE_INCLUDE_BROWSER = "include_browser",
- ATTRIBUTE_SEARCH = "search";
+ ATTRIBUTE_SEARCH = "search",
+ ATTRIBUTE_EDITOR = "editor";
private IIndexFragmentProvider[] fragmentProviders;
@@ -171,6 +172,7 @@ public final class IndexProviderManager implements IElementChangedListener {
result |= getOption(elem, ATTRIBUTE_NAVIGATION, IIndexManager.ADD_EXTENSION_FRAGMENTS_NAVIGATION);
result |= getOption(elem, ATTRIBUTE_SEARCH, IIndexManager.ADD_EXTENSION_FRAGMENTS_SEARCH);
result |= getOption(elem, ATTRIBUTE_TYPE_HIERARCHY, IIndexManager.ADD_EXTENSION_FRAGMENTS_TYPE_HIERARCHY);
+ result |= getOption(elem, ATTRIBUTE_EDITOR, IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
return result;
}
diff --git a/core/org.eclipse.cdt.core/schema/CIndex.exsd b/core/org.eclipse.cdt.core/schema/CIndex.exsd
index 1373144..67a8dc2 100644
--- a/core/org.eclipse.cdt.core/schema/CIndex.exsd
+++ b/core/org.eclipse.cdt.core/schema/CIndex.exsd
@@ -258,6 +258,13 @@ The only information needed for this extension point is the fully qualified name
</documentation>
</annotation>
</attribute>
+ <attribute name="editor" type="boolean" use="optional">
+ <annotation>
+ <documentation>
+ Whether the fragment provider shall be used for C/C++ editor.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoringContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoringContext.java
index 9dc38f5..c162686 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoringContext.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoringContext.java
@@ -21,6 +21,7 @@ import org.eclipse.ltk.core.refactoring.RefactoringContext;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -113,7 +114,8 @@ public class CRefactoringContext extends RefactoringContext {
throw new IllegalStateException("CRefactoringContext is already disposed."); //$NON-NLS-1$
if (fIndex == null) {
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
- IIndex index = CCorePlugin.getIndexManager().getIndex(projects);
+ IIndex index = CCorePlugin.getIndexManager().getIndex(projects,
+ IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
try {
index.acquireReadLock();
} catch (InterruptedException e) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessor.java
index 408c225..14891cd 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameProcessor.java
@@ -39,6 +39,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
@@ -305,7 +306,8 @@ public class CRenameProcessor extends RenameProcessor {
if (indexLockCount == 0) {
if (fIndex == null) {
ICProject[] projects= CoreModel.getDefault().getCModel().getCProjects();
- fIndex= CCorePlugin.getIndexManager().getIndex(projects);
+ fIndex = CCorePlugin.getIndexManager().getIndex(projects,
+ IIndexManager.ADD_EXTENSION_FRAGMENTS_EDITOR);
}
fIndex.acquireReadLock();
}