mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Follow up for 182889, additional information for preprocessor nodes.
This commit is contained in:
parent
cd5c882069
commit
8c4859cd3b
4 changed files with 19 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,9 +7,11 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.util;
|
package org.eclipse.cdt.core.parser.util;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -128,4 +130,10 @@ public class CharArrayObjectMap extends CharTable {
|
||||||
System.arraycopy( valueTable, 0, values, 0, values.length );
|
System.arraycopy( valueTable, 0, values, 0, values.length );
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object [] valueArray(Class clazz){
|
||||||
|
Object[] values= (Object[]) Array.newInstance(clazz, size());
|
||||||
|
System.arraycopy( valueTable, 0, values, 0, values.length );
|
||||||
|
return values;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class DOMScanner extends BaseScanner {
|
public class DOMScanner extends BaseScanner {
|
||||||
|
private static final Class CHAR_ARRAY_CLASS = new char[]{}.getClass();
|
||||||
|
|
||||||
protected final ICodeReaderFactory codeReaderFactory;
|
protected final ICodeReaderFactory codeReaderFactory;
|
||||||
|
|
||||||
protected int[] bufferDelta = new int[bufferInitialSize];
|
protected int[] bufferDelta = new int[bufferInitialSize];
|
||||||
|
|
||||||
private static class DOMInclusion {
|
private static class DOMInclusion {
|
||||||
|
@ -229,9 +229,10 @@ public class DOMScanner extends BaseScanner {
|
||||||
if (d.macro instanceof FunctionStyleMacro && fsmCount == 0) {
|
if (d.macro instanceof FunctionStyleMacro && fsmCount == 0) {
|
||||||
FunctionMacroData fd = (FunctionMacroData)d;
|
FunctionMacroData fd = (FunctionMacroData)d;
|
||||||
FunctionStyleMacro fsm = (FunctionStyleMacro) d.macro;
|
FunctionStyleMacro fsm = (FunctionStyleMacro) d.macro;
|
||||||
|
char[][] actualArgs= (char[][]) fd.getActualArgs().valueArray(CHAR_ARRAY_CLASS);
|
||||||
locationMap.startFunctionStyleExpansion(fsm.attachment,
|
locationMap.startFunctionStyleExpansion(fsm.attachment,
|
||||||
fsm.arglist, getGlobalOffset(d.getStartOffset()),
|
fsm.arglist, getGlobalOffset(d.getStartOffset()),
|
||||||
getGlobalOffset(d.getStartOffset() + d.getLength()),fd.getActualArgs().valueArray() );
|
getGlobalOffset(d.getStartOffset() + d.getLength()), actualArgs);
|
||||||
bufferDelta[bufferStackPos + 1] = 0;
|
bufferDelta[bufferStackPos + 1] = 0;
|
||||||
} else if (d.macro instanceof ObjectStyleMacro && fsmCount == 0) {
|
} else if (d.macro instanceof ObjectStyleMacro && fsmCount == 0) {
|
||||||
ObjectStyleMacro osm = (ObjectStyleMacro) d.macro;
|
ObjectStyleMacro osm = (ObjectStyleMacro) d.macro;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public interface IScannerPreprocessorLog {
|
||||||
|
|
||||||
|
|
||||||
public void startFunctionStyleExpansion(IMacroDefinition macro,
|
public void startFunctionStyleExpansion(IMacroDefinition macro,
|
||||||
char[][] parameters, int startOffset, int endOffset, Object[] objects);
|
char[][] parameters, int startOffset, int endOffset, char[][] actualArguments);
|
||||||
|
|
||||||
public void endFunctionStyleExpansion(IMacroDefinition macro, int offset);
|
public void endFunctionStyleExpansion(IMacroDefinition macro, int offset);
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
|
|
||||||
public class FunctionMacroExpansionLocation extends MacroExpansionLocation{
|
public class FunctionMacroExpansionLocation extends MacroExpansionLocation{
|
||||||
|
|
||||||
private Object[] actParams;
|
private char[][] actParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param macroDefinition
|
* @param macroDefinition
|
||||||
|
@ -119,12 +119,12 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
* @param offset
|
* @param offset
|
||||||
* @param length
|
* @param length
|
||||||
*/
|
*/
|
||||||
public FunctionMacroExpansionLocation(IASTPreprocessorMacroDefinition macroDefinition, IASTNodeLocation[] locations, int offset, int length, Object[] actParameters) {
|
public FunctionMacroExpansionLocation(IASTPreprocessorMacroDefinition macroDefinition, IASTNodeLocation[] locations, int offset, int length, char[][] actParameters) {
|
||||||
super(macroDefinition, locations, offset, length);
|
super(macroDefinition, locations, offset, length);
|
||||||
this.actParams = actParameters;
|
this.actParams = actParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getActualParameters() {
|
public char[][] getActualParameters() {
|
||||||
return actParams;
|
return actParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1595,12 +1595,12 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
|
|
||||||
protected class _FunctionMacroExpansion extends _MacroExpansion {
|
protected class _FunctionMacroExpansion extends _MacroExpansion {
|
||||||
public final char[][] args;
|
public final char[][] args;
|
||||||
public final Object[] actArgs;
|
public final char[][] actArgs;
|
||||||
|
|
||||||
|
|
||||||
public _FunctionMacroExpansion(_CompositeContext parent,
|
public _FunctionMacroExpansion(_CompositeContext parent,
|
||||||
int startOffset, int endOffset, IMacroDefinition definition,
|
int startOffset, int endOffset, IMacroDefinition definition,
|
||||||
char[][] args, Object[] actParameters) {
|
char[][] args, char[][] actParameters) {
|
||||||
super(parent, startOffset, endOffset, definition);
|
super(parent, startOffset, endOffset, definition);
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.actArgs = actParameters;
|
this.actArgs = actParameters;
|
||||||
|
@ -2228,7 +2228,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
* char[][], char[], int)
|
* char[][], char[], int)
|
||||||
*/
|
*/
|
||||||
public void startFunctionStyleExpansion(IMacroDefinition macro,
|
public void startFunctionStyleExpansion(IMacroDefinition macro,
|
||||||
char[][] parameters, int startOffset, int endOffset, Object[] actParameters) {
|
char[][] parameters, int startOffset, int endOffset, char[][] actParameters) {
|
||||||
_FunctionMacroExpansion context = new _FunctionMacroExpansion(
|
_FunctionMacroExpansion context = new _FunctionMacroExpansion(
|
||||||
currentContext, startOffset, endOffset, macro, parameters, actParameters);
|
currentContext, startOffset, endOffset, macro, parameters, actParameters);
|
||||||
currentContext.addSubContext(context);
|
currentContext.addSubContext(context);
|
||||||
|
|
Loading…
Add table
Reference in a new issue