Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-03-18 00:04:51 +0000
committerMarkus Schorn2008-03-18 00:04:51 +0000
commit868da804e7bb2dfe470e79927d40d2f9e9545c56 (patch)
tree09c3d3a79bc317b902d987767821002196dc077b /core/org.eclipse.cdt.core/parser
parent366bb49c07df5427acebeaadb913d03c3ce5a891 (diff)
downloadorg.eclipse.cdt-868da804e7bb2dfe470e79927d40d2f9e9545c56.tar.gz
org.eclipse.cdt-868da804e7bb2dfe470e79927d40d2f9e9545c56.tar.xz
org.eclipse.cdt-868da804e7bb2dfe470e79927d40d2f9e9545c56.zip
Fixes a CCE, bug 223020.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTypedef.java34
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java11
2 files changed, 35 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTypedef.java
index d225db0ff6a..aa7a046c648 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTypedef.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTypedef.java
@@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.Linkage;
@@ -34,10 +35,11 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
private IASTName[] declarations = null;
private IType type = null;
- /**
- * @param declarator
- */
public CPPTypedef(IASTName name) {
+ // bug 223020 even though qualified names are not legal, we need to deal with them.
+ if (name != null && name.getParent() instanceof ICPPASTQualifiedName) {
+ name= (IASTName) name.getParent();
+ }
this.declarations = new IASTName[] { name };
if (name != null)
name.setBinding(this);
@@ -95,14 +97,23 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
public String getName() {
- return declarations[0].toString();
+ return getSimpleName().toString();
+ }
+
+ private IASTName getSimpleName() {
+ IASTName name= declarations[0];
+ if (name instanceof ICPPASTQualifiedName) {
+ IASTName[] na= ((ICPPASTQualifiedName) name).getNames();
+ name= na[na.length-1];
+ }
+ return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
public char[] getNameCharArray() {
- return declarations[0].toCharArray();
+ return getSimpleName().toCharArray();
}
/* (non-Javadoc)
@@ -160,9 +171,18 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
public void addDeclaration(IASTNode node) {
- if (!(node instanceof IASTName))
+ IASTName name;
+ if (node instanceof IASTName) {
+ if (node.getParent() instanceof ICPPASTQualifiedName) {
+ name= (IASTName) node.getParent();
+ }
+ else {
+ name= (IASTName) node;
+ }
+ }
+ else {
return;
- IASTName name = (IASTName) node;
+ }
if (declarations == null) {
declarations = new IASTName[] { name };
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 a2a01509eb6..8e3e43a75da 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
@@ -51,6 +51,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
/**
* Task for the actual indexing. Various indexers need to implement the abstract methods.
@@ -697,14 +698,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
}
private void swallowError(IPath file, Throwable e) throws CoreException {
+ IStatus s;
if (e instanceof CoreException) {
- CCorePlugin.log(((CoreException) e).getStatus());
+ s= ((CoreException) e).getStatus();
+ if (s.getException() == null) {
+ s= new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e);
+ }
}
else {
- IStatus status= CCorePlugin.createStatus(
+ s= CCorePlugin.createStatus(
MessageFormat.format(Messages.AbstractIndexerTask_errorWhileParsing, new Object[]{file}), e);
- CCorePlugin.log(status);
}
+ CCorePlugin.log(s);
if (++fStatistics.fErrorCount > MAX_ERRORS) {
throw new CoreException(CCorePlugin.createStatus(Messages.AbstractIndexerTask_tooManyIndexProblems));
}

Back to the top