Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-02-20 10:17:23 +0000
committerMarkus Schorn2008-02-20 10:17:23 +0000
commitb6d7d0cd9ce53a5916d7a06eefa0787043065e48 (patch)
treec5c199b0bd5777ee71d90f2e450ba672036f41e3 /core/org.eclipse.cdt.core/parser
parent6c826b38420a8b645fa4aabecb80ac56f149c0ca (diff)
downloadorg.eclipse.cdt-b6d7d0cd9ce53a5916d7a06eefa0787043065e48.tar.gz
org.eclipse.cdt-b6d7d0cd9ce53a5916d7a06eefa0787043065e48.tar.xz
org.eclipse.cdt-b6d7d0cd9ce53a5916d7a06eefa0787043065e48.zip
Added search for unresolved includes, bug 213561.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java6
7 files changed, 47 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
index ce498984c27..9c04705405d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,6 @@
* Rational Software - initial implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
-
package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
@@ -44,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
+import org.eclipse.cdt.internal.core.dom.parser.ASTProblem;
/**
* This is a utility class to help convert AST elements to Strings corresponding
@@ -1079,4 +1079,10 @@ public class ASTSignatureUtil {
return result;
}
+ /**
+ * Returns the same message as {@link IASTProblem#getMessageWithoutLocation()}.
+ */
+ public static String getProblemMessage(int problemID, String detail) {
+ return ASTProblem.getMessageWithoutLocation(problemID, detail);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java
index 01997cbac61..9ec6ba390c2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java
@@ -10,7 +10,6 @@
* Andrew Ferguson (Symbian)
* Bryan Wilkinson (QNX)
*******************************************************************************/
-
package org.eclipse.cdt.core.index;
import java.util.regex.Pattern;
@@ -363,4 +362,10 @@ public interface IIndex {
* Creates a file-set that can be used with this index as long as you hold a read-lock.
*/
public IIndexFileSet createFileSet();
+
+ /**
+ * Returns an array of all files that are part of this index. If a file is parsed in two
+ * linkages, or in multiple fragments only one of the files will be returned.
+ */
+ public IIndexFile[] getAllFiles() throws CoreException;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
index aec81fade78..f8a32b57dc0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
@@ -78,16 +78,20 @@ public class ASTProblem extends ASTNode implements IASTProblem {
return ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
}
- public String getMessageWithoutLocation() {
+ public static String getMessageWithoutLocation(int id, String arg) {
String msg = errorMessages.get(new Integer(id));
if (msg == null)
msg = ""; //$NON-NLS-1$
if (arg != null) {
- return MessageFormat.format(msg, new Object[] { new String(arg) });
+ return MessageFormat.format(msg, arg);
}
return msg;
}
+
+ public String getMessageWithoutLocation() {
+ return getMessageWithoutLocation(id, arg == null ? null : new String(arg));
+ }
public boolean checkCategory(int bitmask) {
return ((id & bitmask) != 0);
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 62d0dc7c4ed..de71ba24962 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
@@ -476,9 +476,11 @@ public class CIndex implements IIndex {
private IndexFilter retargetFilter(final ILinkage linkage, final IndexFilter filter) {
return new IndexFilter() {
+ @Override
public boolean acceptBinding(IBinding binding) throws CoreException {
return filter.acceptBinding(binding);
}
+ @Override
public boolean acceptLinkage(ILinkage other) {
return linkage.getLinkageID() == other.getLinkageID();
}
@@ -586,4 +588,14 @@ public class CIndex implements IIndex {
public IIndexFileSet createFileSet() {
return new IndexFileSet();
}
+
+ public IIndexFile[] getAllFiles() throws CoreException {
+ HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<IIndexFileLocation, IIndexFile>();
+ for (IIndexFragment ifrag : fFragments) {
+ for (IIndexFragmentFile iff : ifrag.getAllFiles()) {
+ result.put(iff.getLocation(), iff);
+ }
+ }
+ return result.values().toArray(new IIndexFile[result.size()]);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
index 2122c44a9a5..d42b9b36330 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
@@ -130,4 +130,8 @@ final public class EmptyCIndex implements IIndex {
public IIndexFileSet createFileSet() {
return new IndexFileSet();
}
+
+ public IIndexFile[] getAllFiles() {
+ return IIndexFile.EMPTY_FILE_ARRAY;
+ }
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
index 1d222a62dde..e09760934ea 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
@@ -232,4 +232,9 @@ public interface IIndexFragment {
* @since 5.0
*/
IIndexFragmentFileSet createFileSet();
+
+ /**
+ * @return an array of all files contained in this index.
+ */
+ IIndexFragmentFile[] getAllFiles() throws CoreException;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
index 9de69867b84..9dd5700c700 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
@@ -223,4 +223,10 @@ public class PDOMProxy implements IPDOM {
public IIndexFragmentFileSet createFileSet() {
return new PDOMFileSet();
}
+
+ public synchronized IIndexFragmentFile[] getAllFiles() throws CoreException {
+ if (fDelegate != null)
+ return fDelegate.getAllFiles();
+ return IIndexFragmentFile.EMPTY_ARRAY;
+ }
}

Back to the top