mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Bug 356955: Lookup for overloaded operator.
This commit is contained in:
parent
7d0c06294a
commit
42eaf65363
4 changed files with 35 additions and 5 deletions
|
@ -18,6 +18,7 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
@ -1308,4 +1309,31 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
IFunction f= getBindingFromASTName("fun", 0);
|
IFunction f= getBindingFromASTName("fun", 0);
|
||||||
ITypedef t= getBindingFromASTName("Type", 0);
|
ITypedef t= getBindingFromASTName("Type", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct base {
|
||||||
|
// virtual void operator+(base const &) { }
|
||||||
|
// virtual void operator-(base const &) { }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// #include "header.h"
|
||||||
|
// struct inter : public base {
|
||||||
|
// virtual void operator+(base const &){}
|
||||||
|
// };
|
||||||
|
// struct sub : public inter {
|
||||||
|
// void doSomething() {
|
||||||
|
// base *left, *right;
|
||||||
|
//
|
||||||
|
// *left + *right;
|
||||||
|
// *left - *right;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
public void test_Bug356982() throws Exception {
|
||||||
|
IASTName name= findName("+ ", 1);
|
||||||
|
assertTrue(name instanceof IASTImplicitName);
|
||||||
|
assertEquals("base", name.resolveBinding().getOwner().getName());
|
||||||
|
|
||||||
|
name= findName("- ", 1);
|
||||||
|
assertTrue(name instanceof IASTImplicitName);
|
||||||
|
assertEquals("base", name.resolveBinding().getOwner().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
private static final int NONE = 0, REFS = IIndexManager.ADD_DEPENDENCIES;
|
private static final int NONE = 0, REFS = IIndexManager.ADD_DEPENDENCIES;
|
||||||
private static final int REFD = IIndexManager.ADD_DEPENDENT, BOTH = REFS | REFD;
|
private static final int REFD = IIndexManager.ADD_DEPENDENT, BOTH = REFS | REFD;
|
||||||
private static final IndexFilter FILTER= new IndexFilter() {
|
private static final IndexFilter FILTER= new IndexFilter() {
|
||||||
|
@Override
|
||||||
public boolean acceptBinding(IBinding binding) throws CoreException {
|
public boolean acceptBinding(IBinding binding) throws CoreException {
|
||||||
if (binding instanceof ICPPMethod) {
|
if (binding instanceof ICPPMethod) {
|
||||||
return !((ICPPMethod) binding).isImplicit();
|
return !((ICPPMethod) binding).isImplicit();
|
||||||
|
@ -419,6 +420,7 @@ public class IndexCompositeTests extends BaseTestCase {
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
@ -451,7 +453,7 @@ class ProjectBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICProject create() throws CoreException {
|
ICProject create() throws Exception {
|
||||||
ICProject result = cpp ?
|
ICProject result = cpp ?
|
||||||
CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER) :
|
CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER) :
|
||||||
CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER);
|
CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER);
|
||||||
|
@ -466,7 +468,7 @@ class ProjectBuilder {
|
||||||
result.getProject().setDescription(desc, new NullProgressMonitor());
|
result.getProject().setDescription(desc, new NullProgressMonitor());
|
||||||
|
|
||||||
CCorePlugin.getIndexManager().setIndexerId(result, IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(result, IPDOMManager.ID_FAST_INDEXER);
|
||||||
CCorePlugin.getIndexManager().joinIndexer(4000, new NullProgressMonitor());
|
BaseTestCase.waitForIndexer(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class BaseTestCase extends TestCase {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NullProgressMonitor npm() {
|
public static NullProgressMonitor npm() {
|
||||||
return new NullProgressMonitor();
|
return new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ public class BaseTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForIndexer(ICProject project) throws InterruptedException {
|
public static void waitForIndexer(ICProject project) throws InterruptedException {
|
||||||
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
||||||
assertTrue(indexManager.joinIndexer(10000, npm()));
|
assertTrue(indexManager.joinIndexer(10000, npm()));
|
||||||
long waitms= 1;
|
long waitms= 1;
|
||||||
|
|
|
@ -955,7 +955,7 @@ public class CPPSemantics {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Lookup in base classes
|
// Lookup in base classes
|
||||||
if (!data.usingDirectivesOnly && scope instanceof ICPPClassScope) {
|
if (!data.usingDirectivesOnly && scope instanceof ICPPClassScope && !data.ignoreMembers) {
|
||||||
BaseClassLookup.lookupInBaseClasses(data, (ICPPClassScope) scope, fileSet);
|
BaseClassLookup.lookupInBaseClasses(data, (ICPPClassScope) scope, fileSet);
|
||||||
if (!data.contentAssist && data.hasResultOrProblem())
|
if (!data.contentAssist && data.hasResultOrProblem())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue