diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index b17827eb998..9838cfe81fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -2138,25 +2138,27 @@ public class CPPSemantics { if( useImplicit ){ ICPPFunctionType ftype = (ICPPFunctionType) ((ICPPFunction)fn).getType(); - IScope scope = fn.getScope(); - if( scope instanceof ICPPTemplateScope ) - scope = scope.getParent(); - ICPPClassType cls = null; - if( scope instanceof ICPPClassScope ){ - cls = ((ICPPClassScope)scope).getClassType(); - } else { - cls = new CPPClassType.CPPClassTypeProblem( scope.getPhysicalNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, fn.getNameCharArray() ); - } - if( cls instanceof ICPPClassTemplate ){ - cls = (ICPPClassType) CPPTemplates.instantiateWithinClassTemplate( (ICPPClassTemplate) cls ); - } - IType implicitType = cls; - if( ftype.isConst() || ftype.isVolatile() ){ - implicitType = new CPPQualifierType( implicitType, ftype.isConst(), ftype.isVolatile() ); - } - implicitType = new CPPReferenceType( implicitType ); - - result[0] = implicitType; + if (ftype != null) { + IScope scope = fn.getScope(); + if( scope instanceof ICPPTemplateScope ) + scope = scope.getParent(); + ICPPClassType cls = null; + if( scope instanceof ICPPClassScope ){ + cls = ((ICPPClassScope)scope).getClassType(); + } else { + cls = new CPPClassType.CPPClassTypeProblem( scope.getPhysicalNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, fn.getNameCharArray() ); + } + if( cls instanceof ICPPClassTemplate ){ + cls = (ICPPClassType) CPPTemplates.instantiateWithinClassTemplate( (ICPPClassTemplate) cls ); + } + IType implicitType = cls; + if( ftype.isConst() || ftype.isVolatile() ){ + implicitType = new CPPQualifierType( implicitType, ftype.isConst(), ftype.isVolatile() ); + } + implicitType = new CPPReferenceType( implicitType ); + + result[0] = implicitType; + } } for( int i = 0; i < params.length; i++ ) result = (IType[]) ArrayUtil.append( IType.class, result, params[i].getType() ); @@ -2260,7 +2262,11 @@ public class CPPSemantics { } else varArgs = true; - if( useImplicitObj && j == 0 && ((ICPPInternalFunction)currFn).isStatic( false ) ) { + if( useImplicitObj && j == 0 && + (currFn instanceof ICPPInternalFunction + ? ((ICPPInternalFunction)currFn).isStatic(false) + : currFn.isStatic()) + ) { //13.3.1-4 for static member functions, the implicit object parameter is considered to match any object cost = new Cost( source, target ); cost.rank = Cost.IDENTITY_RANK; //exact match, no cost diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java index f6a14452051..7457f65f0e9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java @@ -234,6 +234,7 @@ abstract class BaseScanner implements IScanner { } private static class EvalException extends Exception { + private static final long serialVersionUID = 0; public EvalException(String msg) { super(msg); } @@ -1296,7 +1297,7 @@ abstract class BaseScanner implements IScanner { locIncludePaths = einfo.getLocalIncludePath(); pushContext(reader.buffer, reader); - if (preIncludeFiles.hasNext()) + while (preIncludeFiles.hasNext()) pushForcedInclusion(); isInitialized = true; @@ -1383,8 +1384,6 @@ abstract class BaseScanner implements IScanner { bufferData[bufferStackPos] = null; --bufferStackPos; - if (preIncludeFiles.hasNext()) - pushForcedInclusion(); return result; } @@ -1639,7 +1638,7 @@ abstract class BaseScanner implements IScanner { // Return null to signify end of file protected IToken fetchToken() throws EndOfFileException { ++count; - contextLoop: while (bufferStackPos >= 0) { + while (bufferStackPos >= 0) { if (isCancelled == true) throw new ParseError( ParseError.ParseErrorKind.TIMEOUT_OR_CANCELLED); @@ -2165,7 +2164,7 @@ abstract class BaseScanner implements IScanner { int stringLen = 0; boolean escaped = false; boolean foundClosingQuote = false; - loop: while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) { + while (++bufferPos[bufferStackPos] < bufferLimit[bufferStackPos]) { ++stringLen; char c = buffer[bufferPos[bufferStackPos]]; if (c == '"') { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index c88026bdbea..97901952030 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -74,11 +74,13 @@ public class PDOMCPPClassType extends PDOMMemberOwner implements ICPPClassType, } public ICPPBase[] getBases() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return new ICPPBase[0]; } public ICPPConstructor[] getConstructors() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return new ICPPConstructor[0]; } public ICPPField[] getDeclaredFields() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java index c65fe749eca..31d7e50d655 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java @@ -72,7 +72,8 @@ public class PDOMCPPField extends PDOMMember implements ICPPField { } public IType getType() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return null; } public boolean isAuto() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java index a8bdf6f2a65..8f233e7ec01 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java @@ -59,7 +59,8 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction { } public IFunctionType getType() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return null; } public boolean isAuto() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java index 48e75fa4b93..35cae9825e7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java @@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; +import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField; @@ -155,7 +156,7 @@ public class PDOMCPPLinkage extends PDOMLinkage { } public PDOMBinding adaptBinding(IBinding binding) throws CoreException { - if (binding == null) + if (binding == null || binding instanceof IProblemBinding) return null; PDOMNode parent = getParent(binding); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java index 9ad3ed9244b..f02aaaa3e68 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -60,7 +60,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod { } public IParameter[] getParameters() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO - need some real parameters + return new IParameter[0]; } public IScope getFunctionScope() throws DOMException { @@ -68,11 +69,13 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod { } public IFunctionType getType() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return null; } public boolean isStatic() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return false; } public boolean isExtern() throws DOMException { @@ -88,7 +91,8 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod { } public boolean takesVarArgs() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return false; } public String[] getQualifiedName() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java index 232ed31642a..7aa9a572c4b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java @@ -44,7 +44,8 @@ public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable { } public IType getType() throws DOMException { - throw new PDOMNotImplementedError(); + // TODO + return null; } public boolean isAuto() throws DOMException {