mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for 162581, by Andrew Ferguson, stack overflow in AST/PDOM.
This commit is contained in:
parent
4c73232e1c
commit
e6a0b48500
4 changed files with 137 additions and 4 deletions
|
@ -75,7 +75,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
||||||
|
|
||||||
public void testOverloadedInCommonHeader_FileScope() throws CoreException {
|
public void testOverloadedInCommonHeader_FileScope() throws CoreException {
|
||||||
Pattern[] QuuxPath = makePatternArray(new String[] {"quux"});
|
Pattern[] QuuxPath = makePatternArray(new String[] {"quux"});
|
||||||
IBinding[] Quux = pdom.findBindings(QuuxPath, false, IndexFilter.getFilter(Linkage.CPP_LINKAGE), new NullProgressMonitor());
|
IBinding[] Quux = pdom.findBindings(QuuxPath, true, IndexFilter.getFilter(Linkage.CPP_LINKAGE), new NullProgressMonitor());
|
||||||
|
|
||||||
assertEquals(5,Quux.length);
|
assertEquals(5,Quux.length);
|
||||||
|
|
||||||
|
@ -112,10 +112,31 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
||||||
// corge::grault(ManyOverloaded*)
|
// corge::grault(ManyOverloaded*)
|
||||||
assertFunctionRefCount(new Class[] {IPointerType.class}, Grault, 12);
|
assertFunctionRefCount(new Class[] {IPointerType.class}, Grault, 12);
|
||||||
|
|
||||||
// (corge::grault(ManyOverloaded)
|
// corge::grault(ManyOverloaded)
|
||||||
assertFunctionRefCount(new Class[] {ICPPClassType.class}, Grault, 14);
|
assertFunctionRefCount(new Class[] {ICPPClassType.class}, Grault, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testOverloadedInCommonHeader_NamespaceScope_Collides_With_Filescope() throws CoreException {
|
||||||
|
Pattern[] ns2Path = makePatternArray(new String[] {"ns2","quux"});
|
||||||
|
IBinding[] ns2 = pdom.findBindings(ns2Path, true, IndexFilter.getFilter(Linkage.CPP_LINKAGE), new NullProgressMonitor());
|
||||||
|
assertEquals(5,ns2.length);
|
||||||
|
|
||||||
|
// ns2::quux()
|
||||||
|
assertFunctionRefCount(new Class[0], ns2, 16);
|
||||||
|
|
||||||
|
// ns2::quux(int,char)
|
||||||
|
assertFunctionRefCount(new Class[] {IBasicType.class}, ns2, 20);
|
||||||
|
|
||||||
|
// ns2::quux(int,char)
|
||||||
|
assertFunctionRefCount(new Class[] {IBasicType.class, IBasicType.class}, ns2, 24);
|
||||||
|
|
||||||
|
// ns2::quux(ManyOverloaded*)
|
||||||
|
assertFunctionRefCount(new Class[] {IPointerType.class}, ns2, 28);
|
||||||
|
|
||||||
|
// ns2::quux(ManyOverloaded)
|
||||||
|
assertFunctionRefCount(new Class[] {ICPPClassType.class}, ns2, 32);
|
||||||
|
}
|
||||||
|
|
||||||
protected void assertFunctionRefCount(Class[] args, IBinding[] bindingPool, int refCount) throws CoreException {
|
protected void assertFunctionRefCount(Class[] args, IBinding[] bindingPool, int refCount) throws CoreException {
|
||||||
assertFunctionRefCount(pdom, args, bindingPool, refCount);
|
assertFunctionRefCount(pdom, args, bindingPool, refCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
class ManyOverloaded {
|
||||||
|
public:
|
||||||
|
void qux();
|
||||||
|
void qux(int i);
|
||||||
|
void qux(int i, char c);
|
||||||
|
void qux(ManyOverloaded* ptr);
|
||||||
|
void qux(ManyOverloaded nptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
void quux();
|
||||||
|
void quux(int i);
|
||||||
|
void quux(int i, char c);
|
||||||
|
void quux(ManyOverloaded* ptr);
|
||||||
|
void quux(ManyOverloaded nptr);
|
||||||
|
|
||||||
|
namespace corge {
|
||||||
|
void grault();
|
||||||
|
void grault(int i);
|
||||||
|
void grault(int i, char c);
|
||||||
|
void grault(ManyOverloaded* ptr);
|
||||||
|
void grault(ManyOverloaded nptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ns2 {
|
||||||
|
void quux();
|
||||||
|
void quux(int i);
|
||||||
|
void quux(int i, char c);
|
||||||
|
void quux(ManyOverloaded* ptr);
|
||||||
|
void quux(ManyOverloaded nptr);
|
||||||
|
}
|
|
@ -1,4 +1,19 @@
|
||||||
#include "class.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
namespace corge {
|
||||||
|
void referencesA_inNS() {
|
||||||
|
ManyOverloaded m;
|
||||||
|
ns2::quux(); ns2::quux(); ns2::quux(); ns2::quux();
|
||||||
|
ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5);
|
||||||
|
ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f');
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void referencesA() {
|
void referencesA() {
|
||||||
ManyOverloaded m;
|
ManyOverloaded m;
|
||||||
|
@ -24,4 +39,30 @@ void referencesA() {
|
||||||
corge::grault(new ManyOverloaded()); corge::grault(new ManyOverloaded());
|
corge::grault(new ManyOverloaded()); corge::grault(new ManyOverloaded());
|
||||||
corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m);
|
corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m);
|
||||||
corge::grault(m); corge::grault(m);
|
corge::grault(m); corge::grault(m);
|
||||||
|
|
||||||
|
ns2::quux(); ns2::quux(); ns2::quux(); ns2::quux();
|
||||||
|
ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5);
|
||||||
|
ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f');
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
|
||||||
|
m.qux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
m.qux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
quux(6, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
corge::grault(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
corge::grault(6, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace corge {
|
||||||
|
void problemRefsA() {
|
||||||
|
ns2::quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,19 @@
|
||||||
#include "class.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
namespace corge {
|
||||||
|
void referencesB_inNS() {
|
||||||
|
ManyOverloaded m;
|
||||||
|
ns2::quux(); ns2::quux(); ns2::quux(); ns2::quux();
|
||||||
|
ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5);
|
||||||
|
ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f');
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void referencesB() {
|
void referencesB() {
|
||||||
ManyOverloaded m;
|
ManyOverloaded m;
|
||||||
|
@ -24,4 +39,30 @@ void referencesB() {
|
||||||
corge::grault(new ManyOverloaded()); corge::grault(new ManyOverloaded());
|
corge::grault(new ManyOverloaded()); corge::grault(new ManyOverloaded());
|
||||||
corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m);
|
corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m); corge::grault(m);
|
||||||
corge::grault(m); corge::grault(m);
|
corge::grault(m); corge::grault(m);
|
||||||
|
|
||||||
|
ns2::quux(); ns2::quux(); ns2::quux(); ns2::quux();
|
||||||
|
ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5); ns2::quux(5);
|
||||||
|
ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f'); ns2::quux(6,'f');
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded()); ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(new ManyOverloaded());
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
ns2::quux(m); ns2::quux(m); ns2::quux(m);
|
||||||
|
|
||||||
|
m.qux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
m.qux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
quux(6, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
corge::grault(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
corge::grault(6, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace corge {
|
||||||
|
void problemRefsB() {
|
||||||
|
ns2::quux(UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
ns2::quux(4, UNRESOLVED_SYMBOL); // indexer should skip without error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue