mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
Fix for 179493: CModelBuilder2 does not build model correctly for function pointer with array parameter
and 147903: Search for references broken for unnamed parameters with array notation
This commit is contained in:
parent
d0015ae8c3
commit
8067e74e3f
2 changed files with 10 additions and 3 deletions
|
@ -93,7 +93,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
assertEquals(offset("nested.cpp", "x.x") + 2, loc.getNodeOffset());
|
||||
}
|
||||
|
||||
public void failedTest147903() throws Exception {
|
||||
public void test147903() throws Exception {
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("pr147903"), false, new IndexFilter(), new NullProgressMonitor());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPNamespaceScope ns = ((ICPPNamespace)bindings[0]).getNamespaceScope();
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
|||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
||||
|
@ -1127,8 +1128,14 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return;
|
||||
if (flags.parm) {
|
||||
ASTNode name = (ASTNode) d.getName();
|
||||
if (name.getOffset() == offset && name.getLength() == length)
|
||||
return;
|
||||
if (name.getOffset() == offset) {
|
||||
// fix for bugs 147903 and 179493
|
||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=147903
|
||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=179493
|
||||
if (name.getLength() == length || d instanceof IASTArrayDeclarator) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (d.getInitializer() != null) {
|
||||
ASTNode init = (ASTNode) d.getInitializer();
|
||||
if (name.getOffset() == offset
|
||||
|
|
Loading…
Add table
Reference in a new issue