diff options
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java')
-rw-r--r-- | core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java index daf282b6106..88f0d3b79d8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java @@ -8,12 +8,11 @@ * Contributors: * Markus Schorn - initial API and implementation * Sergey Prigogin (Google) + * Nathan Ridge *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; @@ -30,19 +29,32 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPFuncti private static final ICPPFunctionType FUNCTION_TYPE= new CPPFunctionType(ProblemType.UNKNOWN_FOR_EXPRESSION, IType.EMPTY_TYPE_ARRAY); - public static ICPPFunction createForSample(IFunction sample) throws DOMException { - if (sample instanceof ICPPConstructor) - return new CPPUnknownConstructor(((ICPPConstructor) sample).getClassOwner()); + /** + * Creates a CPPDeferredFunction given a set of overloaded functions + * (some of which may be templates) that the function might resolve to. + * At least one candidate must be provided. + * @param candidates a set of overloaded functions, some of which may be templates + * @return the constructed CPPDeferredFunction + */ + public static ICPPFunction createForCandidates(ICPPFunction... candidates) { + if (candidates[0] instanceof ICPPConstructor) + return new CPPUnknownConstructor(((ICPPConstructor) candidates[0]).getClassOwner(), candidates); - final IBinding owner = sample.getOwner(); - return new CPPDeferredFunction(owner, sample.getNameCharArray()); + final IBinding owner = candidates[0].getOwner(); + return new CPPDeferredFunction(owner, candidates[0].getNameCharArray(), candidates); } private final IBinding fOwner; + private final ICPPFunction[] fCandidates; - public CPPDeferredFunction(IBinding owner, char[] name) { + public CPPDeferredFunction(IBinding owner, char[] name, ICPPFunction[] candidates) { super(name); fOwner= owner; + fCandidates = candidates; + } + + public ICPPFunction[] getCandidates() { + return fCandidates; } @Override |