mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 16:26:11 +02:00
Improved Remove Unused Declarations code reducer
Change-Id: I6d7cdea0fe85df14fe64ea7bd57b88ac27f4f9df
This commit is contained in:
parent
899284e8da
commit
352f47bc82
1 changed files with 6 additions and 0 deletions
|
@ -53,6 +53,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -336,6 +337,11 @@ public class RemoveUnusedDeclarationsRefactoring extends CRefactoring {
|
||||||
|
|
||||||
for (IASTName name : names) {
|
for (IASTName name : names) {
|
||||||
if (name != declName) {
|
if (name != declName) {
|
||||||
|
if (name.getPropertyInParent() == IASTDeclarator.DECLARATOR_NAME
|
||||||
|
&& name.getParent().getPropertyInParent() == IASTParameterDeclaration.DECLARATOR) {
|
||||||
|
continue; // Ignore parameter names.
|
||||||
|
}
|
||||||
|
|
||||||
char[] nameChars = name.getSimpleID();
|
char[] nameChars = name.getSimpleID();
|
||||||
|
|
||||||
int offset = nameChars.length != 0 && nameChars[0] == '~' ? 1 : 0;
|
int offset = nameChars.length != 0 && nameChars[0] == '~' ? 1 : 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue