Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-03-14 13:05:35 +0000
committerMarkus Schorn2008-03-14 13:05:35 +0000
commit7b37526690d506266ef6e17ecb65259dca28f6ab (patch)
treeab126263a78f56309dacc120e735bbb6c351f8c8 /core/org.eclipse.cdt.core/parser
parente5b6fb457b66f9391a326e6923d8e2d2cfed7151 (diff)
downloadorg.eclipse.cdt-7b37526690d506266ef6e17ecb65259dca28f6ab.tar.gz
org.eclipse.cdt-7b37526690d506266ef6e17ecb65259dca28f6ab.tar.xz
org.eclipse.cdt-7b37526690d506266ef6e17ecb65259dca28f6ab.zip
Open Declaration shows macros twice, bug 222597.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java57
1 files changed, 25 insertions, 32 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
index 121c2b8b8b6..e251b6e6657 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
@@ -535,44 +535,37 @@ public class CIndex implements IIndex {
}
private IIndexMacro[] findMacros(char[] name, boolean isPrefix, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
- if (SPECIALCASE_SINGLES && fFragments.length==1) {
+ // macros can be represented multiple times when a header is parsed in c- and c++ context,
+ // so there is no special case for indexes with single fragments.
+ if (monitor == null) {
+ monitor= new NullProgressMonitor();
+ }
+ List<IIndexMacro> result = new ArrayList<IIndexMacro>();
+ HashSet<IIndexFileLocation> handledIFLs= new HashSet<IIndexFileLocation>();
+ monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length);
+ for (int i = 0; i < fPrimaryFragmentCount; i++) {
+ HashSet<IIndexFile> allowedFiles= new HashSet<IIndexFile>();
try {
- return fFragments[0].findMacros(name, isPrefix, caseSensitive, filter, monitor);
- } catch (CoreException e) {
- CCorePlugin.log(e);
- return IIndexMacro.EMPTY_INDEX_MACRO_ARRAY;
- }
- } else {
- if (monitor == null) {
- monitor= new NullProgressMonitor();
- }
- List<IIndexMacro> result = new ArrayList<IIndexMacro>();
- HashSet<IIndexFileLocation> handledIFLs= new HashSet<IIndexFileLocation>();
- monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length);
- for (int i = 0; i < fPrimaryFragmentCount; i++) {
- HashSet<IIndexFile> allowedFiles= new HashSet<IIndexFile>();
- try {
- IIndexMacro[] macros= fFragments[i].findMacros(name, isPrefix, caseSensitive, filter, new SubProgressMonitor(monitor, 1));
- for (int k = 0; k < macros.length; k++) {
- IIndexMacro indexMacro = macros[k];
- IIndexFile file= indexMacro.getFile();
- if (!allowedFiles.contains(file)) {
- if (handledIFLs.add(file.getLocation())) {
- allowedFiles.add(file);
- }
- else {
- continue;
- }
+ IIndexMacro[] macros= fFragments[i].findMacros(name, isPrefix, caseSensitive, filter, new SubProgressMonitor(monitor, 1));
+ for (int k = 0; k < macros.length; k++) {
+ IIndexMacro indexMacro = macros[k];
+ IIndexFile file= indexMacro.getFile();
+ if (!allowedFiles.contains(file)) {
+ if (handledIFLs.add(file.getLocation())) {
+ allowedFiles.add(file);
+ }
+ else {
+ continue;
}
- result.add(indexMacro);
}
- } catch (CoreException e) {
- CCorePlugin.log(e);
+ result.add(indexMacro);
}
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
}
- monitor.done();
- return result.toArray(new IIndexMacro[result.size()]);
}
+ monitor.done();
+ return result.toArray(new IIndexMacro[result.size()]);
}
public long getCacheHits() {

Back to the top