mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,9 +7,11 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -128,4 +130,10 @@ public class CharArrayObjectMap extends CharTable {
|
|||
System.arraycopy( valueTable, 0, values, 0, values.length );
|
||||
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
|
||||
*/
|
||||
public class DOMScanner extends BaseScanner {
|
||||
private static final Class CHAR_ARRAY_CLASS = new char[]{}.getClass();
|
||||
|
||||
protected final ICodeReaderFactory codeReaderFactory;
|
||||
|
||||
protected int[] bufferDelta = new int[bufferInitialSize];
|
||||
|
||||
private static class DOMInclusion {
|
||||
|
@ -229,9 +229,10 @@ public class DOMScanner extends BaseScanner {
|
|||
if (d.macro instanceof FunctionStyleMacro && fsmCount == 0) {
|
||||
FunctionMacroData fd = (FunctionMacroData)d;
|
||||
FunctionStyleMacro fsm = (FunctionStyleMacro) d.macro;
|
||||
char[][] actualArgs= (char[][]) fd.getActualArgs().valueArray(CHAR_ARRAY_CLASS);
|
||||
locationMap.startFunctionStyleExpansion(fsm.attachment,
|
||||
fsm.arglist, getGlobalOffset(d.getStartOffset()),
|
||||
getGlobalOffset(d.getStartOffset() + d.getLength()),fd.getActualArgs().valueArray() );
|
||||
getGlobalOffset(d.getStartOffset() + d.getLength()), actualArgs);
|
||||
bufferDelta[bufferStackPos + 1] = 0;
|
||||
} else if (d.macro instanceof ObjectStyleMacro && fsmCount == 0) {
|
||||
ObjectStyleMacro osm = (ObjectStyleMacro) d.macro;
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface IScannerPreprocessorLog {
|
|||
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
|||
|
||||
public class FunctionMacroExpansionLocation extends MacroExpansionLocation{
|
||||
|
||||
private Object[] actParams;
|
||||
private char[][] actParams;
|
||||
|
||||
/**
|
||||
* @param macroDefinition
|
||||
|
@ -119,12 +119,12 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
|||
* @param offset
|
||||
* @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);
|
||||
this.actParams = actParameters;
|
||||
}
|
||||
|
||||
public Object[] getActualParameters() {
|
||||
public char[][] getActualParameters() {
|
||||
return actParams;
|
||||
}
|
||||
|
||||
|
@ -1595,12 +1595,12 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
|||
|
||||
protected class _FunctionMacroExpansion extends _MacroExpansion {
|
||||
public final char[][] args;
|
||||
public final Object[] actArgs;
|
||||
public final char[][] actArgs;
|
||||
|
||||
|
||||
public _FunctionMacroExpansion(_CompositeContext parent,
|
||||
int startOffset, int endOffset, IMacroDefinition definition,
|
||||
char[][] args, Object[] actParameters) {
|
||||
char[][] args, char[][] actParameters) {
|
||||
super(parent, startOffset, endOffset, definition);
|
||||
this.args = args;
|
||||
this.actArgs = actParameters;
|
||||
|
@ -2228,7 +2228,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
|||
* char[][], char[], int)
|
||||
*/
|
||||
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(
|
||||
currentContext, startOffset, endOffset, macro, parameters, actParameters);
|
||||
currentContext.addSubContext(context);
|
||||
|
|
Loading…
Add table
Reference in a new issue