1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-07-08 20:03:24 -07:00
parent 8fac40ce1b
commit 77e792334f
20 changed files with 552 additions and 566 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;

View file

@ -45,8 +45,8 @@ import org.eclipse.cdt.internal.core.pdom.db.TypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException;
/**
* Represents values of variables, enumerators or expressions. The primary purpose of the representation
* is to support instantiation of templates with non-type template parameters.
* Represents values of variables, enumerators or expressions. The primary purpose of
* the representation is to support instantiation of templates with non-type template parameters.
*/
public class Value implements IValue {
public static final int MAX_RECURSION_DEPTH = 25;
@ -858,7 +858,7 @@ public class Value implements IValue {
final int len= value.length;
int result = 0;
boolean ok= false;
for(; offset < len; offset++) {
for (; offset < len; offset++) {
final int digit= (value[offset] - '0');
if (digit < 0 || digit > 9)
break;
@ -880,7 +880,7 @@ public class Value implements IValue {
int result = 0;
boolean ok= false;
final int len= value.length;
for(; offset < len; offset++) {
for (; offset < len; offset++) {
int digit= (value[offset] - '0');
if (digit < 0 || digit > 9) {
digit += '0' - 'a' + 10;
@ -917,7 +917,7 @@ public class Value implements IValue {
negative = true;
offset++;
}
for(; offset < len; offset++) {
for (; offset < len; offset++) {
final int digit= (value[offset] - '0');
if (digit < 0 || digit > 9)
break;
@ -951,7 +951,7 @@ public class Value implements IValue {
if (i == len)
return null;
for(; i < len; i++) {
for (; i < len; i++) {
if (result > maxvalue)
return null;
@ -993,7 +993,7 @@ public class Value implements IValue {
}
public static IValue create(ICPPEvaluation eval, IASTNode point) {
// compute value of evaluation
// Compute value of evaluation
return Value.UNKNOWN;
}
}

View file

@ -857,7 +857,8 @@ public class CPPTemplates {
}
}
public static IValue instantiateValue(IValue value, ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, int maxdepth, IASTNode point) {
public static IValue instantiateValue(IValue value, ICPPTemplateParameterMap tpMap, int packOffset,
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
if (value == null)
return null;
IBinding[] unknowns= value.getUnknownBindings();
@ -2547,7 +2548,7 @@ public static IValue instantiateValue(IValue value, ICPPTemplateParameterMap tpM
Collections.reverse(defs);
ObjectMap result= new ObjectMap(keys.length);
for (int key: keys) {
for (int key : keys) {
int nestingLevel= key >> 16;
int numParam= key & 0xffff;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
@ -206,7 +205,6 @@ public class EvalBinary implements ICPPEvaluation {
return ExpressionTypes.restoreTypedefs(type, originalType1, originalType2);
}
switch (fOperator) {
case op_arrayAccess:
if (type1 instanceof IPointerType) {

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.glvalueType;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromFunctionCall;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
@ -30,8 +29,8 @@ import org.eclipse.core.runtime.CoreException;
* Performs evaluation of an expression.
*/
public class EvalFixed implements ICPPEvaluation {
public static final ICPPEvaluation INCOMPLETE = new EvalFixed(
ProblemType.UNKNOWN_FOR_EXPRESSION, PRVALUE, Value.UNKNOWN);
public static final ICPPEvaluation INCOMPLETE =
new EvalFixed(ProblemType.UNKNOWN_FOR_EXPRESSION, PRVALUE, Value.UNKNOWN);
private final IType fType;
private final IValue fValue;
@ -108,7 +107,7 @@ public class EvalFixed implements ICPPEvaluation {
int firstByte = ITypeMarshalBuffer.EVAL_FIXED;
if (includeValue)
firstByte |= ITypeMarshalBuffer.FLAG1;
switch(fValueCategory) {
switch (fValueCategory) {
case LVALUE:
firstByte |= ITypeMarshalBuffer.FLAG2;
break;
@ -131,15 +130,15 @@ public class EvalFixed implements ICPPEvaluation {
IValue value;
ValueCategory cat;
switch (firstByte & (ITypeMarshalBuffer.FLAG2 | ITypeMarshalBuffer.FLAG3)) {
case ITypeMarshalBuffer.FLAG2:
cat= LVALUE;
break;
case ITypeMarshalBuffer.FLAG3:
cat= PRVALUE;
break;
default:
cat= XVALUE;
break;
case ITypeMarshalBuffer.FLAG2:
cat= LVALUE;
break;
case ITypeMarshalBuffer.FLAG3:
cat= PRVALUE;
break;
default:
cat= XVALUE;
break;
}
IType type= buffer.unmarshalType();

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;

View file

@ -29,13 +29,13 @@ import org.eclipse.core.runtime.CoreException;
* For marshalling types to byte arrays.
*/
public class TypeMarshalBuffer implements ITypeMarshalBuffer {
public final static byte[] EMPTY= { 0, 0, 0, 0, 0, 0 };
public final static byte NULL_TYPE= 0;
public final static byte INDIRECT_TYPE= (byte) -1;
public final static byte BINDING_TYPE= (byte) -2;
public final static byte UNSTORABLE_TYPE= (byte) -3;
public static final byte[] EMPTY= { 0, 0, 0, 0, 0, 0 };
public static final byte NULL_TYPE= 0;
public static final byte INDIRECT_TYPE= (byte) -1;
public static final byte BINDING_TYPE= (byte) -2;
public static final byte UNSTORABLE_TYPE= (byte) -3;
public final static IType UNSTORABLE_TYPE_PROBLEM = new ProblemType(ISemanticProblem.TYPE_NOT_PERSISTED);
public static final IType UNSTORABLE_TYPE_PROBLEM = new ProblemType(ISemanticProblem.TYPE_NOT_PERSISTED);
static {
assert EMPTY.length == Database.TYPE_SIZE;
@ -129,7 +129,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
byte firstByte= fBuffer[fPos];
if (firstByte == BINDING_TYPE) {
fPos+= 2;
fPos += 2;
long rec= getRecordPointer();
return (IType) fLinkage.getNode(rec);
} else if (firstByte == NULL_TYPE) {
@ -209,7 +209,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
@Override
public int getByte() throws CoreException {
if (fPos+1 > fBuffer.length)
if (fPos + 1 > fBuffer.length)
throw unmarshallingError();
return 0xff & fBuffer[fPos++];
}
@ -218,6 +218,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
public CoreException unmarshallingError() {
return new CoreException(CCorePlugin.createStatus("Unmarshalling error")); //$NON-NLS-1$
}
public CoreException marshallingError() {
return new CoreException(CCorePlugin.createStatus("Marshalling error")); //$NON-NLS-1$
}
@ -225,13 +226,13 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
@Override
public void putShort(short value) {
request(2);
fBuffer[fPos++]= (byte)(value >> 8);
fBuffer[fPos++]= (byte)(value);
fBuffer[fPos++]= (byte) (value >> 8);
fBuffer[fPos++]= (byte) (value);
}
@Override
public int getShort() throws CoreException {
if (fPos+2 > fBuffer.length)
if (fPos + 2 > fBuffer.length)
throw unmarshallingError();
final int byte1 = 0xff & fBuffer[fPos++];
final int byte2 = 0xff & fBuffer[fPos++];
@ -242,14 +243,14 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
request(4);
fPos += 4;
int p= fPos;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value);
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value);
}
public int getInt() throws CoreException {
if (fPos+4 > fBuffer.length)
if (fPos + 4 > fBuffer.length)
throw unmarshallingError();
int result= 0;
result |= fBuffer[fPos++] & 0xff; result <<= 8;
@ -264,19 +265,19 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
request(8);
fPos += 8;
int p= fPos;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value); value >>= 8;
fBuffer[--p]= (byte)(value);
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value); value >>= 8;
fBuffer[--p]= (byte) (value);
}
@Override
public long getLong() throws CoreException {
if (fPos+8 > fBuffer.length)
if (fPos + 8 > fBuffer.length)
throw unmarshallingError();
long result= 0;
result |= fBuffer[fPos++] & 0xff; result <<= 8;
@ -293,7 +294,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
private void putRecordPointer(long record) {
request(Database.PTR_SIZE);
Chunk.putRecPtr(record, fBuffer, fPos);
fPos+= Database.PTR_SIZE;
fPos += Database.PTR_SIZE;
}
private long getRecordPointer() throws CoreException {

View file

@ -13,11 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
@ -119,6 +114,11 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
import org.eclipse.core.runtime.CoreException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* Container for c++-entities.
*/
@ -1046,7 +1046,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
@Override
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= buffer.getByte();
switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
switch ((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
case ITypeMarshalBuffer.ARRAY_TYPE:
return CPPArrayType.unmarshal(firstByte, buffer);
case ITypeMarshalBuffer.BASIC_TYPE:
@ -1075,7 +1075,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
@Override
public ISerializableEvaluation unmarshalEvaluation(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= buffer.getByte();
switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
switch ((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
case ITypeMarshalBuffer.EVAL_BINARY:
return EvalBinary.unmarshal(firstByte, buffer);
case ITypeMarshalBuffer.EVAL_BINARY_TYPE_ID: