1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

Bug 509619 - Highlighting of pointer passed by const reference

Change-Id: Ife414e63ad7076334b7ced9d33aa9b59084caa02
This commit is contained in:
Nathan Ridge 2016-12-21 23:05:51 -05:00
parent b6c2d930f4
commit 768354b4d4
2 changed files with 15 additions and 2 deletions

View file

@ -626,4 +626,12 @@ public class SemanticHighlightingTest extends TestCase {
public void testVariablePassedByNonconstRef_487764b() throws Exception { public void testVariablePassedByNonconstRef_487764b() throws Exception {
makeAssertions(); makeAssertions();
} }
// void foo(int* const &); //$functionDeclaration
// void bar(int* waldo) { //$functionDeclaration,parameterVariable
// foo(waldo); //$function,parameterVariable
// }
public void testReferenceToConstPointer_509619() throws Exception {
makeAssertions();
}
} }

View file

@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.ILabel; import org.eclipse.cdt.core.dom.ast.ILabel;
import org.eclipse.cdt.core.dom.ast.IMacroBinding; import org.eclipse.cdt.core.dom.ast.IMacroBinding;
import org.eclipse.cdt.core.dom.ast.IParameter; import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -1711,8 +1712,12 @@ public class SemanticHighlightings {
if (referredType instanceof IArrayType) { if (referredType instanceof IArrayType) {
referredType = ((IArrayType) referredType).getType(); referredType = ((IArrayType) referredType).getType();
} }
boolean isConstRef = (referredType instanceof IQualifierType) && boolean isConstRef = false;
((IQualifierType) referredType).isConst(); if (referredType instanceof IQualifierType) {
isConstRef = ((IQualifierType) referredType).isConst();
} else if (referredType instanceof IPointerType) {
isConstRef = ((IPointerType) referredType).isConst();
}
return !isConstRef; return !isConstRef;
} }
return false; return false;