mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 509619 - Highlighting of pointer passed by const reference
Change-Id: Ife414e63ad7076334b7ced9d33aa9b59084caa02
This commit is contained in:
parent
b6c2d930f4
commit
768354b4d4
2 changed files with 15 additions and 2 deletions
|
@ -626,4 +626,12 @@ public class SemanticHighlightingTest extends TestCase {
|
|||
public void testVariablePassedByNonconstRef_487764b() throws Exception {
|
||||
makeAssertions();
|
||||
}
|
||||
|
||||
// void foo(int* const &); //$functionDeclaration
|
||||
// void bar(int* waldo) { //$functionDeclaration,parameterVariable
|
||||
// foo(waldo); //$function,parameterVariable
|
||||
// }
|
||||
public void testReferenceToConstPointer_509619() throws Exception {
|
||||
makeAssertions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.IMacroBinding;
|
||||
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.IQualifierType;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -1711,8 +1712,12 @@ public class SemanticHighlightings {
|
|||
if (referredType instanceof IArrayType) {
|
||||
referredType = ((IArrayType) referredType).getType();
|
||||
}
|
||||
boolean isConstRef = (referredType instanceof IQualifierType) &&
|
||||
((IQualifierType) referredType).isConst();
|
||||
boolean isConstRef = false;
|
||||
if (referredType instanceof IQualifierType) {
|
||||
isConstRef = ((IQualifierType) referredType).isConst();
|
||||
} else if (referredType instanceof IPointerType) {
|
||||
isConstRef = ((IPointerType) referredType).isConst();
|
||||
}
|
||||
return !isConstRef;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue